Fix the horrible mess that was anything related to sources and paths.
[ardour.git] / libs / ardour / ardour / midi_diskstream.h
index a3d4d6d0a459252a768db264bea53cd504d98644..eddeaa451a9416a45d5f07d0848da25bc43f78f3 100644 (file)
 
 #include <pbd/fastlog.h>
 #include <pbd/ringbufferNPT.h>
 
 #include <ardour/ardour.h>
 #include <ardour/configuration.h>
-#include <ardour/session.h>
-#include <ardour/route_group.h>
-#include <ardour/route.h>
-#include <ardour/port.h>
-#include <ardour/utils.h>
 #include <ardour/diskstream.h>
 #include <ardour/midi_playlist.h>
 #include <ardour/midi_ring_buffer.h>
 #include <ardour/midi_state_tracker.h>
+#include <ardour/utils.h>
 
 struct tm;
 
 namespace ARDOUR {
 
+class IO;
 class MidiEngine;
+class MidiPort;
+class MidiRingbuffer;
+class SMFSource;
 class Send;
 class Session;
-class MidiPlaylist;
-class SMFSource;
-class IO;
 
 class MidiDiskstream : public Diskstream
 {      
@@ -132,6 +128,8 @@ class MidiDiskstream : public Diskstream
        void non_realtime_input_change ();
        void non_realtime_locate (nframes_t location);
 
+       static void set_readahed_frames( nframes_t frames_ahead ) { midi_readahead = frames_ahead; }
+
   protected:
        int seek (nframes_t which_sample, bool complete_refill = false);
 
@@ -140,11 +138,12 @@ class MidiDiskstream : public Diskstream
 
        int  process (nframes_t transport_frame, nframes_t nframes, nframes_t offset, bool can_record, bool rec_monitors_input);
        bool commit  (nframes_t nframes);
+       static nframes_t midi_readahead;
 
   private:
 
        /* The two central butler operations */
-       int do_flush (Session::RunContext context, bool force = false);
+       int do_flush (RunContext context, bool force = false);
        int do_refill ();
        
        int do_refill_with_alloc();
@@ -171,16 +170,16 @@ class MidiDiskstream : public Diskstream
        
        void engage_record_enable ();
        void disengage_record_enable ();
-       void check_note_onoffs(Evoral::MIDIEvent &event);
-       void emit_pending_note_offs(MidiBuffer &dst, nframes_t time);
-
-       MidiRingBuffer*                   _playback_buf;
-       MidiRingBuffer*                   _capture_buf;
-       MidiPort*                         _source_port;
-       boost::shared_ptr<SMFSource>      _write_source;
-       nframes_t                         _last_flush_frame;
-       NoteMode                          _note_mode;  
-       MidiStateTracker                  _midistate_tracker;
+
+       MidiRingBuffer<nframes_t>*   _playback_buf;
+       MidiRingBuffer<nframes_t>*   _capture_buf;
+       MidiPort*                    _source_port;
+       boost::shared_ptr<SMFSource> _write_source;
+       nframes_t                    _last_flush_frame;
+       NoteMode                     _note_mode;  
+       MidiStateTracker             _midi_state_tracker;
+       volatile gint                _frames_written_to_ringbuffer;
+       volatile gint                _frames_read_from_ringbuffer;
 };
 
 }; /* namespace ARDOUR */