Fix broken whitespace. I'd apologize for the compile times if it was my fault :D
[ardour.git] / libs / ardour / ardour / session.h
index 47285088ff30bfe066e3eb88dd168a70b1fd2c11..e1e693510ad64b5896b7417f2f9880bcdf72c0f4 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef __ardour_session_h__
 #define __ardour_session_h__
 
+#include "libardour-config.h"
+
 #include <list>
 #include <map>
 #include <set>
@@ -171,14 +173,11 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
 
        static PBD::Signal1<void,std::string> Dialog;
 
-       std::string sound_dir (bool with_path = true) const;
-       std::string peak_dir () const;
-       std::string dead_dir () const;
+       int ensure_subdirs ();
+
        std::string automation_dir () const;
        std::string analysis_dir() const;
        std::string plugins_dir() const;
-       
-       int ensure_subdirs ();
 
        std::string peak_path (std::string) const;
 
@@ -207,7 +206,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        void refresh_disk_space ();
 
        int load_diskstreams_2X (XMLNode const &, int);
-       
+
        int load_routes (const XMLNode&, int);
        boost::shared_ptr<RouteList> get_routes() const {
                return routes.reader ();
@@ -251,7 +250,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
                return (RecordState) g_atomic_int_get (&_record_status);
        }
 
