From patchwork Wed Sep 21 16:11:04 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 115810 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 93FB7B6F84 for ; Thu, 22 Sep 2011 02:12:01 +1000 (EST) Received: from localhost ([::1]:54504 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6POv-0002NK-E9 for incoming@patchwork.ozlabs.org; Wed, 21 Sep 2011 12:11:57 -0400 Received: from eggs.gnu.org ([140.186.70.92]:48269) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6POg-0002Aa-Ae for qemu-devel@nongnu.org; Wed, 21 Sep 2011 12:11:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R6POa-0004qO-Gv for qemu-devel@nongnu.org; Wed, 21 Sep 2011 12:11:42 -0400 Received: from mail-wy0-f173.google.com ([74.125.82.173]:63801) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6POa-0004ln-8C for qemu-devel@nongnu.org; Wed, 21 Sep 2011 12:11:36 -0400 Received: by mail-wy0-f173.google.com with SMTP id 22so2108807wyh.4 for ; Wed, 21 Sep 2011 09:11:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=SQHaUzovnwq6LtlxtizXbZn9wSit3lQKGxthxvMl3hg=; b=xtdOio8Vr3OkB6UCP7CCWm/eMzL2h6n6S5r0jWMzZa4ajTDszx0iRKyZJyfgxmn80Z cqFtWYQHSsoGrTHldKH0huUWdrcA/ZNVK+sYAk02kkQw6hvMSdzQBIz2F1tp6PMno6lD Tt5Cy/Zwpje6rd2w35zVNJ8dB/aigeJf8rFVE= Received: by 10.227.5.213 with SMTP id 21mr914433wbw.40.1316621495727; Wed, 21 Sep 2011 09:11:35 -0700 (PDT) Received: from localhost (207.Red-79-152-121.dynamicIP.rima-tde.net. [79.152.121.207]) by mx.google.com with ESMTPS id j18sm7457405wbo.6.2011.09.21.09.11.34 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Sep 2011 09:11:35 -0700 (PDT) From: "=?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=" To: qemu-devel@nongnu.org Date: Wed, 21 Sep 2011 18:11:04 +0200 Message-Id: <1316621468-32171-8-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 1.7.6.2 In-Reply-To: <1316621468-32171-1-git-send-email-marcandre.lureau@redhat.com> References: <1316621468-32171-1-git-send-email-marcandre.lureau@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.82.173 Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [Qemu-devel] [PATCH 07/11] audio/spice: add support for volume control X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org --- audio/spiceaudio.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 43 insertions(+), 0 deletions(-) diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index f972110..2df0957 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -202,7 +202,28 @@ 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); +#else +#warning "Spice playback volume unsupported" +#endif + break; + } } + return 0; } @@ -304,7 +325,28 @@ 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); +#else +#warning "Spice record volume unsupported" +#endif + break; + } } + return 0; } @@ -337,6 +379,7 @@ struct audio_driver spice_audio_driver = { .max_voices_in = 1, .voice_size_out = sizeof (SpiceVoiceOut), .voice_size_in = sizeof (SpiceVoiceIn), + .ctl_caps = VOICE_VOLUME_CAP }; void qemu_spice_audio_init (void)