|
Hans de Goede |
56753f |
From eaa3b2d4cc2ac17b2aaf0d6387d3991b9d08c56e Mon Sep 17 00:00:00 2001
|
|
Hans de Goede |
56753f |
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@gmail.com>
|
|
Hans de Goede |
56753f |
Date: Tue, 17 Apr 2012 14:32:36 +0200
|
|
Hans de Goede |
56753f |
Subject: [PATCH 502/509] audio: don't apply volume effect if backend has
|
|
Hans de Goede |
56753f |
VOICE_VOLUME_CAP
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
If the audio backend is capable of volume control, don't apply
|
|
Hans de Goede |
56753f |
software volume (mixeng_volume ()), but instead, rely on backend
|
|
Hans de Goede |
56753f |
volume control. This will allow guest to have full range volume
|
|
Hans de Goede |
56753f |
control.
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
Signed-off-by: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
|
|
Hans de Goede |
56753f |
Signed-off-by: malc <av1474@comtv.ru>
|
|
Hans de Goede |
56753f |
---
|
|
Hans de Goede |
56753f |
audio/audio.c | 9 +++++++--
|
|
Hans de Goede |
56753f |
audio/audio_int.h | 5 +++++
|
|
Hans de Goede |
56753f |
audio/audio_template.h | 2 ++
|
|
Hans de Goede |
56753f |
3 files changed, 14 insertions(+), 2 deletions(-)
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
diff --git a/audio/audio.c b/audio/audio.c
|
|
Hans de Goede |
56753f |
index 2ae9b2f..0fe95a7 100644
|
|
Hans de Goede |
56753f |
--- a/audio/audio.c
|
|
Hans de Goede |
56753f |
+++ b/audio/audio.c
|
|
Hans de Goede |
56753f |
@@ -954,7 +954,9 @@ int audio_pcm_sw_read (SWVoiceIn *sw, void *buf, int size)
|
|
Hans de Goede |
56753f |
total += isamp;
|
|
Hans de Goede |
56753f |
}
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
- mixeng_volume (sw->buf, ret, &sw->vol);
|
|
Hans de Goede |
56753f |
+ if (!(hw->ctl_caps & VOICE_VOLUME_CAP)) {
|
|
Hans de Goede |
56753f |
+ mixeng_volume (sw->buf, ret, &sw->vol);
|
|
Hans de Goede |
56753f |
+ }
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
sw->clip (buf, sw->buf, ret);
|
|
Hans de Goede |
56753f |
sw->total_hw_samples_acquired += total;
|
|
Hans de Goede |
56753f |
@@ -1038,7 +1040,10 @@ int audio_pcm_sw_write (SWVoiceOut *sw, void *buf, int size)
|
|
Hans de Goede |
56753f |
swlim = audio_MIN (swlim, samples);
|
|
Hans de Goede |
56753f |
if (swlim) {
|
|
Hans de Goede |
56753f |
sw->conv (sw->buf, buf, swlim);
|
|
Hans de Goede |
56753f |
- mixeng_volume (sw->buf, swlim, &sw->vol);
|
|
Hans de Goede |
56753f |
+
|
|
Hans de Goede |
56753f |
+ if (!(sw->hw->ctl_caps & VOICE_VOLUME_CAP)) {
|
|
Hans de Goede |
56753f |
+ mixeng_volume (sw->buf, swlim, &sw->vol);
|
|
Hans de Goede |
56753f |
+ }
|
|
Hans de Goede |
56753f |
}
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
while (swlim) {
|
|
Hans de Goede |
56753f |
diff --git a/audio/audio_int.h b/audio/audio_int.h
|
|
Hans de Goede |
56753f |
index 117f95e..b9b0676 100644
|
|
Hans de Goede |
56753f |
--- a/audio/audio_int.h
|
|
Hans de Goede |
56753f |
+++ b/audio/audio_int.h
|
|
Hans de Goede |
56753f |
@@ -82,6 +82,7 @@ typedef struct HWVoiceOut {
|
|
Hans de Goede |
56753f |
int samples;
|
|
Hans de Goede |
56753f |
QLIST_HEAD (sw_out_listhead, SWVoiceOut) sw_head;
|
|
Hans de Goede |
56753f |
QLIST_HEAD (sw_cap_listhead, SWVoiceCap) cap_head;
|
|
Hans de Goede |
56753f |
+ int ctl_caps;
|
|
Hans de Goede |
56753f |
struct audio_pcm_ops *pcm_ops;
|
|
Hans de Goede |
56753f |
QLIST_ENTRY (HWVoiceOut) entries;
|
|
Hans de Goede |
56753f |
} HWVoiceOut;
|
|
Hans de Goede |
56753f |
@@ -101,6 +102,7 @@ typedef struct HWVoiceIn {
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
int samples;
|
|
Hans de Goede |
56753f |
QLIST_HEAD (sw_in_listhead, SWVoiceIn) sw_head;
|
|
Hans de Goede |
56753f |
+ int ctl_caps;
|
|
Hans de Goede |
56753f |
struct audio_pcm_ops *pcm_ops;
|
|
Hans de Goede |
56753f |
QLIST_ENTRY (HWVoiceIn) entries;
|
|
Hans de Goede |
56753f |
} HWVoiceIn;
|
|
Hans de Goede |
56753f |
@@ -150,6 +152,7 @@ struct audio_driver {
|
|
Hans de Goede |
56753f |
int max_voices_in;
|
|
Hans de Goede |
56753f |
int voice_size_out;
|
|
Hans de Goede |
56753f |
int voice_size_in;
|
|
Hans de Goede |
56753f |
+ int ctl_caps;
|
|
Hans de Goede |
56753f |
};
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
struct audio_pcm_ops {
|
|
Hans de Goede |
56753f |
@@ -233,6 +236,8 @@ void audio_run (const char *msg);
|
|
Hans de Goede |
56753f |
#define VOICE_DISABLE 2
|
|
Hans de Goede |
56753f |
#define VOICE_VOLUME 3
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
+#define VOICE_VOLUME_CAP (1 << VOICE_VOLUME)
|
|
Hans de Goede |
56753f |
+
|
|
Hans de Goede |
56753f |
static inline int audio_ring_dist (int dst, int src, int len)
|
|
Hans de Goede |
56753f |
{
|
|
Hans de Goede |
56753f |
return (dst >= src) ? (dst - src) : (len - src + dst);
|
|
Hans de Goede |
56753f |
diff --git a/audio/audio_template.h b/audio/audio_template.h
|
|
Hans de Goede |
56753f |
index e62a713..519432a 100644
|
|
Hans de Goede |
56753f |
--- a/audio/audio_template.h
|
|
Hans de Goede |
56753f |
+++ b/audio/audio_template.h
|
|
Hans de Goede |
56753f |
@@ -263,6 +263,8 @@ static HW *glue (audio_pcm_hw_add_new_, TYPE) (struct audsettings *as)
|
|
Hans de Goede |
56753f |
}
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
hw->pcm_ops = drv->pcm_ops;
|
|
Hans de Goede |
56753f |
+ hw->ctl_caps = drv->ctl_caps;
|
|
Hans de Goede |
56753f |
+
|
|
Hans de Goede |
56753f |
QLIST_INIT (&hw->sw_head);
|
|
Hans de Goede |
56753f |
#ifdef DAC
|
|
Hans de Goede |
56753f |
QLIST_INIT (&hw->cap_head);
|
|
Hans de Goede |
56753f |
--
|
|
Hans de Goede |
56753f |
1.7.10
|
|
Hans de Goede |
56753f |
|