summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/MidiBuffer.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-09-22 23:51:00 +0000
committerDavid Robillard <d@drobilla.net>2007-09-22 23:51:00 +0000
commitc1160ffc8a5dfb38891b0faa6373c9eecdd8e4c9 (patch)
tree1baf40b7a90bc96c4b0832103ff0cdabdf1ed1a6 /src/libs/engine/MidiBuffer.cpp
parent4bd53e016b8bb912e48d77e756720516d876d5c2 (diff)
downloadingen-c1160ffc8a5dfb38891b0faa6373c9eecdd8e4c9.tar.gz
ingen-c1160ffc8a5dfb38891b0faa6373c9eecdd8e4c9.tar.bz2
ingen-c1160ffc8a5dfb38891b0faa6373c9eecdd8e4c9.zip
Type oblivious set_port_value interface.
git-svn-id: http://svn.drobilla.net/lad/ingen@765 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/MidiBuffer.cpp')
-rw-r--r--src/libs/engine/MidiBuffer.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libs/engine/MidiBuffer.cpp b/src/libs/engine/MidiBuffer.cpp
index 5a8dbc4e..0e10a44e 100644
--- a/src/libs/engine/MidiBuffer.cpp
+++ b/src/libs/engine/MidiBuffer.cpp
@@ -30,6 +30,7 @@ namespace Ingen {
*/
MidiBuffer::MidiBuffer(size_t capacity)
: Buffer(DataType(DataType::MIDI), capacity)
+ , _latest_stamp(0)
, _joined_buf(NULL)
{
if (capacity > UINT32_MAX) {
@@ -167,7 +168,7 @@ MidiBuffer::increment() const
/** Append a MIDI event to the buffer.
*
- * \a timestamp must be > the latest event in the buffer,
+ * \a timestamp must be >= the latest event in the buffer,
* and < this_nframes()
*
* \return true on success
@@ -182,6 +183,7 @@ MidiBuffer::append(double timestamp,
assert(size > 0);
assert(data[0] >= 0x80);
+ assert(timestamp >= _latest_stamp);
*(double*)(_buf->data + _buf->size) = timestamp;
_buf->size += sizeof(double);
@@ -191,6 +193,7 @@ MidiBuffer::append(double timestamp,
_buf->size += size;
++_buf->event_count;
+ _latest_stamp = timestamp;
return true;
}