[SCM] calf/master: More cleanups.
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:40:01 UTC 2013
The following commit has been merged in the master branch:
commit 2fb86fbfa37645474fb7493ff210157f80a52004
Author: Krzysztof Foltman <wdev at foltman.com>
Date: Mon Apr 5 15:19:36 2010 +0100
More cleanups.
Add const attribute in few more places. Workaround the compiler warning about
strict aliasing rules (seems to be caused by the virtual base class - I have
no clue how to solve it properly and whether it's a proper behaviour on
compiler side).
diff --git a/src/calf/giface.h b/src/calf/giface.h
index 0796758..9913ddf 100644
--- a/src/calf/giface.h
+++ b/src/calf/giface.h
@@ -326,7 +326,7 @@ struct plugin_metadata_iface
/// @return NULL-terminated list of menu commands
virtual plugin_command_info *get_commands() const { return NULL; }
/// @return description structure for given parameter
- virtual parameter_properties *get_param_props(int param_no) const = 0;
+ virtual const parameter_properties *get_param_props(int param_no) const = 0;
/// @return retrieve names of audio ports (@note control ports are named in parameter_properties, not here)
virtual const char **get_port_names() const = 0;
/// @return description structure for the plugin
@@ -381,7 +381,7 @@ struct plugin_list_info_iface;
class plugin_registry
{
public:
- typedef std::vector<plugin_metadata_iface *> plugin_vector;
+ typedef std::vector<const plugin_metadata_iface *> plugin_vector;
private:
plugin_vector plugins;
plugin_registry();
@@ -456,8 +456,8 @@ public:
}
};
-extern bool check_for_message_context_ports(parameter_properties *parameters, int count);
-extern bool check_for_string_ports(parameter_properties *parameters, int count);
+extern bool check_for_message_context_ports(const parameter_properties *parameters, int count);
+extern bool check_for_string_ports(const parameter_properties *parameters, int count);
#if USE_EXEC_GUI || USE_DSSI
@@ -524,7 +524,7 @@ public:
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; }
plugin_command_info *get_commands() const { return NULL; }
- parameter_properties *get_param_props(int param_no) const { return ¶m_props[param_no]; }
+ const parameter_properties *get_param_props(int param_no) const { return ¶m_props[param_no]; }
const char **get_port_names() const { return port_names; }
bool is_cv(int param_no) const { return true; }
bool is_noisy(int param_no) const { return false; }
@@ -537,6 +537,7 @@ public:
ports.push_back(i);
}
}
+ const plugin_metadata_iface *get_metadata_iface_ptr() const { return static_cast<const Metadata *>(this); }
};
/// A class for delegating metadata implementation to a "remote" metadata class.
@@ -565,7 +566,7 @@ public:
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(); }
- parameter_properties *get_param_props(int param_no) const { return impl->get_param_props(param_no); }
+ 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); }
diff --git a/src/calf/gui.h b/src/calf/gui.h
index fc834ca..a81af18 100644
--- a/src/calf/gui.h
+++ b/src/calf/gui.h
@@ -64,7 +64,7 @@ struct param_control: public control_base
};
param_control() { gui = NULL; param_no = -1; label = NULL; in_change = 0;}
- inline parameter_properties &get_props();
+ inline const parameter_properties &get_props();
virtual void init_xml(const char *element) {}
virtual GtkWidget *create_label();
@@ -187,7 +187,7 @@ public:
};
-inline parameter_properties ¶m_control::get_props()
+inline const parameter_properties ¶m_control::get_props()
{
return *gui->plugin->get_param_props(param_no);
}
diff --git a/src/calf/jackhost.h b/src/calf/jackhost.h
index d6a1816..88e47ed 100644
--- a/src/calf/jackhost.h
+++ b/src/calf/jackhost.h
@@ -202,7 +202,7 @@ public:
Module::params_changed();
}
- virtual parameter_properties* get_param_props(int param_no) { return Module::param_props + param_no; }
+ virtual const parameter_properties* get_param_props(int param_no) { return Module::param_props + param_no; }
void handle_event(uint8_t *buffer, uint32_t size)
{
diff --git a/src/calf/ladspa_wrap.h b/src/calf/ladspa_wrap.h
index 21800dc..f2a71b8 100644
--- a/src/calf/ladspa_wrap.h
+++ b/src/calf/ladspa_wrap.h
@@ -70,7 +70,7 @@ struct ladspa_instance: public Module, public plugin_ctl_iface
feedback_sender = NULL;
#endif
}
- virtual parameter_properties *get_param_props(int param_no)
+ virtual const parameter_properties *get_param_props(int param_no)
{
return &Module::param_props[param_no];
}
@@ -223,7 +223,7 @@ struct ladspa_wrapper
for (; i < ins + outs + params; i++)
{
LADSPA_PortRangeHint &prh = ((LADSPA_PortRangeHint *)descriptor.PortRangeHints)[i];
- parameter_properties &pp = Module::param_props[i - ins - outs];
+ const parameter_properties &pp = Module::param_props[i - ins - outs];
((int *)descriptor.PortDescriptors)[i] =
LADSPA_PORT_CONTROL | (pp.flags & PF_PROP_OUTPUT ? LADSPA_PORT_OUTPUT : LADSPA_PORT_INPUT);
prh.HintDescriptor = LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_BOUNDED_BELOW;
diff --git a/src/calf/lv2wrap.h b/src/calf/lv2wrap.h
index fcbff10..604cc05 100644
--- a/src/calf/lv2wrap.h
+++ b/src/calf/lv2wrap.h
@@ -73,7 +73,7 @@ struct lv2_instance: public plugin_ctl_iface, public progress_report_iface, publ
Module::progress_report = this;
Module::post_instantiate();
}
- virtual parameter_properties *get_param_props(int param_no)
+ virtual const parameter_properties *get_param_props(int param_no)
{
return &Module::param_props[param_no];
}
@@ -133,7 +133,7 @@ struct lv2_instance: public plugin_ctl_iface, public progress_report_iface, publ
for (unsigned int i = 0; i < message_params.size(); i++)
{
int pn = message_params[i];
- parameter_properties &pp = *get_param_props(pn);
+ const parameter_properties &pp = *get_param_props(pn);
if ((pp.flags & PF_TYPEMASK) == PF_STRING
&& (((LV2_String_Data *)Module::params[pn])->flags & LV2_STRING_DATA_CHANGED_FLAG)) {
printf("Calling configure on %s\n", pp.short_name);
diff --git a/src/giface.cpp b/src/giface.cpp
index 529e3be..c9cdedc 100644
--- a/src/giface.cpp
+++ b/src/giface.cpp
@@ -192,7 +192,7 @@ void calf_plugins::plugin_ctl_iface::clear_preset() {
int param_count = get_param_count();
for (int i=0; i < param_count; i++)
{
- parameter_properties &pp = *get_param_props(i);
+ const parameter_properties &pp = *get_param_props(i);
if ((pp.flags & PF_TYPEMASK) == PF_STRING)
{
configure(pp.short_name, pp.choices ? pp.choices[0] : "");
@@ -213,7 +213,7 @@ const char *calf_plugins::load_gui_xml(const std::string &plugin_id)
}
}
-bool calf_plugins::check_for_message_context_ports(parameter_properties *parameters, int count)
+bool calf_plugins::check_for_message_context_ports(const parameter_properties *parameters, int count)
{
for (int i = count - 1; i >= 0; i--)
{
@@ -223,7 +223,7 @@ bool calf_plugins::check_for_message_context_ports(parameter_properties *paramet
return false;
}
-bool calf_plugins::check_for_string_ports(parameter_properties *parameters, int count)
+bool calf_plugins::check_for_string_ports(const parameter_properties *parameters, int count)
{
for (int i = count - 1; i >= 0; i--)
{
diff --git a/src/gui.cpp b/src/gui.cpp
index 912aa87..8893461 100644
--- a/src/gui.cpp
+++ b/src/gui.cpp
@@ -67,7 +67,7 @@ GtkWidget *param_control::create_label()
void param_control::update_label()
{
- parameter_properties &props = get_props();
+ const parameter_properties &props = get_props();
gtk_label_set_text (GTK_LABEL (label), props.to_string(gui->plugin->get_param_value(param_no)).c_str());
}
@@ -424,7 +424,7 @@ void plugin_gui::on_idle()
{
if (params[i]->param_no != -1)
{
- parameter_properties &props = *plugin->get_param_props(params[i]->param_no);
+ const parameter_properties &props = *plugin->get_param_props(params[i]->param_no);
bool is_output = (props.flags & PF_PROP_OUTPUT) != 0;
if (is_output) {
params[i]->set();
diff --git a/src/gui_controls.cpp b/src/gui_controls.cpp
index eab1fa9..c2028a7 100644
--- a/src/gui_controls.cpp
+++ b/src/gui_controls.cpp
@@ -44,7 +44,7 @@ GtkWidget *combo_box_param_control::create(plugin_gui *_gui, int _param_no)
param_no = _param_no;
lstore = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); // value, key
- parameter_properties &props = get_props();
+ const parameter_properties &props = get_props();
widget = gtk_combo_box_new_text ();
if (props.choices)
{
@@ -60,13 +60,13 @@ GtkWidget *combo_box_param_control::create(plugin_gui *_gui, int _param_no)
void combo_box_param_control::set()
{
_GUARD_CHANGE_
- parameter_properties &props = get_props();
+ const parameter_properties &props = get_props();
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), (int)gui->plugin->get_param_value(param_no) - (int)props.min);
}
void combo_box_param_control::get()
{
- parameter_properties &props = get_props();
+ const parameter_properties &props = get_props();
gui->set_param_value(param_no, gtk_combo_box_get_active (GTK_COMBO_BOX(widget)) + props.min, this);
}
@@ -180,14 +180,14 @@ void hscale_param_control::init_xml(const char *element)
void hscale_param_control::set()
{
_GUARD_CHANGE_
- parameter_properties &props = get_props();
+ const parameter_properties &props = get_props();
gtk_range_set_value (GTK_RANGE (widget), props.to_01 (gui->plugin->get_param_value(param_no)));
// hscale_value_changed (GTK_HSCALE (widget), (gpointer)this);
}
void hscale_param_control::get()
{
- parameter_properties &props = get_props();
+ const parameter_properties &props = get_props();
float cvalue = props.from_01 (gtk_range_get_value (GTK_RANGE (widget)));
gui->set_param_value(param_no, cvalue, this);
}
@@ -243,14 +243,14 @@ void vscale_param_control::init_xml(const char *element)
void vscale_param_control::set()
{
_GUARD_CHANGE_
- parameter_properties &props = get_props();
+ const parameter_properties &props = get_props();
gtk_range_set_value (GTK_RANGE (widget), props.to_01 (gui->plugin->get_param_value(param_no)));
// vscale_value_changed (GTK_HSCALE (widget), (gpointer)this);
}
void vscale_param_control::get()
{
- parameter_properties &props = get_props();
+ const parameter_properties &props = get_props();
float cvalue = props.from_01 (gtk_range_get_value (GTK_RANGE (widget)));
gui->set_param_value(param_no, cvalue, this);
}
@@ -287,7 +287,7 @@ GtkWidget *value_param_control::create(plugin_gui *_gui, int _param_no)
widget = gtk_label_new ("");
if (param_no != -1)
{
- parameter_properties &props = get_props();
+ const parameter_properties &props = get_props();
gtk_label_set_width_chars (GTK_LABEL (widget), props.get_char_count());
}
else
@@ -307,7 +307,7 @@ void value_param_control::set()
if (param_no == -1)
return;
_GUARD_CHANGE_
- parameter_properties &props = get_props();
+ const parameter_properties &props = get_props();
gtk_label_set_text (GTK_LABEL (widget), props.to_string(gui->plugin->get_param_value(param_no)).c_str());
}
@@ -324,7 +324,7 @@ void value_param_control::send_status(const char *key, const char *value)
GtkWidget *vumeter_param_control::create(plugin_gui *_gui, int _param_no)
{
gui = _gui, param_no = _param_no;
- // parameter_properties &props = get_props();
+ // const parameter_properties &props = get_props();
widget = calf_vumeter_new ();
gtk_widget_set_name(GTK_WIDGET(widget), "calf-vumeter");
calf_vumeter_set_mode (CALF_VUMETER (widget), (CalfVUMeterMode)get_int("mode", 0));
@@ -337,7 +337,7 @@ GtkWidget *vumeter_param_control::create(plugin_gui *_gui, int _param_no)
void vumeter_param_control::set()
{
_GUARD_CHANGE_
- parameter_properties &props = get_props();
+ const parameter_properties &props = get_props();
calf_vumeter_set_value (CALF_VUMETER (widget), props.to_01(gui->plugin->get_param_value(param_no)));
if (label)
update_label();
@@ -348,7 +348,7 @@ void vumeter_param_control::set()
GtkWidget *led_param_control::create(plugin_gui *_gui, int _param_no)
{
gui = _gui, param_no = _param_no;
- // parameter_properties &props = get_props();
+ // const parameter_properties &props = get_props();
widget = calf_led_new ();
gtk_widget_set_name(GTK_WIDGET(widget), "calf-led");
CALF_LED(widget)->led_mode = get_int("mode", 0);
@@ -359,7 +359,7 @@ GtkWidget *led_param_control::create(plugin_gui *_gui, int _param_no)
void led_param_control::set()
{
_GUARD_CHANGE_
- // parameter_properties &props = get_props();
+ // const parameter_properties &props = get_props();
calf_led_set_value (CALF_LED (widget), gui->plugin->get_param_value(param_no));
if (label)
update_label();
@@ -370,7 +370,7 @@ void led_param_control::set()
GtkWidget *tube_param_control::create(plugin_gui *_gui, int _param_no)
{
gui = _gui, param_no = _param_no;
- // parameter_properties &props = get_props();
+ // const parameter_properties &props = get_props();
widget = calf_tube_new ();
gtk_widget_set_name(GTK_WIDGET(widget), "calf-tube");
CALF_TUBE(widget)->size = get_int("size", 2);
@@ -382,7 +382,7 @@ GtkWidget *tube_param_control::create(plugin_gui *_gui, int _param_no)
void tube_param_control::set()
{
_GUARD_CHANGE_
- // parameter_properties &props = get_props();
+ // const parameter_properties &props = get_props();
calf_tube_set_value (CALF_TUBE (widget), gui->plugin->get_param_value(param_no));
if (label)
update_label();
@@ -800,7 +800,6 @@ GtkWidget *line_graph_param_control::create(plugin_gui *_gui, int _param_no)
gui = _gui;
param_no = _param_no;
last_generation = -1;
- // const parameter_properties &props = get_props();
widget = calf_line_graph_new ();
gtk_widget_set_name(GTK_WIDGET(widget), "calf-graph");
diff --git a/src/lv2gui.cpp b/src/lv2gui.cpp
index 173166a..0522823 100644
--- a/src/lv2gui.cpp
+++ b/src/lv2gui.cpp
@@ -127,7 +127,7 @@ plugin_proxy_base::plugin_proxy_base(const plugin_metadata_iface *metadata, LV2U
params.resize(param_count);
for (int i = 0; i < param_count; i++)
{
- parameter_properties *pp = metadata->get_param_props(i);
+ const parameter_properties *pp = metadata->get_param_props(i);
params_by_name[pp->short_name] = i;
unsigned int port_type = pp->flags & PF_TYPEMASK;
if (port_type < PF_STRING)
diff --git a/src/makerdf.cpp b/src/makerdf.cpp
index b1988fd..cd8aa8c 100644
--- a/src/makerdf.cpp
+++ b/src/makerdf.cpp
@@ -45,7 +45,7 @@ static struct option long_options[] = {
#if USE_LADSPA
-static std::string unit_to_string(parameter_properties &props)
+static std::string unit_to_string(const parameter_properties &props)
{
uint32_t flags = props.flags & PF_UNITMASK;
@@ -65,7 +65,7 @@ static std::string unit_to_string(parameter_properties &props)
}
}
-static std::string scale_to_string(parameter_properties &props)
+static std::string scale_to_string(const parameter_properties &props)
{
if ((props.flags & PF_TYPEMASK) != PF_ENUM) {
return "/";
@@ -77,7 +77,7 @@ static std::string scale_to_string(parameter_properties &props)
return tmp+" </ladspa:Scale></ladspa:hasScale></ladspa:InputControlPort";
}
-std::string generate_ladspa_rdf(const ladspa_plugin_info &info, parameter_properties *params, const char *param_names[], unsigned int count,
+std::string generate_ladspa_rdf(const ladspa_plugin_info &info, const parameter_properties *params, const char *param_names[], unsigned int count,
unsigned int ctl_ofs)
{
string rdf;
@@ -134,7 +134,7 @@ void make_rdf()
set<int> used_ids;
for (unsigned int i = 0; i < plugins.size(); i++)
{
- plugin_metadata_iface *p = plugins[i];
+ const plugin_metadata_iface *p = plugins[i];
const ladspa_plugin_info &info = p->get_plugin_info();
if(used_ids.count(info.unique_id))
@@ -207,7 +207,7 @@ static const char *units[] = {
//////////////// To all haters: calm down, I'll rewrite it to use the new interface one day
-static void add_ctl_port(string &ports, parameter_properties &pp, int pidx, plugin_metadata_iface *pmi, int param)
+static void add_ctl_port(string &ports, const parameter_properties &pp, int pidx, const plugin_metadata_iface *pmi, int param)
{
stringstream ss;
const char *ind = " ";
@@ -352,7 +352,7 @@ void make_ttl(string path_prefix)
map<string, string> id_to_label;
for (unsigned int i = 0; i < plugins.size(); i++) {
- plugin_metadata_iface *pi = plugins[i];
+ const plugin_metadata_iface *pi = plugins[i];
const ladspa_plugin_info &lpi = pi->get_plugin_info();
id_to_label[pi->get_id()] = pi->get_label();
string uri = string("<" + plugin_uri_prefix) + string(lpi.label) + ">";
@@ -362,7 +362,7 @@ void make_ttl(string path_prefix)
#if USE_LV2_GUI
for (int j = 0; j < pi->get_param_count(); j++)
{
- parameter_properties &props = *pi->get_param_props(j);
+ const parameter_properties &props = *pi->get_param_props(j);
if (props.flags & PF_PROP_OUTPUT)
{
string portnot = " uiext:portNotification [\n uiext:plugin " + uri + " ;\n uiext:portIndex " + i2s(j) + "\n] .\n\n";
@@ -524,13 +524,13 @@ void make_gui(string path_prefix)
path_prefix += "/gui-";
for (unsigned int i = 0; i < plugins.size(); i++)
{
- plugin_metadata_iface *pi = plugins[i];
+ const plugin_metadata_iface *pi = plugins[i];
stringstream xml;
int graphs = 0;
for (int j = 0; j < pi->get_param_count(); j++)
{
- parameter_properties &props = *pi->get_param_props(j);
+ const parameter_properties &props = *pi->get_param_props(j);
if (props.flags & PF_PROP_GRAPH)
graphs++;
}
@@ -539,7 +539,7 @@ void make_gui(string path_prefix)
{
if (j)
xml << "\n <!-- -->\n\n";
- parameter_properties &props = *pi->get_param_props(j);
+ const parameter_properties &props = *pi->get_param_props(j);
string expand_x = "expand-x=\"1\" ";
string fill_x = "fill-x=\"1\" ";
string shrink_x = "shrink-x=\"1\" ";
@@ -612,7 +612,7 @@ void make_gui(string path_prefix)
xml << " <vbox expand-x=\"1\" fill-x=\"1\" attach-x=\"3\" attach-y=\"0\" attach-h=\"" << pi->get_param_count() << "\">" << endl;
for (int j = 0; j < pi->get_param_count(); j++)
{
- parameter_properties &props = *pi->get_param_props(j);
+ const parameter_properties &props = *pi->get_param_props(j);
if (props.flags & PF_PROP_GRAPH)
{
xml << " <line-graph refresh=\"1\" width=\"160\" param=\"" << props.short_name << "\"/>\n" << endl;
diff --git a/src/modules.cpp b/src/modules.cpp
index 4008373..5cd2074 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -892,8 +892,7 @@ CALF_PORT_PROPS(wavetable) = {
calf_plugins::plugin_registry::plugin_registry()
{
- #define PER_MODULE_ITEM(name, isSynth, jackname) plugins.push_back(new name##_metadata);
- #define PER_SMALL_MODULE_ITEM(...)
+ #define PER_MODULE_ITEM(name, isSynth, jackname) plugins.push_back((new name##_metadata)->get_metadata_iface_ptr());
#include <calf/modulelist.h>
}
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list