[SCM] calf/master: More simplification of the internal APIs.

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:40:02 UTC 2013


The following commit has been merged in the master branch:
commit 0253d45dcea29d308e8a10a60a5a17348150f734
Author: Krzysztof Foltman <wdev at foltman.com>
Date:   Tue Apr 6 01:36:17 2010 +0100

    More simplification of the internal APIs.
    
    Move the get_line_graph_iface to the remote control interface (the idea to put
    it into metadata class was wrong in first place). Remove plugin_metadata_proxy
    as it is not needed or used. Make JACK host class a regular class instead of a class
    template.

diff --git a/src/calf/giface.h b/src/calf/giface.h
index d63cd41..0f08327 100644
--- a/src/calf/giface.h
+++ b/src/calf/giface.h
@@ -319,8 +319,6 @@ struct plugin_metadata_iface
     virtual bool requires_midi() const =0;
     /// @return port offset of first control (parameter) port (= number of audio inputs + number of audio outputs in all existing plugins as for 1 Aug 2008)
     virtual int get_param_port_offset() const  = 0;
-    /// @return line_graph_iface if any
-    virtual const line_graph_iface *get_line_graph_iface() const = 0;
     /// @return table_edit_iface if any
     virtual const table_edit_iface *get_table_edit_iface() const = 0;
     /// @return NULL-terminated list of menu commands
@@ -373,6 +371,8 @@ struct plugin_ctl_iface
     virtual int send_status_updates(send_updates_iface *sui, int last_serial) { return last_serial; }
     /// Return metadata object
     virtual const plugin_metadata_iface *get_metadata_iface() const = 0;
+    /// @return line_graph_iface if any
+    virtual const line_graph_iface *get_line_graph_iface() const = 0;
     /// Do-nothing destructor to silence compiler warning
     virtual ~plugin_ctl_iface() {}
 };
@@ -451,6 +451,8 @@ struct audio_module_iface
     virtual uint32_t process(uint32_t offset, uint32_t numsamples, uint32_t inputs_mask, uint32_t outputs_mask) = 0;
     /// Message port processing function
     virtual uint32_t message_run(const void *valid_ports, void *output_ports) = 0;
+    /// @return line_graph_iface if any
+    virtual const line_graph_iface *get_line_graph_iface() const = 0;
     virtual ~audio_module_iface() {}
 };
 
@@ -548,6 +550,8 @@ public:
             offset = newend;
         }
     }
+    /// @return line_graph_iface if any
+    virtual const line_graph_iface *get_line_graph_iface() const { return dynamic_cast<const line_graph_iface *>(this); }
 };
 
 extern bool check_for_message_context_ports(const parameter_properties *parameters, int count);
@@ -614,7 +618,6 @@ public:
     bool get_midi() const { return Metadata::support_midi; }
     bool requires_midi() const { return Metadata::require_midi; }
     bool is_rt_capable() const { return Metadata::rt_capable; }
-    const line_graph_iface *get_line_graph_iface() const { return dynamic_cast<const line_graph_iface *>(this); }    
     const table_edit_iface *get_table_edit_iface() const { return dynamic_cast<const table_edit_iface *>(this); }    
     int get_param_port_offset()  const { return Metadata::in_count + Metadata::out_count; }
     const char *get_gui_xml() const { static const char *data_ptr = calf_plugins::load_gui_xml(get_id()); return data_ptr; }
@@ -634,42 +637,6 @@ public:
     }
 };
 
