Fix various MIDI corruption bugs.

Re-enable MIDI CC controller bars and other immediate output (hans commented out, tsk tsk).
Write channel mode as textual enumeration instead of magic number.
Better atomic (almost) channel mode switching on MIDI ring buffer (was a possible, if unlikely, source of corruption).
Handle some cases of broken MIDI, and oversized events, more gracefully.


git-svn-id: svn://localhost/ardour2/branches/3.0@3335 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2008-05-12 02:40:48 +00:00
parent a76e2128ef
commit 8ca72c4eca
17 changed files with 351 additions and 297 deletions

View file

@ -361,11 +361,11 @@ SMFSource::read_event(uint32_t* delta_t, uint32_t* size, Byte** buf) const
if (event_size > 1)
fread((*buf) + 1, 1, *size - 1, _fd);
printf("SMFSource %s read event: delta = %u, size = %u, data = ", _name.c_str(), *delta_t, *size);
/*printf("SMFSource %s read event: delta = %u, size = %u, data = ", _name.c_str(), *delta_t, *size);
for (size_t i=0; i < *size; ++i) {
printf("%X ", (*buf)[i]);
}
printf("\n");
printf("\n");*/
return (int)*size;
}
@ -374,7 +374,7 @@ SMFSource::read_event(uint32_t* delta_t, uint32_t* size, Byte** buf) const
nframes_t
SMFSource::read_unlocked (MidiRingBuffer& dst, nframes_t start, nframes_t cnt, nframes_t stamp_offset, nframes_t negative_stamp_offset) const
{
cerr << "SMF read_unlocked " << name() << " read " << start << ", count=" << cnt << ", offset=" << stamp_offset << endl;
//cerr << "SMF read_unlocked " << name() << " read " << start << ", count=" << cnt << ", offset=" << stamp_offset << endl;
// 64 bits ought to be enough for anybody
uint64_t time = 0; // in SMF ticks, 1 tick per _ppqn