From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7AKk-0007oH-Mp for qemu-devel@nongnu.org; Mon, 12 Mar 2012 14:51:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S7AKi-0008Te-Tu for qemu-devel@nongnu.org; Mon, 12 Mar 2012 14:51:02 -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 1S7AKi-0008JW-Ky for qemu-devel@nongnu.org; Mon, 12 Mar 2012 14:51:00 -0400 Received: by mail-ey0-f173.google.com with SMTP id f11so1649617eaa.4 for ; Mon, 12 Mar 2012 11:50:59 -0700 (PDT) From: "=?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=" Date: Mon, 12 Mar 2012 19:50:07 +0100 Message-Id: <1331578211-18232-8-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 07/11] audio/spice: add support for volume control 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 Use Spice server volume control API when available. --- audio/spiceaudio.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 41 insertions(+), 0 deletions(-) diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index f972110..92964ae 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -202,7 +202,26 @@ static int line_out_ctl (HWVoiceOut *hw, int cmd, ...) } spice_server_playback_stop (&out->sin); break; + case VOICE_VOLUME: + { +#if ((SPICE_INTERFACE_PLAYBACK_MAJOR >= 1) && (SPICE_INTERFACE_PLAYBACK_MINOR >= 2)) + SWVoiceOut *sw; + va_list ap; + uint16_t vol[2]; + + va_start (ap, cmd); + sw = va_arg (ap, SWVoiceOut *); + va_end (ap); + + vol[0] = sw->vol.l >> 16; + vol[1] = sw->vol.r >> 16; + spice_server_playback_set_volume (&out->sin, 2, vol); + spice_server_playback_set_mute (&out->sin, sw->vol.mute); +#endif + break; + } } + return 0; } @@ -304,7 +323,26 @@ static int line_in_ctl (HWVoiceIn *hw, int cmd, ...) in->active = 0; spice_server_record_stop (&in->sin); break; + case VOICE_VOLUME: + { +#if ((SPICE_INTERFACE_RECORD_MAJOR >= 2) && (SPICE_INTERFACE_RECORD_MINOR >= 2)) + SWVoiceIn *sw; + va_list ap; + uint16_t vol[2]; + + va_start (ap, cmd); + sw = va_arg (ap, SWVoiceIn *); + va_end (ap); + + vol[0] = sw->vol.l >> 16; + vol[1] = sw->vol.r >> 16; + spice_server_record_set_volume (&in->sin, 2, vol); + spice_server_record_set_mute (&in->sin, sw->vol.mute); +#endif + break; + } } + return 0; } @@ -337,6 +375,9 @@ struct audio_driver spice_audio_driver = { .max_voices_in = 1, .voice_size_out = sizeof (SpiceVoiceOut), .voice_size_in = sizeof (SpiceVoiceIn), +#if ((SPICE_INTERFACE_PLAYBACK_MAJOR >= 1) && (SPICE_INTERFACE_PLAYBACK_MINOR >= 2)) + .ctl_caps = VOICE_VOLUME_CAP +#endif }; void qemu_spice_audio_init (void) -- 1.7.7.6