mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
volume: Clamp volume to PA_VOLUME_MAX
This ensures that we always clamp the volume to PA_VOLUME_MAX. While this currently has no effect, it will be required for making sure we don't exceed PA_VOLUME_MAX when its value changes in the future.
This commit is contained in:
parent
1d2ef7923d
commit
49101fc540
7 changed files with 24 additions and 19 deletions
|
|
@ -359,8 +359,8 @@ static int sink_get_hw_volume_cb(pa_sink *s) {
|
|||
if (waveOutGetVolume(u->hwo, &vol) != MMSYSERR_NOERROR)
|
||||
return -1;
|
||||
|
||||
left = (vol & 0xFFFF) * PA_VOLUME_NORM / WAVEOUT_MAX_VOLUME;
|
||||
right = ((vol >> 16) & 0xFFFF) * PA_VOLUME_NORM / WAVEOUT_MAX_VOLUME;
|
||||
left = PA_CLAMP_VOLUME((vol & 0xFFFF) * PA_VOLUME_NORM / WAVEOUT_MAX_VOLUME);
|
||||
right = PA_CLAMP_VOLUME(((vol >> 16) & 0xFFFF) * PA_VOLUME_NORM / WAVEOUT_MAX_VOLUME);
|
||||
|
||||
/* Windows supports > 2 channels, except for volume control */
|
||||
if (s->hw_volume.channels > 2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue