diff options
author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2012-04-17 14:32:35 +0200 |
---|---|---|
committer | malc <av1474@comtv.ru> | 2012-04-17 16:57:57 +0400 |
commit | 6c95ab94f9f7e8d3156e4e16ecc7c499e141bb1a (patch) | |
tree | 04b8296de6173bcb0ef7a347badc38da0c7935a9 /audio/audio.c | |
parent | 158fd3ce98afd21f2e2639600f6414ea703a9121 (diff) |
audio: add VOICE_VOLUME ctl
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>
Diffstat (limited to 'audio/audio.c')
-rw-r--r-- | audio/audio.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/audio/audio.c b/audio/audio.c index 398763fd7c..d76c342dcf 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); + } } } |