[Summary] Added EngineStateController methods to apply the state to all inputs/outputs and hooked up them to the keys to enable/disable all inputs/outputs

[git-p4: depot-paths = "//Abdaw/dev_main/tracks/": change = 463558]
This commit is contained in:
Grygorii Zharun 2014-05-26 09:36:51 -05:00
parent 85fbe5d9fb
commit 96eb98559c
3 changed files with 60 additions and 7 deletions

View file

@ -487,25 +487,25 @@ void TracksControlPanel::device_changed (bool show_confirm_dial/*=true*/)
void
TracksControlPanel::on_all_inputs_on_button(WavesButton*)
{
EngineStateController::instance()->set_state_to_all_inputs(true);
}
void
TracksControlPanel::on_all_inputs_off_button(WavesButton*)
{
EngineStateController::instance()->set_state_to_all_inputs(false);
}
void
TracksControlPanel::on_all_outputs_on_button(WavesButton*)
{
EngineStateController::instance()->set_state_to_all_outputs(true);
}
void
TracksControlPanel::on_all_outputs_off_button(WavesButton*)
{
EngineStateController::instance()->set_state_to_all_outputs(false);
}
void

View file

@ -66,20 +66,28 @@ public:
ARDOUR::pframes_t get_default_buffer_size() const;
void available_buffer_sizes_for_current_device(std::vector<ARDOUR::pframes_t>&) const;
// get the number of all enabled inputs/outputs
uint32_t get_available_inputs_count() const;
uint32_t get_available_outputs_count () const;
// get all enabled physical inputs/outputs names
void get_physical_audio_inputs (std::vector<std::string>&);
void get_physical_audio_outputs (std::vector<std::string>&);
// propagate new state to all inputs/outputs
void set_state_to_all_inputs(bool);
void set_state_to_all_outputs(bool); // does nothing in Stereo Out mode
// get states of all inputs/outputs
void get_physical_audio_input_states(std::vector<ChannelState>&);
void get_physical_audio_output_states(std::vector<ChannelState>&);
// set/get the state for input or output
void set_physical_audio_input_state(const std::string&, bool);
void set_physical_audio_output_state(const std::string&, bool);
bool get_physical_audio_input_state(const std::string&);
bool get_physical_audio_output_state(const std::string&);
void get_physical_audio_input_states(std::vector<ChannelState>&);
void get_physical_audio_output_states(std::vector<ChannelState>&);
bool is_setup_required() const {return ARDOUR::AudioEngine::instance()->setup_required (); }
// set parameters inside the controller,

View file

@ -590,6 +590,51 @@ EngineStateController::get_physical_audio_output_state(const std::string& port_n
}
void
EngineStateController::set_state_to_all_inputs(bool state)
{
bool something_changed = false;
ChannelStateList::iterator iter = _current_state->input_channel_states.begin();
for (; iter != _current_state->input_channel_states.end(); ++iter) {
if (iter->active != state) {
iter->active = state;
something_changed = true;
}
}
if (something_changed) {
AudioEngine::instance()->reconnect_session_routes();
InputConfigChanged();
}
}
void
EngineStateController::set_state_to_all_outputs(bool state)
{
// unapplicable in Stereo Out mode, just return
if (Config->get_output_auto_connect() & AutoConnectMaster) {
return;
}
bool something_changed = false;
ChannelStateList::iterator iter = _current_state->output_channel_states.begin();
for (; iter != _current_state->output_channel_states.end(); ++iter) {
if (iter->active != state) {
iter->active = state;
something_changed = true;
}
}
if (something_changed) {
AudioEngine::instance()->reconnect_session_routes();
OutputConfigChanged();
}
}
void
EngineStateController::get_physical_audio_input_states(std::vector<ChannelState>& channel_states)
{