From patchwork Wed May 11 10:31:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Krempa X-Patchwork-Id: 9067721 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 32BFEBF29F for ; Wed, 11 May 2016 10:31:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 95058201BB for ; Wed, 11 May 2016 10:31:31 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C0CB420142 for ; Wed, 11 May 2016 10:31:30 +0000 (UTC) Received: from localhost ([::1]:51502 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0RQP-0005Us-6D for patchwork-qemu-devel@patchwork.kernel.org; Wed, 11 May 2016 06:31:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0RQH-0005R2-S2 for qemu-devel@nongnu.org; Wed, 11 May 2016 06:31:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b0RQD-0002nM-Ip for qemu-devel@nongnu.org; Wed, 11 May 2016 06:31:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56614) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0RQD-0002nI-DI for qemu-devel@nongnu.org; Wed, 11 May 2016 06:31:17 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EA03947049 for ; Wed, 11 May 2016 10:31:14 +0000 (UTC) Received: from andariel.brq.redhat.com (dhcp129-88.brq.redhat.com [10.34.129.88]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4BAVDT2029777; Wed, 11 May 2016 06:31:14 -0400 From: Peter Krempa To: qemu-devel@nongnu.org Date: Wed, 11 May 2016 12:31:04 +0200 Message-Id: <78853815be2069971b89b3a2e3181837064dd8f3.1462962512.git.pkrempa@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 11 May 2016 10:31:15 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] audio: pa: Set volume of recording stream instead of recording device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Krempa , Gerd Hoffmann Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since pulseaudio 1.0 it's possible to set the individual stream volume rather than setting the device volume. With this, setting hardware mixer of a emulated sound card doesn't mess up the volume configuration of the host. A side effect is that this limits compatible pulseaudio version to 1.0 which was released on 2011-09-27. Signed-off-by: Peter Krempa Reviewed-by: Marc-André Lureau --- This patch is keeping the old coding style by keeping the space after function name so that the styles are not mixed in this file. audio/paaudio.c | 11 +++++------ configure | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/audio/paaudio.c b/audio/paaudio.c index 57678e7..65beb6f 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -781,23 +781,22 @@ static int qpa_ctl_in (HWVoiceIn *hw, int cmd, ...) pa_threaded_mainloop_lock (g->mainloop); - /* FIXME: use the upcoming "set_source_output_{volume,mute}" */ - op = pa_context_set_source_volume_by_index (g->context, - pa_stream_get_device_index (pa->stream), + op = pa_context_set_source_output_volume (g->context, + pa_stream_get_index (pa->stream), &v, NULL, NULL); if (!op) { qpa_logerr (pa_context_errno (g->context), - "set_source_volume() failed\n"); + "set_source_output_volume() failed\n"); } else { pa_operation_unref(op); } - op = pa_context_set_source_mute_by_index (g->context, + op = pa_context_set_source_output_mute (g->context, pa_stream_get_index (pa->stream), sw->vol.mute, NULL, NULL); if (!op) { qpa_logerr (pa_context_errno (g->context), - "set_source_mute() failed\n"); + "set_source_output_mute() failed\n"); } else { pa_operation_unref (op); } diff --git a/configure b/configure index c37fc5f..d71f27c 100755 --- a/configure +++ b/configure @@ -2795,8 +2795,8 @@ for drv in $audio_drv_list; do ;; pa) - audio_drv_probe $drv pulse/mainloop.h "-lpulse" \ - "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;" + audio_drv_probe $drv pulse/pulseaudio.h "-lpulse" \ + "pa_context_set_source_output_volume(NULL, 0, NULL, NULL, NULL); return 0;" libs_softmmu="-lpulse $libs_softmmu" audio_pt_int="yes" ;;