-/** 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.
- */
-void MidiModel::append(const MIDI::Event& ev)
-{
- write_lock();
- _edited = true;
-
- cerr << "MidiModel append event type: "
- << hex << "0x" << (int)ev.type() << endl;
-
- assert(_notes.empty() || ev.time() >= _notes.back()->time());
- assert(_writing);
-
- if (ev.is_note_on()) {
- append_note_on_unlocked(ev.channel(), ev.time(), ev.note(),
- ev.velocity());
- } else if (ev.is_note_off()) {
- append_note_off_unlocked(ev.channel(), ev.time(), ev.note());
- } else if (ev.is_cc()) {
- append_automation_event_unlocked(MidiCCAutomation, ev.channel(),
- ev.time(), ev.cc_number(), ev.cc_value());
- } else if (ev.is_pgm_change()) {
- append_automation_event_unlocked(MidiPgmChangeAutomation, ev.channel(),
- ev.time(), ev.pgm_number(), 0);
- } else if (ev.is_pitch_bender()) {
- append_automation_event_unlocked(MidiPitchBenderAutomation,
- ev.channel(), ev.time(), ev.pitch_bender_lsb(),
- ev.pitch_bender_msb());
- } else if (ev.is_channel_aftertouch()) {
- append_automation_event_unlocked(MidiChannelAftertouchAutomation,
- ev.channel(), ev.time(), ev.channel_aftertouch(), 0);
- } else {
- printf("WARNING: MidiModel: Unknown event type %X\n", ev.type());
- }