summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/midi_model.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-08-16 01:25:58 +0000
committerDavid Robillard <d@drobilla.net>2007-08-16 01:25:58 +0000
commitf9a7388d7aa62c6b8ab0bc8c62bf53ae1652e8e1 (patch)
treeb3737567d21c42688ff3129f28be144898cb28a6 /libs/ardour/ardour/midi_model.h
parent356f9ba80aabb8705ce24ad78b2b409d084a718e (diff)
Make SMFSource suck significantly less.
Read from MidiRingbuffer directly into model, don't read MidiRingBuffer into a new midi buffer, then into the model. Pass rec data to UI via model instead of a separate buffer. Read MIDI CC data into MidiModel (though not actually used yet). Made quantization toggle edited flag so model is saved. git-svn-id: svn://localhost/ardour2/trunk@2308 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour/midi_model.h')
-rw-r--r--libs/ardour/ardour/midi_model.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/libs/ardour/ardour/midi_model.h b/libs/ardour/ardour/midi_model.h
index 63b87c9683..f688c0fe09 100644
--- a/libs/ardour/ardour/midi_model.h
+++ b/libs/ardour/ardour/midi_model.h
@@ -28,6 +28,7 @@
#include <ardour/types.h>
#include <ardour/midi_buffer.h>
#include <ardour/midi_ring_buffer.h>
+#include <ardour/automatable.h>
namespace ARDOUR {
@@ -41,7 +42,7 @@ class MidiSource;
* note on and off events (controller data is not here since it's represented
* as an AutomationList)
*/
-class MidiModel : public boost::noncopyable {
+class MidiModel : public boost::noncopyable, public Automatable {
public:
struct Note {
Note(double time=0, double dur=0, uint8_t note=0, uint8_t vel=0x40);
@@ -92,11 +93,13 @@ public:
void append(const MidiBuffer& data);
/** Resizes vector if necessary (NOT realtime safe) */
- void append(double time, size_t size, const Byte* in_buffer);
+ //void append(double time, size_t size, const Byte* in_buffer);
+ void append(const MidiEvent& ev);
inline const Note& note_at(unsigned i) const { 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<Note> Notes;
@@ -146,7 +149,12 @@ public:
void apply_command(Command* cmd);
bool edited() const { return _edited; }
+ void set_edited(bool yn) { _edited = yn; }
bool write_to(boost::shared_ptr<MidiSource> source);
+
+ // MidiModel doesn't use the normal AutomationList serialisation code, as CC data is in the .mid
+ XMLNode& get_state();
+ int set_state(const XMLNode&) { return 0; }
sigc::signal<void> ContentsChanged;
@@ -155,12 +163,13 @@ private:
void add_note_unlocked(const Note& note);
void remove_note_unlocked(const Note& note);
+#ifndef NDEBUG
bool is_sorted() const;
+#endif
void append_note_on(double time, uint8_t note, uint8_t velocity);
void append_note_off(double time, uint8_t note);
-
- Session& _session;
+ void append_cc(double time, uint8_t number, uint8_t value);
Glib::RWLock _lock;