MidiTrack::set_diskstream (boost::shared_ptr<Diskstream> ds)
{
Track::set_diskstream (ds);
-
+
_diskstream->set_track (this);
_diskstream->set_destructive (_mode == Destructive);
return ret;
}
+void
+MidiTrack::realtime_locate ()
+{
+ Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK);
+ if (!lm.locked ()) {
+ return;
+ }
+
+ for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
+ (*i)->realtime_locate ();
+ }
+}
+
void
MidiTrack::realtime_handle_transport_stopped ()
{
const Evoral::MIDIEvent<framepos_t> ev(*e, false);
/* note on, since for step edit, note length is determined
- elsewhere
+ elsewhere
*/
if (ev.is_note_on()) {
void
MidiTrack::write_out_of_band_data (BufferSet& bufs, framepos_t /*start*/, framepos_t /*end*/, framecnt_t nframes)
{
- // Append immediate events
MidiBuffer& buf (bufs.get_midi (0));
+
+ // Append immediate events
+
if (_immediate_events.read_space()) {
- DEBUG_TRACE (DEBUG::MidiIO, string_compose ("%1 has %2 of immediate events to deliver\n",
+
+ DEBUG_TRACE (DEBUG::MidiIO, string_compose ("%1 has %2 of immediate events to deliver\n",
name(), _immediate_events.read_space()));
+
+ /* write as many of the immediate events as we can, but give "true" as
+ * the last argument ("stop on overflow in destination") so that we'll
+ * ship the rest out next time.
+ *
+ * the (nframes-1) argument puts all these events at the last
+ * possible position of the output buffer, so that we do not
+ * violate monotonicity when writing.
+ */
+
+ _immediate_events.read (buf, 0, 1, nframes-1, true);
}
- _immediate_events.read (buf, 0, 1, nframes-1); // all stamps = 0
// MIDI thru: send incoming data "through" output
if (_midi_thru && _session.transport_speed() != 0.0f && _input->n_ports().n_midi()) {
{
DataRecorded (buf, src); /* EMIT SIGNAL */
}
-
+
bool
MidiTrack::should_monitor () const
{