[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 01/10] audio: add VOICE_VOLUME ctl
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH 01/10] audio: add VOICE_VOLUME ctl |
Date: |
Tue, 17 Apr 2012 14:32:35 +0200 |
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 <address@hidden>
---
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)
{
--
1.7.10
- [Qemu-devel] [PATCH 00/10] apply volume on client side v5 bis, Marc-André Lureau, 2012/04/17
- [Qemu-devel] [PATCH 01/10] audio: add VOICE_VOLUME ctl,
Marc-André Lureau <=
- [Qemu-devel] [PATCH 02/10] audio: don't apply volume effect if backend has VOICE_VOLUME_CAP, Marc-André Lureau, 2012/04/17
- [Qemu-devel] [PATCH 03/10] hw/ac97: remove USE_MIXER code, Marc-André Lureau, 2012/04/17
- [Qemu-devel] [PATCH 04/10] hw/ac97: the volume mask is not only 0x1f, Marc-André Lureau, 2012/04/17
- [Qemu-devel] [PATCH 05/10] hw/ac97: add support for volume control, Marc-André Lureau, 2012/04/17
- [Qemu-devel] [PATCH 09/10] Allow controlling volume with PulseAudio backend, Marc-André Lureau, 2012/04/17
- [Qemu-devel] [PATCH 10/10] Enable mixemu by default, add runtime option, Marc-André Lureau, 2012/04/17
- [Qemu-devel] [PATCH 07/10] Do not use pa_simple PulseAudio API, Marc-André Lureau, 2012/04/17