Fix compensation of roll delay with MIDI tracks; data
should be obtained from playback_sample, not transport_frame (should fix #4172). git-svn-id: svn://localhost/ardour2/branches/3.0@10362 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
5dba72c874
commit
03b57c455a
@ -62,7 +62,7 @@ class MidiDiskstream : public Diskstream
|
||||
float playback_buffer_load() const;
|
||||
float capture_buffer_load() const;
|
||||
|
||||
void get_playback(MidiBuffer& dst, framepos_t start, framepos_t end);
|
||||
void get_playback (MidiBuffer& dst, framecnt_t);
|
||||
|
||||
void set_record_enabled (bool yn);
|
||||
|
||||
|
@ -1409,43 +1409,34 @@ MidiDiskstream::use_pending_capture_data (XMLNode& /*node*/)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Writes playback events in the given range to \a dst, translating time stamps
|
||||
* so that an event at \a start has time = 0
|
||||
/** Writes playback events from playback_sample for nframes to dst, translating time stamps
|
||||
* so that an event at playback_sample has time = 0
|
||||
*/
|
||||
void
|
||||
MidiDiskstream::get_playback (MidiBuffer& dst, framepos_t start, framepos_t end)
|
||||
MidiDiskstream::get_playback (MidiBuffer& dst, framecnt_t nframes)
|
||||
{
|
||||
dst.clear();
|
||||
assert(dst.size() == 0);
|
||||
|
||||
// Reverse. ... We just don't do reverse, ok? Back off.
|
||||
if (end <= start) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Translate stamps to be relative to start
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
DEBUG_TRACE (DEBUG::MidiDiskstreamIO, string_compose (
|
||||
"%1 MDS pre-read read %4..%5 from %2 write to %3\n", _name,
|
||||
_playback_buf->get_read_ptr(), _playback_buf->get_write_ptr(), start, end));
|
||||
_playback_buf->get_read_ptr(), _playback_buf->get_write_ptr(), playback_sample, playback_sample + nframes));
|
||||
// cerr << "================\n";
|
||||
// _playback_buf->dump (cerr);
|
||||
// cerr << "----------------\n";
|
||||
|
||||
const size_t events_read = _playback_buf->read(dst, start, end);
|
||||
const size_t events_read = _playback_buf->read (dst, playback_sample, playback_sample + nframes);
|
||||
DEBUG_TRACE (DEBUG::MidiDiskstreamIO, string_compose (
|
||||
"%1 MDS events read %2 range %3 .. %4 rspace %5 wspace %6 r@%7 w@%8\n",
|
||||
_name, events_read, start, end,
|
||||
_name, events_read, playback_sample, playback_sample + nframes,
|
||||
_playback_buf->read_space(), _playback_buf->write_space(),
|
||||
_playback_buf->get_read_ptr(), _playback_buf->get_write_ptr()));
|
||||
#else
|
||||
_playback_buf->read(dst, start, end);
|
||||
_playback_buf->read (dst, playback_sample, playback_sample + nframes);
|
||||
#endif
|
||||
|
||||
gint32 frames_read = end - start;
|
||||
g_atomic_int_add(&_frames_read_from_ringbuffer, frames_read);
|
||||
g_atomic_int_add (&_frames_read_from_ringbuffer, nframes);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -358,7 +358,7 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame
|
||||
c.set_midi (1);
|
||||
bufs.set_count (c);
|
||||
|
||||
diskstream->get_playback (mbuf, start_frame, end_frame);
|
||||
diskstream->get_playback (mbuf, nframes);
|
||||
|
||||
/* append immediate messages to the first MIDI buffer (thus sending it to the first output port) */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user