Another not-quite-there-but-better commit.
[ardour.git] / libs / ardour / ardour / plugin.h
index feb86f1b7b2e4a2bf399d08ce234d7d6460c965a..5c490693758f6f974db6d2c9e173ca415c1fef09 100644 (file)
 
 #include <jack/types.h>
 #include <ardour/types.h>
+#include <ardour/chan_count.h>
 #include <ardour/plugin_state.h>
 #include <ardour/cycles.h>
+#include <ardour/latent.h>
+#include <ardour/param_id.h>
 
 #include <vector>
 #include <set>
@@ -60,8 +63,8 @@ class PluginInfo {
 
        string name;
        string category;
-       uint32_t n_inputs;
-       uint32_t n_outputs;
+       ChanCount n_inputs;
+       ChanCount n_outputs;
        ARDOUR::PluginType type;
 
        long unique_id;
@@ -77,7 +80,7 @@ class PluginInfo {
 typedef boost::shared_ptr<PluginInfo> PluginInfoPtr;
 typedef std::list<PluginInfoPtr> PluginInfoList;
 
-class Plugin : public PBD::StatefulDestructible
+class Plugin : public PBD::StatefulDestructible, public Latent
 {
   public:
        Plugin (ARDOUR::AudioEngine&, ARDOUR::Session&);
@@ -108,8 +111,6 @@ class Plugin : public PBD::StatefulDestructible
        virtual const char * maker() const = 0;
        virtual uint32_t parameter_count () const = 0;
        virtual float default_value (uint32_t port) = 0;
-       virtual nframes_t latency() const = 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;
@@ -120,10 +121,10 @@ class Plugin : public PBD::StatefulDestructible
 
        virtual int connect_and_run (BufferSet& bufs, uint32_t& in, uint32_t& out, nframes_t nframes, nframes_t offset) = 0;
        
-       virtual std::set<uint32_t> automatable() const = 0;
+       virtual std::set<ParamID> automatable() const = 0;
        virtual void store_state (ARDOUR::PluginState&) = 0;
        virtual void restore_state (ARDOUR::PluginState&) = 0;
-       virtual string describe_parameter (uint32_t) = 0;
+       virtual string describe_parameter (ParamID) = 0;
        virtual string state_node_name() const = 0;
        virtual void print_parameter (uint32_t, char*, uint32_t len) const = 0;
 
@@ -138,10 +139,6 @@ class Plugin : public PBD::StatefulDestructible
 
        virtual bool has_editor() const = 0;
 
-       sigc::signal<void,uint32_t,float> ParameterChanged;
-       
-       PBD::Controllable *get_nth_control (uint32_t);
-
        PluginInfoPtr get_info() { return _info; }
        void set_info (const PluginInfoPtr inf) { _info = inf; }
 
@@ -152,32 +149,15 @@ class Plugin : public PBD::StatefulDestructible
        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<string,string>       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<PortControllable*> controls;
 };
 
 PluginPtr find_plugin(ARDOUR::Session&, string name, long unique_id, ARDOUR::PluginType);