From c01b2456238f73964876471452e27d4aad7900fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 17 Apr 2012 14:32:36 +0200 Subject: audio: don't apply volume effect if backend has VOICE_VOLUME_CAP If the audio backend is capable of volume control, don't apply software volume (mixeng_volume ()), but instead, rely on backend volume control. This will allow guest to have full range volume control. Signed-off-by: Marc-Andr? Lureau Signed-off-by: malc --- audio/audio.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'audio/audio.c') diff --git a/audio/audio.c b/audio/audio.c index d76c342..bd9237e 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -957,7 +957,9 @@ int audio_pcm_sw_read (SWVoiceIn *sw, void *buf, int size) total += isamp; } - mixeng_volume (sw->buf, ret, &sw->vol); + if (!(hw->ctl_caps & VOICE_VOLUME_CAP)) { + mixeng_volume (sw->buf, ret, &sw->vol); + } sw->clip (buf, sw->buf, ret); sw->total_hw_samples_acquired += total; @@ -1041,7 +1043,10 @@ int audio_pcm_sw_write (SWVoiceOut *sw, void *buf, int size) swlim = audio_MIN (swlim, samples); if (swlim) { sw->conv (sw->buf, buf, swlim); - mixeng_volume (sw->buf, swlim, &sw->vol); + + if (!(sw->hw->ctl_caps & VOICE_VOLUME_CAP)) { + mixeng_volume (sw->buf, swlim, &sw->vol); + } } while (swlim) { -- cgit v1.1