mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-20 13:46:30 +01:00
Revert stupid r4975.
git-svn-id: svn://localhost/ardour2/branches/3.0@4984 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
b90424cf80
commit
d489a65dad
1 changed files with 16 additions and 16 deletions
|
|
@ -171,9 +171,9 @@ SMFSource::write_unlocked (MidiRingBuffer<nframes_t>& source, sframes_t position
|
||||||
{
|
{
|
||||||
_write_data_count = 0;
|
_write_data_count = 0;
|
||||||
|
|
||||||
nframes_t event_time;
|
nframes_t time;
|
||||||
Evoral::EventType event_type;
|
Evoral::EventType type;
|
||||||
uint32_t event_size;
|
uint32_t size;
|
||||||
|
|
||||||
size_t buf_capacity = 4;
|
size_t buf_capacity = 4;
|
||||||
uint8_t* buf = (uint8_t*)malloc(buf_capacity);
|
uint8_t* buf = (uint8_t*)malloc(buf_capacity);
|
||||||
|
|
@ -185,36 +185,36 @@ SMFSource::write_unlocked (MidiRingBuffer<nframes_t>& source, sframes_t position
|
||||||
Evoral::MIDIEvent<nframes_t> ev;
|
Evoral::MIDIEvent<nframes_t> ev;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
bool ret = source.peek_time(&event_time);
|
bool ret = source.peek_time(&time);
|
||||||
g_debug ("position: %lu, event_time: %u, last_write_end: %lu, duration: %u", position, event_time, _last_write_end, duration);
|
g_debug ("time: %u, last_write_end: %lu, duration: %u", time, _last_write_end, duration);
|
||||||
if (!ret || event_time > _last_write_end + duration) {
|
if (!ret || time > _last_write_end + duration) {
|
||||||
if (!ret) g_debug ("peek failed");
|
if (!ret) g_debug ("peek failed");
|
||||||
if (event_time > _last_write_end + duration) g_debug ("event_time: %u > last_write_end: %lu + duration: %u", event_time, _last_write_end, duration);
|
if (time > _last_write_end + duration) g_debug ("time: %u > last_write_end: %lu + duration: %u", time, _last_write_end, duration);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = source.read_prefix(&event_time, &event_type, &event_size);
|
ret = source.read_prefix(&time, &type, &size);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
cerr << "ERROR: Unable to read event prefix, corrupt MIDI ring buffer" << endl;
|
cerr << "ERROR: Unable to read event prefix, corrupt MIDI ring buffer" << endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event_size > buf_capacity) {
|
if (size > buf_capacity) {
|
||||||
buf_capacity = event_size;
|
buf_capacity = size;
|
||||||
buf = (uint8_t*)realloc(buf, event_size);
|
buf = (uint8_t*)realloc(buf, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = source.read_contents(event_size, buf);
|
ret = source.read_contents(size, buf);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
cerr << "ERROR: Read event time/size but not buffer, corrupt MIDI ring buffer" << endl;
|
cerr << "ERROR: Read time/size but not buffer, corrupt MIDI ring buffer" << endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(event_time >= position);
|
assert(time >= position);
|
||||||
event_time -= position;
|
time -= position;
|
||||||
|
|
||||||
ev.set(buf, event_size, event_time);
|
ev.set(buf, size, time);
|
||||||
ev.set_event_type(EventTypeMap::instance().midi_event_type(ev.buffer()[0]));
|
ev.set_event_type(EventTypeMap::instance().midi_event_type(ev.buffer()[0]));
|
||||||
if (!(ev.is_channel_event() || ev.is_smf_meta_event() || ev.is_sysex())) {
|
if (!(ev.is_channel_event() || ev.is_smf_meta_event() || ev.is_sysex())) {
|
||||||
cerr << "SMFSource: WARNING: caller tried to write non SMF-Event of type "
|
cerr << "SMFSource: WARNING: caller tried to write non SMF-Event of type "
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue