summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/midi_ring_buffer.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_ring_buffer.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_ring_buffer.h')
-rw-r--r--libs/ardour/ardour/midi_ring_buffer.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/libs/ardour/ardour/midi_ring_buffer.h b/libs/ardour/ardour/midi_ring_buffer.h
index 21beebacd2..9389f962fc 100644
--- a/libs/ardour/ardour/midi_ring_buffer.h
+++ b/libs/ardour/ardour/midi_ring_buffer.h
@@ -233,6 +233,9 @@ public:
size_t write(double time, size_t size, const Byte* buf);
bool read(double* time, size_t* size, Byte* buf);
+ bool read_prefix(double* time, size_t* size);
+ bool read_contents(size_t size, Byte* buf);
+
size_t read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes_t offset=0);
};
@@ -250,6 +253,30 @@ MidiRingBuffer::read(double* time, size_t* size, Byte* buf)
}
+/** Read the time and size of an event. This call MUST be immediately proceeded
+ * by a call to read_contents (or the read pointer will be garabage).
+ */
+inline bool
+MidiRingBuffer::read_prefix(double* time, size_t* size)
+{
+ bool success = MidiRingBufferBase<Byte>::full_read(sizeof(double), (Byte*)time);
+ if (success)
+ success = MidiRingBufferBase<Byte>::full_read(sizeof(size_t), (Byte*)size);
+
+ return success;
+}
+
+
+/** Read the contenst of an event. This call MUST be immediately preceeded
+ * by a call to read_prefix (or the returned even will be garabage).
+ */
+inline bool
+MidiRingBuffer::read_contents(size_t size, Byte* buf)
+{
+ return MidiRingBufferBase<Byte>::full_read(size, buf);
+}
+
+
inline size_t
MidiRingBuffer::write(double time, size_t size, const Byte* buf)
{