Tracks calls tracks "Tracks"; Ardour uses type-names
[ardour.git] / libs / ardour / ardour / session.h
index 75b3bd2006c69e1035b859d7c12d5762b03a3f5a..c90c83cca86d181433ca00fcee49e7ef87018797 100644 (file)
@@ -148,6 +148,9 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
                Recording = 2
        };
 
+    static const char * default_trx_track_name_pattern;
+    static const char * default_ardour_track_name_pattern;
+    
        /* a new session might have non-empty mix_template, an existing session should always have an empty one.
           the bus profile can be null if no master out bus is required.
        */
@@ -183,6 +186,9 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
 
        static PBD::Signal1<void,std::string> Dialog;
 
+       PBD::Signal0<void> BatchUpdateStart;
+       PBD::Signal0<void> BatchUpdateEnd;
+
        int ensure_subdirs ();
 
        std::string automation_dir () const;  ///< Automation data
@@ -211,6 +217,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        BufferSet& get_mix_buffers (ChanCount count = ChanCount::ZERO);
 
        bool have_rec_enabled_track () const;
+    bool have_rec_disabled_track () const;
 
        bool have_captured() const { return _have_captured; }
 
@@ -397,8 +404,11 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
                std::string new_parent_folder;  /* parent folder where new session folder will be created */
                std::string new_name;           /* name of newly saved session */
                bool        switch_to;     /* true if we should be working on newly saved session after save-as; false otherwise */
+               bool        include_media; /* true if the newly saved session should contain references to media */
                bool        copy_media;    /* true if media files (audio, media, etc) should be copied into newly saved session; false otherwise */
                bool        copy_external; /* true if external media should be consolidated into the newly saved session; false otherwise */
+
+               std::string final_session_folder_name; /* filled in by * Session::save_as(), provides full path to newly saved session */
                
                /* emitted as we make progress. 3 arguments passed to signal
                 * handler:
@@ -419,7 +429,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        };
 
        int save_as (SaveAs&);
-       int save_state (std::string snapshot_name, bool pending = false, bool switch_to_snapshot = false);
+       int save_state (std::string snapshot_name, bool pending = false, bool switch_to_snapshot = false, bool template_only = false);
        int restore_state (std::string snapshot_name);
        int save_template (std::string template_name);
        int save_history (std::string snapshot_name = "");
@@ -427,7 +437,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        void remove_state (std::string snapshot_name);
        void rename_state (std::string old_name, std::string new_name);
        void remove_pending_capture_state ();
-       int rename (const std::string&, bool after_copy = false);
+       int rename (const std::string&);
        bool get_nsm_state () const { return _under_nsm_control; }
        void set_nsm_state (bool state) { _under_nsm_control = state; }
        bool save_default_options ();
@@ -590,6 +600,9 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        TempoMap&       tempo_map()       { return *_tempo_map; }
        const TempoMap& tempo_map() const { return *_tempo_map; }
 
+       unsigned int    get_xrun_count () const {return _xrun_count; }
+       void            reset_xrun_count () {_xrun_count = 0; }
+
        /* region info  */
 
        boost::shared_ptr<Region> find_whole_file_parent (boost::shared_ptr<Region const>) const;
@@ -691,6 +704,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        void set_mute (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
        void set_listen (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
        void set_record_enabled (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
+       void set_record_safe (boost::shared_ptr<RouteList>, bool yn, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
        void set_solo_isolated (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
        void set_monitoring (boost::shared_ptr<RouteList>, MonitorChoice, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
        void set_exclusive_input_active (boost::shared_ptr<RouteList> rt, bool onoff, bool flip_others=false);
@@ -702,6 +716,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        /* monitor/master out */
 
        void add_monitor_section ();
+       void reset_monitor_section ();
        void remove_monitor_section ();
 
        boost::shared_ptr<Route> monitor_out() const { return _monitor_out; }
@@ -816,6 +831,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        /* buffers for gain and pan */
 
        gain_t* gain_automation_buffer () const;
+       gain_t* trim_automation_buffer () const;
        gain_t* send_gain_automation_buffer () const;
        pan_t** pan_automation_buffer () const;
 
@@ -967,6 +983,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
     
        MIDI::MachineControl& mmc() { return *_mmc; }
 
+       void reconnect_midi_scene_ports (bool);
+
   protected:
        friend class AudioEngine;
        void set_block_size (pframes_t nframes);
@@ -1036,6 +1054,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        bool                    _writable;
        bool                    _was_seamless;
        bool                    _under_nsm_control;
+       unsigned int            _xrun_count;
 
        void initialize_latencies ();
        void set_worst_io_latencies ();
@@ -1265,6 +1284,21 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
 
        void *do_work();
 
+       /* Signal Forwarding */
+       void emit_route_signals ();
+       void emit_thread_run ();
+       static void *emit_thread (void *);
+       void emit_thread_start ();
+       void emit_thread_terminate ();
+
+       pthread_t       _rt_emit_thread;
+       bool            _rt_thread_active;
+
+       pthread_mutex_t _rt_emit_mutex;
+       pthread_cond_t  _rt_emit_cond;
+       bool            _rt_emit_pending;
+
+
        /* SessionEventManager interface */
 
        void process_event (SessionEvent*);
@@ -1648,8 +1682,9 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
 
        mutable bool have_looped; ///< Used in ::audible_frame(*)
 
-       void update_have_rec_enabled_track ();
+       void update_route_record_state ();
        gint _have_rec_enabled_track;
+       gint _have_rec_disabled_track;
 
        static int ask_about_playlist_deletion (boost::shared_ptr<Playlist>);
 
@@ -1672,6 +1707,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
        void rt_set_listen (boost::shared_ptr<RouteList>, bool yn, bool group_override);
        void rt_set_solo_isolated (boost::shared_ptr<RouteList>, bool yn, bool group_override);
        void rt_set_record_enabled (boost::shared_ptr<RouteList>, bool yn, bool group_override);
+       void rt_set_record_safe (boost::shared_ptr<RouteList>, bool yn, bool group_override);
        void rt_set_monitoring (boost::shared_ptr<RouteList>, MonitorChoice, bool group_override);
 
        /** temporary list of Diskstreams used only during load of 2.X sessions */