Skip to content

Commit

Permalink
improve audio handling at non-60 fps targets (#2246)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaklyy authored Dec 25, 2024
1 parent 72c86ad commit 66d1091
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/frontend/qt_sdl/EmuInstanceAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ using namespace melonDS;

int EmuInstance::audioGetNumSamplesOut(int outlen)
{
float f_len_in = (outlen * 32823.6328125) / (float)audioFreq;
float f_len_in = (outlen * 32823.6328125 * (curFPS/60.0)) / (float)audioFreq;
f_len_in += audioSampleFrac;
int len_in = (int)floor(f_len_in);
audioSampleFrac = f_len_in - len_in;
Expand Down Expand Up @@ -73,6 +73,7 @@ void EmuInstance::audioCallback(void* data, Uint8* stream, int len)
// resample incoming audio to match the output sample rate

int len_in = inst->audioGetNumSamplesOut(len);
if (len_in > 1024) len_in = 1024;
s16 buf_in[1024*2];
int num_in;

Expand Down

0 comments on commit 66d1091

Please sign in to comment.