Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve audio sampling at non-60 fps targets #2246

Merged
merged 1 commit into from
Dec 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading