From ec6ab8a04811acd1b548a23ab8f95c27797267fe Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 3 Oct 2008 03:16:19 +0000 Subject: Apply panners/automation patch from torbenh (Panner is-a Processor). git-svn-id: svn://localhost/ardour2/branches/3.0@3848 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/panner.h | 83 ++++++++++++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 32 deletions(-) (limited to 'libs/ardour/ardour/panner.h') diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index 7b4f2d1039..7019f5e5ac 100644 --- a/libs/ardour/ardour/panner.h +++ b/libs/ardour/ardour/panner.h @@ -32,12 +32,15 @@ #include #include +#include +#include using std::istream; using std::ostream; namespace ARDOUR { +class Route; class Session; class Panner; class BufferSet; @@ -102,21 +105,7 @@ class StreamPanner : public sigc::trackable, public PBD::Stateful bool _muted; - struct PanControllable : public AutomationControl { - PanControllable (Session& s, std::string name, StreamPanner& p, Evoral::Parameter param) - : AutomationControl (s, param, - boost::shared_ptr(new AutomationList(param)), name) - , panner (p) - { assert(param.type() != NullAutomation); } - - AutomationList* alist() { return (AutomationList*)_list.get(); } - StreamPanner& panner; - - void set_value (float); - float get_value (void) const; - }; - - boost::shared_ptr _control; + boost::shared_ptr _control; void add_state (XMLNode&); virtual void update () = 0; @@ -197,7 +186,8 @@ class Multi2dPanner : public StreamPanner void update (); }; -class Panner : public std::vector, public PBD::Stateful, public sigc::trackable + +class Panner : public Processor { public: struct Output { @@ -211,37 +201,43 @@ class Panner : public std::vector, public PBD::Stateful, public s }; + //Panner (std::string name, Session&, int _num_bufs); Panner (string name, Session&); virtual ~Panner (); + void clear_panners (); + + /// The fundamental Panner function - void distribute(BufferSet& src, BufferSet& dest, nframes_t start_frame, nframes_t end_frames, nframes_t nframes, nframes_t offset); + void set_automation_state (AutoState); + AutoState automation_state() const; + void set_automation_style (AutoStyle); + AutoStyle automation_style() const; + bool touching() const; + + bool is_in_place () const { return false; } + bool is_out_of_place () const { return true; } + bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const { return true; }; + + void run_out_of_place(BufferSet& src, BufferSet& dest, nframes_t start_frame, nframes_t end_frames, nframes_t nframes, nframes_t offset); + + //void* get_inline_gui() const = 0; + //void* get_full_gui() const = 0; bool bypassed() const { return _bypassed; } void set_bypassed (bool yn); StreamPanner* add (); void remove (uint32_t which); - void clear (); void reset (uint32_t noutputs, uint32_t npans); - void snapshot (nframes_t now); - void transport_stopped (nframes_t frame); - void clear_automation (); - void set_automation_state (AutoState); - AutoState automation_state() const; - void set_automation_style (AutoStyle); - AutoStyle automation_style() const; - bool touching() const; XMLNode& get_state (void); XMLNode& state (bool full); int set_state (const XMLNode&); - sigc::signal Changed; - static bool equivalent (pan_t a, pan_t b) { return fabsf (a - b) < 0.002; // about 1 degree of arc for a stereo panner } @@ -251,7 +247,6 @@ class Panner : public std::vector, public PBD::Stateful, public s Output& output (uint32_t n) { return outputs[n]; } std::vector outputs; - Session& session() const { return _session; } enum LinkDirection { SameDirection, @@ -264,6 +259,10 @@ class Panner : public std::vector, public PBD::Stateful, public s bool linked() const { return _linked; } void set_linked (bool yn); + StreamPanner &streampanner( uint32_t n ) const { assert( n < _streampanners.size() ); return *_streampanners[n]; } + uint32_t npanners() const { return _streampanners.size(); } + + sigc::signal Changed; sigc::signal LinkStateChanged; sigc::signal StateChanged; /* for bypass */ @@ -277,10 +276,31 @@ class Panner : public std::vector, public PBD::Stateful, public s int load (); + struct PanControllable : public AutomationControl { + PanControllable (Session& s, std::string name, Panner& p, Evoral::Parameter param) + : AutomationControl (s, param, + boost::shared_ptr(new AutomationList(param)), name) + , panner (p) + { assert(param.type() != NullAutomation); } + + AutomationList* alist() { return (AutomationList*)_list.get(); } + Panner& panner; + + void set_value (float); + float get_value (void) const; + }; + + boost::shared_ptr pan_control ( int id, int chan=0 ) { + return boost::dynamic_pointer_cast( control( Evoral::Parameter (PanAutomation, chan, id) )); + } + + boost::shared_ptr pan_control ( int id, int chan=0 ) const { + return boost::dynamic_pointer_cast( control( Evoral::Parameter (PanAutomation, chan, id) )); + } + private: void distribute_no_automation(BufferSet& src, BufferSet& dest, nframes_t nframes, nframes_t offset, gain_t gain_coeff); - - Session& _session; + std::vector _streampanners; uint32_t current_outs; bool _linked; bool _bypassed; @@ -291,7 +311,6 @@ class Panner : public std::vector, public PBD::Stateful, public s /* old school automation handling */ std::string automation_path; - void set_name (std::string); }; } // namespace ARDOUR -- cgit v1.2.3