|
@@ -1891,31 +1891,45 @@ void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque)
|
|
|
}
|
|
|
|
|
|
void AUD_set_volume_out (SWVoiceOut *sw, int mute, uint8_t lvol, uint8_t rvol)
|
|
|
+{
|
|
|
+ Volume vol = { .mute = mute, .channels = 2, .vol = { lvol, rvol } };
|
|
|
+ audio_set_volume_out(sw, &vol);
|
|
|
+}
|
|
|
+
|
|
|
+void audio_set_volume_out(SWVoiceOut *sw, Volume *vol)
|
|
|
{
|
|
|
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;
|
|
|
+ sw->vol.mute = vol->mute;
|
|
|
+ sw->vol.l = nominal_volume.l * vol->vol[0] / 255;
|
|
|
+ sw->vol.r = nominal_volume.l * vol->vol[vol->channels > 1 ? 1 : 0] /
|
|
|
+ 255;
|
|
|
|
|
|
if (hw->pcm_ops->volume_out) {
|
|
|
- hw->pcm_ops->volume_out(hw, &sw->vol);
|
|
|
+ hw->pcm_ops->volume_out(hw, vol);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void AUD_set_volume_in (SWVoiceIn *sw, int mute, uint8_t lvol, uint8_t rvol)
|
|
|
+{
|
|
|
+ Volume vol = { .mute = mute, .channels = 2, .vol = { lvol, rvol } };
|
|
|
+ audio_set_volume_in(sw, &vol);
|
|
|
+}
|
|
|
+
|
|
|
+void audio_set_volume_in(SWVoiceIn *sw, Volume *vol)
|
|
|
{
|
|
|
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;
|
|
|
+ sw->vol.mute = vol->mute;
|
|
|
+ sw->vol.l = nominal_volume.l * vol->vol[0] / 255;
|
|
|
+ sw->vol.r = nominal_volume.r * vol->vol[vol->channels > 1 ? 1 : 0] /
|
|
|
+ 255;
|
|
|
|
|
|
if (hw->pcm_ops->volume_in) {
|
|
|
- hw->pcm_ops->volume_in(hw, &sw->vol);
|
|
|
+ hw->pcm_ops->volume_in(hw, vol);
|
|
|
}
|
|
|
}
|
|
|
}
|