]> git.proxmox.com Git - qemu.git/commitdiff
audio: add VOICE_VOLUME ctl
authorMarc-André Lureau <marcandre.lureau@gmail.com>
Tue, 17 Apr 2012 12:32:35 +0000 (14:32 +0200)
committermalc <av1474@comtv.ru>
Tue, 17 Apr 2012 12:57:57 +0000 (16:57 +0400)
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 <marcandre.lureau@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
audio/audio.c
audio/audio_int.h

index 398763fd7c94a10574a5226b75724d08ccc9b582..d76c342dcf493a1936c0a489ca9031535e18d6f6 100644 (file)
@@ -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);
+        }
     }
 }
index 2003f8bf20a56fb29c5518b39b690a87751f9552..117f95e36b25dac176269e9d8feed690e6edfc6f 100644 (file)
@@ -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)
 {