US2400: send_pan_azimuth lookup function (currently mb-only)
[ardour.git] / libs / ardour / ardour / route.h
index bf8d05dd12d32c10100cc644f3c3b27da856dc2d..235ae2089b7c7c7ec1c5b1d1c71a764240380864 100644 (file)
@@ -138,14 +138,11 @@ public:
 
        virtual void filter_input (BufferSet &) {}
 
-       virtual int roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample,
-                         int declick, bool& need_butler);
+       int roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, int declick, bool& need_butler);
 
-       virtual int no_roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample,
-                            bool state_changing);
+       int no_roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool state_changing);
 
-       virtual int silent_roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample,
-                                bool& need_butler);
+       int silent_roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool& need_butler);
 
        virtual bool can_record() { return false; }
 
@@ -203,7 +200,6 @@ public:
        boost::shared_ptr<PeakMeter>       peak_meter()       { return _meter; }
        boost::shared_ptr<const PeakMeter> peak_meter() const { return _meter; }
        boost::shared_ptr<PeakMeter> shared_peak_meter() const { return _meter; }
-       boost::shared_ptr<DelayLine> delay_line() const  { return _delayline; }
 
        void flush_processors ();
 
@@ -341,19 +337,19 @@ public:
         */
        bool remove_sidechain (boost::shared_ptr<Processor> proc) { return add_remove_sidechain (proc, false); }
 
-       samplecnt_t set_private_port_latencies (bool playback) const;
-       void       set_public_port_latencies (samplecnt_t, bool playback) const;
+       samplecnt_t  update_signal_latency (bool apply_to_delayline = false);
+       virtual void apply_latency_compensation ();
 
-       samplecnt_t   update_signal_latency (bool set_initial_delay = false);
-       virtual void set_latency_compensation (samplecnt_t);
+       samplecnt_t  set_private_port_latencies (bool playback) const;
+       void         set_public_port_latencies (samplecnt_t, bool playback) const;
 
        void set_user_latency (samplecnt_t);
-       samplecnt_t initial_delay() const  { return _initial_delay; }
        samplecnt_t signal_latency() const { return _signal_latency; }
+       samplecnt_t playback_latency (bool incl_downstream = false) const;
 
-       PBD::Signal0<void>       active_changed;
-       PBD::Signal0<void>       denormal_protection_changed;
-       PBD::Signal0<void>       comment_changed;
+       PBD::Signal0<void> active_changed;
+       PBD::Signal0<void> denormal_protection_changed;
+       PBD::Signal0<void> comment_changed;
 
        /** track numbers - assigned by session
         * nubers > 0 indicate tracks (audio+midi)
@@ -384,18 +380,19 @@ public:
        PBD::Signal1<void,void*> record_enable_changed;
        PBD::Signal0<void> processor_latency_changed;
        /** the metering point has changed */
-       PBD::Signal0<void>       meter_change;
-       PBD::Signal0<void>       signal_latency_changed;
-       PBD::Signal0<void>       initial_delay_changed;
+       PBD::Signal0<void> meter_change;
+       /** a processor's latency has changed */
+       PBD::Signal0<void> signal_latency_changed;
+       /** route has updated its latency compensation */
+       PBD::Signal0<void> signal_latency_updated;
 
        /** Emitted with the process lock held */
        PBD::Signal0<void>       io_changed;
 
        /* stateful */
-
        XMLNode& get_state();
+       XMLNode& get_template();
        virtual int set_state (const XMLNode&, int version);
-       virtual XMLNode& get_template();
 
        XMLNode& get_processor_state ();
        void set_processor_state (const XMLNode&);
@@ -560,6 +557,7 @@ public:
         */
        boost::shared_ptr<AutomationControl> send_level_controllable (uint32_t n) const;
        boost::shared_ptr<AutomationControl> send_enable_controllable (uint32_t n) const;
+       boost::shared_ptr<AutomationControl> send_pan_azi_controllable (uint32_t n) const;
        /* for the same value of @param n, this returns the name of the send
         * associated with the pair of controllables returned by the above two methods.
         */
