From 69b5c5138800b0d44aa23b0ce0b83357047e3bc4 Mon Sep 17 00:00:00 2001 From: bjorn Date: Fri, 2 Apr 2021 22:28:38 -0600 Subject: [PATCH] Fix Sound:setFrames; --- src/api/l_data_sound.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api/l_data_sound.c b/src/api/l_data_sound.c index 6da12b7f..7a5e6ba2 100644 --- a/src/api/l_data_sound.c +++ b/src/api/l_data_sound.c @@ -221,20 +221,20 @@ static int l_lovrSoundSetFrames(lua_State* L) { if (format == SAMPLE_I16) { short* shorts = (short*) buffer; for (uint32_t i = 0; i < samples; i++) { - lua_rawgeti(L, 2, dstOffset + frames + i); + lua_rawgeti(L, 2, srcOffset + frames + i); *shorts++ = lua_tointeger(L, -1); lua_pop(L, 1); } } else if (format == SAMPLE_F32) { float* floats = (float*) buffer; for (uint32_t i = 0; i < samples; i++) { - lua_rawgeti(L, 2, dstOffset + frames + i); + lua_rawgeti(L, 2, srcOffset + frames + i); *floats++ = lua_tonumber(L, -1); lua_pop(L, 1); } } - uint32_t written = lovrSoundWrite(sound, srcOffset + frames, chunk, buffer); + uint32_t written = lovrSoundWrite(sound, dstOffset + frames, chunk, buffer); if (written == 0) break; frames += written; }