Remove unused Session::butler_mixdown_buffer and Session::butler_gain_buffer.
[ardour.git] / libs / ardour / ardour / session.h
index 614ab42eeba38e58cf0866576d9593971635bb95..0e543462aef36b4b1992e351e1fb85ef28a0e6ad 100644 (file)
@@ -178,7 +178,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
 
                std::list<AudioRange> audio_range;
                std::list<MusicRange> music_range;
-               
+
                boost::shared_ptr<Region> region;
 
                Event(Type t, Action a, nframes_t when, nframes_t where, double spd, bool yn = false)
@@ -206,11 +206,11 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
                        return e1->before (*e2);
                }
 
-               void *operator new (size_t ignored) {
+               void *operator new (size_t) {
                        return pool.alloc ();
                }
 
-               void operator delete(void *ptr, size_t size) {
+               void operator delete (void *ptr, size_t /*size*/) {
                        pool.release (ptr);
                }
 
@@ -223,15 +223,15 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
        /* creating from an XML file */
 
        Session (AudioEngine&,
-                       const std::string& fullpath,
-                       const std::string& snapshot_name,
-                       std::string mix_template = "");
+                       const std::string& fullpath,
+                       const std::string& snapshot_name,
+                       std::string mix_template = "");
 
        /* creating a new Session */
 
        Session (AudioEngine&,
-                       std::string fullpath,
-                       std::string snapshot_name,
+                       std::string fullpath,
+                       std::string snapshot_name,
                        AutoConnectOption input_auto_connect,
                        AutoConnectOption output_auto_connect,
                        uint32_t control_out_channels,
@@ -249,6 +249,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
 
        void set_snap_name ();
 
+       bool writable() const { return _writable; }
        void set_dirty ();
        void set_clean ();
        bool dirty() const { return _state_of_the_state & Dirty; }
@@ -304,7 +305,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
 
        typedef std::list<boost::shared_ptr<Diskstream> > DiskstreamList;
 
-       int load_routes (const XMLNode&);
+       int load_routes (const XMLNode&, int);
        boost::shared_ptr<RouteList> get_routes() const {
                return routes.reader ();
        }
@@ -318,10 +319,10 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
        }
 
        struct RoutePublicOrderSorter {
-           bool operator() (boost::shared_ptr<Route>, boost::shared_ptr<Route> b);
+               bool operator() (boost::shared_ptr<Route>, boost::shared_ptr<Route> b);
        };
-       
-       void sync_order_keys (const char* base);
+
+       void sync_order_keys (std::string const &);
 
        template<class T> void foreach_route (T *obj, void (T::*func)(Route&));
        template<class T> void foreach_route (T *obj, void (T::*func)(boost::shared_ptr<Route>));
@@ -377,6 +378,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
        sigc::signal<void> Located;
 
        sigc::signal<void,RouteList&> RouteAdded;
+       sigc::signal<void> RouteGroupChanged;
 
        void request_roll_at_and_return (nframes_t start, nframes_t return_to);
        void request_bounded_roll (nframes_t start, nframes_t end);
@@ -417,7 +419,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
        double frames_per_smpte_frame() const { return _frames_per_smpte_frame; }
        nframes_t smpte_frames_per_hour() const { return _smpte_frames_per_hour; }
 
-       MIDI::byte get_mtc_smpte_bits() const { 
+       MIDI::byte get_mtc_smpte_bits() const {
                return mtc_smpte_bits;   /* encoding of SMTPE type for MTC */
        }
 
@@ -466,7 +468,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
        static std::vector<std::string*>* possible_states (std::string path);
 
        XMLNode& get_state();
-       int      set_state(const XMLNode& node); // not idempotent
+       int      set_state(const XMLNode& node, int version); // not idempotent
        XMLNode& get_template();
 
        /// The instant xml file is written to the session directory
@@ -485,28 +487,16 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
 
        StateOfTheState state_of_the_state() const { return _state_of_the_state; }
 
-       RouteGroup* add_edit_group (std::string);
-       RouteGroup* add_mix_group (std::string);
-
-       void remove_edit_group (RouteGroup&);
-       void remove_mix_group (RouteGroup&);
-
-       RouteGroup *mix_group_by_name (std::string);
-       RouteGroup *edit_group_by_name (std::string);
+       void add_route_group (RouteGroup *);
+       void remove_route_group (RouteGroup&);
 
-       sigc::signal<void,RouteGroup*> edit_group_added;
-       sigc::signal<void,RouteGroup*> mix_group_added;
-       sigc::signal<void>             edit_group_removed;
-       sigc::signal<void>             mix_group_removed;
+       RouteGroup *route_group_by_name (std::string);
 
-       void foreach_edit_group (sigc::slot<void,RouteGroup*> sl) {
-               for (std::list<RouteGroup *>::iterator i = edit_groups.begin(); i != edit_groups.end(); i++) {
-                       sl (*i);
-               }
-       }
+       sigc::signal<void,RouteGroup*> route_group_added;
+       sigc::signal<void>             route_group_removed;
 
-       void foreach_mix_group (sigc::slot<void,RouteGroup*> sl) {
-               for (std::list<RouteGroup *>::iterator i = mix_groups.begin(); i != mix_groups.end(); i++) {
+       void foreach_route_group (sigc::slot<void,RouteGroup*> sl) {
+               for (std::list<RouteGroup *>::iterator i = _route_groups.begin(); i != _route_groups.end(); i++) {
                        sl (*i);
                }
        }
@@ -514,12 +504,14 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
        /* fundamental operations. duh. */
 
        std::list<boost::shared_ptr<AudioTrack> > new_audio_track (
-                       int input_channels, int output_channels, TrackMode mode = Normal, uint32_t how_many = 1);
-       
-       RouteList new_audio_route (int input_channels, int output_channels, uint32_t how_many);
+               int input_channels, int output_channels, TrackMode mode = Normal, RouteGroup* route_group = 0, uint32_t how_many = 1
+               );
+
+       RouteList new_audio_route (int input_channels, int output_channels, RouteGroup* route_group, uint32_t how_many);
 
        std::list<boost::shared_ptr<MidiTrack> > new_midi_track (
-                       TrackMode mode = Normal, uint32_t how_many = 1);
+               TrackMode mode = Normal, RouteGroup* route_group = 0, uint32_t how_many = 1
+               );
 
        void   remove_route (boost::shared_ptr<Route>);
        void   resort_routes ();
@@ -590,7 +582,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
 
        /// signals the current transport position in frames, bbt and smpte time (in that order)
        sigc::signal<void, const nframes_t&, const BBT_Time&, const SMPTE::Time&> tick;
-       
+
        /* region info  */
 
        void add_regions (std::vector<boost::shared_ptr<Region> >&);
@@ -636,7 +628,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
        boost::shared_ptr<ExportHandler> get_export_handler ();
        boost::shared_ptr<ExportStatus> get_export_status ();
 
-       int  start_audio_export (nframes_t position, bool realtime);    
+       int  start_audio_export (nframes_t position, bool realtime);
 
        sigc::signal<int, nframes_t> ProcessExport;
        sigc::signal<void> ExportReadFinished;
@@ -725,16 +717,18 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
        /* flattening stuff */
 
        boost::shared_ptr<Region> write_one_track (AudioTrack&, nframes_t start, nframes_t end,
-                                                  bool overwrite, std::vector<boost::shared_ptr<Source> >&, InterThreadInfo& wot,
-                                                  bool enable_processing = true);
+                       bool overwrite, std::vector<boost::shared_ptr<Source> >&, InterThreadInfo& wot,
+                       bool enable_processing = true);
        int freeze (InterThreadInfo&);
 
        /* session-wide solo/mute/rec-enable */
 
        bool soloing() const { return _non_soloed_outs_muted; }
-       
+       bool listening() const { return _listen_cnt > 0; }
+
        void set_all_solo (bool);
        void set_all_mute (bool);
+       void set_all_listen (bool);
 
        sigc::signal<void,bool> SoloActive;
        sigc::signal<void> SoloChanged;
@@ -747,11 +741,11 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
        boost::shared_ptr<Route> control_out() const { return _control_out; }
        boost::shared_ptr<Route> master_out() const { return _master_out; }
 
-       /* insert/send management */
-
-       uint32_t n_port_inserts() const { return _port_inserts.size(); }
-       uint32_t n_plugin_inserts() const { return _plugin_inserts.size(); }
-       uint32_t n_sends() const { return _sends.size(); }
+       void globally_add_internal_sends (boost::shared_ptr<Route> dest, Placement p);
+       void globally_set_send_gains_from_track (boost::shared_ptr<Route> dest);
+       void globally_set_send_gains_to_zero (boost::shared_ptr<Route> dest);
+       void globally_set_send_gains_to_unity (boost::shared_ptr<Route> dest);
+       void add_internal_sends (boost::shared_ptr<Route> dest, Placement p, boost::shared_ptr<RouteList> senders);
 
        static void set_disable_all_loaded_plugins (bool yn) {
                _disable_all_loaded_plugins = yn;
@@ -852,22 +846,21 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
 
        class GlobalRouteStateCommand : public Command
        {
-         public:
+       public:
                GlobalRouteStateCommand (Session&, void*);
                GlobalRouteStateCommand (Session&, const XMLNode& node);
-               int set_state (const XMLNode&);
+               int set_state (const XMLNode&, int version);
                XMLNode& get_state ();
 
-         protected:
+       protected:
                GlobalRouteBooleanState before, after;
                Session& sess;
                void* src;
-
        };
 
        class GlobalSoloStateCommand : public GlobalRouteStateCommand
        {
-         public:
+       public:
                GlobalSoloStateCommand (Session &, void *src);
                GlobalSoloStateCommand (Session&, const XMLNode&);
                void operator()(); //redo
@@ -878,7 +871,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
 
        class GlobalMuteStateCommand : public GlobalRouteStateCommand
        {
-         public:
+       public:
                GlobalMuteStateCommand(Session &, void *src);
                GlobalMuteStateCommand (Session&, const XMLNode&);
                void operator()(); // redo
@@ -889,7 +882,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
 
        class GlobalRecordEnableStateCommand : public GlobalRouteStateCommand
        {
-         public:
+       public:
                GlobalRecordEnableStateCommand(Session &, void *src);
                GlobalRecordEnableStateCommand (Session&, const XMLNode&);
                void operator()(); // redo
@@ -900,16 +893,16 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
 
        class GlobalMeteringStateCommand : public Command
        {
-         public:
+       public:
                GlobalMeteringStateCommand(Session &, void *src);
                GlobalMeteringStateCommand (Session&, const XMLNode&);
                void operator()();
                void undo();
                XMLNode &get_state();
-               int set_state (const XMLNode&);
+               int set_state (const XMLNode&, int version);
                void mark();
 
-         protected:
+       protected:
                Session& sess;
                void* src;
                GlobalRouteMeterState before;
@@ -945,7 +938,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
 
        gain_t* gain_automation_buffer () const { return _gain_automation_buffer; }
        pan_t** pan_automation_buffer () const  { return _pan_automation_buffer; }
-       
+
        void ensure_buffer_set (BufferSet& buffers, const ChanCount& howmany);
 
        /* VST support */
@@ -970,6 +963,10 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
 
        SessionConfiguration config;
 
+       bool exporting () const {
+               return _exporting;
+       }
+
   protected:
        friend class AudioEngine;
        void set_block_size (nframes_t nframes);
@@ -1021,11 +1018,13 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
        Location*                start_location;
        Slave*                  _slave;
        bool                    _silent;
-       volatile double         _transport_speed;
-       double                  _last_transport_speed;
-                                // varispeed playback
-       double                  _target_transport_speed;
-       LinearInterpolation     interpolation;
+
+    // varispeed playback
+       volatile double             _transport_speed;
+       double                      _last_transport_speed;
+       double                      _target_transport_speed;
+       CubicInterpolation          interpolation;
+
        bool                     auto_play_legal;
        nframes_t               _last_slave_transport_frame;
        nframes_t                maximum_output_latency;
@@ -1041,9 +1040,11 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
        float                   _meter_hold;
        float                   _meter_falloff;
        bool                    _non_soloed_outs_muted;
+       uint32_t                _listen_cnt;
+       bool                    _writable;
 
        void set_worst_io_latencies ();
-       void set_worst_io_latencies_x (IOChange asifwecare, void *ignored) {
+       void set_worst_io_latencies_x (IOChange, void *) {
                set_worst_io_latencies ();
        }
 
@@ -1083,10 +1084,10 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
        void reset_slave_state ();
        bool follow_slave (nframes_t);
        void calculate_moving_average_of_slave_delta(int dir, nframes_t this_delta);
-       void track_slave_state(float slave_speed, nframes_t slave_transport_frame, 
-                              nframes_t this_delta, bool starting);
+       void track_slave_state(float slave_speed, nframes_t slave_transport_frame,
+                              nframes_t this_delta, bool starting);
        void follow_slave_silently(nframes_t nframes, float slave_speed);
-       
+
        void set_slave_source (SlaveSource);
 
        SlaveSource post_export_slave;
@@ -1094,14 +1095,14 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
 
        bool _exporting;
        bool _exporting_realtime;
-       
+
        boost::shared_ptr<ExportHandler> export_handler;
        boost::shared_ptr<ExportStatus>  export_status;
 
        int  pre_export ();
        int  stop_audio_export ();
        void finalize_audio_export ();
-       
+
        sigc::connection export_freewheel_connection;
 
        void prepare_diskstreams ();
@@ -1133,8 +1134,8 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
        }
 
        bool maybe_stop (nframes_t limit) {
-               if (   (_transport_speed > 0.0f && _transport_frame >= limit)
-                   || (_transport_speed < 0.0f && _transport_frame == 0)    ) {
+               if ( (_transport_speed > 0.0f && _transport_frame >= limit)
+                               || (_transport_speed < 0.0f && _transport_frame == 0) ) {
                        stop_transport ();
                        return true;
                }
@@ -1169,8 +1170,8 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
 
        std::string _current_snapshot_name;
 
-       XMLTree* state_tree;
-       bool     state_was_pending;
+       XMLTree*         state_tree;
+       bool             state_was_pending;
        StateOfTheState _state_of_the_state;
 
        void     auto_save();
@@ -1186,8 +1187,6 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
        bool              pending_abort;
        bool              pending_auto_loop;
 
-       Sample*           butler_mixdown_buffer;
-       float*            butler_gain_buffer;
        pthread_t         butler_thread;
        Glib::Mutex       butler_request_lock;
        Glib::Cond        butler_paused;
@@ -1438,13 +1437,9 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
 
        /* edit/mix groups */
 
-       int load_route_groups (const XMLNode&, bool is_edit);
-       int load_edit_groups (const XMLNode&);
-       int load_mix_groups (const XMLNode&);
-
+       int load_route_groups (const XMLNode&, int);
 
-       std::list<RouteGroup *> edit_groups;
-       std::list<RouteGroup *> mix_groups;
+       std::list<RouteGroup *> _route_groups;
 
        /* disk-streams */
 
@@ -1461,20 +1456,19 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
        void add_routes (RouteList&, bool save);
        uint32_t destructive_index;
 
-       boost::shared_ptr<Route> XMLRouteFactory (const XMLNode&);
+       boost::shared_ptr<Route> XMLRouteFactory (const XMLNode&, int);
 
        /* mixer stuff */
 
-       bool       solo_update_disabled;
-       bool       currently_soloing;
+       bool solo_update_disabled;
 
+       void route_listen_changed (void *src, boost::weak_ptr<Route>);
        void route_mute_changed (void *src);
        void route_solo_changed (void *src, boost::weak_ptr<Route>);
-       void catch_up_on_solo ();
-       void catch_up_on_solo_mute_override ();
-       void update_route_solo_state ();
-       void modify_solo_mute (bool, bool);
-       void strip_portname_for_solo (std::string& portname);
+       void update_route_solo_state (boost::shared_ptr<RouteList> r = boost::shared_ptr<RouteList>());
+
+       void listen_position_changed ();
+       void solo_control_mode_changed ();
 
        /* REGION MANAGEMENT */
 
@@ -1491,6 +1485,8 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
 
        int load_regions (const XMLNode& node);
 
+       void route_group_changed ();
+
        /* SOURCES */
 
        mutable Glib::Mutex source_lock;
@@ -1559,16 +1555,9 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
 
        /* INSERT AND SEND MANAGEMENT */
 
-       std::list<PortInsert *>              _port_inserts;
-       std::list<PluginInsert *>            _plugin_inserts;
-       std::list<Send *>                    _sends;
-       std::list<Return *>                  _returns;
        boost::dynamic_bitset<uint32_t> send_bitset;
        boost::dynamic_bitset<uint32_t> return_bitset;
        boost::dynamic_bitset<uint32_t> insert_bitset;
-       uint32_t                        send_cnt;
-       uint32_t                        insert_cnt;
-
 
        void add_processor (Processor *);
        void remove_processor (Processor *);
@@ -1644,15 +1633,15 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
                Click (nframes_t s, nframes_t d, const Sample *b)
                        : start (s), duration (d), data (b) { offset = 0; }
 
-               void *operator new(size_t ignored) {
+               void *operator new (size_t) {
                        return pool.alloc ();
                };
 
-               void operator delete(void *ptr, size_t size) {
+               void operator delete(void *ptr, size_t /*size*/) {
                        pool.release (ptr);
                }
 
-         private:
+       private:
                static Pool pool;
        };
 
@@ -1738,7 +1727,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
        void sync_order_keys ();
 
        static bool _disable_all_loaded_plugins;
-       
+
        SessionMetadata * _metadata;
 
        mutable bool have_looped; ///< Used in ::audible_frame(*)