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 playback_buffer_load() const;
|
||||||
float capture_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);
|
void set_record_enabled (bool yn);
|
||||||
|
|
||||||
|
|
|
@ -1409,43 +1409,34 @@ MidiDiskstream::use_pending_capture_data (XMLNode& /*node*/)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Writes playback events in the given range to \a dst, translating time stamps
|
/** Writes playback events from playback_sample for nframes to dst, translating time stamps
|
||||||
* so that an event at \a start has time = 0
|
* so that an event at playback_sample has time = 0
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
MidiDiskstream::get_playback (MidiBuffer& dst, framepos_t start, framepos_t end)
|
MidiDiskstream::get_playback (MidiBuffer& dst, framecnt_t nframes)
|
||||||
{
|
{
|
||||||
dst.clear();
|
dst.clear();
|
||||||
assert(dst.size() == 0);
|
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
|
#ifndef NDEBUG
|
||||||
DEBUG_TRACE (DEBUG::MidiDiskstreamIO, string_compose (
|
DEBUG_TRACE (DEBUG::MidiDiskstreamIO, string_compose (
|
||||||
"%1 MDS pre-read read %4..%5 from %2 write to %3\n", _name,
|
"%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";
|
// cerr << "================\n";
|
||||||
// _playback_buf->dump (cerr);
|
// _playback_buf->dump (cerr);
|
||||||
// cerr << "----------------\n";
|
// 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 (
|
DEBUG_TRACE (DEBUG::MidiDiskstreamIO, string_compose (
|
||||||
"%1 MDS events read %2 range %3 .. %4 rspace %5 wspace %6 r@%7 w@%8\n",
|
"%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->read_space(), _playback_buf->write_space(),
|
||||||
_playback_buf->get_read_ptr(), _playback_buf->get_write_ptr()));
|
_playback_buf->get_read_ptr(), _playback_buf->get_write_ptr()));
|
||||||
#else
|
#else
|
||||||
_playback_buf->read(dst, start, end);
|
_playback_buf->read (dst, playback_sample, playback_sample + nframes);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gint32 frames_read = end - start;
|
g_atomic_int_add (&_frames_read_from_ringbuffer, nframes);
|
||||||
g_atomic_int_add(&_frames_read_from_ringbuffer, frames_read);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -358,7 +358,7 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame
|
||||||
c.set_midi (1);
|
c.set_midi (1);
|
||||||
bufs.set_count (c);
|
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) */
|
/* append immediate messages to the first MIDI buffer (thus sending it to the first output port) */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user