summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-10-08 21:20:00 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-10-08 21:20:00 +0000
commitac84a7f794e904807da352098ccf19e16f83ede9 (patch)
treec0af5ed3d78513620448f8e69eddf11b1d6bf1a2 /libs/ardour
parentbb07f59737c2b9c83a2cf4e103e65569182b07d8 (diff)
add initial-program-change support
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3892 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/configuration_vars.h1
-rw-r--r--libs/ardour/session_state.cc11
2 files changed, 12 insertions, 0 deletions
diff --git a/libs/ardour/ardour/configuration_vars.h b/libs/ardour/ardour/configuration_vars.h
index 1d610b123a..1e7ab5eab4 100644
--- a/libs/ardour/ardour/configuration_vars.h
+++ b/libs/ardour/ardour/configuration_vars.h
@@ -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 */
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index a6d8af079b..f14eaaefcb 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -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 ();