-       bool actively_recording () {
+       bool actively_recording () const {
                return record_status() == Recording;
        }
 
@@ -272,7 +271,15 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
 
        /* Transport mechanism signals */
 
-       PBD::Signal0<void> TransportStateChange; /* generic */
+       /** Emitted on the following changes in transport state:
+        *  - stop (from the butler thread)
+        *  - change in whether or not we are looping (from the process thread)
+        *  - change in the play range (from the process thread)
+        *  - start (from the process thread)
+        *  - engine halted
+       */
+       PBD::Signal0<void> TransportStateChange;
+
        PBD::Signal1<void,framepos_t> PositionChanged; /* sent after any non-sequential motion */
        PBD::Signal1<void,framepos_t> Xrun;
        PBD::Signal0<void> TransportLooped;
@@ -353,7 +360,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        framecnt_t worst_track_latency ()  const { return _worst_track_latency; }
        framecnt_t worst_playback_latency () const { return _worst_output_latency + _worst_track_latency; }
 
-#ifdef HAVE_JACK_SESSION 
+#ifdef HAVE_JACK_SESSION
        void jack_session_event (jack_session_event_t* event);
 #endif
        int save_state (std::string snapshot_name, bool pending = false, bool switch_to_snapshot = false);
@@ -396,12 +403,14 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
 
        void add_route_group (RouteGroup *);
        void remove_route_group (RouteGroup&);
+       void reorder_route_groups (std::list<RouteGroup*>);
 
        RouteGroup* route_group_by_name (std::string);
        RouteGroup& all_route_group() const;
 
        PBD::Signal1<void,RouteGroup*> route_group_added;
        PBD::Signal0<void>             route_group_removed;
+       PBD::Signal0<void>             route_groups_reordered;
 
        void foreach_route_group (boost::function<void(RouteGroup*)> f) {
                for (std::list<RouteGroup *>::iterator i = _route_groups.begin(); i != _route_groups.end(); ++i) {
@@ -472,7 +481,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        void timecode_duration_string (char *, framecnt_t) const;
 
        framecnt_t convert_to_frames (AnyTime const & position);
-        framecnt_t any_duration_to_frames (framepos_t position, AnyTime const & duration);
+       framecnt_t any_duration_to_frames (framepos_t position, AnyTime const & duration);
 
        static PBD::Signal1<void, framepos_t> StartTimeChanged;
        static PBD::Signal1<void, framepos_t> EndTimeChanged;
@@ -545,7 +554,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
 
        boost::shared_ptr<AudioFileSource> create_audio_source_for_session (
                size_t, std::string const &, uint32_t, bool destructive);
-       
+
        boost::shared_ptr<MidiSource> create_midi_source_for_session (
                Track*, std::string const &);
 
@@ -603,7 +612,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        PBD::Signal1<void,bool> SoloActive;
        PBD::Signal0<void> SoloChanged;
        PBD::Signal0<void> IsolatedChanged;
-       
+
        /* control/master out */
 
        boost::shared_ptr<Route> monitor_out() const { return _monitor_out; }
@@ -724,7 +733,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
 
        /* Speakers */
 
-        boost::shared_ptr<Speakers> get_speakers ();
+       boost::shared_ptr<Speakers> get_speakers ();
 
        /* Controllables */
 
@@ -734,7 +743,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        void add_controllable (boost::shared_ptr<PBD::Controllable>);
        void remove_controllable (PBD::Controllable*);
 
-        boost::shared_ptr<PBD::Controllable> solo_cut_control() const;
+       boost::shared_ptr<PBD::Controllable> solo_cut_control() const;
 
        SessionMetadata & metadata () { return *_metadata; }
 
@@ -775,7 +784,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
                Waiting,
                Running
        };
-       
+
        SlaveState slave_state() const { return _slave_state; }
 
        boost::shared_ptr<SessionPlaylists> playlists;
@@ -818,7 +827,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
   protected:
        friend class Route;
        void schedule_curve_reallocation ();
-       void update_latency_compensation (bool, bool);
+       void update_latency_compensation (bool force = false);
 
   private:
        int  create (const std::string& mix_template, BusProfile*);
@@ -853,7 +862,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        bool                    _silent;
 
        void maybe_update_session_range (framepos_t, framepos_t);
-       
+
        // varispeed playback
        double                  _transport_speed;
        double                  _last_transport_speed;
@@ -878,9 +887,13 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        bool                    _was_seamless;
 
        void set_worst_io_latencies ();
+       void set_worst_playback_latency ();
+       void set_worst_capture_latency ();
        void set_worst_io_latencies_x (IOChange, void *) {
                set_worst_io_latencies ();
        }
+       void post_capture_latency ();
+       void post_playback_latency ();
 
        void update_latency_compensation_proxy (void* ignored);
 
@@ -988,6 +1001,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        void when_engine_running ();
        void graph_reordered ();
 
+       /** current snapshot name, without the .ardour suffix */
        std::string _current_snapshot_name;
 
        XMLTree*         state_tree;
@@ -1181,6 +1195,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        void stop_transport (bool abort = false, bool clear_state = false);
        void start_transport ();
        void realtime_stop (bool abort, bool clear_state);
+       void realtime_locate ();
        void non_realtime_start_scrub ();
        void non_realtime_set_speed ();
        void non_realtime_locate ();
@@ -1206,7 +1221,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
 
        SerializedRCUManager<RouteList>  routes;
 
-       void add_routes (RouteList&, bool save);
+       void add_routes (RouteList&, bool auto_connect, bool save);
        uint32_t destructive_index;
 
        boost::shared_ptr<Route> XMLRouteFactory (const XMLNode&, int);
@@ -1215,15 +1230,11 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        void route_processors_changed (RouteProcessorChange);
 
        bool find_route_name (std::string const &, uint32_t& id, char* name, size_t name_len, bool);
-       void count_existing_route_channels (ChanCount& in, ChanCount& out);
-       void auto_connect_route (
-               Route* route,
-               ChanCount& existing_inputs,
-               ChanCount& existing_outputs,
-               bool connect_inputs = true,
-               ChanCount input_start = ChanCount (),
-               ChanCount output_start = ChanCount ()
-               );
+       void count_existing_track_channels (ChanCount& in, ChanCount& out);
+       void auto_connect_route (boost::shared_ptr<Route> route, ChanCount& existing_inputs, ChanCount& existing_outputs,
+                                bool with_lock, bool connect_inputs = true,
+                                ChanCount input_start = ChanCount (), ChanCount output_start = ChanCount ());
+       void midi_output_change_handler (IOChange change, void* /*src*/, boost::weak_ptr<Route> midi_track);
 
        /* mixer stuff */
 
@@ -1243,6 +1254,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        mutable Glib::Mutex region_lock;
 
        int load_regions (const XMLNode& node);
+       int load_compounds (const XMLNode& node);
 
        void route_group_changed ();
 
@@ -1250,10 +1262,10 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
 
        mutable Glib::Mutex source_lock;
 
-  public:      
+  public:
        typedef std::map<PBD::ID,boost::shared_ptr<Source> > SourceMap;
 
-  private:     
+  private:
        SourceMap sources;
 
   public:
@@ -1364,9 +1376,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        void reset_jack_connection (jack_client_t* jack);
        void process_rtop (SessionEvent*);
 
-#ifdef HAVE_JACK_NEW_LATENCY
-        void  update_latency (bool playback);
-#endif
+       void  update_latency (bool playback);
 
        XMLNode& state(bool);
 
@@ -1430,7 +1440,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        Glib::Mutex controllables_lock;
        Controllables controllables;
 
-        boost::shared_ptr<PBD::Controllable> _solo_cut_control;
+       boost::shared_ptr<PBD::Controllable> _solo_cut_control;
 
        void reset_native_file_format();
        bool first_file_data_format_reset;
@@ -1457,7 +1467,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        /* realtime "apply to set of routes" operations */
        SessionEvent* get_rt_event (
                boost::shared_ptr<RouteList> rl, bool yn,
-               SessionEvent::RTeventCallback after, bool group_override, 
+               SessionEvent::RTeventCallback after, bool group_override,
                void (Session::*method) (boost::shared_ptr<RouteList>, bool, bool));
 
        void rt_set_solo (boost::shared_ptr<RouteList>, bool yn, bool group_override);
@@ -1487,9 +1497,11 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        void start_time_changed (framepos_t);
        void end_time_changed (framepos_t);
 
-        void set_track_monitor_input_status (bool);
+       void set_track_monitor_input_status (bool);
+       framepos_t compute_stop_limit () const;
 
-        boost::shared_ptr<Speakers> _speakers; 
+       boost::shared_ptr<Speakers> _speakers;
+       void load_nested_sources (const XMLNode& node);
 };
 
 } // namespace ARDOUR