From d771ca6b0e67d54d96378b69480e7dd291a73dc3 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 27 Dec 2011 00:22:21 +0000 Subject: [PATCH] Move patch changes when inserting silence at the start of a model. git-svn-id: svn://localhost/ardour2/branches/3.0@11084 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/midi_model.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc index e6ff05c7b7..40d2f600c8 100644 --- a/libs/ardour/midi_model.cc +++ b/libs/ardour/midi_model.cc @@ -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) { -- 2.30.2