mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1046592 - Fix volume computation in cubeb's opensl backend. r=kinetik
This commit is contained in:
parent
a5628808a9
commit
ccbbdd0298
@ -752,11 +752,13 @@ opensl_stream_set_volume(cubeb_stream * stm, float volume)
|
||||
return CUBEB_ERROR;
|
||||
}
|
||||
|
||||
/* convert to millibels */
|
||||
millibels = lroundf(2000.f * log10f(volume));
|
||||
millibels = SL_MILLIBEL_MIN + (float)(max_level - SL_MILLIBEL_MIN) * volume;
|
||||
|
||||
/* clamp to supported range */
|
||||
if (millibels > max_level) {
|
||||
millibels = max_level;
|
||||
} else if (millibels < SL_MILLIBEL_MIN) {
|
||||
millibels = SL_MILLIBEL_MIN;
|
||||
}
|
||||
|
||||
res = (*stm->volume)->SetVolumeLevel(stm->volume, millibels);
|
||||
|
Loading…
Reference in New Issue
Block a user