qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@gmail.com>
To: qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	dnb@redhat.com, dlaor@redhat.com, kraxel@redhat.com
Subject: [Qemu-devel] [PATCH 01/11] audio: add VOICE_VOLUME ctl
Date: Mon, 12 Mar 2012 19:50:01 +0100	[thread overview]
Message-ID: <1331578211-18232-2-git-send-email-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <1331578211-18232-1-git-send-email-marcandre.lureau@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

  reply	other threads:[~2012-03-12 18:50 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-12 18:50 [Qemu-devel] [PATCH 00/11] apply volume on client side (v3) Marc-André Lureau
2012-03-12 18:50 ` Marc-André Lureau [this message]
2012-03-12 18:50 ` [Qemu-devel] [PATCH 02/11] audio: don't apply volume effect if backend has VOICE_VOLUME_CAP Marc-André Lureau
2012-03-12 18:50 ` [Qemu-devel] [PATCH 03/11] audio: use a nominal volume of UINT_MAX Marc-André Lureau
2012-03-12 20:03   ` malc
2012-03-12 20:25     ` Marc-André Lureau
2012-03-12 20:29       ` malc
2012-03-12 20:50         ` Marc-André Lureau
2012-03-12 21:00           ` malc
2012-03-12 21:07             ` Marc-André Lureau
2012-03-12 21:11               ` malc
2012-03-12 21:28                 ` Marc-André Lureau
2012-03-12 21:42                   ` malc
2012-03-12 21:46                     ` Marc-André Lureau
2012-03-12 22:52                       ` malc
2012-03-12 23:09                         ` Marc-André Lureau
2012-03-12 18:50 ` [Qemu-devel] [PATCH 04/11] hw/ac97: remove USE_MIXER code Marc-André Lureau
2012-03-12 18:50 ` [Qemu-devel] [PATCH 05/11] hw/ac97: the volume mask is not only 0x1f Marc-André Lureau
2012-03-12 18:50 ` [Qemu-devel] [PATCH 06/11] hw/ac97: add support for volume control Marc-André Lureau
2012-03-12 19:42   ` malc
2012-03-12 18:50 ` [Qemu-devel] [PATCH 07/11] audio/spice: " Marc-André Lureau
2012-03-12 18:50 ` [Qemu-devel] [PATCH 08/11] Do not use pa_simple PulseAudio API Marc-André Lureau
2012-03-12 20:05   ` malc
2012-03-12 18:50 ` [Qemu-devel] [PATCH 09/11] configure: pa_simple is not needed anymore Marc-André Lureau
2012-03-12 18:50 ` [Qemu-devel] [PATCH 10/11] Allow controlling volume with PulseAudio backend Marc-André Lureau
2012-03-12 18:50 ` [Qemu-devel] [PATCH 11/11] Make mixemu mandatory Marc-André Lureau
2012-03-12 19:44 ` [Qemu-devel] [PATCH 00/11] apply volume on client side (v3) malc
2012-03-12 20:35   ` Marc-André Lureau
2012-03-12 20:51     ` malc
2012-03-12 20:59       ` Marc-André Lureau
2012-03-12 21:02         ` malc
2012-03-13 10:19           ` Gerd Hoffmann
2012-03-13 10:33             ` Kevin Wolf
2012-03-13 10:34               ` Gerd Hoffmann
2012-03-13 11:02             ` Marc-André Lureau
2012-03-13 12:09               ` malc
  -- strict thread matches above, loose matches on Subject: below --
2012-03-01 14:27 [Qemu-devel] [PATCH 00/11] apply volume on client side Marc-André Lureau
2011-09-21 16:10 ` [Qemu-devel] [PATCH 00/11] RFC: apply volume on client stream Marc-André Lureau
2011-09-21 16:10   ` [Qemu-devel] [PATCH 01/11] audio: add VOICE_VOLUME ctl Marc-André Lureau
2011-10-13 12:26   ` Marc-André Lureau
2012-03-01 14:27   ` Marc-André Lureau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1331578211-18232-2-git-send-email-marcandre.lureau@redhat.com \
    --to=marcandre.lureau@gmail.com \
    --cc=dlaor@redhat.com \
    --cc=dnb@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).