- virtual nframes_t midi_read (MidiRingBuffer<nframes_t>& dst,
- sframes_t position,
- sframes_t start, nframes_t cnt,
- sframes_t stamp_offset, sframes_t negative_stamp_offset) const;
-
- virtual nframes_t midi_write (MidiRingBuffer<nframes_t>& src,
- sframes_t position,
- nframes_t cnt);
-
- virtual void append_event_unlocked_beats(const Evoral::Event<double>& ev) = 0;
-
- virtual void append_event_unlocked_frames(const Evoral::Event<nframes_t>& ev,
- sframes_t position) = 0;
-
- virtual sframes_t length (sframes_t pos) const;
- virtual void update_length (sframes_t pos, sframes_t cnt);
-
- virtual void mark_streaming_midi_write_started (NoteMode mode, sframes_t start_time);
- virtual void mark_streaming_write_started ();
- virtual void mark_streaming_write_completed ();
-
+ virtual framecnt_t midi_read (const Lock& lock,
+ Evoral::EventSink<framepos_t>& dst,
+ framepos_t source_start,
+ framepos_t start,
+ framecnt_t cnt,
+ MidiStateTracker* tracker,
+ MidiChannelFilter* filter,
+ const std::set<Evoral::Parameter>& filtered) const;
+
+ /** Write data from a MidiRingBuffer to this source.
+ * @param source Source to read from.
+ * @param source_start This source's start position in session frames.
+ * @param cnt The length of time to write.
+ */
+ virtual framecnt_t midi_write (const Lock& lock,
+ MidiRingBuffer<framepos_t>& src,
+ framepos_t source_start,
+ framecnt_t cnt);
+
+ /** Append a single event with a timestamp in beats.
+ *
+ * Caller must ensure that the event is later than the last written event.
+ */
+ virtual void append_event_beats(const Lock& lock,
+ const Evoral::Event<Evoral::Beats>& ev) = 0;
+
+ /** Append a single event with a timestamp in frames.
+ *
+ * Caller must ensure that the event is later than the last written event.
+ */
+ virtual void append_event_frames(const Lock& lock,
+ const Evoral::Event<framepos_t>& ev,
+ framepos_t source_start) = 0;
+
+ virtual bool empty () const;
+ virtual framecnt_t length (framepos_t pos) const;
+ virtual void update_length (framecnt_t);
+
+ virtual void mark_streaming_midi_write_started (const Lock& lock, NoteMode mode);
+ virtual void mark_streaming_write_started (const Lock& lock);
+ virtual void mark_streaming_write_completed (const Lock& lock);
+
+ /** Mark write starting with the given time parameters.
+ *
+ * This is called by MidiDiskStream::process before writing to the capture
+ * buffer which will be later read by midi_read().
+ *
+ * @param position The timeline position the source now starts at.
+ * @param capture_length The current length of the capture, which may not
+ * be zero if record is armed while rolling.
+ * @param loop_length The loop length if looping, otherwise zero.
+ */
+ void mark_write_starting_now (framecnt_t position,
+ framecnt_t capture_length,
+ framecnt_t loop_length);
+
+ /* like ::mark_streaming_write_completed() but with more arguments to
+ * allow control over MIDI-specific behaviour. Expected to be used only
+ * when recording actual MIDI input, rather then when importing files
+ * etc.
+ */
+ virtual void mark_midi_streaming_write_completed (
+ const Lock& lock,
+ Evoral::Sequence<Evoral::Beats>::StuckNoteOption stuck_option,
+ Evoral::Beats when = Evoral::Beats());
+