summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_scene_changer.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-11-10 21:28:21 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2014-11-10 23:17:19 -0500
commite27651d31521a527a2acaf570512a44163b5c638 (patch)
tree0c5b520c19e96659f095a878295cb149b92f09eb /libs/ardour/midi_scene_changer.cc
parent0f243d5f7c1201377460d1b46aed4f10e68ef0cf (diff)
when creating a new MIDI scene change, check existing scene changes for equality and reuse their color (which may or may not be set)
Diffstat (limited to 'libs/ardour/midi_scene_changer.cc')
-rw-r--r--libs/ardour/midi_scene_changer.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/libs/ardour/midi_scene_changer.cc b/libs/ardour/midi_scene_changer.cc
index 75a1a98cb7..e799b5a2ce 100644
--- a/libs/ardour/midi_scene_changer.cc
+++ b/libs/ardour/midi_scene_changer.cc
@@ -310,6 +310,19 @@ MIDISceneChanger::program_change_input (MIDI::Parser& parser, MIDI::byte program
MIDISceneChange* msc =new MIDISceneChange (channel, bank, program & 0x7f);
+ /* check for identical scene change so we can re-use color, if any */
+
+ Locations::LocationList copy (locations->list());
+
+ for (Locations::LocationList::const_iterator l = copy.begin(); l != copy.end(); ++l) {
+ boost::shared_ptr<MIDISceneChange> m = boost::dynamic_pointer_cast<MIDISceneChange>((*l)->scene_change());
+
+ if (m && (*m.get()) == *msc) {
+ msc->set_color (m->color ());
+ break;
+ }
+ }
+
loc->set_scene_change (boost::shared_ptr<MIDISceneChange> (msc));
/* this will generate a "changed" signal to be emitted by locations,