Skip to content

Commit

Permalink
* Fixed the stereo audio buffer size to account for the *stereo* over…
Browse files Browse the repository at this point in the history
…samples.
  • Loading branch information
luciusDXL committed Sep 25, 2023
1 parent 9d6e0d7 commit 0019fe7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions TheForceEngine/TFE_Jedi/IMuse/imDigitalSound.cpp
Expand Up @@ -77,7 +77,7 @@ namespace TFE_Jedi
static f32* s_audioNormalization = &s_audioNormalizationMem[MAX_SOUND_CHANNELS * 128 + 4];

static f32* s_audioDriverOut;
static s16 s_audioOut[AUDIO_BUFFER_SIZE + IM_AUDIO_OVERSAMPLE]; // Add 2 stereo samples from the next frame for interpolation.
static s16 s_audioOut[AUDIO_BUFFER_SIZE + IM_AUDIO_OVERSAMPLE*2]; // Add 2 stereo samples from the next frame for interpolation.
static s32 s_audioOutSize;
static u8* s_audioData;

Expand Down Expand Up @@ -196,7 +196,7 @@ namespace TFE_Jedi
s_audioDriverOut = buffer;
s_audioOutSize = bufferSize;
assert(bufferSize * 2 <= AUDIO_BUFFER_SIZE);
memset(s_audioOut, 0, (2*bufferSize + IM_AUDIO_OVERSAMPLE) * sizeof(s16));
memset(s_audioOut, 0, 2*(bufferSize + IM_AUDIO_OVERSAMPLE) * sizeof(s16));

// Write sounds to s_audioOut.
ImWaveSound* sound = s_imWaveSoundList;
Expand Down Expand Up @@ -742,7 +742,7 @@ namespace TFE_Jedi
return imInvalidSound;
}

s32 bufferSize = s_audioOutSize*2 + IM_AUDIO_OVERSAMPLE;
s32 bufferSize = 2*(s_audioOutSize + IM_AUDIO_OVERSAMPLE);
s16* audioOut = s_audioOut;
f32* driverOut = s_audioDriverOut;
for (s32 i = 0; i < bufferSize; i++, audioOut++, driverOut++)
Expand Down

0 comments on commit 0019fe7

Please sign in to comment.