mixer_control: don't touch mixers of disabled outputs
When an audio output device is disabled, also disable its mixer.
This commit is contained in:
parent
c37567a14f
commit
0bc7f584f4
@ -33,6 +33,9 @@ mixer_control_setvol(unsigned int device, int volume, int rel)
|
|||||||
assert(device < audio_output_count());
|
assert(device < audio_output_count());
|
||||||
|
|
||||||
output = audio_output_get(device);
|
output = audio_output_get(device);
|
||||||
|
if (!output->enabled)
|
||||||
|
return false;
|
||||||
|
|
||||||
mixer = ao_plugin_get_mixer(output->plugin, output->data);
|
mixer = ao_plugin_get_mixer(output->plugin, output->data);
|
||||||
if (mixer != NULL) {
|
if (mixer != NULL) {
|
||||||
if (rel) {
|
if (rel) {
|
||||||
@ -61,6 +64,9 @@ mixer_control_getvol(unsigned int device, int *volume)
|
|||||||
assert(device < audio_output_count());
|
assert(device < audio_output_count());
|
||||||
|
|
||||||
output = audio_output_get(device);
|
output = audio_output_get(device);
|
||||||
|
if (!output->enabled)
|
||||||
|
return false;
|
||||||
|
|
||||||
mixer = ao_plugin_get_mixer(output->plugin, output->data);
|
mixer = ao_plugin_get_mixer(output->plugin, output->data);
|
||||||
if (mixer != NULL) {
|
if (mixer != NULL) {
|
||||||
int volume2;
|
int volume2;
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include "output_command.h"
|
#include "output_command.h"
|
||||||
#include "output_all.h"
|
#include "output_all.h"
|
||||||
#include "output_internal.h"
|
#include "output_internal.h"
|
||||||
|
#include "output_plugin.h"
|
||||||
|
#include "mixer_api.h"
|
||||||
#include "idle.h"
|
#include "idle.h"
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -48,6 +50,7 @@ bool
|
|||||||
audio_output_disable_index(unsigned idx)
|
audio_output_disable_index(unsigned idx)
|
||||||
{
|
{
|
||||||
struct audio_output *ao;
|
struct audio_output *ao;
|
||||||
|
struct mixer *mixer;
|
||||||
|
|
||||||
if (idx >= audio_output_count())
|
if (idx >= audio_output_count())
|
||||||
return false;
|
return false;
|
||||||
@ -57,5 +60,11 @@ audio_output_disable_index(unsigned idx)
|
|||||||
ao->enabled = false;
|
ao->enabled = false;
|
||||||
idle_add(IDLE_OUTPUT);
|
idle_add(IDLE_OUTPUT);
|
||||||
|
|
||||||
|
mixer = ao_plugin_get_mixer(ao->plugin, ao->data);
|
||||||
|
if (mixer != NULL) {
|
||||||
|
mixer_close(mixer);
|
||||||
|
idle_add(IDLE_MIXER);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user