protected:
virtual void flush_midi() = 0;
- virtual nframes_t read_unlocked (MidiRingBuffer<nframes_t>& dst, nframes_t start, nframes_t cnt, nframes_t stamp_offset, nframes_t negative_stamp_offset) const = 0;
+ virtual nframes_t read_unlocked (MidiRingBuffer<nframes_t>& dst, nframes_t start, nframes_t cnt,
+ nframes_t stamp_offset, nframes_t negative_stamp_offset) const = 0;
virtual nframes_t write_unlocked (MidiRingBuffer<nframes_t>& dst, nframes_t cnt) = 0;
mutable Glib::Mutex _lock;
int _set_state (const XMLNode&, bool call_base);
private:
-
void write_controller_messages(MidiBuffer& buf,
nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset);
<< " stamp size: " << stamp_size << " \n";*/
if (_size + stamp_size + ev.size() >= _capacity) {
- cerr << "MidiBuffer::push_back failed (buffer is full)"
- << endl;
+ cerr << "MidiBuffer::push_back failed (buffer is full)" << endl;
+ return false;
+ }
+
+ if (!Evoral::midi_event_is_valid(ev.buffer(), ev.size())) {
+ cerr << "WARNING: MidiBuffer ignoring illegal MIDI event" << endl;
return false;
}
cerr << "MidiBuffer::push_back failed (buffer is full)" << endl;
return false;
}
+
+ if (!Evoral::midi_event_is_valid(ev.buffer, ev.size)) {
+ cerr << "WARNING: MidiBuffer ignoring illegal MIDI event" << endl;
+ return false;
+ }
uint8_t* const write_loc = _data + _size;
*((TimeType*)write_loc) = ev.time;
#include <pbd/enumwriter.h>
#include <midi++/events.h>
+#include <evoral/midi_util.h>
#include <ardour/midi_track.h>
#include <ardour/midi_diskstream.h>
bool
MidiTrack::write_immediate_event(size_t size, const uint8_t* buf)
{
- /*printf("Write immediate event: ");
- for (size_t i=0; i < size; ++i) {
- printf("%X ", buf[i]);
+ if (!Evoral::midi_event_is_valid(buf, size)) {
+ cerr << "WARNING: Ignoring illegal immediate MIDI event" << endl;
+ return false;
}
- printf("\n");*/
const uint32_t type = EventTypeMap::instance().midi_event_type(buf[0]);
return (_immediate_events.write(0, type, size, buf) == size);
}
} printf("\n");*/
if (!midi_event_is_valid(buf, size)) {
- cerr << "WARNING: Ignoring illegal MIDI event" << endl;
+ cerr << "WARNING: SMF ignoring illegal MIDI event" << endl;
return;
}
assert(_writing);
if (!midi_event_is_valid(ev.buffer(), ev.size())) {
- cerr << "WARNING: Ignoring illegal MIDI event" << endl;
+ cerr << "WARNING: Sequence ignoring illegal MIDI event" << endl;
return;
}