From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40192) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7AKQ-00072W-JA for qemu-devel@nongnu.org; Mon, 12 Mar 2012 14:50:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S7AKK-0008Jw-CS for qemu-devel@nongnu.org; Mon, 12 Mar 2012 14:50:42 -0400 Received: from mail-ey0-f173.google.com ([209.85.215.173]:63230) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7AKK-0008JW-3C for qemu-devel@nongnu.org; Mon, 12 Mar 2012 14:50:36 -0400 Received: by eaaf11 with SMTP id f11so1649617eaa.4 for ; Mon, 12 Mar 2012 11:50:33 -0700 (PDT) From: "=?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=" Date: Mon, 12 Mar 2012 19:50:01 +0100 Message-Id: <1331578211-18232-2-git-send-email-marcandre.lureau@redhat.com> In-Reply-To: <1331578211-18232-1-git-send-email-marcandre.lureau@redhat.com> References: <1331578211-18232-1-git-send-email-marcandre.lureau@redhat.com> Subject: [Qemu-devel] [PATCH 01/11] audio: add VOICE_VOLUME ctl List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , dnb@redhat.com, dlaor@redhat.com, kraxel@redhat.com Add a new PCM control operation to update the stream volume on the audio backend. The argument given is a SWVoiceOut/SWVoiceIn. --- audio/audio.c | 12 ++++++++++++ audio/audio_int.h | 1 + 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 398763f..d76c342 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -2053,17 +2053,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); + } } } diff --git a/audio/audio_int.h b/audio/audio_int.h index 2003f8b..117f95e 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -231,6 +231,7 @@ void audio_run (const char *msg); #define VOICE_ENABLE 1 #define VOICE_DISABLE 2 +#define VOICE_VOLUME 3 static inline int audio_ring_dist (int dst, int src, int len) { -- 1.7.7.6