mirror of
https://github.com/love2d/love.git
synced 2026-08-19 04:06:17 +02:00
Re-added the no-argument variant of RecordingDevice:start().
It uses the samples / sample rate / bit depth / channel count previously set for the RecordingDevice, and errors if it hasn't been set before. --HG-- branch : minor
This commit is contained in:
@@ -36,15 +36,23 @@ int w_RecordingDevice_start(lua_State *L)
|
|||||||
{
|
{
|
||||||
RecordingDevice *d = luax_checkrecordingdevice(L, 1);
|
RecordingDevice *d = luax_checkrecordingdevice(L, 1);
|
||||||
|
|
||||||
int samples = (int) luaL_optinteger(L, 2, RecordingDevice::DEFAULT_SAMPLES);
|
int samples = d->getSampleCount();
|
||||||
int sampleRate = (int) luaL_optinteger(L, 3, RecordingDevice::DEFAULT_SAMPLE_RATE);
|
int samplerate = d->getSampleRate();
|
||||||
int bitDepth = (int) luaL_optinteger(L, 4, RecordingDevice::DEFAULT_BIT_DEPTH);
|
int bitdepth = d->getBitDepth();
|
||||||
int channels = (int) (int) luaL_optinteger(L, 5, RecordingDevice::DEFAULT_CHANNELS);
|
int channels = d->getChannels();
|
||||||
|
|
||||||
luax_catchexcept(L, [&](){
|
if (lua_gettop(L) > 1)
|
||||||
lua_pushboolean(L, d->start(samples, sampleRate, bitDepth, channels));
|
{
|
||||||
});
|
samples = (int) luaL_checkinteger(L, 2);
|
||||||
|
samplerate = (int) luaL_optinteger(L, 3, RecordingDevice::DEFAULT_SAMPLE_RATE);
|
||||||
|
bitdepth = (int) luaL_optinteger(L, 4, RecordingDevice::DEFAULT_BIT_DEPTH);
|
||||||
|
channels = (int) (int) luaL_optinteger(L, 5, RecordingDevice::DEFAULT_CHANNELS);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool success = false;
|
||||||
|
luax_catchexcept(L, [&]() { success = d->start(samples, samplerate, bitdepth, channels); });
|
||||||
|
|
||||||
|
luax_pushboolean(L, success);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user