aboutsummaryrefslogtreecommitdiff
path: root/audio/audio.c
diff options
context:
space:
mode:
Diffstat (limited to 'audio/audio.c')
-rw-r--r--audio/audio.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/audio/audio.c b/audio/audio.c
index fab1e35718..7128ee98dc 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -636,7 +636,7 @@ static size_t audio_pcm_sw_read(SWVoiceIn *sw, void *buf, size_t size)
total += isamp;
}
- if (!(hw->ctl_caps & VOICE_VOLUME_CAP)) {
+ if (!hw->pcm_ops->volume_in) {
mixeng_volume (sw->buf, ret, &sw->vol);
}
@@ -723,7 +723,7 @@ static size_t audio_pcm_sw_write(SWVoiceOut *sw, void *buf, size_t size)
if (swlim) {
sw->conv (sw->buf, buf, swlim);
- if (!(sw->hw->ctl_caps & VOICE_VOLUME_CAP)) {
+ if (!sw->hw->pcm_ops->volume_out) {
mixeng_volume (sw->buf, swlim, &sw->vol);
}
}
@@ -890,7 +890,9 @@ void AUD_set_active_out (SWVoiceOut *sw, int on)
if (!hw->enabled) {
hw->enabled = 1;
if (s->vm_running) {
- hw->pcm_ops->ctl_out(hw, VOICE_ENABLE);
+ if (hw->pcm_ops->enable_out) {
+ hw->pcm_ops->enable_out(hw, true);
+ }
audio_reset_timer (s);
}
}
@@ -935,7 +937,9 @@ void AUD_set_active_in (SWVoiceIn *sw, int on)
if (!hw->enabled) {
hw->enabled = 1;
if (s->vm_running) {
- hw->pcm_ops->ctl_in(hw, VOICE_ENABLE);
+ if (hw->pcm_ops->enable_in) {
+ hw->pcm_ops->enable_in(hw, true);
+ }
audio_reset_timer (s);
}
}
@@ -952,7 +956,9 @@ void AUD_set_active_in (SWVoiceIn *sw, int on)
if (nb_active == 1) {
hw->enabled = 0;
- hw->pcm_ops->ctl_in (hw, VOICE_DISABLE);
+ if (hw->pcm_ops->enable_in) {
+ hw->pcm_ops->enable_in(hw, false);
+ }
}
}
}
@@ -1105,7 +1111,9 @@ static void audio_run_out (AudioState *s)
#endif
hw->enabled = 0;
hw->pending_disable = 0;
- hw->pcm_ops->ctl_out (hw, VOICE_DISABLE);
+ if (hw->pcm_ops->enable_out) {
+ hw->pcm_ops->enable_out(hw, false);
+ }
for (sc = hw->cap_head.lh_first; sc; sc = sc->entries.le_next) {
sc->sw.active = 0;
audio_recalc_and_notify_capture (sc->cap);
@@ -1470,15 +1478,18 @@ static void audio_vm_change_state_handler (void *opaque, int running,
AudioState *s = opaque;
HWVoiceOut *hwo = NULL;
HWVoiceIn *hwi = NULL;
- int op = running ? VOICE_ENABLE : VOICE_DISABLE;
s->vm_running = running;
while ((hwo = audio_pcm_hw_find_any_enabled_out(s, hwo))) {
- hwo->pcm_ops->ctl_out(hwo, op);
+ if (hwo->pcm_ops->enable_out) {
+ hwo->pcm_ops->enable_out(hwo, running);
+ }
}
while ((hwi = audio_pcm_hw_find_any_enabled_in(s, hwi))) {
- hwi->pcm_ops->ctl_in(hwi, op);
+ if (hwi->pcm_ops->enable_in) {
+ hwi->pcm_ops->enable_in(hwi, running);
+ }
}
audio_reset_timer (s);
}
@@ -1498,8 +1509,8 @@ static void free_audio_state(AudioState *s)
QLIST_FOREACH_SAFE(hwo, &s->hw_head_out, entries, hwon) {
SWVoiceCap *sc;
- if (hwo->enabled) {
- hwo->pcm_ops->ctl_out (hwo, VOICE_DISABLE);
+ if (hwo->enabled && hwo->pcm_ops->enable_out) {
+ hwo->pcm_ops->enable_out(hwo, false);
}
hwo->pcm_ops->fini_out (hwo);
@@ -1515,8 +1526,8 @@ static void free_audio_state(AudioState *s)
}
QLIST_FOREACH_SAFE(hwi, &s->hw_head_in, entries, hwin) {
- if (hwi->enabled) {
- hwi->pcm_ops->ctl_in (hwi, VOICE_DISABLE);
+ if (hwi->enabled && hwi->pcm_ops->enable_in) {
+ hwi->pcm_ops->enable_in(hwi, false);
}
hwi->pcm_ops->fini_in (hwi);
QLIST_REMOVE(hwi, entries);
@@ -1838,8 +1849,8 @@ void AUD_set_volume_out (SWVoiceOut *sw, int mute, uint8_t lvol, uint8_t rvol)
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);
+ if (hw->pcm_ops->volume_out) {
+ hw->pcm_ops->volume_out(hw, &sw->vol);
}
}
}
@@ -1853,8 +1864,8 @@ void AUD_set_volume_in (SWVoiceIn *sw, int mute, uint8_t lvol, uint8_t rvol)
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);
+ if (hw->pcm_ops->volume_in) {
+ hw->pcm_ops->volume_in(hw, &sw->vol);
}
}
}