mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
We now return nil instead of a null SoundData when getting recorded data fails.
This commit is contained in:
@@ -71,7 +71,7 @@ namespace openal
|
|||||||
|
|
||||||
alcMakeContextCurrent(0);
|
alcMakeContextCurrent(0);
|
||||||
alcDestroyContext(context);
|
alcDestroyContext(context);
|
||||||
alcCaptureCloseDevice(capture);
|
if (capture) alcCaptureCloseDevice(capture);
|
||||||
alcCloseDevice(device);
|
alcCloseDevice(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -212,7 +212,8 @@ namespace audio
|
|||||||
int w_getRecordedData(lua_State * L)
|
int w_getRecordedData(lua_State * L)
|
||||||
{
|
{
|
||||||
love::sound::SoundData * sd = instance->getRecordedData();
|
love::sound::SoundData * sd = instance->getRecordedData();
|
||||||
luax_newtype(L, "SoundData", SOUND_SOUND_DATA_T, (void*)sd);
|
if (!sd) lua_pushnil(L);
|
||||||
|
else luax_newtype(L, "SoundData", SOUND_SOUND_DATA_T, (void*)sd);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,7 +221,8 @@ namespace audio
|
|||||||
{
|
{
|
||||||
if (luax_optboolean(L, 1, true)) {
|
if (luax_optboolean(L, 1, true)) {
|
||||||
love::sound::SoundData * sd = instance->stopRecording(true);
|
love::sound::SoundData * sd = instance->stopRecording(true);
|
||||||
luax_newtype(L, "SoundData", SOUND_SOUND_DATA_T, (void*)sd);
|
if (!sd) lua_pushnil(L);
|
||||||
|
else luax_newtype(L, "SoundData", SOUND_SOUND_DATA_T, (void*)sd);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
instance->stopRecording(false);
|
instance->stopRecording(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user