+void
+MidiSource::mark_write_starting_now (framecnt_t position,
+ framecnt_t capture_length,
+ framecnt_t loop_length)
+{
+ /* I'm not sure if this is the best way to approach this, but
+ _capture_length needs to be set up with the transport frame
+ when a record actually starts, as it is used by
+ SMFSource::write_unlocked to decide whether incoming notes
+ are within the correct time range.
+ mark_streaming_midi_write_started (perhaps a more logical
+ place to do this) is not called at exactly the time when
+ record starts, and I don't think it necessarily can be
+ because it is not RT-safe.
+ */
+
+ set_timeline_position(position);
+ _capture_length = capture_length;
+ _capture_loop_length = loop_length;
+
+ BeatsFramesConverter converter(_session.tempo_map(), position);
+ _length_beats = converter.from(capture_length);
+}
+