add initial-program-change support

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3892 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2008-10-08 21:20:00 +00:00
parent bb07f59737
commit ac84a7f794
2 changed files with 12 additions and 0 deletions

View file

@ -38,6 +38,7 @@ CONFIG_VARIABLE (bool, mmc_control, "mmc-control", true)
CONFIG_VARIABLE (bool, midi_feedback, "midi-feedback", false)
CONFIG_VARIABLE (uint8_t, mmc_receive_device_id, "mmc-receive-device-id", 0)
CONFIG_VARIABLE (uint8_t, mmc_send_device_id, "mmc-send-device-id", 0x7f)
CONFIG_VARIABLE (int32_t, initial_program_change, "initial-program-change", -1)
/* control surfaces */

View file

@ -341,6 +341,8 @@ Session::second_stage_init (bool new_session)
deliver_mmc (MIDI::MachineControl::cmdMmcReset, 0);
deliver_mmc (MIDI::MachineControl::cmdLocate, 0);
/* initial program change will be delivered later; see ::config_changed() */
BootMessage (_("Reset Control Protocols"));
ControlProtocolManager::instance().set_session (*this);
@ -3345,6 +3347,15 @@ Session::config_changed (const char* parameter_name)
set_history_depth (Config->get_history_depth());
} else if (PARAM_IS ("sync-all-route-ordering")) {
sync_order_keys ("session");
} else if (PARAM_IS ("initial-program-change")) {
if (_mmc_port && Config->get_initial_program_change() >= 0) {
MIDI::byte* buf = new MIDI::byte[2];
buf[0] = MIDI::program; // channel zero by default
buf[1] = (Config->get_initial_program_change() & 0x7f);
deliver_midi (_mmc_port, buf, 2);
}
}
set_dirty ();