1
0
Fork 0
mirror of https://github.com/bjornbytes/lovr.git synced 2024-07-03 04:53:35 +00:00
This commit is contained in:
Nevyn Bengtsson 2020-12-16 16:47:51 +01:00 committed by Bjorn
parent 5fcaad9bde
commit 46e9ae8ef5
2 changed files with 2 additions and 1 deletions

View file

@ -39,6 +39,7 @@ static int l_lovrSoundDataRead(lua_State* L) {
SoundData* source = luax_checktype(L, 1, SoundData); SoundData* source = luax_checktype(L, 1, SoundData);
int index = 2; int index = 2;
SoundData* dest = luax_totype(L, index, SoundData); SoundData* dest = luax_totype(L, index, SoundData);
if (dest) index++;
size_t frameCount = lua_type(L, index) == LUA_TNUMBER ? lua_tointeger(L, index++) : lovrSoundDataGetDuration(source); size_t frameCount = lua_type(L, index) == LUA_TNUMBER ? lua_tointeger(L, index++) : lovrSoundDataGetDuration(source);
size_t offset = dest ? luaL_optinteger(L, index, 0) : 0; size_t offset = dest ? luaL_optinteger(L, index, 0) : 0;
bool shouldRelease = false; bool shouldRelease = false;

View file

@ -205,7 +205,7 @@ bool lovrAudioInitDevice(AudioType type) {
if (type == AUDIO_CAPTURE) { if (type == AUDIO_CAPTURE) {
lovrRelease(SoundData, state.captureStream); lovrRelease(SoundData, state.captureStream);
state.captureStream = lovrSoundDataCreateStream(state.config[type].sampleRate * 1.0, CAPTURE_CHANNELS, state.config[type].sampleRate, OUTPUT_FORMAT); state.captureStream = lovrSoundDataCreateStream(state.config[type].sampleRate * 1.0, CAPTURE_CHANNELS, state.config[type].sampleRate, state.config[type].format);
if (!state.captureStream) { if (!state.captureStream) {
lovrLog(LOG_WARN, "audio", "Failed to init audio device %d\n", type); lovrLog(LOG_WARN, "audio", "Failed to init audio device %d\n", type);
lovrAudioDestroy(); lovrAudioDestroy();