new Session::default_track_name_pattern (DataType) method, based on an idea in Tracks
[ardour.git] / libs / ardour / ardour / session.h
index 2a90230c73d5d8250b992f1850a3e2b033959ce9..a2f8c164c8659b59a2760ff66794c17cfe6fc4e2 100644 (file)
@@ -176,9 +176,14 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        bool dirty() const { return _state_of_the_state & Dirty; }
        void set_deletion_in_progress ();
        void clear_deletion_in_progress ();
+       bool reconnection_in_progress() const { return _reconnecting_routes_in_progress; }
        bool deletion_in_progress() const { return _state_of_the_state & Deletion; }
+       bool routes_deletion_in_progress() const { return _route_deletion_in_progress; }
+
        PBD::Signal0<void> DirtyChanged;
 
+       PBD::Signal1<void, bool> RouteAddedOrRemoved;
+
        const SessionDirectory& session_directory () const { return *(_session_dir.get()); }
 
        static PBD::Signal1<void,std::string> Dialog;
@@ -293,9 +298,19 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
 
        PBD::Signal0<void> IOConnectionsComplete;
 
+       /* Timecode status signals */
+       PBD::Signal1<void, bool> MTCSyncStateChanged;
+       
        /* Record status signals */
 
-       PBD::Signal0<void> RecordStateChanged;
+       PBD::Signal0<void> RecordStateChanged; /* signals changes in recording state (i.e. are we recording) */
+       /* XXX may 2015: paul says: it isn't clear to me that this has semantics that cannot be inferrred
+          from the previous signal and session state.
+       */
+       PBD::Signal0<void> RecordArmStateChanged; /* signals changes in recording arming */
+
+       /* Emited when session is loaded */
+       PBD::Signal0<void> SessionLoaded;
 
        /* Transport mechanism signals */
 
@@ -332,6 +347,9 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        /* Step Editing status changed */
        PBD::Signal1<void,bool> StepEditStatusChange;
 
+       /* Timecode state signals */
+       PBD::Signal0<void> MtcOrLtcInputPortChanged;
+       
        void queue_event (SessionEvent*);
 
        void request_roll_at_and_return (framepos_t start, framepos_t return_to);
@@ -540,13 +558,17 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
                RouteGroup* route_group = 0, uint32_t how_many = 1, std::string name_template = ""
                );
 
-       void   remove_route (boost::shared_ptr<Route>);
-       void   resort_routes ();
-       void   resort_routes_using (boost::shared_ptr<RouteList>);
+       void remove_routes (boost::shared_ptr<RouteList>);
+       void remove_route (boost::shared_ptr<Route>);
+
+       void resort_routes ();
+       void resort_routes_using (boost::shared_ptr<RouteList>);
 
        AudioEngine & engine() { return _engine; }
        AudioEngine const & engine () const { return _engine; }
 
+       static std::string default_track_name_pattern (DataType);
+       
        /* Time */
 
        framepos_t transport_frame () const {return _transport_frame; }
@@ -587,7 +609,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
 
        void   request_sync_source (Slave*);
        bool   synced_to_engine() const { return _slave && config.get_external_sync() && Config->get_sync_source() == Engine; }
-
+       bool   synced_to_mtc () const { return config.get_external_sync() && Config->get_sync_source() == MTC && g_atomic_int_get (const_cast<gint*>(&_mtc_active)); }
+       
        double transport_speed() const { return _transport_speed; }
        bool   transport_stopped() const { return _transport_speed == 0.0f; }
        bool   transport_rolling() const { return _transport_speed != 0.0f; }
@@ -710,6 +733,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        PBD::Signal0<void> SoloChanged;
        PBD::Signal0<void> IsolatedChanged;
 
+       PBD::Signal0<void> session_routes_reconnected;
+
        /* monitor/master out */
 
        void add_monitor_section ();
@@ -825,6 +850,14 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
 
        void maybe_update_session_range (framepos_t, framepos_t);
 
