summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_diskstream.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-09-21 15:43:11 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-09-21 15:43:11 +0000
commitddf532a655ea285287d9f0f0419c97cfa2fbb827 (patch)
treea30a718f0b8a4b0ee0da7ec23dfaf5a7efbbc34d /libs/ardour/midi_diskstream.cc
parent378a90b345d6eca50e8ef8fab6ccd102688e6614 (diff)
(full commit): fix MIDI playback by not writing into the playback buffer from MidiDiskStream::process() unless recording. This has a negative impact on "monitoring" MIDI, but that needs a different, somewhat more expansive solution anyway
git-svn-id: svn://localhost/ardour2/branches/3.0@5685 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_diskstream.cc')
-rw-r--r--libs/ardour/midi_diskstream.cc34
1 files changed, 7 insertions, 27 deletions
diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc
index 6e57714ae2..e658958b30 100644
--- a/libs/ardour/midi_diskstream.cc
+++ b/libs/ardour/midi_diskstream.cc
@@ -599,7 +599,6 @@ MidiDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can_
nframes_t rec_nframes = 0;
bool nominally_recording;
bool re = record_enabled ();
- bool collect_playback = true;
/* if we've already processed the frames corresponding to this call,
just return. this allows multiple routes that are taking input
@@ -700,6 +699,10 @@ MidiDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can_
const Evoral::MIDIEvent<MidiBuffer::TimeType> ev(*i, false);
assert(ev.buffer());
_capture_buf->write(ev.time() + transport_frame, ev.type(), ev.size(), ev.buffer());
+
+ /* put it in the playback buffer as well, so that we can monitor */
+
+ _playback_buf->write(ev.time() + transport_frame, ev.type(), ev.size(), ev.buffer());
}
} else {
@@ -722,34 +725,12 @@ MidiDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can_
} else if (nominally_recording) {
- /* can't do actual capture yet - waiting for latency effects to finish before we start*/
+ /* XXXX do this for MIDI !!!
+ can't do actual capture yet - waiting for latency effects to finish before we start
+ */
playback_distance = nframes;
- collect_playback = false;
-
- }
-
- if (collect_playback) {
-
- /* we're doing playback */
-
- nframes_t necessary_samples;
-
- /* no varispeed playback if we're recording, because the output .... TBD */
- if (rec_nframes == 0 && _actual_speed != 1.0f) {
- necessary_samples = (nframes_t) floor ((nframes * fabs (_actual_speed))) + 1;
- } else {
- necessary_samples = nframes;
- }
-
- // Pump entire port buffer into playback buffer (FIXME: split cycles?)
- MidiBuffer& buf = _source_port->get_midi_buffer(nframes);
- for (MidiBuffer::iterator i = buf.begin(); i != buf.end(); ++i) {
- const Evoral::MIDIEvent<MidiBuffer::TimeType> ev(*i, false);
- assert(ev.buffer());
- _playback_buf->write(ev.time() + transport_frame, ev.type(), ev.size(), ev.buffer());
- }
}
ret = 0;
@@ -1647,7 +1628,6 @@ MidiDiskstream::get_playback (MidiBuffer& dst, nframes_t start, nframes_t end)
// Translates stamps to be relative to start
-
_playback_buf->read(dst, start, end);
#if 0