- MidiModel(MidiSource *s, size_t size=0);
-
- void write_lock();
- void write_unlock();
- void read_lock() const;
- void read_unlock() const;
-
- void clear() { _notes.clear(); }
-
- NoteMode note_mode() const { return _note_mode; }
- void set_note_mode(NoteMode mode) { _note_mode = mode; }
-
- void start_write();
- bool writing() const { return _writing; }
- void end_write(bool delete_stuck=false);
-
- size_t read (MidiRingBuffer& dst, nframes_t start, nframes_t nframes, nframes_t stamp_offset, nframes_t negative_stamp_offset) const;
-
- /** Resizes vector if necessary (NOT realtime safe) */
- void append(const MIDI::Event& ev);
-
- inline const boost::shared_ptr<const Note> note_at(unsigned i) const { return _notes[i]; }
- inline const boost::shared_ptr<Note> note_at(unsigned i) { return _notes[i]; }
-
- inline size_t n_notes() const { return _notes.size(); }
- inline bool empty() const { return _notes.size() == 0 && _controls.size() == 0; }
-
- typedef std::vector< boost::shared_ptr<Note> > Notes;
-
- inline static bool note_time_comparator (const boost::shared_ptr<const Note> a,
- const boost::shared_ptr<const Note> b) {
- return a->time() < b->time();
- }
-
- struct LaterNoteEndComparator {
- typedef const Note* value_type;
- inline bool operator()(const boost::shared_ptr<const Note> a,
- const boost::shared_ptr<const Note> b) const {
- return a->end_time() > b->end_time();
- }
+ typedef Evoral::MusicalTime TimeType;
+
+ MidiModel (boost::shared_ptr<MidiSource>);
+
+ NoteMode note_mode() const { return (percussive() ? Percussive : Sustained); }
+ void set_note_mode(NoteMode mode) { set_percussive(mode == Percussive); };
+
+ class DiffCommand : public Command {
+ public:
+
+ DiffCommand (boost::shared_ptr<MidiModel> m, const std::string& name);
+
+ const std::string& name () const { return _name; }
+
+ virtual void operator() () = 0;
+ virtual void undo () = 0;
+
+ virtual int set_state (const XMLNode&, int version) = 0;
+ virtual XMLNode & get_state () = 0;
+
+ boost::shared_ptr<MidiModel> model() const { return _model; }
+
+ protected:
+ boost::shared_ptr<MidiModel> _model;
+ const std::string _name;
+