add slave,transport and event debugging traces
[ardour.git] / libs / ardour / ardour / midi_source.h
index 705674878680d57f08ebd0bcd0f55c63af01c687..dfbd5ea6a2f1377bed86fba0802099944ed5ab2b 100644 (file)
@@ -34,6 +34,7 @@
 
 namespace ARDOUR {
 
+class MidiStateTracker;
 class MidiModel;
 template<typename T> class MidiRingBuffer;
 
@@ -55,15 +56,16 @@ class MidiSource : virtual public Source
         * \param cnt Length of range to be read (in audio frames)
         * \param stamp_offset Offset to add to event times written to dst
         * \param negative_stamp_offset Offset to subtract from event times written to dst
+        * \param tracker an optional pointer to MidiStateTracker object, for note on/off tracking
         */
-       virtual nframes_t midi_read (MidiRingBuffer<nframes_t>& dst,
-                       sframes_t source_start,
-                       sframes_t start, nframes_t cnt,
-                       sframes_t stamp_offset, sframes_t negative_stamp_offset) const;
+       virtual nframes_t midi_read (Evoral::EventSink<nframes_t>& dst,
+                                    sframes_t source_start,
+                                    sframes_t start, nframes_t cnt,
+                                    sframes_t stamp_offset, sframes_t negative_stamp_offset, MidiStateTracker*) const;
 
        virtual nframes_t midi_write (MidiRingBuffer<nframes_t>& src,
-                       sframes_t source_start,
-                       nframes_t cnt);
+                                     sframes_t source_start,
+                                     nframes_t cnt);
 
        virtual void append_event_unlocked_beats(const Evoral::Event<Evoral::MusicalTime>& ev) = 0;
 
@@ -91,7 +93,7 @@ class MidiSource : virtual public Source
        mutable sigc::signal<void,sframes_t,nframes_t> ViewDataRangeReady;
 
        XMLNode& get_state ();
-       int set_state (const XMLNode&);
+       int set_state (const XMLNode&, int version);
 
        bool length_mutable() const { return true; }
 
@@ -112,10 +114,11 @@ class MidiSource : virtual public Source
   protected:
        virtual void flush_midi() = 0;
 
-       virtual nframes_t read_unlocked (MidiRingBuffer<nframes_t>& dst,
-                       sframes_t position,
-                       sframes_t start, nframes_t cnt,
-                       sframes_t stamp_offset, sframes_t negative_stamp_offset) const = 0;
+       virtual nframes_t read_unlocked (Evoral::EventSink<nframes_t>& dst,
+                                        sframes_t position,
+                                        sframes_t start, nframes_t cnt,
+                                        sframes_t stamp_offset, sframes_t negative_stamp_offset,
+                                        MidiStateTracker* tracker) const = 0;
 
        virtual nframes_t write_unlocked (MidiRingBuffer<nframes_t>& dst,
                        sframes_t position,
@@ -129,13 +132,11 @@ class MidiSource : virtual public Source
        bool                         _writing;
 
        mutable Evoral::Sequence<Evoral::MusicalTime>::const_iterator _model_iter;
+       mutable bool                                                  _model_iter_valid;
 
        mutable double    _length_beats;
        mutable sframes_t _last_read_end;
        sframes_t         _last_write_end;
-
-  private:
-       bool file_changed (std::string path);
 };
 
 }