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);
int index = 2;
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 offset = dest ? luaL_optinteger(L, index, 0) : 0;
bool shouldRelease = false;

View File

@ -205,7 +205,7 @@ bool lovrAudioInitDevice(AudioType type) {
if (type == AUDIO_CAPTURE) {
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) {
lovrLog(LOG_WARN, "audio", "Failed to init audio device %d\n", type);
lovrAudioDestroy();