|
Hans de Goede |
56753f |
From be81272bafb948278e5e5739ef975cd7bbf0ee0c 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:35 +0200
|
|
Hans de Goede |
56753f |
Subject: [PATCH 501/509] audio: add VOICE_VOLUME ctl
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
Add a new PCM control operation to update the stream volume on the
|
|
Hans de Goede |
56753f |
audio backend. The argument given is a SWVoiceOut/SWVoiceIn.
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
v4:
|
|
Hans de Goede |
56753f |
- verified other backends didn't fail/assert on this new control
|
|
Hans de Goede |
56753f |
they randomly return 0 or -1, but we ignore return value.
|
|
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 | 12 ++++++++++++
|
|
Hans de Goede |
56753f |
audio/audio_int.h | 1 +
|
|
Hans de Goede |
56753f |
2 files changed, 13 insertions(+)
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
diff --git a/audio/audio.c b/audio/audio.c
|
|
Hans de Goede |
56753f |
index 50d0d71..2ae9b2f 100644
|
|
Hans de Goede |
56753f |
--- a/audio/audio.c
|
|
Hans de Goede |
56753f |
+++ b/audio/audio.c
|
|
Hans de Goede |
56753f |
@@ -2050,17 +2050,29 @@ void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque)
|
|
Hans de Goede |
56753f |
void AUD_set_volume_out (SWVoiceOut *sw, int mute, uint8_t lvol, uint8_t rvol)
|
|
Hans de Goede |
56753f |
{
|
|
Hans de Goede |
56753f |
if (sw) {
|
|
Hans de Goede |
56753f |
+ HWVoiceOut *hw = sw->hw;
|
|
Hans de Goede |
56753f |
+
|
|
Hans de Goede |
56753f |
sw->vol.mute = mute;
|
|
Hans de Goede |
56753f |
sw->vol.l = nominal_volume.l * lvol / 255;
|
|
Hans de Goede |
56753f |
sw->vol.r = nominal_volume.r * rvol / 255;
|
|
Hans de Goede |
56753f |
+
|
|
Hans de Goede |
56753f |
+ if (hw->pcm_ops->ctl_out) {
|
|
Hans de Goede |
56753f |
+ hw->pcm_ops->ctl_out (hw, VOICE_VOLUME, sw);
|
|
Hans de Goede |
56753f |
+ }
|
|
Hans de Goede |
56753f |
}
|
|
Hans de Goede |
56753f |
}
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
void AUD_set_volume_in (SWVoiceIn *sw, int mute, uint8_t lvol, uint8_t rvol)
|
|
Hans de Goede |
56753f |
{
|
|
Hans de Goede |
56753f |
if (sw) {
|
|
Hans de Goede |
56753f |
+ HWVoiceIn *hw = sw->hw;
|
|
Hans de Goede |
56753f |
+
|
|
Hans de Goede |
56753f |
sw->vol.mute = mute;
|
|
Hans de Goede |
56753f |
sw->vol.l = nominal_volume.l * lvol / 255;
|
|
Hans de Goede |
56753f |
sw->vol.r = nominal_volume.r * rvol / 255;
|
|
Hans de Goede |
56753f |
+
|
|
Hans de Goede |
56753f |
+ if (hw->pcm_ops->ctl_in) {
|
|
Hans de Goede |
56753f |
+ hw->pcm_ops->ctl_in (hw, VOICE_VOLUME, sw);
|
|
Hans de Goede |
56753f |
+ }
|
|
Hans de Goede |
56753f |
}
|
|
Hans de Goede |
56753f |
}
|
|
Hans de Goede |
56753f |
diff --git a/audio/audio_int.h b/audio/audio_int.h
|
|
Hans de Goede |
56753f |
index 2003f8b..117f95e 100644
|
|
Hans de Goede |
56753f |
--- a/audio/audio_int.h
|
|
Hans de Goede |
56753f |
+++ b/audio/audio_int.h
|
|
Hans de Goede |
56753f |
@@ -231,6 +231,7 @@ void audio_run (const char *msg);
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
#define VOICE_ENABLE 1
|
|
Hans de Goede |
56753f |
#define VOICE_DISABLE 2
|
|
Hans de Goede |
56753f |
+#define VOICE_VOLUME 3
|
|
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 |
--
|
|
Hans de Goede |
56753f |
1.7.10
|
|
Hans de Goede |
56753f |
|