diff options
author | Max Kellermann <max@duempel.org> | 2014-01-27 08:20:25 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-28 09:20:53 +0100 |
commit | f5a923b9d16e4c63942a033d1bdb2ab150aae342 (patch) | |
tree | 6e3c39b305fd2a1da2a7b9c2b79a6737ca21a23b /src/output/OutputCommand.cxx | |
parent | 36bab6ef066c6898a791dd15054301f80757b3f6 (diff) | |
download | mpd-f5a923b9d16e4c63942a033d1bdb2ab150aae342.tar.gz mpd-f5a923b9d16e4c63942a033d1bdb2ab150aae342.tar.xz mpd-f5a923b9d16e4c63942a033d1bdb2ab150aae342.zip |
OutputAll: convert to class, move instance to class Partition
Another big chunk of code for multi-player support.
Diffstat (limited to '')
-rw-r--r-- | src/output/OutputCommand.cxx | 46 |
1 files changed, 20 insertions, 26 deletions
diff --git a/src/output/OutputCommand.cxx b/src/output/OutputCommand.cxx index d82b7c696..d4c1d844d 100644 --- a/src/output/OutputCommand.cxx +++ b/src/output/OutputCommand.cxx @@ -26,7 +26,7 @@ #include "config.h" #include "OutputCommand.hxx" -#include "OutputAll.hxx" +#include "MultipleOutputs.hxx" #include "OutputInternal.hxx" #include "PlayerControl.hxx" #include "mixer/MixerControl.hxx" @@ -35,21 +35,19 @@ extern unsigned audio_output_state_version; bool -audio_output_enable_index(unsigned idx) +audio_output_enable_index(MultipleOutputs &outputs, unsigned idx) { - struct audio_output *ao; - - if (idx >= audio_output_count()) + if (idx >= outputs.Size()) return false; - ao = audio_output_get(idx); - if (ao->enabled) + audio_output &ao = outputs.Get(idx); + if (ao.enabled) return true; - ao->enabled = true; + ao.enabled = true; idle_add(IDLE_OUTPUT); - ao->player_control->UpdateAudio(); + ao.player_control->UpdateAudio(); ++audio_output_state_version; @@ -57,27 +55,25 @@ audio_output_enable_index(unsigned idx) } bool -audio_output_disable_index(unsigned idx) +audio_output_disable_index(MultipleOutputs &outputs, unsigned idx) { - struct audio_output *ao; - - if (idx >= audio_output_count()) + if (idx >= outputs.Size()) return false; - ao = audio_output_get(idx); - if (!ao->enabled) + audio_output &ao = outputs.Get(idx); + if (!ao.enabled) return true; - ao->enabled = false; + ao.enabled = false; idle_add(IDLE_OUTPUT); - Mixer *mixer = ao->mixer; + Mixer *mixer = ao.mixer; if (mixer != nullptr) { mixer_close(mixer); idle_add(IDLE_MIXER); } - ao->player_control->UpdateAudio(); + ao.player_control->UpdateAudio(); ++audio_output_state_version; @@ -85,26 +81,24 @@ audio_output_disable_index(unsigned idx) } bool -audio_output_toggle_index(unsigned idx) +audio_output_toggle_index(MultipleOutputs &outputs, unsigned idx) { - struct audio_output *ao; - - if (idx >= audio_output_count()) + if (idx >= outputs.Size()) return false; - ao = audio_output_get(idx); - const bool enabled = ao->enabled = !ao->enabled; + audio_output &ao = outputs.Get(idx); + const bool enabled = ao.enabled = !ao.enabled; idle_add(IDLE_OUTPUT); if (!enabled) { - Mixer *mixer = ao->mixer; + Mixer *mixer = ao.mixer; if (mixer != nullptr) { mixer_close(mixer); idle_add(IDLE_MIXER); } } - ao->player_control->UpdateAudio(); + ao.player_control->UpdateAudio(); ++audio_output_state_version; |