class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_shared_from_this<MidiSource>
{
public:
- typedef double TimeType;
+ typedef Evoral::MusicalTime TimeType;
MidiSource (Session& session, std::string name, Source::Flag flags = Source::Flag(0));
MidiSource (Session& session, const XMLNode&);
virtual ~MidiSource ();
- boost::shared_ptr<MidiSource> clone (const std::string& path,
- Evoral::MusicalTime begin = Evoral::MinMusicalTime,
- Evoral::MusicalTime end = Evoral::MaxMusicalTime);
+ /** Write the data in the given time range to another MidiSource
+ * \param newsrc MidiSource to which data will be written. Should be a
+ * new, empty source. If it already has contents, the results are
+ * undefined. Source must be writable.
+ * \param begin time of earliest event that can be written.
+ * \param end time of latest event that can be written.
+ * \return zero on success, non-zero if the write failed for any reason.
+ */
+ int write_to (boost::shared_ptr<MidiSource> newsrc,
+ Evoral::MusicalTime begin = Evoral::MinMusicalTime,
+ Evoral::MusicalTime end = Evoral::MaxMusicalTime);
/** Read the data in a given time range from the MIDI source.
* All time stamps in parameters are in audio frames (even if the source has tempo time).
- * \param dst Ring buffer where read events are written
- * \param source_start Start position of the SOURCE in this read context
- * \param start Start of range to be read
- * \param cnt Length of range to be read (in audio frames)
- * \param tracker an optional pointer to MidiStateTracker object, for note on/off tracking
+ * \param dst Ring buffer where read events are written.
+ * \param source_start Start position of the SOURCE in this read context.
+ * \param start Start of range to be read.
+ * \param cnt Length of range to be read (in audio frames).
+ * \param tracker an optional pointer to MidiStateTracker object, for note on/off tracking.
+ * \param filtered Parameters whose MIDI messages will not be returned.
*/
- virtual framecnt_t midi_read (Evoral::EventSink<framepos_t>& dst,
- framepos_t source_start,
- framepos_t start,
- framecnt_t cnt,
- MidiStateTracker* tracker,
- std::set<Evoral::Parameter> const &) const;
+ virtual framecnt_t midi_read (Evoral::EventSink<framepos_t>& dst,
+ framepos_t source_start,
+ framepos_t start,
+ framecnt_t cnt,
+ MidiStateTracker* tracker,
+ const std::set<Evoral::Parameter>& filtered) const;
/** Write data from a MidiRingBuffer to this source.
* @param source Source to read from.
*/
virtual void mark_midi_streaming_write_completed (
Evoral::Sequence<Evoral::MusicalTime>::StuckNoteOption stuck_option,
- Evoral::MusicalTime when = 0);
+ Evoral::MusicalTime when = Evoral::MusicalTime());
virtual void session_saved();
bool length_mutable() const { return true; }
- void set_length_beats(double l) { _length_beats = l; }
- double length_beats() const { return _length_beats; }
+ void set_length_beats(TimeType l) { _length_beats = l; }
+ TimeType length_beats() const { return _length_beats; }
virtual void load_model(bool lock=true, bool force_reload=false) = 0;
virtual void destroy_model() = 0;
mutable Evoral::Sequence<Evoral::MusicalTime>::const_iterator _model_iter;
mutable bool _model_iter_valid;
- mutable double _length_beats;
- mutable framepos_t _last_read_end;
+ mutable Evoral::MusicalTime _length_beats;
+ mutable framepos_t _last_read_end;
/** The total duration of the current capture. */
framepos_t _capture_length;