X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fmidi_ring_buffer.cc;h=e4ae3f3ffe5e9b210f0df544d34b0c6f1e8a66d9;hb=456fb789d3adcdb52de3abd863c1bf64c973effa;hp=21f840af10a9481690332ea4b0bba69f28d7f9c9;hpb=fc77ae0738565770abde1a25f650a035cf082af0;p=ardour.git diff --git a/libs/ardour/midi_ring_buffer.cc b/libs/ardour/midi_ring_buffer.cc index 21f840af10..e4ae3f3ffe 100644 --- a/libs/ardour/midi_ring_buffer.cc +++ b/libs/ardour/midi_ring_buffer.cc @@ -17,6 +17,7 @@ */ #include "pbd/compose.h" +#include "pbd/enumwriter.h" #include "pbd/error.h" #include "ardour/debug.h" @@ -54,7 +55,7 @@ MidiRingBuffer::read(MidiBuffer& dst, framepos_t start, framepos_t end, frame /* this cannot fail, because we've already verified that there is prefix_space to read */ - assert (this->peek (peekbuf, prefix_size)); + this->peek (peekbuf, prefix_size); ev_time = *((T*) peekbuf); ev_size = *((uint32_t*)(peekbuf + sizeof(T) + sizeof (Evoral::EventType))); @@ -78,18 +79,8 @@ MidiRingBuffer::read(MidiBuffer& dst, framepos_t start, framepos_t end, frame this->increment_read_ptr (prefix_size); uint8_t status; - assert (this->peek (&status, sizeof(uint8_t))); // If this failed, buffer is corrupt, all hope is lost - - // Ignore event if it doesn't match channel filter - if (is_channel_event(status) && get_channel_mode() == FilterChannels) { - const uint8_t channel = status & 0x0F; - if (!(get_channel_mask() & (1L << channel))) { - DEBUG_TRACE (DEBUG::MidiDiskstreamIO, string_compose ("MRB skipping event (%3 bytes) due to channel mask (mask = %1 chn = %2)\n", - get_channel_mask(), (int) channel, ev_size)); - this->increment_read_ptr (ev_size); // Advance read pointer to next event - continue; - } - } + bool r = this->peek (&status, sizeof(uint8_t)); + assert (r); // If this failed, buffer is corrupt, all hope is lost /* lets see if we are going to be able to write this event into dst. */ @@ -129,10 +120,7 @@ MidiRingBuffer::read(MidiBuffer& dst, framepos_t start, framepos_t end, frame } else if (is_note_off(write_loc[0])) { _tracker.remove (write_loc[1], write_loc[0] & 0xf); } - - if (is_channel_event(status) && get_channel_mode() == ForceChannel) { - write_loc[0] = (write_loc[0] & 0xF0) | (get_channel_mask() & 0x0F); - } + ++count; } else { cerr << "WARNING: error reading event contents from MIDI ring" << endl;