mirror of
https://github.com/mpv-player/mpv
synced 2025-03-08 07:08:12 +00:00
mixer: keep fractional part of volume setting
mixer_setvolume() accepts float values for volume, but used the integer function av_clip() to limit range, losing the fractional part as a side effect. Change the code to use av_clipf() instead. For most uses this shouldn't make any real difference; actual AO volume settings may not have that much precision anyway.
This commit is contained in:
parent
3f7526d641
commit
82d72ef39f
@ -124,8 +124,8 @@ static void setvolume_internal(mixer_t *mixer, float l, float r)
|
||||
void mixer_setvolume(mixer_t *mixer, float l, float r)
|
||||
{
|
||||
checkvolume(mixer); // to check mute status and AO support for volume
|
||||
mixer->vol_l = av_clip(l, 0, 100);
|
||||
mixer->vol_r = av_clip(r, 0, 100);
|
||||
mixer->vol_l = av_clipf(l, 0, 100);
|
||||
mixer->vol_r = av_clipf(r, 0, 100);
|
||||
if (!mixer->ao || mixer->muted_using_volume)
|
||||
return;
|
||||
setvolume_internal(mixer, mixer->vol_l, mixer->vol_r);
|
||||
|
Loading…
Reference in New Issue
Block a user