diff options
author | Carl Hetherington <carl@carlh.net> | 2010-12-28 18:19:40 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-12-28 18:19:40 +0000 |
commit | f8ebb4582d4d881fbda75a6bc9cd9c50f5c921f3 (patch) | |
tree | 90608a3cb424866b2a164c354d1665a7b0a9d79a /libs/ardour/ardour/midi_model.h | |
parent | 390f18c1152f2007b790a77c873b50ef48209f44 (diff) |
Unify program change and bank handling so that they are manipulated together.
git-svn-id: svn://localhost/ardour2/branches/3.0@8346 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour/midi_model.h')
-rw-r--r-- | libs/ardour/ardour/midi_model.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/libs/ardour/ardour/midi_model.h b/libs/ardour/ardour/midi_model.h index 83fe00567a..23e4b9de56 100644 --- a/libs/ardour/ardour/midi_model.h +++ b/libs/ardour/ardour/midi_model.h @@ -172,8 +172,66 @@ public: Change unmarshal_change (XMLNode *); }; + class PatchChangeDiffCommand : public DiffCommand { + public: + PatchChangeDiffCommand (boost::shared_ptr<MidiModel>, const std::string &); + PatchChangeDiffCommand (boost::shared_ptr<MidiModel>, const XMLNode &); + + int set_state (const XMLNode &, int version); + XMLNode & get_state (); + + void operator() (); + void undo (); + + void add (PatchChangePtr); + void remove (PatchChangePtr); + void change_time (PatchChangePtr, TimeType); + void change_channel (PatchChangePtr, uint8_t); + void change_program (PatchChangePtr, uint8_t); + void change_bank (PatchChangePtr, int); + + enum Property { + Time, + Channel, + Program, + Bank + }; + + private: + + struct Change { + PatchChangePtr patch; + Property property; + union { + TimeType old_time; + uint8_t old_channel; + int old_bank; + uint8_t old_program; + }; + union { + uint8_t new_channel; + TimeType new_time; + uint8_t new_program; + int new_bank; + }; + }; + + typedef std::list<Change> ChangeList; + ChangeList _changes; + + std::list<PatchChangePtr> _added; + std::list<PatchChangePtr> _removed; + + XMLNode & marshal_change (const Change &); + Change unmarshal_change (XMLNode *); + + XMLNode & marshal_patch_change (constPatchChangePtr); + PatchChangePtr unmarshal_patch_change (XMLNode *); + }; + MidiModel::NoteDiffCommand* new_note_diff_command (const std::string name = "midi edit"); MidiModel::SysExDiffCommand* new_sysex_diff_command (const std::string name = "midi edit"); + MidiModel::PatchChangeDiffCommand* new_patch_change_diff_command (const std::string name = "midi edit"); void apply_command (Session& session, Command* cmd); void apply_command_as_subcommand (Session& session, Command* cmd); @@ -193,6 +251,7 @@ public: void set_midi_source (boost::shared_ptr<MidiSource>); boost::shared_ptr<Evoral::Note<TimeType> > find_note (NotePtr); + PatchChangePtr find_patch_change (Evoral::event_id_t); boost::shared_ptr<Evoral::Note<TimeType> > find_note (gint note_id); boost::shared_ptr<Evoral::Event<TimeType> > find_sysex (gint); |