From: "Marc-André Lureau" <marcandre.lureau@gmail.com>
To: qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>, kraxel@redhat.com
Subject: [Qemu-devel] [PATCH 02/11] audio: don't apply volume effect if backend has VOICE_VOLUME_CAP
Date: Thu, 1 Mar 2012 15:27:58 +0100 [thread overview]
Message-ID: <1330612087-1882-3-git-send-email-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <1330612087-1882-1-git-send-email-marcandre.lureau@redhat.com>
In-Reply-To: <1316621468-32171-1-git-send-email-marcandre.lureau@redhat.com>
---
audio/audio.c | 9 +++++++--
audio/audio_int.h | 5 +++++
audio/audio_template.h | 2 ++
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/audio/audio.c b/audio/audio.c
index d76c342..bd9237e 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -957,7 +957,9 @@ int audio_pcm_sw_read (SWVoiceIn *sw, void *buf, int size)
total += isamp;
}
- mixeng_volume (sw->buf, ret, &sw->vol);
+ if (!(hw->ctl_caps & VOICE_VOLUME_CAP)) {
+ mixeng_volume (sw->buf, ret, &sw->vol);
+ }
sw->clip (buf, sw->buf, ret);
sw->total_hw_samples_acquired += total;
@@ -1041,7 +1043,10 @@ int audio_pcm_sw_write (SWVoiceOut *sw, void *buf, int size)
swlim = audio_MIN (swlim, samples);
if (swlim) {
sw->conv (sw->buf, buf, swlim);
- mixeng_volume (sw->buf, swlim, &sw->vol);
+
+ if (!(sw->hw->ctl_caps & VOICE_VOLUME_CAP)) {
+ mixeng_volume (sw->buf, swlim, &sw->vol);
+ }
}
while (swlim) {
diff --git a/audio/audio_int.h b/audio/audio_int.h
index 117f95e..b9b0676 100644
--- a/audio/audio_int.h
+++ b/audio/audio_int.h
@@ -82,6 +82,7 @@ typedef struct HWVoiceOut {
int samples;
QLIST_HEAD (sw_out_listhead, SWVoiceOut) sw_head;
QLIST_HEAD (sw_cap_listhead, SWVoiceCap) cap_head;
+ int ctl_caps;
struct audio_pcm_ops *pcm_ops;
QLIST_ENTRY (HWVoiceOut) entries;
} HWVoiceOut;
@@ -101,6 +102,7 @@ typedef struct HWVoiceIn {
int samples;
QLIST_HEAD (sw_in_listhead, SWVoiceIn) sw_head;
+ int ctl_caps;
struct audio_pcm_ops *pcm_ops;
QLIST_ENTRY (HWVoiceIn) entries;
} HWVoiceIn;
@@ -150,6 +152,7 @@ struct audio_driver {
int max_voices_in;
int voice_size_out;
int voice_size_in;
+ int ctl_caps;
};
struct audio_pcm_ops {
@@ -233,6 +236,8 @@ void audio_run (const char *msg);
#define VOICE_DISABLE 2
#define VOICE_VOLUME 3
+#define VOICE_VOLUME_CAP (1 << VOICE_VOLUME)
+
static inline int audio_ring_dist (int dst, int src, int len)
{
return (dst >= src) ? (dst - src) : (len - src + dst);
diff --git a/audio/audio_template.h b/audio/audio_template.h
index e62a713..519432a 100644
--- a/audio/audio_template.h
+++ b/audio/audio_template.h
@@ -263,6 +263,8 @@ static HW *glue (audio_pcm_hw_add_new_, TYPE) (struct audsettings *as)
}
hw->pcm_ops = drv->pcm_ops;
+ hw->ctl_caps = drv->ctl_caps;
+
QLIST_INIT (&hw->sw_head);
#ifdef DAC
QLIST_INIT (&hw->cap_head);
--
1.7.7.6
next prev parent reply other threads:[~2012-03-01 14:29 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
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-09-21 16:10 ` [Qemu-devel] [PATCH 02/11] audio: don't apply volume effect if backend has VOICE_VOLUME_CAP Marc-André Lureau
2011-09-21 16:11 ` [Qemu-devel] [PATCH 03/11] audio: use a nominal volume of 1^32-1 Marc-André Lureau
2011-09-21 16:11 ` [Qemu-devel] [PATCH 04/11] hw/ac97: remove USE_MIXER code Marc-André Lureau
2011-09-21 16:11 ` [Qemu-devel] [PATCH 05/11] hw/ac97: the volume mask was not always 0x1f Marc-André Lureau
2011-09-21 16:11 ` [Qemu-devel] [PATCH 06/11] hw/ac97: new support for volume control Marc-André Lureau
2011-09-21 16:11 ` [Qemu-devel] [PATCH 07/11] audio/spice: add " Marc-André Lureau
2011-10-11 8:49 ` Gerd Hoffmann
2011-10-13 12:06 ` Marc-André Lureau
2011-09-21 16:11 ` [Qemu-devel] [PATCH 08/11] RFC: use full PulseAudio API, largely adapted from pa_simple* Marc-André Lureau
2011-09-21 16:11 ` [Qemu-devel] [PATCH 09/11] RFC: configure: pa_simple is not needed anymore Marc-André Lureau
2011-09-21 16:11 ` [Qemu-devel] [PATCH 10/11] RFC: allow controlling volume with PulseAudio backend Marc-André Lureau
2011-09-21 16:11 ` [Qemu-devel] [PATCH 11/11] RFC: make mixemu mandatory Marc-André Lureau
2011-10-11 8:54 ` [Qemu-devel] [PATCH 00/11] RFC: apply volume on client stream Gerd Hoffmann
2011-10-13 12:26 ` [Qemu-devel] [PATCH 01/11] audio: add VOICE_VOLUME ctl Marc-André Lureau
2011-10-13 12:26 ` [Qemu-devel] [PATCH 02/11] audio: don't apply volume effect if backend has VOICE_VOLUME_CAP Marc-André Lureau
2011-10-13 12:26 ` [Qemu-devel] [PATCH 03/11] audio: use a nominal volume of 1^32-1 Marc-André Lureau
2011-10-13 12:26 ` [Qemu-devel] [PATCH 04/11] hw/ac97: remove USE_MIXER code Marc-André Lureau
2011-10-13 12:26 ` [Qemu-devel] [PATCH 05/11] hw/ac97: the volume mask was not always 0x1f Marc-André Lureau
2011-10-13 12:26 ` [Qemu-devel] [PATCH 06/11] hw/ac97: new support for volume control Marc-André Lureau
2011-10-13 12:26 ` [Qemu-devel] [PATCH 07/11] audio/spice: add " Marc-André Lureau
2011-10-13 12:26 ` [Qemu-devel] [PATCH 08/11] audio: use full PulseAudio API, largely adapted from pa_simple* Marc-André Lureau
2011-10-13 12:26 ` [Qemu-devel] [PATCH 09/11] configure: pa_simple is not needed anymore Marc-André Lureau
2011-10-13 12:26 ` [Qemu-devel] [PATCH 10/11] audio: allow controlling volume with PulseAudio backend Marc-André Lureau
2011-10-13 12:26 ` [Qemu-devel] [PATCH 11/11] audio: make mixemu mandatory Marc-André Lureau
2012-03-01 14:27 ` [Qemu-devel] [PATCH 00/11] apply volume on client side Marc-André Lureau
2012-03-01 14:27 ` [Qemu-devel] [PATCH 01/11] audio: add VOICE_VOLUME ctl Marc-André Lureau
2012-03-01 14:27 ` Marc-André Lureau [this message]
2012-03-01 14:27 ` [Qemu-devel] [PATCH 03/11] audio: use a nominal volume of 1^32-1 Marc-André Lureau
2012-03-01 15:16 ` Eric Blake
2012-03-01 14:28 ` [Qemu-devel] [PATCH 04/11] hw/ac97: remove USE_MIXER code Marc-André Lureau
2012-03-01 14:28 ` [Qemu-devel] [PATCH 05/11] hw/ac97: the volume mask was not always 0x1f Marc-André Lureau
2012-03-01 14:28 ` [Qemu-devel] [PATCH 06/11] hw/ac97: new support for volume control Marc-André Lureau
2012-03-01 14:28 ` [Qemu-devel] [PATCH 07/11] audio/spice: add " Marc-André Lureau
2012-03-01 14:28 ` [Qemu-devel] [PATCH 08/11] Do not use pa_simple PulseAudio API Marc-André Lureau
2012-03-01 14:28 ` [Qemu-devel] [PATCH 09/11] configure: pa_simple is not needed anymore Marc-André Lureau
2012-03-01 14:28 ` [Qemu-devel] [PATCH 10/11] Allow controlling volume with PulseAudio backend Marc-André Lureau
2012-03-01 14:28 ` [Qemu-devel] [PATCH 11/11] Make mixemu mandatory Marc-André Lureau
-- strict thread matches above, loose matches on Subject: below --
2012-03-12 18:50 [Qemu-devel] [PATCH 00/11] apply volume on client side (v3) Marc-André Lureau
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
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=1330612087-1882-3-git-send-email-marcandre.lureau@redhat.com \
--to=marcandre.lureau@gmail.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).