X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=libs%2Fardour%2Fmidi_state_tracker.cc;h=10b312ea9b53e0759aaff32d7d4410787d4e84a4;hb=fd832d9d1a7eb33ff9b8b206e1b8509aef100faf;hp=f919a02f355ecdb3907ea78c43d958eacfc8b457;hpb=a7067557107fc2f01586a88bb8b0a097914798ea;p=ardour.git diff --git a/libs/ardour/midi_state_tracker.cc b/libs/ardour/midi_state_tracker.cc index f919a02f35..10b312ea9b 100644 --- a/libs/ardour/midi_state_tracker.cc +++ b/libs/ardour/midi_state_tracker.cc @@ -55,7 +55,7 @@ MidiStateTracker::add (uint8_t note, uint8_t chn) ++_active_notes[note + 128 * chn]; if (_active_notes[note+128 * chn] > 1) { - cerr << this << " note " << (int) note << '/' << (int) chn << " was already on, now at " << (int) _active_notes[note+128*chn] << endl; + //cerr << this << " note " << (int) note << '/' << (int) chn << " was already on, now at " << (int) _active_notes[note+128*chn] << endl; } DEBUG_TRACE (PBD::DEBUG::MidiTrackers, string_compose ("%1 ON %2/%3 voices %5 total on %4\n", @@ -65,7 +65,7 @@ MidiStateTracker::add (uint8_t note, uint8_t chn) void MidiStateTracker::remove (uint8_t note, uint8_t chn) -{ +{ switch (_active_notes[note + 128 * chn]) { case 0: break; @@ -79,7 +79,7 @@ MidiStateTracker::remove (uint8_t note, uint8_t chn) } DEBUG_TRACE (PBD::DEBUG::MidiTrackers, string_compose ("%1 OFF %2/%3 current voices = %5 total on %4\n", - this, (int) note, (int) chn, _on, + this, (int) note, (int) chn, _on, (int) _active_notes[note+128 * chn])); } @@ -110,7 +110,7 @@ MidiStateTracker::track (const uint8_t* evbuf) } void -MidiStateTracker::resolve_notes (MidiBuffer &dst, framepos_t time) +MidiStateTracker::resolve_notes (MidiBuffer &dst, samplepos_t time) { DEBUG_TRACE (PBD::DEBUG::MidiTrackers, string_compose ("%1 MB-resolve notes @ %2 on = %3\n", this, time, _on)); @@ -122,14 +122,14 @@ MidiStateTracker::resolve_notes (MidiBuffer &dst, framepos_t time) for (int note = 0; note < 128; ++note) { while (_active_notes[note + 128 * channel]) { uint8_t buffer[3] = { ((uint8_t) (MIDI_CMD_NOTE_OFF | channel)), uint8_t (note), 0 }; - Evoral::MIDIEvent noteoff - (MIDI_CMD_NOTE_OFF, time, 3, buffer, false); + Evoral::Event noteoff + (Evoral::MIDI_EVENT, time, 3, buffer, false); /* note that we do not care about failure from push_back() ... should we warn someone ? */ dst.push_back (noteoff); _active_notes[note + 128 * channel]--; - DEBUG_TRACE (PBD::DEBUG::MidiTrackers, string_compose ("%1: MB-resolved note %2/%3 at %4\n", + DEBUG_TRACE (PBD::DEBUG::MidiTrackers, string_compose ("%1: MB-resolved note %2/%3 at %4\n", this, (int) note, (int) channel, time)); } } @@ -138,7 +138,7 @@ MidiStateTracker::resolve_notes (MidiBuffer &dst, framepos_t time) } void -MidiStateTracker::resolve_notes (Evoral::EventSink &dst, framepos_t time) +MidiStateTracker::resolve_notes (Evoral::EventSink &dst, samplepos_t time) { uint8_t buf[3]; @@ -157,9 +157,9 @@ MidiStateTracker::resolve_notes (Evoral::EventSink &dst, framepos_t /* note that we do not care about failure from write() ... should we warn someone ? */ - dst.write (time, midi_parameter_type (buf[0]), 3, buf); + dst.write (time, Evoral::MIDI_EVENT, 3, buf); _active_notes[note + 128 * channel]--; - DEBUG_TRACE (PBD::DEBUG::MidiTrackers, string_compose ("%1: EVS-resolved note %2/%3 at %4\n", + DEBUG_TRACE (PBD::DEBUG::MidiTrackers, string_compose ("%1: EVS-resolved note %2/%3 at %4\n", this, (int) note, (int) channel, time)); } } @@ -168,7 +168,7 @@ MidiStateTracker::resolve_notes (Evoral::EventSink &dst, framepos_t } void -MidiStateTracker::resolve_notes (MidiSource& src, const MidiSource::Lock& lock, Evoral::MusicalTime time) +MidiStateTracker::resolve_notes (MidiSource& src, const MidiSource::Lock& lock, Temporal::Beats time) { DEBUG_TRACE (PBD::DEBUG::MidiTrackers, string_compose ("%1 MS-resolve notes @ %2 on = %3\n", this, time, _on)); @@ -181,17 +181,17 @@ MidiStateTracker::resolve_notes (MidiSource& src, const MidiSource::Lock& lock, for (int channel = 0; channel < 16; ++channel) { for (int note = 0; note < 128; ++note) { while (_active_notes[note + 128 * channel]) { - Evoral::MIDIEvent ev ((MIDI_CMD_NOTE_OFF|channel), time, 3, 0, true); + Evoral::Event ev (Evoral::MIDI_EVENT, time, 3, 0, true); ev.set_type (MIDI_CMD_NOTE_OFF); ev.set_channel (channel); ev.set_note (note); ev.set_velocity (0); src.append_event_beats (lock, ev); - DEBUG_TRACE (PBD::DEBUG::MidiTrackers, string_compose ("%1: MS-resolved note %2/%3 at %4\n", + DEBUG_TRACE (PBD::DEBUG::MidiTrackers, string_compose ("%1: MS-resolved note %2/%3 at %4\n", this, (int) note, (int) channel, time)); _active_notes[note + 128 * channel]--; /* don't stack events up at the same time */ - time += Evoral::MusicalTime::tick(); + time += Temporal::Beats::tick(); } } } @@ -206,7 +206,7 @@ MidiStateTracker::dump (ostream& o) for (int x = 0; x < 128; ++x) { if (_active_notes[c * 128 + x]) { o << "Channel " << c+1 << " Note " << x << " is on (" - << (int) _active_notes[c*128+x] << "times)\n"; + << (int) _active_notes[c*128+x] << " times)\n"; } } }