13
0

add Session::reconnect_midi_scene_ports()

This commit is contained in:
Paul Davis 2015-05-08 15:03:06 -04:00
parent 2f95da983b
commit 511f609a14
2 changed files with 36 additions and 0 deletions

View File

@ -980,6 +980,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
MIDI::MachineControl& mmc() { return *_mmc; }
void reconnect_midi_scene_ports (bool);
protected:
friend class AudioEngine;
void set_block_size (pframes_t nframes);

View File

@ -2375,6 +2375,40 @@ Session::reconnect_existing_routes (bool withLock, bool reconnect_master, bool r
*/
}
void
Session::reconnect_midi_scene_ports(bool inputs)
{
if (inputs) {
scene_in()->disconnect_all ();
std::vector<EngineStateController::MidiPortState> midi_port_states;
EngineStateController::instance()->get_physical_midi_input_states (midi_port_states);
std::vector<EngineStateController::MidiPortState>::iterator state_iter = midi_port_states.begin();
for (; state_iter != midi_port_states.end(); ++state_iter) {
if (state_iter->active && state_iter->available && state_iter->connected) {
scene_in()->connect (state_iter->name);
}
}
} else {
scene_out()->disconnect_all ();
std::vector<EngineStateController::MidiPortState> midi_port_states;
EngineStateController::instance()->get_physical_midi_output_states (midi_port_states);
std::vector<EngineStateController::MidiPortState>::iterator state_iter = midi_port_states.begin();
for (; state_iter != midi_port_states.end(); ++state_iter) {
if (state_iter->active && state_iter->available && state_iter->connected) {
scene_out()->connect (state_iter->name);
}
}
}
}
/** Caller must not hold process lock
* @param name_template string to use for the start of the name, or "" to use "Audio".