Pan automation/serialization fixes.
[ardour.git] / libs / ardour / ardour / midi_track.h
index 654eb98e302b7902a803504a2082c9b55866869f..c437ca73dee06407204af60fbbe21024437748b6 100644 (file)
@@ -21,6 +21,7 @@
 #define __ardour_midi_track_h__
 
 #include <ardour/track.h>
+#include <ardour/midi_ring_buffer.h>
 
 namespace ARDOUR
 {
@@ -37,56 +38,64 @@ public:
        MidiTrack (Session&, const XMLNode&);
        ~MidiTrack ();
        
-       int set_name (string str, void *src);
-
-       int roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, 
-               jack_nframes_t offset, int declick, bool can_record, bool rec_monitors_input);
+       int roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, 
+               nframes_t offset, int declick, bool can_record, bool rec_monitors_input);
        
-       int no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, 
-               jack_nframes_t offset, bool state_changing, bool can_record, bool rec_monitors_input);
+       int no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, 
+               nframes_t offset, bool state_changing, bool can_record, bool rec_monitors_input);
        
-       int silent_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, 
-               jack_nframes_t offset, bool can_record, bool rec_monitors_input);
+       int silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, 
+               nframes_t offset, bool can_record, bool rec_monitors_input);
 
        void process_output_buffers (BufferSet& bufs,
-                                    jack_nframes_t start_frame, jack_nframes_t end_frame,
-                                    jack_nframes_t nframes, jack_nframes_t offset, bool with_redirects, int declick,
+                                    nframes_t start_frame, nframes_t end_frame,
+                                    nframes_t nframes, nframes_t offset, bool with_redirects, int declick,
                                     bool meter);
 
-       MidiDiskstream& midi_diskstream() const;
+       boost::shared_ptr<MidiDiskstream> midi_diskstream() const;
 
        int use_diskstream (string name);
        int use_diskstream (const PBD::ID& id);
 
-       void set_mode (TrackMode m);
+       int set_mode (TrackMode m);
 
-       void set_latency_delay (jack_nframes_t);
+       void set_latency_delay (nframes_t);
 
        int export_stuff (BufferSet& bufs,
-               jack_nframes_t nframes, jack_nframes_t end_frame);
+               nframes_t nframes, nframes_t end_frame);
 
        void freeze (InterThreadInfo&);
        void unfreeze ();
 
        void bounce (InterThreadInfo&);
-       void bounce_range (jack_nframes_t start, jack_nframes_t end, InterThreadInfo&);
+       void bounce_range (nframes_t start, nframes_t end, InterThreadInfo&);
 
        int set_state(const XMLNode& node);
 
+       bool write_immediate_event(size_t size, const Byte* buf);
+       
+       struct MidiControl : public AutomationControl {
+           MidiControl(boost::shared_ptr<MidiTrack> route, boost::shared_ptr<AutomationList> al)
+                       : AutomationControl (route->session(), al, al->param_id().to_string())
+                       , _route (route)
+               {}
+        
+           void set_value (float val);
+   
+               boost::weak_ptr<MidiTrack> _route;
+       };
+
 protected:
        XMLNode& state (bool full);
-
-       void passthru_silence (jack_nframes_t start_frame, jack_nframes_t end_frame,
-                              jack_nframes_t nframes, jack_nframes_t offset, int declick,
-                              bool meter);
-
-       ChanCount n_process_buffers ();
+       
+       int _set_state (const XMLNode&, bool call_base);
 
 private:
-       int set_diskstream (MidiDiskstream&);
-
+       int set_diskstream (boost::shared_ptr<MidiDiskstream> ds);
        void set_state_part_two ();
        void set_state_part_three ();
+
+       MidiRingBuffer _immediate_events;
 };
 
 } /* namespace ARDOUR*/