LIBRETRO: set closest power of 2 for scummvm audio buffer size

This commit is contained in:
Giovanni Cascione 2024-03-28 22:27:41 +01:00
parent a9026919d4
commit cd3cc986ed

View File

@ -610,7 +610,16 @@ uint16 retro_setting_get_sample_rate(void) {
}
uint16 retro_setting_get_audio_samples_buffer_size(void) {
return audio_samples_per_frame + 1;
/* ScummVM a.udio buffer size is normally between 512 and 8192, but the value
must be one of: 256, 512, 1024, 2048, 4096, 8192, 16384, or 32768. */
uint16 v = audio_samples_per_frame--;
v |= v >> 1;
v |= v >> 2;
v |= v >> 4;
v |= v >> 8;
v |= v >> 16;
return ++v;
}
void init_command_params(void) {