+ /* Currently this class only supports changes of sys-ex time, but could be expanded */
+ class LIBARDOUR_API SysExDiffCommand : public DiffCommand {
+ public:
+ SysExDiffCommand (boost::shared_ptr<MidiModel> m, const XMLNode& node);
+
+ enum Property {
+ Time,
+ };
+
+ int set_state (const XMLNode&, int version);
+ XMLNode & get_state ();
+
+ void remove (SysExPtr sysex);
+ void operator() ();
+ void undo ();
+
+ void change (boost::shared_ptr<Evoral::Event<TimeType> >, TimeType);
+
+ private:
+ struct Change {
+ Change () : sysex_id (0) {}
+ boost::shared_ptr<Evoral::Event<TimeType> > sysex;
+ gint sysex_id;
+ SysExDiffCommand::Property property;
+ TimeType old_time;
+ TimeType new_time;
+ };
+
+ typedef std::list<Change> ChangeList;
+ ChangeList _changes;
+
+ std::list<SysExPtr> _removed;
+
+ XMLNode & marshal_change (const Change &);
+ Change unmarshal_change (XMLNode *);
+ };
+
+ class LIBARDOUR_API 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;
+ gint patch_id;
+ TimeType old_time;
+ union {
+ uint8_t old_channel;
+ int old_bank;
+ uint8_t old_program;
+ };
+ TimeType new_time;
+ union {
+ uint8_t new_channel;
+ uint8_t new_program;
+ int new_bank;
+ };
+
+ Change() : patch_id (-1) {}
+ };
+
+ 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 (Session* session, Command* cmd) { if (session) { apply_command (*session, cmd); } }
+ void apply_command_as_subcommand (Session& session, Command* cmd);
+
+ bool sync_to_source (const Glib::Threads::Mutex::Lock& source_lock);
+
+ bool write_to(boost::shared_ptr<MidiSource> source,
+ const Glib::Threads::Mutex::Lock& source_lock);