aboutsummaryrefslogtreecommitdiff
path: root/audio/audio.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2012-04-18 10:05:58 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2012-04-18 10:06:09 -0500
commit51006bbc45bc74977ae538190a53df2af534acb9 (patch)
tree6fd11943a51b242e657e50d51651833090c201c2 /audio/audio.c
parent25b9e14e78bf9790cdee12d57c45898e86866a24 (diff)
parent6e7a7f3d9bc2031b4c93c05400b18775ba1b1f55 (diff)
Merge remote-tracking branch 'origin/master' into staging
* origin/master: Allow controlling volume with PulseAudio backend configure: pa_simple is not needed anymore Do not use pa_simple PulseAudio API audio/spice: add support for volume control hw/ac97: add support for volume control hw/ac97: the volume mask is not only 0x1f hw/ac97: remove USE_MIXER code audio: don't apply volume effect if backend has VOICE_VOLUME_CAP audio: add VOICE_VOLUME ctl
Diffstat (limited to 'audio/audio.c')
-rw-r--r--audio/audio.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/audio/audio.c b/audio/audio.c
index 398763fd7c..bd9237e9d3 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) {
@@ -2053,17 +2058,29 @@ void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque)
void AUD_set_volume_out (SWVoiceOut *sw, int mute, uint8_t lvol, uint8_t rvol)
{
if (sw) {
+ HWVoiceOut *hw = sw->hw;
+
sw->vol.mute = mute;
sw->vol.l = nominal_volume.l * lvol / 255;
sw->vol.r = nominal_volume.r * rvol / 255;
+
+ if (hw->pcm_ops->ctl_out) {
+ hw->pcm_ops->ctl_out (hw, VOICE_VOLUME, sw);
+ }
}
}
void AUD_set_volume_in (SWVoiceIn *sw, int mute, uint8_t lvol, uint8_t rvol)
{
if (sw) {
+ HWVoiceIn *hw = sw->hw;
+
sw->vol.mute = mute;
sw->vol.l = nominal_volume.l * lvol / 255;
sw->vol.r = nominal_volume.r * rvol / 255;
+
+ if (hw->pcm_ops->ctl_in) {
+ hw->pcm_ops->ctl_in (hw, VOICE_VOLUME, sw);
+ }
}
}