-/// A class for delegating metadata implementation to a "remote" metadata class.
-/// Used for GUI wrappers that cannot have a dependency on actual classes,
-/// and which instead take an "external" metadata object pointer, obtained
-/// through get_all_plugins.
-class plugin_metadata_proxy: public plugin_metadata_iface
-{
-public:
-    const plugin_metadata_iface *impl;
-public:
-    plugin_metadata_proxy(const plugin_metadata_iface *_impl) { impl = _impl; }
-    const char *get_name() const { return impl->get_name(); } 
-    const char *get_id() const { return impl->get_id(); } 
-    const char *get_label() const { return impl->get_label(); } 
-    int get_input_count() const { return impl->get_input_count(); }
-    int get_output_count() const { return impl->get_output_count(); }
-    int get_inputs_optional() const { return impl->get_inputs_optional(); }
-    int get_outputs_optional() const { return impl->get_outputs_optional(); }
-    int get_param_count() const { return impl->get_param_count(); }
-    bool get_midi() const { return impl->get_midi(); }
-    bool requires_midi() const { return impl->requires_midi(); }
-    bool is_rt_capable() const { return impl->is_rt_capable(); }
-    const line_graph_iface *get_line_graph_iface() const { return impl->get_line_graph_iface(); }    
-    const table_edit_iface *get_table_edit_iface() const { return impl->get_table_edit_iface(); }    
-    int get_param_port_offset() const { return impl->get_param_port_offset(); }
-    const char *get_gui_xml() const { return impl->get_gui_xml(); }
-    plugin_command_info *get_commands() const { return impl->get_commands(); }
-    const parameter_properties *get_param_props(int param_no) const { return impl->get_param_props(param_no); }
-    const char **get_port_names() const { return impl->get_port_names(); }
-    bool is_cv(int param_no) const { return impl->is_cv(param_no); }
-    bool is_noisy(int param_no) const { return impl->is_noisy(param_no); }
-    const ladspa_plugin_info &get_plugin_info() const { return impl->get_plugin_info(); }
-    bool requires_message_context() const { return impl->requires_message_context(); }
-    bool requires_string_ports() const { return impl->requires_string_ports(); }
-    void get_message_context_parameters(std::vector<int> &ports) const { impl->get_message_context_parameters(ports); }
-};
-
 #define CALF_PORT_NAMES(name) template<> const char *::plugin_metadata<name##_metadata>::port_names[]
 #define CALF_PORT_PROPS(name) template<> parameter_properties plugin_metadata<name##_metadata>::param_props[]
 #define CALF_PLUGIN_INFO(name) template<> calf_plugins::ladspa_plugin_info plugin_metadata<name##_metadata>::plugin_info
