Move patch changes when inserting silence at the start of a model.
authorCarl Hetherington <carl@carlh.net>
Tue, 27 Dec 2011 00:22:21 +0000 (00:22 +0000)
committerCarl Hetherington <carl@carlh.net>
Tue, 27 Dec 2011 00:22:21 +0000 (00:22 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@11084 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/midi_model.cc

index e6ff05c7b7236acce461c9ef9fd4daa2a0b7f862..40d2f600c881f0b0a34824e28c753fbe852432f4 100644 (file)
@@ -1868,7 +1868,7 @@ MidiModel::midi_source ()
        return _midi_source.lock ();
 }
 
-/** Moves notes, controllers and sys-ex to insert silence at the start of the model.
+/** Moves notes, patch changes, controllers and sys-ex to insert silence at the start of the model.
  *  Adds commands to the session's current undo stack to reflect the movements.
  */
 void
@@ -1889,6 +1889,18 @@ MidiModel::insert_silence_at_start (TimeType t)
                apply_command_as_subcommand (s->session(), c);
        }
 
+       /* Patch changes */
+
+       if (!patch_changes().empty ()) {
+               PatchChangeDiffCommand* c = new_patch_change_diff_command ("insert silence");
+
+               for (PatchChanges::const_iterator i = patch_changes().begin(); i != patch_changes().end(); ++i) {
+                       c->change_time (*i, (*i)->time() + t);
+               }
+
+               apply_command_as_subcommand (s->session(), c);
+       }
+
        /* Controllers */
 
        for (Controls::iterator i = controls().begin(); i != controls().end(); ++i) {