summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_model.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-06-09 02:07:59 +0000
committerDavid Robillard <d@drobilla.net>2007-06-09 02:07:59 +0000
commit7ff7f4013dfbbf18d08e397230ad2486fa7ff58f (patch)
tree4740e59efb0749e522c0ae55464e2a5140ebeaa7 /libs/ardour/midi_model.cc
parent0605f98fdce1ad456e3da6f6ae391ad394b3edfb (diff)
Use double MIDI timestamps (towards tempo based time, and more-than-sample-accurate LV2 MIDI plugin application).
Eliminate double iteration over MIDIRingBuffer read to translate timestamps. git-svn-id: svn://localhost/ardour2/trunk@1981 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_model.cc')
-rw-r--r--libs/ardour/midi_model.cc20
1 files changed, 8 insertions, 12 deletions
diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc
index f12d91ba8a..dc58afa8ea 100644
--- a/libs/ardour/midi_model.cc
+++ b/libs/ardour/midi_model.cc
@@ -38,7 +38,7 @@ MidiModel::~MidiModel()
}
-/** Append contents of \a buf to model. NOT (even remotely) realtime safe.
+/** Append contents of \a buf to model. NOT realtime safe.
*
* Timestamps of events in \a buf are expected to be relative to
* the start of this model (t=0) and MUST be monotonically increasing
@@ -64,25 +64,21 @@ MidiModel::append(const MidiBuffer& buf)
}
-/** Append \a in_event to model. NOT (even remotely) realtime safe.
+/** Append \a in_event to model. NOT realtime safe.
*
* Timestamps of events in \a buf are expected to be relative to
* the start of this model (t=0) and MUST be monotonically increasing
* and MUST be >= the latest event currently in the model.
- *
- * Events in buf are deep copied.
*/
void
-MidiModel::append(const MidiEvent& in_event)
+MidiModel::append(double time, size_t size, Byte* in_buffer)
{
- assert(_events.empty() || in_event.time >= _events.back().time);
+ assert(_events.empty() || time >= _events.back().time);
- _events.push_back(in_event);
- MidiEvent& my_event = _events.back();
- assert(my_event.time == in_event.time);
- assert(my_event.size == in_event.size);
+ cerr << "Model event: time = " << time << endl;
- my_event.buffer = new Byte[my_event.size];
- memcpy(my_event.buffer, in_event.buffer, my_event.size);
+ Byte* my_buffer = new Byte[size];
+ memcpy(my_buffer, in_buffer, size);
+ _events.push_back(MidiEvent(time, size, my_buffer));
}