diff --git a/src/calf/jackhost.h b/src/calf/jackhost.h
index 8fd8acf..a1506d6 100644
--- a/src/calf/jackhost.h
+++ b/src/calf/jackhost.h
@@ -32,11 +32,11 @@
 
 namespace calf_plugins {
 
-class jack_host_base;
+class jack_host;
     
 class jack_client {
 protected:
-    std::vector<jack_host_base *> plugins;
+    std::vector<jack_host *> plugins;
     calf_utils::ptmutex mutex;
 public:
     jack_client_t *client;
@@ -54,7 +54,7 @@ public:
         client = NULL;
     }
     
-    void add(jack_host_base *plugin)
+    void add(jack_host *plugin)
     {
         calf_utils::ptlock lock(mutex);
         plugins.push_back(plugin);
@@ -115,9 +115,8 @@ public:
     static int do_jack_bufsize(jack_nframes_t numsamples, void *p);
 };
     
-class jack_host_base: public plugin_ctl_iface {
+class jack_host: public plugin_ctl_iface {
 public:
-    typedef int (*process_func)(jack_nframes_t nframes, void *p);
     struct port {
         jack_port_t *handle;
         float *data;
@@ -125,6 +124,16 @@ public:
         port() : handle(NULL), data(NULL) {}
         ~port() { }
     };
+public:
+    float **ins, **outs, **params;
+    std::vector<port> inputs, outputs;
+    std::vector<vumeter> input_vus, output_vus;
+    float *param_values;
+    float midi_meter;
+    audio_module_iface *module;
+    
+public:
+    typedef int (*process_func)(jack_nframes_t nframes, void *p);
     jack_client *client;
     bool changed;
     port midi_port;
@@ -132,21 +141,7 @@ public:
     std::string instance_name;
     int in_count, out_count;
     const plugin_metadata_iface *metadata;
-    virtual port *get_inputs()=0;
-    virtual port *get_outputs()=0;
-    virtual port *get_midi_port() { return get_metadata_iface()->get_midi() ? &midi_port : NULL; }
-    virtual float *get_params()=0;
-    virtual void init_module()=0;
-    virtual void cache_ports()=0;
-    virtual int process(jack_nframes_t nframes)=0;
-    
-    jack_host_base(const std::string &_name, const std::string &_instance_name) {
-        name = _name;
-        instance_name = _instance_name;
-        
-        client = NULL;
-        changed = true;
-    }
+    port *get_midi_port() { return get_metadata_iface()->get_midi() ? &midi_port : NULL; }
     
     void set_params(const float *params) {
         memcpy(get_params(), params, get_metadata_iface()->get_param_count() * sizeof(float));
@@ -163,25 +158,17 @@ public:
     
     void close();
     
-    virtual ~jack_host_base() {
-    }
-};
-
-template<class Module>
-class jack_host: public jack_host_base {
-public:
-    float **ins, **outs, **params;
-    std::vector<port> inputs, outputs;
-    std::vector<vumeter> input_vus, output_vus;
-    float *param_values;
-    float midi_meter;
-    audio_module_iface *iface;
-    
-    jack_host(audio_module_iface *_iface, const std::string &_name, const std::string &_instance_name, calf_plugins::progress_report_iface *_priface)
-    : jack_host_base(_name, _instance_name), iface(_iface)
+    jack_host(audio_module_iface *_module, const std::string &_name, const std::string &_instance_name, calf_plugins::progress_report_iface *_priface)
+    : module(_module)
     {
-        iface->get_port_arrays(ins, outs, params);
-        metadata = iface->get_metadata_iface();
+        name = _name;
+        instance_name = _instance_name;
+        
+        client = NULL;
+        changed = true;
+
+        module->get_port_arrays(ins, outs, params);
+        metadata = module->get_metadata_iface();
         in_count = metadata->get_input_count();
         out_count = metadata->get_output_count();
         inputs.resize(in_count);
@@ -194,8 +181,8 @@ public:
         }
         clear_preset();
         midi_meter = 0;
-        iface->set_progress_report_iface(_priface);
-        iface->post_instantiate();
+        module->set_progress_report_iface(_priface);
+        module->post_instantiate();
     }
     
     ~jack_host()
@@ -206,9 +193,9 @@ public:
     }
     
     virtual void init_module() {
-        iface->set_sample_rate(client->sample_rate);
-        iface->activate();
-        iface->params_changed();
+        module->set_sample_rate(client->sample_rate);
+        module->activate();
+        module->params_changed();
     }
 
     virtual const parameter_properties* get_param_props(int param_no) { return metadata->get_param_props(param_no); }
@@ -219,26 +206,26 @@ public:
         switch(buffer[0] >> 4)
         {
         case 8:
-            iface->note_off(buffer[1], buffer[2]);
+            module->note_off(buffer[1], buffer[2]);
             break;
         case 9:
             if (!buffer[2])
-                iface->note_off(buffer[1], 0);
+                module->note_off(buffer[1], 0);
             else
-                iface->note_on(buffer[1], buffer[2]);
+                module->note_on(buffer[1], buffer[2]);
             break;
         case 11:
-            iface->control_change(buffer[1], buffer[2]);
+            module->control_change(buffer[1], buffer[2]);
             break;
         case 12:
-            iface->program_change(buffer[1]);
+            module->program_change(buffer[1]);
             break;
         case 13:
-            iface->channel_pressure(buffer[1]);
+            module->channel_pressure(buffer[1]);
             break;
         case 14:
             value = buffer[1] + 128 * buffer[2] - 8192;
-            iface->pitch_bend(value);
+            module->pitch_bend(value);
             break;
         }
     }
@@ -248,7 +235,7 @@ public:
             return;
         for (int i = 0; i < in_count; i++)
             input_vus[i].update(ins[i] + time, len);
-        unsigned int mask = iface->process(time, len, -1, -1);
+        unsigned int mask = module->process(time, len, -1, -1);
         for (int i = 0; i < out_count; i++)
         {
             if (!(mask & (1 << i))) {
@@ -282,7 +269,7 @@ public:
         if (metadata->get_midi())
             midi_port.data = (float *)jack_port_get_buffer(midi_port.handle, nframes);
         if (changed) {
-            iface->params_changed();
+            module->params_changed();
             changed = false;
         }
 
@@ -312,7 +299,7 @@ public:
             }
         }
         process_part(time, nframes - time);
-        iface->params_reset();
+        module->params_reset();
         return 0;
     }
     
