Audio buffer size calculated wrong?

Ask for help with ScummVM problems

Moderator: ScummVM Team

Post Reply
User avatar
Raziel
ScummVM Porter
Posts: 1513
Joined: Tue Oct 25, 2005 8:27 am
Location: a dying planet

Audio buffer size calculated wrong?

Post by Raziel »

Hey there,

i have a little problem with the automatic audio buffer size calculation.

I suffer from audible "thuds" in numerous games (most prominently in Grim Fandango, but that might be because i do a lot of testing with this one) during every audio/music playback starting in the intro.

I'm always using "sample rate" of 44100Hz to cover all possible games (since the readme tells me that it doesn't gain any sound quality, but it also doesn't worsen it - "backwards compatibility", so to speak).

I used the hidden "audio_buffer_size" setting to override the calculated setting, which seems to be 1024 (gathered with -d8),
...
Using SDL Audio Driver "amigaos4"
Output sample rate: 44100 Hz
Output buffer size: 1024 samples
...
and manually force it to 2048.

The "thuds" are gone completely.

Could there be a tiny calculation (or rounding) error in the code (I don't know where it resides) that causes the buffer size to be set too low?

Trying to understand the readme, which tells that the audio buffer size is calculated from the sample rate to reach a latency of 45ms.
So, "sample rate"/"latency"="audio buffer size (not rounded)"?
That would give me a buffer size of 980 (and rounded up to 1024 to not break the sequence)?

But why is this setting causing such problems for my setup?

I'd like to get the "working" setting through ScummVM's internal calculation and not rely on that hidden setting (especially normal end users will probably never find it and also suffer from this set too low).

If someone could point me to the place in the code i could try to set an exception just for my platform?
Or any other ideas welcome :-)

Thanks a lot
Post Reply