+       /* temporary hacks to allow selection to be pushed from GUI into backend.
+          Whenever we move the selection object into libardour, these will go away.
+        */
+       void set_range_selection (framepos_t start, framepos_t end);
+       void set_object_selection (framepos_t start, framepos_t end);
+       void clear_range_selection ();
+       void clear_object_selection ();
+       
        /* buffers for gain and pan */
 
        gain_t* gain_automation_buffer () const;
@@ -980,6 +1013,10 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
     
        MIDI::MachineControl& mmc() { return *_mmc; }
 
+       void reconnect_midi_scene_ports (bool);
+       void reconnect_mtc_ports ();
+       void reconnect_mmc_ports (bool);
+
   protected:
        friend class AudioEngine;
        void set_block_size (pframes_t nframes);
@@ -1051,6 +1088,9 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        bool                    _under_nsm_control;
        unsigned int            _xrun_count;
 
+       void mtc_status_changed (bool);
+       PBD::ScopedConnection mtc_status_connection;
+       
        void initialize_latencies ();
        void set_worst_io_latencies ();
        void set_worst_playback_latency ();
@@ -1088,6 +1128,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        bool have_first_delta_accumulator;
 
        SlaveState _slave_state;
+       gint _mtc_active;
        framepos_t slave_wait_end;
 
        void reset_slave_state ();
@@ -1230,7 +1271,6 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
 
        void update_skips (Location*, bool consolidate);
        void update_marks (Location* loc);
-       void update_loop (Location* loc);
        void consolidate_skips (Location*);
        void sync_locations_to_skips ();
        void _sync_locations_to_skips ();
@@ -1252,6 +1292,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        int  post_engine_init ();
        int  immediately_post_engine ();
        void remove_empty_sounds ();
+       
+       void session_loaded ();
 
        void setup_midi_control ();
        int  midi_read (MIDI::Port *);
@@ -1414,6 +1456,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        void engine_halted ();
        void xrun_recovery ();
        void set_track_loop (bool);
+       bool select_playhead_priority_target (framepos_t&);
+       void follow_playhead_priority ();
        
        /* These are synchronous and so can only be called from within the process
         * cycle
@@ -1441,6 +1485,9 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        void add_routes (RouteList&, bool input_auto_connect, bool output_auto_connect, bool save);
        void add_routes_inner (RouteList&, bool input_auto_connect, bool output_auto_connect);
        bool _adding_routes_in_progress;
+       bool _reconnecting_routes_in_progress;
+       bool _route_deletion_in_progress;
+
        uint32_t destructive_index;
 
        boost::shared_ptr<Route> XMLRouteFactory (const XMLNode&, int);
@@ -1448,7 +1495,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
 
        void route_processors_changed (RouteProcessorChange);
 
-       bool find_route_name (std::string const &, uint32_t& id, char* name, size_t name_len, bool);
+       bool find_route_name (std::string const &, uint32_t& id, std::string& name, bool);
        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,
@@ -1635,6 +1682,12 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        void set_play_range (std::list<AudioRange>&, bool leave_rolling);
        void unset_play_range ();
 
+       /* temporary hacks to allow selection to be pushed from GUI into backend
+          Whenever we move the selection object into libardour, these will go away.
+       */
+       Evoral::Range<framepos_t> _range_selection;
+       Evoral::Range<framepos_t> _object_selection;
+       
        /* main outs */
        uint32_t main_outs;
 
@@ -1708,7 +1761,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        /** temporary list of Diskstreams used only during load of 2.X sessions */
        std::list<boost::shared_ptr<Diskstream> > _diskstreams_2X;
 
-       void add_session_range_location (framepos_t, framepos_t);
+       void set_session_range_location (framepos_t, framepos_t);
 
        void setup_midi_machine_control ();
 
@@ -1761,6 +1814,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        void save_as_bring_callback (uint32_t, uint32_t, std::string);
 
        static int get_session_info_from_path (XMLTree& state_tree, const std::string& xmlpath);
+       static const uint32_t session_end_shift;
 };