@@ -334,25 +321,15 @@ public:
         param_values[param_no] = value;
         changed = true;
     }
-    virtual void execute(int cmd_no) {
-        iface->execute(cmd_no);
-    }
-    virtual char *configure(const char *key, const char *value) { 
-        return iface->configure(key, value);
-    }
-    virtual void send_configures(send_configure_iface *sci) {
-        iface->send_configures(sci);
-    }
-    virtual int send_status_updates(send_updates_iface *sui, int last_serial) { 
-        return iface->send_status_updates(sui, last_serial);
-    }
-    virtual const plugin_metadata_iface *get_metadata_iface() const
-    {
-        return iface->get_metadata_iface();
-    }
+    virtual void execute(int cmd_no) { module->execute(cmd_no); }
+    virtual char *configure(const char *key, const char *value) { return module->configure(key, value); }
+    virtual void send_configures(send_configure_iface *sci) { module->send_configures(sci); }
+    virtual int send_status_updates(send_updates_iface *sui, int last_serial) { return module->send_status_updates(sui, last_serial); }
+    virtual const plugin_metadata_iface *get_metadata_iface() const { return module->get_metadata_iface(); }
+    virtual const line_graph_iface *get_line_graph_iface() const { return module->get_line_graph_iface(); }
 };
 
-extern jack_host_base *create_jack_host(const char *name, const std::string &instance_name, calf_plugins::progress_report_iface *priface);
+extern jack_host *create_jack_host(const char *name, const std::string &instance_name, calf_plugins::progress_report_iface *priface);
 
 };
 
diff --git a/src/calf/ladspa_wrap.h b/src/calf/ladspa_wrap.h
index 6625a1f..1f3ebee 100644
--- a/src/calf/ladspa_wrap.h
+++ b/src/calf/ladspa_wrap.h
@@ -45,6 +45,7 @@ struct ladspa_instance: public plugin_ctl_iface
 #endif
     
     ladspa_instance(audio_module_iface *_module, ladspa_plugin_metadata_set *_ladspa, int sample_rate);
+    virtual const line_graph_iface *get_line_graph_iface() const { return module->get_line_graph_iface(); }
     virtual float get_param_value(int param_no);
     virtual void set_param_value(int param_no, float value);
     virtual bool activate_preset(int bank, int program);
diff --git a/src/calf/lv2wrap.h b/src/calf/lv2wrap.h
index 983c5f7..d28a2e8 100644
--- a/src/calf/lv2wrap.h
+++ b/src/calf/lv2wrap.h
@@ -156,10 +156,8 @@ struct lv2_instance: public plugin_ctl_iface, public progress_report_iface
             return;
         *params[param_no] = value;
     }
-    virtual const plugin_metadata_iface *get_metadata_iface() const
-    {
-        return metadata;
-    }
+    virtual const plugin_metadata_iface *get_metadata_iface() const { return metadata; }
+    virtual const line_graph_iface *get_line_graph_iface() const { return module->get_line_graph_iface(); }
 };
 
 struct LV2_Calf_Descriptor {
diff --git a/src/dssigui.cpp b/src/dssigui.cpp
index 6ec00ff..01a9f1c 100644
--- a/src/dssigui.cpp
+++ b/src/dssigui.cpp
@@ -130,7 +130,7 @@ void param_line_graphs::clear()
 
 }
 
