radically rethink export/bounce/freeze code design. probably not 100% done by freeze...
[ardour.git] / libs / ardour / ardour / midi_track.h
index 60d2567c21be929fc4ed791594590352bd0300f4..45055a0c3d02543630f117593da8cda56b85a7b4 100644 (file)
@@ -1,6 +1,6 @@
 /*
     Copyright (C) 2006 Paul Davis
-    Written by Dave Robillard
+    Author: David Robillard
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@
 #ifndef __ardour_midi_track_h__
 #define __ardour_midi_track_h__
 
+#include "ardour/interthread_info.h"
 #include "ardour/track.h"
 #include "ardour/midi_ring_buffer.h"
 #include "ardour/midi_state_tracker.h"
@@ -31,7 +32,7 @@ class Session;
 class MidiDiskstream;
 class MidiPlaylist;
 class RouteGroup;
-class SMFSource;       
+class SMFSource;
 
 class MidiTrack : public Track
 {
@@ -39,32 +40,32 @@ public:
        MidiTrack (Session&, string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal);
        ~MidiTrack ();
 
-       int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
-                  int declick, bool can_record, bool rec_monitors_input, bool& need_butler);
+       int init ();
+
+       int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler);
 
        void realtime_handle_transport_stopped ();
+       void realtime_locate ();
 
-       void use_new_diskstream ();
-        void set_diskstream (boost::shared_ptr<Diskstream>);
+       boost::shared_ptr<Diskstream> create_diskstream ();
+       void set_diskstream (boost::shared_ptr<Diskstream>);
        void set_record_enabled (bool yn, void *src);
 
        DataType data_type () const {
                return DataType::MIDI;
        }
 
-       void set_latency_delay (framecnt_t);
-
-       int export_stuff (BufferSet& bufs, framecnt_t nframes, framepos_t end_frame);
-
        void freeze_me (InterThreadInfo&);
        void unfreeze ();
-        
+
+       bool bounceable (boost::shared_ptr<Processor>, bool) const { return false; }
        boost::shared_ptr<Region> bounce (InterThreadInfo&);
-       boost::shared_ptr<Region> bounce_range (
-                       framepos_t start, framepos_t end, InterThreadInfo&, bool enable_processing
-               );
+       boost::shared_ptr<Region> bounce_range (framepos_t start, framepos_t end, InterThreadInfo&, 
+                                               boost::shared_ptr<Processor> endpoint, bool include_endpoint);
+       int export_stuff (BufferSet& bufs, framecnt_t nframes, framepos_t end_frame, 
+                         boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export);
 
-       int set_state(const XMLNode&, int version);
+       int set_state (const XMLNode&, int version);
 
        void midi_panic(void);
        bool write_immediate_event(size_t size, const uint8_t* buf);
@@ -89,10 +90,7 @@ public:
        void set_step_editing (bool yn);
        MidiRingBuffer<framepos_t>& step_edit_ring_buffer() { return _step_edit_ring_buffer; }
 
-        PBD::Signal1<void,bool> StepEditStatusChange;
-
-       uint8_t default_channel() const { return _default_channel; }
-       void set_default_channel (uint8_t chn);
+       PBD::Signal1<void,bool> StepEditStatusChange;
 
        bool midi_thru() const { return _midi_thru; }
        void set_midi_thru (bool yn);
@@ -103,14 +101,25 @@ public:
        uint16_t get_channel_mask ();
        boost::shared_ptr<MidiPlaylist> midi_playlist ();
 
-       PBD::Signal2<void, boost::shared_ptr<MidiBuffer>, boost::weak_ptr<MidiSource> > DataRecorded;
+       PBD::Signal1<void, boost::weak_ptr<MidiSource> > DataRecorded;
+       boost::shared_ptr<MidiBuffer> get_gui_feed_buffer () const;
+
+       void set_monitoring (MonitorChoice);
+       MonitorState monitoring_state () const;
+
+       void set_input_active (bool);
+       bool input_active () const;
+       PBD::Signal0<void> InputActiveChanged;
 
 protected:
        XMLNode& state (bool full);
-       
-       int _set_state (const XMLNode&, int, bool call_base);
 
-private:
+       void act_on_mute ();
+
+  private:
+
+       virtual boost::shared_ptr<Diskstream> diskstream_factory (XMLNode const &);
+       
        boost::shared_ptr<MidiDiskstream> midi_diskstream () const;
 
        void write_out_of_band_data (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, framecnt_t nframes);
@@ -122,15 +131,17 @@ private:
        MidiRingBuffer<framepos_t> _step_edit_ring_buffer;
        NoteMode                  _note_mode;
        bool                      _step_editing;
-       uint8_t                   _default_channel;
        bool                      _midi_thru;
+       bool                      _input_active;
 
-       int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
-                       bool state_changing, bool can_record, bool rec_monitors_input);
+       int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool state_changing);
        void push_midi_input_to_step_edit_ringbuffer (framecnt_t nframes);
 
-       void diskstream_data_recorded (boost::shared_ptr<MidiBuffer>, boost::weak_ptr<MidiSource>);
+       void diskstream_data_recorded (boost::weak_ptr<MidiSource>);
        PBD::ScopedConnection _diskstream_data_recorded_connection;
+
+       void track_input_active (IOChange, void*);
+       void map_input_active (bool);
 };
 
 } /* namespace ARDOUR*/