From patchwork Tue Apr 17 12:32:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 153157 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 113DFB707A for ; Tue, 17 Apr 2012 22:33:25 +1000 (EST) Received: from localhost ([::1]:35743 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SK7b0-0001Wq-Tt for incoming@patchwork.ozlabs.org; Tue, 17 Apr 2012 08:33:22 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58376) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SK7ak-0001AR-GQ for qemu-devel@nongnu.org; Tue, 17 Apr 2012 08:33:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SK7af-0008Am-K5 for qemu-devel@nongnu.org; Tue, 17 Apr 2012 08:33:06 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:47043) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SK7af-0008AG-BK for qemu-devel@nongnu.org; Tue, 17 Apr 2012 08:33:01 -0400 Received: by pbcuo5 with SMTP id uo5so8847635pbc.4 for ; Tue, 17 Apr 2012 05:32:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=pokOJLnnRXSCf7tnZsDjG1JlRSWTQDHmZoeJxSmedCU=; b=MKlkXl1MvtaH9+WPIW7BbVpY/IOskI/WZtIqHH5iE4RqazRCA2cJX98LxJ+b+DeeGs 8OiB+I/A6pGgEEJWQch/Am+xhyDSeosIsGpcpFRodXRIzqzUQVWq/9haDL+bQFubG3vC w8JlalxYQHuyPAHaUbmvzcDqIU5kELJGjCC08tRYMH69zF5WTYYo0jMNJu9pwggNR5IN moZI+GlWMpn81u3e8IglF7p895JSPhbSlL0CQOTlm366+gVfYlmkYc+qOw8theM4q7ix SGAogl0oX1Oivs6vd3GU1sok4Gb/VTI7IM01REVaL52pegW9eLp/l5M8DpVFeRX7ivKi qR5g== Received: by 10.68.202.167 with SMTP id kj7mr36927608pbc.9.1334665979360; Tue, 17 Apr 2012 05:32:59 -0700 (PDT) Received: from localhost (140.pool85-58-59.dynamic.orange.es. [85.58.59.140]) by mx.google.com with ESMTPS id v1sm20625627pbk.10.2012.04.17.05.32.56 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 Apr 2012 05:32:58 -0700 (PDT) From: "=?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=" To: qemu-devel@nongnu.org Date: Tue, 17 Apr 2012 14:32:35 +0200 Message-Id: <1334665964-3075-2-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1334665964-3075-1-git-send-email-marcandre.lureau@redhat.com> References: <1334665964-3075-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , dlaor@redhat.com, kraxel@redhat.com, areis@redhat.com Subject: [Qemu-devel] [PATCH 01/10] audio: add VOICE_VOLUME ctl 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 Add a new PCM control operation to update the stream volume on the audio backend. The argument given is a SWVoiceOut/SWVoiceIn. v4: - verified other backends didn't fail/assert on this new control they randomly return 0 or -1, but we ignore return value. Signed-off-by: Marc-André Lureau --- audio/audio.c | 12 ++++++++++++ audio/audio_int.h | 1 + 2 files changed, 13 insertions(+) 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) {