-struct plugin_proxy: public plugin_ctl_iface, public plugin_metadata_proxy, public line_graph_iface
+struct plugin_proxy: public plugin_ctl_iface, public line_graph_iface
 {
     osc_client *client;
     bool send_osc;
@@ -140,10 +140,11 @@ struct plugin_proxy: public plugin_ctl_iface, public plugin_metadata_proxy, publ
     float *params;
     map<int, param_line_graphs> graphs;
     bool update_graphs;
+    const plugin_metadata_iface *metadata;
 
     plugin_proxy(const plugin_metadata_iface *md)
-    : plugin_metadata_proxy(md)
     {
+        metadata = md;
         client = NULL;
         send_osc = false;
         update_graphs = true;
@@ -151,7 +152,7 @@ struct plugin_proxy: public plugin_ctl_iface, public plugin_metadata_proxy, publ
         param_count = md->get_param_count();
         params = new float[param_count];
         for (int i = 0; i < param_count; i++)
-            params[i] = get_param_props(i)->def_value;
+            params[i] = metadata->get_param_props(i)->def_value;
     }
     virtual float get_param_value(int param_no) {
         if (param_no < 0 || param_no >= param_count)
@@ -166,7 +167,7 @@ struct plugin_proxy: public plugin_ctl_iface, public plugin_metadata_proxy, publ
         if (send_osc)
         {
             osc_inline_typed_strstream str;
-            str << (uint32_t)(param_no + get_param_port_offset()) << value;
+            str << (uint32_t)(param_no + metadata->get_param_port_offset()) << value;
             client->send("/control", str);
         }
     }
@@ -212,7 +213,7 @@ struct plugin_proxy: public plugin_ctl_iface, public plugin_metadata_proxy, publ
     virtual bool get_dot(int index, int subindex, float &x, float &y, int &size, cairo_iface *context) const;
     virtual bool get_gridline(int index, int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context) const;
     void update_cairo_context(cairo_iface *context, cairo_params &item) const;
-    virtual const plugin_metadata_iface *get_metadata_iface() const { return this; }
+    virtual const plugin_metadata_iface *get_metadata_iface() const { return metadata; }
 };
 
 bool plugin_proxy::get_graph(int index, int subindex, float *data, int points, cairo_iface *context) const
