From bbf41757133a29df0d37905f2fdce091878d2ffd Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 30 Jun 2007 18:41:50 +0000 Subject: Another not-quite-there-but-better commit. Brought plugin automation into the fold of new automation system. Fixed plugin automation, broke panner automation :] (pending Panner work). Made AutomationController better at automatically following it's controller value (mimic what gain meter does). Fixed some visible automation track bugs (but still broken WRT serialization). git-svn-id: svn://localhost/ardour2/trunk@2092 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/automatable.h | 8 ++++--- libs/ardour/ardour/panner.h | 48 ++++++-------------------------------- libs/ardour/ardour/plugin.h | 28 +++------------------- libs/ardour/ardour/plugin_insert.h | 17 +++++++++++--- 4 files changed, 29 insertions(+), 72 deletions(-) (limited to 'libs/ardour/ardour') diff --git a/libs/ardour/ardour/automatable.h b/libs/ardour/ardour/automatable.h index a1161db80d..c0d80dbb85 100644 --- a/libs/ardour/ardour/automatable.h +++ b/libs/ardour/ardour/automatable.h @@ -48,10 +48,14 @@ public: virtual boost::shared_ptr control(ParamID id, bool create_if_missing=false); virtual boost::shared_ptr control(ParamID id) const; + + typedef std::map > Controls; + Controls controls() { return _controls; } virtual void add_control(boost::shared_ptr); virtual void automation_snapshot(nframes_t now); + virtual void transport_stopped(nframes_t now); virtual bool find_next_event(nframes_t start, nframes_t end, ControlEvent& ev) const; @@ -60,7 +64,7 @@ public: virtual void clear_automation(); - AutoState get_parameter_automation_state (ParamID param); + AutoState get_parameter_automation_state (ParamID param, bool lock = true); virtual void set_parameter_automation_state (ParamID param, AutoState); AutoStyle get_parameter_automation_style (ParamID param); @@ -88,8 +92,6 @@ protected: mutable Glib::Mutex _automation_lock; - typedef std::map > Controls; - Controls _controls; std::set _visible_controls; std::set _can_automate_list; diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index 89f56e03c5..ec3cb59b9b 100644 --- a/libs/ardour/ardour/panner.h +++ b/libs/ardour/ardour/panner.h @@ -31,6 +31,7 @@ #include #include +#include using std::istream; using std::ostream; @@ -69,22 +70,8 @@ class StreamPanner : public sigc::trackable, public PBD::Stateful virtual void distribute_automated (AudioBuffer& src, BufferSet& obufs, nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers) = 0; - /* automation */ - - virtual void snapshot (nframes_t now) = 0; - virtual void transport_stopped (nframes_t frame) = 0; - virtual void set_automation_state (AutoState) = 0; - virtual void set_automation_style (AutoStyle) = 0; - - boost::shared_ptr control() { return _control; } + boost::shared_ptr pan_control() { return _control; } - /* XXX this is wrong. for multi-dimensional panners, there - must surely be more than 1 automation curve. - */ - /* TODO: Panner is-a Automation solves this */ - - virtual boost::shared_ptr automation() = 0; - sigc::signal Changed; /* for position */ sigc::signal StateChanged; /* for mute */ @@ -115,8 +102,11 @@ class StreamPanner : public sigc::trackable, public PBD::Stateful bool _muted; - struct PanControllable : public PBD::Controllable { - PanControllable (std::string name, StreamPanner& p) : Controllable (name), panner (p) {} + struct PanControllable : public AutomationControl { + PanControllable (Session& s, std::string name, StreamPanner& p) + : AutomationControl (s, boost::shared_ptr(new AutomationList( + ParamID(PanAutomation), 0.0, 1.0, 0.5)), name) + , panner (p) {} StreamPanner& panner; @@ -145,14 +135,6 @@ class BaseStereoPanner : public StreamPanner void distribute (AudioBuffer& src, BufferSet& obufs, gain_t gain_coeff, nframes_t nframes); - void snapshot (nframes_t now); - void transport_stopped (nframes_t frame); - void set_automation_state (AutoState); - void set_automation_style (AutoStyle); - - /* TODO: StreamPanner is-a Automatable? */ - boost::shared_ptr automation() { return _automation; } - /* old school automation loading */ int load (istream&, string path, uint32_t&); @@ -164,8 +146,6 @@ class BaseStereoPanner : public StreamPanner float desired_right; float left_interp; float right_interp; - - boost::shared_ptr _automation; }; class EqualPowerStereoPanner : public BaseStereoPanner @@ -197,19 +177,6 @@ class Multi2dPanner : public StreamPanner Multi2dPanner (Panner& parent); ~Multi2dPanner (); - void snapshot (nframes_t now); - void transport_stopped (nframes_t frame); - void set_automation_state (AutoState); - void set_automation_style (AutoStyle); - - /* XXX this is wrong. for multi-dimensional panners, there - must surely be more than 1 automation curve. - */ - - /* TODO: StreamPanner is-a Automatable? */ - - boost::shared_ptr automation() { return _automation; } - void distribute (AudioBuffer& src, BufferSet& obufs, gain_t gain_coeff, nframes_t nframes); void distribute_automated (AudioBuffer& src, BufferSet& obufs, nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers); @@ -226,7 +193,6 @@ class Multi2dPanner : public StreamPanner int load (istream&, string path, uint32_t&); private: - boost::shared_ptr _automation; void update (); }; diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index 00c31720a7..5c49069375 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -111,7 +111,6 @@ class Plugin : public PBD::StatefulDestructible, public Latent virtual const char * maker() const = 0; virtual uint32_t parameter_count () const = 0; virtual float default_value (uint32_t port) = 0; - virtual void set_parameter (uint32_t which, float val) = 0; virtual float get_parameter(uint32_t which) const = 0; virtual int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const = 0; @@ -140,10 +139,6 @@ class Plugin : public PBD::StatefulDestructible, public Latent virtual bool has_editor() const = 0; - sigc::signal ParameterChanged; - - PBD::Controllable *get_nth_control (uint32_t); - PluginInfoPtr get_info() { return _info; } void set_info (const PluginInfoPtr inf) { _info = inf; } @@ -154,32 +149,15 @@ class Plugin : public PBD::StatefulDestructible, public Latent cycles_t cycles() const { return _cycles; } protected: + friend class PluginInsert; + virtual void set_parameter (uint32_t which, float val) = 0; + ARDOUR::AudioEngine& _engine; ARDOUR::Session& _session; PluginInfoPtr _info; uint32_t _cycles; map presets; bool save_preset(string name, string domain /* vst, ladspa etc. */); - - void setup_controls (); - - struct PortControllable : public PBD::Controllable { - PortControllable (std::string name, Plugin&, uint32_t abs_port_id, - float lower, float upper, bool toggled, bool logarithmic); - - void set_value (float); - float get_value () const; - - Plugin& plugin; - uint32_t absolute_port; - float upper; - float lower; - float range; - bool toggled; - bool logarithmic; - }; - - vector controls; }; PluginPtr find_plugin(ARDOUR::Session&, string name, long unique_id, ARDOUR::PluginType); diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index 90c83057df..1e2064d991 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -77,8 +77,22 @@ class PluginInsert : public Processor bool is_generator() const; void set_parameter (ParamID param, float val); + float get_parameter (ParamID param); float default_parameter_value (ParamID param); + + struct PluginControl : public AutomationControl { + PluginControl (PluginInsert& p, boost::shared_ptr list); + + void set_value (float val); + float get_value (void) const; + + private: + PluginInsert& _plugin; + boost::shared_ptr _list; + bool _logarithmic; + bool _toggled; + }; boost::shared_ptr plugin(uint32_t num=0) const { if (num < _plugins.size()) { @@ -94,9 +108,6 @@ class PluginInsert : public Processor nframes_t signal_latency() const; - void transport_stopped (nframes_t now); - void automation_snapshot (nframes_t now); - private: void parameter_changed (ParamID, float); -- cgit v1.2.3