mgba-emu / mgba

mGBA Game Boy Advance Emulator
https://mgba.io/
Mozilla Public License 2.0
5.73k stars 794 forks source link

Audio buffer issues with sndio #234

Open bentley opened 8 years ago

bentley commented 8 years ago

On OpenBSD running the sndiod(8) sound server, the emulator runs slowly, apparently due to problems with the audio buffer size.

The Qt frontend appears to set audioBuffers=1536, resulting in correct emulation speed. If sndiod is not running, the sdl frontend runs correctly. If sndiod is running, then the sdl frontend runs slowly unless audioBuffers=1536 is added to the config file.

This effect has been visible since 13f1ab5ab84c83129e96ae80a9d261806b91289f.

endrift commented 8 years ago

Was this an issue in 0.4.0 as well?

bentley commented 8 years ago

I don’t know about 0.4.0 specifically but it is not an issue on the 0.4 branch.

endrift commented 8 years ago

Wait really? That's...so weird.

endrift commented 8 years ago

Not really a fix, but dd76386f4cee134237f6a86c37f178eeca8bd44b changes the default buffer size to 1024. This circumvents the issue, and is probably good for other platforms too.

GhostlyDark commented 6 years ago

I noticed that with a sample rate of 192kHz (Windows 10 1809), an audio buffer of 1536 or lower causes wrong emulation speeds as well. I need the buffer to be at least 2048 for both SDL and Qt Multimedia.