@@ -588,8 +586,8 @@ public:
 
        virtual void use_captured_sources (SourceList& srcs, CaptureInfos const &) {}
 
-  protected:
-        friend class Session;
+protected:
+       friend class Session;
 
        void catch_up_on_solo_mute_override ();
        void set_listen (bool);
@@ -597,19 +595,17 @@ public:
        void curve_reallocate ();
        virtual void set_block_size (pframes_t nframes);
 
-       virtual samplecnt_t check_initial_delay (samplecnt_t nframes, samplepos_t&) { return nframes; }
-
-       void fill_buffers_with_input (BufferSet& bufs, boost::shared_ptr<IO> io, pframes_t nframes);
+       virtual int no_roll_unlocked (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool session_state_changing);
 
-       void passthru (BufferSet&, samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes, int declick, bool gain_automation_ok);
+       virtual void snapshot_out_of_band_data (samplecnt_t /* nframes */) {}
+       virtual void write_out_of_band_data (BufferSet&, samplecnt_t /* nframes */) const {}
+       virtual void update_controls (BufferSet const&) {}
 
-       virtual void write_out_of_band_data (BufferSet& /* bufs */, samplepos_t /* start_sample */, samplepos_t /* end_sample */,
-                                            samplecnt_t /* nframes */) {}
-
-       virtual void process_output_buffers (BufferSet& bufs,
-                                            samplepos_t start_sample, samplepos_t end_sample,
-                                            pframes_t nframes, int declick,
-                                            bool gain_automation_ok);
+       void process_output_buffers (BufferSet& bufs,
+                                    samplepos_t start_sample, samplepos_t end_sample,
+                                    pframes_t nframes, int declick,
+                                    bool gain_automation_ok,
+                                    bool run_disk_processors);
 
        void flush_processor_buffers_locked (samplecnt_t nframes);
 
@@ -618,28 +614,29 @@ public:
                                                                                                                         boost::shared_ptr<Processor> endpoint, bool include_endpoint,
                                     bool for_export, bool for_freeze);
 
-       samplecnt_t   bounce_get_latency (boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze) const;
+       samplecnt_t  bounce_get_latency (boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze) const;
        ChanCount    bounce_get_output_streams (ChanCount &cc, boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze) const;
 
-       boost::shared_ptr<IO> _input;
-       boost::shared_ptr<IO> _output;
-
        bool           _active;
-       samplecnt_t     _signal_latency;
-       samplecnt_t     _initial_delay;
+       samplecnt_t    _signal_latency;
 
        ProcessorList  _processors;
-       mutable Glib::Threads::RWLock   _processor_lock;
-       boost::shared_ptr<Delivery> _main_outs;
-       boost::shared_ptr<InternalSend> _monitor_send;
-       boost::shared_ptr<InternalReturn> _intreturn;
+       mutable Glib::Threads::RWLock _processor_lock;
+
+       boost::shared_ptr<IO>               _input;
+       boost::shared_ptr<IO>               _output;
+
+       boost::shared_ptr<Delivery>         _main_outs;
+       boost::shared_ptr<InternalSend>     _monitor_send;
+       boost::shared_ptr<InternalReturn>   _intreturn;
        boost::shared_ptr<MonitorProcessor> _monitor_control;
-       boost::shared_ptr<Pannable> _pannable;
-       boost::shared_ptr<DiskReader> _disk_reader;
-       boost::shared_ptr<DiskWriter> _disk_writer;
-       boost::shared_ptr<MonitorControl> _monitoring_control;
+       boost::shared_ptr<Pannable>         _pannable;
+       boost::shared_ptr<DiskReader>       _disk_reader;
+       boost::shared_ptr<DiskWriter>       _disk_writer;
 
