From 41f2b26d11e81095a0d8d370480e0d2459208070 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 7 Mar 2014 15:24:32 +0100 Subject: audio/out: make ao struct opaque We want to move the AO to its own thread. There's no technical reason for making the ao struct opaque to do this. But it helps us sleep at night, because we can control access to shared state better. --- audio/mixer.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'audio/mixer.c') diff --git a/audio/mixer.c b/audio/mixer.c index a9759976a2..34a1722c80 100644 --- a/audio/mixer.c +++ b/audio/mixer.c @@ -210,7 +210,7 @@ void mixer_setbalance(struct mixer *mixer, float val) if (af_control_any_rev(mixer->af, AF_CONTROL_SET_PAN_BALANCE, &val)) return; - if (val == 0 || mixer->ao->channels.num < 2) + if (val == 0) return; if (!(af_pan_balance = af_add(mixer->af, "pan", NULL))) { @@ -243,8 +243,9 @@ static void probe_softvol(struct mixer *mixer) { if (mixer->opts->softvol == SOFTVOL_AUTO) { // No system-wide volume => fine with AO volume control. - mixer->softvol = !(mixer->ao->per_application_mixer || - mixer->ao->no_persistent_volume); + mixer->softvol = + ao_control(mixer->ao, AOCONTROL_HAS_TEMP_VOLUME, 0) != 1 && + ao_control(mixer->ao, AOCONTROL_HAS_PER_APP_VOLUME, 0) != 1; } else { mixer->softvol = mixer->opts->softvol == SOFTVOL_YES; } @@ -275,9 +276,10 @@ static void restore_volume(struct mixer *mixer) int force_mute = -1; const char *prev_driver = mixer->driver; - mixer->driver = mixer->softvol ? "softvol" : ao->driver->name; + mixer->driver = mixer->softvol ? "softvol" : ao_get_name(ao); - bool restore = mixer->softvol || ao->no_persistent_volume; + bool restore + = mixer->softvol || ao_control(ao, AOCONTROL_HAS_TEMP_VOLUME, 0) == 1; // Restore old parameters if volume won't survive reinitialization. // But not if volume scale is possibly different. -- cgit v1.2.3