@@ -508,9 +509,9 @@ void dssi_osc_server::receive_osc_message(std::string address, std::string args,
         {
             bool sosc = plugin->send_osc;
             plugin->send_osc = false;
-            int count = plugin->get_param_count();
+            int count = plugin->metadata->get_param_count();
             for (int i =0 ; i < count; i++)
-                plugin->set_param_value(i, plugin->get_param_props(i)->def_value);
+                plugin->set_param_value(i, plugin->metadata->get_param_props(i)->def_value);
             plugin->send_osc = sosc;
             window->gui->refresh();
             // special handling for default preset
@@ -535,13 +536,13 @@ void dssi_osc_server::receive_osc_message(std::string address, std::string args,
         
         buffer >> port >> val;
         
-        int idx = port - plugin->get_param_port_offset();
+        int idx = port - plugin->metadata->get_param_port_offset();
         debug_printf("CONTROL %d %f\n", idx, val);
         bool sosc = plugin->send_osc;
         plugin->send_osc = false;
         window->gui->set_param_value(idx, val);
         plugin->send_osc = sosc;
-        if (plugin->get_param_props(idx)->flags & PF_PROP_GRAPH)
+        if (plugin->metadata->get_param_props(idx)->flags & PF_PROP_GRAPH)
             plugin->update_graphs = true;
         return;
     }
diff --git a/src/gui_controls.cpp b/src/gui_controls.cpp
index 4e21b72..dd3de1e 100644
--- a/src/gui_controls.cpp
+++ b/src/gui_controls.cpp
@@ -807,7 +807,7 @@ GtkWidget *line_graph_param_control::create(plugin_gui *_gui, int _param_no)
     widget->requisition.width = get_int("width", 40);
     widget->requisition.height = get_int("height", 40);
     calf_line_graph_set_square(clg, get_int("square", 0));
-    clg->source = gui->plugin->get_metadata_iface()->get_line_graph_iface();
+    clg->source = gui->plugin->get_line_graph_iface();
     clg->source_id = param_no;
     gtk_widget_set_name(GTK_WIDGET(widget), "Calf-LineGraph");
     return widget;
diff --git a/src/jackhost.cpp b/src/jackhost.cpp
index dec3da7..2ed27ae 100644
--- a/src/jackhost.cpp
+++ b/src/jackhost.cpp
@@ -54,14 +54,14 @@ static bool load_data_set_cb(lash_config_handle_t *handle, void *user_data);
 static bool quit_cb(void *user_data);
 #endif
 
-jack_host_base *calf_plugins::create_jack_host(const char *effect_name, const std::string &instance_name, calf_plugins::progress_report_iface *priface)
+jack_host *calf_plugins::create_jack_host(const char *effect_name, const std::string &instance_name, calf_plugins::progress_report_iface *priface)
 {
-    #define PER_MODULE_ITEM(name, isSynth, jackname) if (!strcasecmp(effect_name, jackname)) return new jack_host<audio_module_iface>(new name##_audio_module, effect_name, instance_name, priface);
+    #define PER_MODULE_ITEM(name, isSynth, jackname) if (!strcasecmp(effect_name, jackname)) return new jack_host(new name##_audio_module, effect_name, instance_name, priface);
     #include <calf/modulelist.h>
     return NULL;
 }
 
-void jack_host_base::open(jack_client *_client)
+void jack_host::open(jack_client *_client)
 {
     client = _client; //jack_client_open(client_name, JackNullOption, &status);
     
@@ -73,7 +73,7 @@ void jack_host_base::open(jack_client *_client)
     changed = false;
 }
 
-void jack_host_base::create_ports() {
+void jack_host::create_ports() {
     char buf[32];
     char buf2[64];
     string prefix = client->name + ":";
@@ -112,7 +112,7 @@ void jack_host_base::create_ports() {
     }
 }
 
-void jack_host_base::close() {
+void jack_host::close() {
     port *inputs = get_inputs(), *outputs = get_outputs();
     int input_count = metadata->get_input_count(), output_count = metadata->get_output_count();
     for (int i = 0; i < input_count; i++) {
@@ -202,7 +202,7 @@ struct host_session: public main_window_owner_iface, public calf_plugins::progre
     string autoconnect_midi;
     int autoconnect_midi_index;
     set<int> chains;
-    vector<jack_host_base *> plugins;
+    vector<jack_host *> plugins;
     main_window *main_win;
     bool restoring_session;
     std::set<std::string> instances;
@@ -275,7 +275,7 @@ void host_session::add_plugin(string name, string preset, string instance_name)
 {
     if (instance_name.empty())
         instance_name = get_next_instance_name(name);
-    jack_host_base *jh = create_jack_host(name.c_str(), instance_name, this);
+    jack_host *jh = create_jack_host(name.c_str(), instance_name, this);
     if (!jh) {
         string s = 
         #define PER_MODULE_ITEM(name, isSynth, jackname) jackname ", "
@@ -367,7 +367,7 @@ void host_session::open()
 
 void host_session::new_plugin(const char *name)
 {
-    jack_host_base *jh = create_jack_host(name, get_next_instance_name(name), this);
+    jack_host *jh = create_jack_host(name, get_next_instance_name(name), this);
     if (!jh)
         return;
     instances.insert(jh->instance_name);
@@ -564,7 +564,7 @@ char *host_session::save_file(const char *name)
     data = "<?xml version=\"1.1\" encoding=\"utf-8\">\n";
     data = "<rack>\n";
     for (unsigned int i = 0; i < plugins.size(); i++) {
-        jack_host_base *p = plugins[i];
+        jack_host *p = plugins[i];
         plugin_preset preset;
         preset.plugin = p->metadata->get_id();
         preset.get_from(p);
@@ -625,7 +625,7 @@ void host_session::update_lash()
                 lash_send_config(lash_client, cfg);
                 
                 for (unsigned int i = 0; i < plugins.size(); i++) {
-                    jack_host_base *p = plugins[i];
+                    jack_host *p = plugins[i];
                     char ss[32];
                     plugin_preset preset;
                     preset.plugin = p->get_id();
@@ -725,7 +725,7 @@ bool save_data_set_cb(lash_config_handle_t *handle, void *user_data)
     pstr = encode_map(tmp);
     lash_config_write_raw(handle, "global", pstr.c_str(), pstr.length());
     for (unsigned int i = 0; i < sess->plugins.size(); i++) {
-        jack_host_base *p = sess->plugins[i];
+        jack_host *p = sess->plugins[i];
         char ss[32];
         plugin_preset preset;
         preset.plugin = p->metadata->get_id();
diff --git a/src/lv2gui.cpp b/src/lv2gui.cpp
index 16f1b78..7401c7a 100644
--- a/src/lv2gui.cpp
+++ b/src/lv2gui.cpp
@@ -99,7 +99,7 @@ struct plugin_proxy_base
     /// Obtain instance pointers
     void resolve_instance();
 
-    /// Find a line graph interface, if available (via instance access/data access extensions)
+    /// Obtain line graph interface if available
     const line_graph_iface *get_line_graph_iface() const;
     
     /// Map an URI to an integer value using a given URI map
@@ -191,7 +191,7 @@ uint32_t plugin_proxy_base::map_uri(const char *mapURI, const char *keyURI)
 const line_graph_iface *plugin_proxy_base::get_line_graph_iface() const
 {
     if (instance)
-        return instance->get_metadata_iface()->get_line_graph_iface();
+        return instance->get_line_graph_iface();
     return NULL;
 }
 
@@ -236,7 +236,7 @@ void plugin_proxy_base::enable_all_sends()
 
 /// Plugin controller that uses LV2 host with help of instance/data access to remotely
 /// control a plugin from the GUI
-struct lv2_plugin_proxy: public plugin_ctl_iface, public plugin_metadata_proxy, public plugin_proxy_base
+struct lv2_plugin_proxy: public plugin_ctl_iface, public plugin_proxy_base
 {
     /// Plugin GTK+ GUI object pointer
     plugin_gui *gui;
@@ -244,8 +244,7 @@ struct lv2_plugin_proxy: public plugin_ctl_iface, public plugin_metadata_proxy,
     int source_id;
     
     lv2_plugin_proxy(const plugin_metadata_iface *md, LV2UI_Write_Function wf, LV2UI_Controller c, const LV2_Feature* const* f)
-    : plugin_metadata_proxy(md)
-    , plugin_proxy_base(md, wf, c, f)
+    : plugin_proxy_base(md, wf, c, f)
     {
         gui = NULL;
         instance = NULL;
@@ -273,15 +272,8 @@ struct lv2_plugin_proxy: public plugin_ctl_iface, public plugin_metadata_proxy,
         return false;
     }
     
-    virtual char *configure(const char *key, const char *value)
-    {
-        plugin_proxy_base::configure(key, value);
-        return NULL;
-    }
-    
-    virtual const line_graph_iface *get_line_graph_iface() const {
-        return plugin_proxy_base::get_line_graph_iface();
-    }
+    /// Override for a method in plugin_ctl_iface - trivial delegation to base class
+    virtual char *configure(const char *key, const char *value) { return plugin_proxy_base::configure(key, value); }
     
     virtual float get_level(unsigned int port) { return 0.f; }
     virtual void execute(int command_no) { assert(0); }
@@ -289,6 +281,9 @@ struct lv2_plugin_proxy: public plugin_ctl_iface, public plugin_metadata_proxy,
         fprintf(stderr, "TODO: send_configures (non-control port configuration dump) not implemented in LV2 GUIs\n");
     }
     virtual const plugin_metadata_iface *get_metadata_iface() const { return plugin_metadata; }
+    /// Override for a method in plugin_ctl_iface - trivial delegation to base class
+    virtual const line_graph_iface *get_line_graph_iface() const { return plugin_proxy_base::get_line_graph_iface(); }
+    
 };
 
 static gboolean plugin_on_idle(void *data)
@@ -322,7 +317,7 @@ LV2UI_Handle gui_instantiate(const struct _LV2UI_Descriptor* descriptor,
     main->conditions.insert("lv2gui");    
     plugin_gui_window *window = new plugin_gui_window(main);
     plugin_gui *gui = new plugin_gui(window);
-    const char *xml = proxy->get_gui_xml();
+    const char *xml = proxy->plugin_metadata->get_gui_xml();
     assert(xml);
     *(GtkWidget **)(widget) = gui->create_from_xml(proxy, xml);
     proxy->enable_all_sends();

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list