-       DiskIOPoint    _disk_io_point;
+       boost::shared_ptr<MonitorControl>   _monitoring_control;
+
+       DiskIOPoint _disk_io_point;
 
        enum {
                EmitNone = 0x00,
@@ -660,7 +657,6 @@ public:
        bool           _denormal_protection;
 
        bool _recordable : 1;
-       bool _silent : 1;
        bool _declickable : 1;
 
        boost::shared_ptr<SoloControl> _solo_control;
@@ -678,13 +674,10 @@ public:
 
        virtual ChanCount input_streams () const;
 
-       virtual XMLNode& state(bool);
+       virtual XMLNode& state (bool save_template);
 
        int configure_processors (ProcessorStreams*);
 
-       void passthru_silence (samplepos_t start_sample, samplepos_t end_sample,
-                              pframes_t nframes, int declick);
-
        void silence (samplecnt_t);
        void silence_unlocked (samplecnt_t);
 
@@ -701,14 +694,18 @@ public:
        boost::shared_ptr<GainControl> _trim_control;
        boost::shared_ptr<Amp>       _trim;
        boost::shared_ptr<PeakMeter> _meter;
+
        boost::shared_ptr<DelayLine> _delayline;
 
+       bool is_internal_processor (boost::shared_ptr<Processor>) const;
+
        boost::shared_ptr<Processor> the_instrument_unlocked() const;
 
        SlavableControlList slavables () const;
 
 private:
-       int64_t _track_number;
+       /* no copy construction */
+       Route (Route const &);
 
        int set_state_2X (const XMLNode&, int);
        void set_processor_state_2X (XMLNodeList const &, int);
@@ -724,10 +721,6 @@ private:
        bool input_port_count_changing (ChanCount);
        bool output_port_count_changing (ChanCount);
 
-       bool _in_configure_processors;
-       bool _initial_io_setup;
-       bool _in_sidechain_setup;
-
        int configure_processors_unlocked (ProcessorStreams*, Glib::Threads::RWLock::WriterLock*);
        bool set_meter_point_unlocked ();
        void apply_processor_order (const ProcessorList& new_order);
@@ -740,17 +733,23 @@ private:
        void placement_range (Placement p, ProcessorList::iterator& start, ProcessorList::iterator& end);
 
        void set_self_solo (bool yn);
+       void unpan ();
 
        void set_processor_positions ();
        samplecnt_t update_port_latencies (PortSet& ports, PortSet& feeders, bool playback, samplecnt_t) const;
 
        void setup_invisible_processors ();
 
-       void unpan ();
+       pframes_t latency_preroll (pframes_t nframes, samplepos_t& start_sample, samplepos_t& end_sample);
 
-       void set_plugin_state_dir (boost::weak_ptr<Processor>, const std::string&);
+       void run_route (samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes, int declick, bool gain_automation_ok, bool run_disk_reader);
+       void fill_buffers_with_input (BufferSet& bufs, boost::shared_ptr<IO> io, pframes_t nframes);
 
-       boost::shared_ptr<CapturingProcessor> _capturing_processor;
+       void reset_instrument_info ();
+       void solo_control_changed (bool self, PBD::Controllable::GroupControlDisposition);
+       void maybe_note_meter_position ();
+
+       void set_plugin_state_dir (boost::weak_ptr<Processor>, const std::string&);
 
        /** A handy class to keep processor state while we attempt a reconfiguration
         *  that may fail.
@@ -779,12 +778,13 @@ private:
 
        friend class ProcessorState;
 
-       bool _strict_io;
-
-       /* no copy construction */
-       Route (Route const &);
+       boost::shared_ptr<CapturingProcessor> _capturing_processor;
 
-       void maybe_note_meter_position ();
+       int64_t _track_number;
+       bool    _strict_io;
+       bool    _in_configure_processors;
+       bool    _initial_io_setup;
+       bool    _in_sidechain_setup;
 
        /** true if we've made a note of a custom meter position in these variables */
        bool _custom_meter_position_noted;
@@ -792,12 +792,9 @@ private:
            or 0.
        */
        boost::weak_ptr<Processor> _processor_after_last_custom_meter;
-       RoutePinWindowProxy *_pinmgr_proxy;
-       PatchChangeGridDialog* _patch_selector_dialog;
 
-       void reset_instrument_info ();
-
-       void solo_control_changed (bool self, PBD::Controllable::GroupControlDisposition);
+       RoutePinWindowProxy*   _pinmgr_proxy;
+       PatchChangeGridDialog* _patch_selector_dialog;
 };
 
 } // namespace ARDOUR