[SCM] calf/master: + Small modules: cleanup to have plugin IDs in just one place, added two versions of Quad Power plugin (calculates x*a, x*a^2, x*a^3, x*a^4 for control or audio x, for octaves/detune/whatever)
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:37:36 UTC 2013
The following commit has been merged in the master branch:
commit 07057cf2f993b3cf85408bec7a75f0c782be7a71
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date: Thu Sep 18 23:05:17 2008 +0000
+ Small modules: cleanup to have plugin IDs in just one place, added two versions of Quad Power plugin (calculates x*a, x*a^2, x*a^3, x*a^4 for control or audio x, for octaves/detune/whatever)
git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@292 78b06b96-2940-0410-b7fc-879d825d01d8
diff --git a/src/calf/modulelist.h b/src/calf/modulelist.h
index 77d196e..ffebaa8 100644
--- a/src/calf/modulelist.h
+++ b/src/calf/modulelist.h
@@ -7,23 +7,25 @@
PER_MODULE_ITEM(rotary_speaker, false, "rotaryspeaker")
PER_MODULE_ITEM(phaser, false, "phaser")
#ifdef ENABLE_EXPERIMENTAL
- PER_SMALL_MODULE_ITEM(small_lp_filter)
- PER_SMALL_MODULE_ITEM(small_hp_filter)
- PER_SMALL_MODULE_ITEM(small_bp_filter)
- PER_SMALL_MODULE_ITEM(small_br_filter)
- PER_SMALL_MODULE_ITEM(small_onepole_lp_filter)
- PER_SMALL_MODULE_ITEM(small_onepole_hp_filter)
- PER_SMALL_MODULE_ITEM(small_onepole_ap_filter)
- PER_SMALL_MODULE_ITEM(small_min)
- PER_SMALL_MODULE_ITEM(small_max)
- PER_SMALL_MODULE_ITEM(small_minus)
- PER_SMALL_MODULE_ITEM(small_mul)
- PER_SMALL_MODULE_ITEM(small_neg)
- PER_SMALL_MODULE_ITEM(small_map_lin2exp)
- PER_SMALL_MODULE_ITEM(small_square_osc)
- PER_SMALL_MODULE_ITEM(small_saw_osc)
- PER_SMALL_MODULE_ITEM(small_print)
- PER_SMALL_MODULE_ITEM(small_print2)
+ PER_SMALL_MODULE_ITEM(small_lp_filter, "lowpass12")
+ PER_SMALL_MODULE_ITEM(small_hp_filter, "highpass12")
+ PER_SMALL_MODULE_ITEM(small_bp_filter, "bandpass6")
+ PER_SMALL_MODULE_ITEM(small_br_filter, "notch6")
+ PER_SMALL_MODULE_ITEM(small_onepole_lp_filter, "lowpass6")
+ PER_SMALL_MODULE_ITEM(small_onepole_hp_filter, "highpass6")
+ PER_SMALL_MODULE_ITEM(small_onepole_ap_filter, "allpass")
+ PER_SMALL_MODULE_ITEM(small_min, "min")
+ PER_SMALL_MODULE_ITEM(small_max, "max")
+ PER_SMALL_MODULE_ITEM(small_minus, "minus")
+ PER_SMALL_MODULE_ITEM(small_mul, "mul")
+ PER_SMALL_MODULE_ITEM(small_neg, "neg")
+ PER_SMALL_MODULE_ITEM(small_map_lin2exp, "lin2exp")
+ PER_SMALL_MODULE_ITEM(small_square_osc, "square_osc")
+ PER_SMALL_MODULE_ITEM(small_saw_osc, "saw_osc")
+ PER_SMALL_MODULE_ITEM(small_print, "print")
+ PER_SMALL_MODULE_ITEM(small_print2, "print2")
+ PER_SMALL_MODULE_ITEM(small_quadpower_a, "quadpower_a")
+ PER_SMALL_MODULE_ITEM(small_quadpower_c, "quadpower_c")
#endif
#undef PER_MODULE_ITEM
#undef PER_SMALL_MODULE_ITEM
diff --git a/src/calf/modules_small.h b/src/calf/modules_small.h
index 0ad7e93..e5838fa 100644
--- a/src/calf/modules_small.h
+++ b/src/calf/modules_small.h
@@ -72,7 +72,7 @@ public:
}
static void plugin_info(plugin_info_iface *pii)
{
- pii->names("lowpass12", "lowpass12", "12dB/oct RBJ Lowpass", "lv2:LowpassPlugin");
+ pii->names("lowpass12", "12dB/oct RBJ Lowpass", "lv2:LowpassPlugin");
port_info(pii);
}
};
@@ -86,7 +86,7 @@ public:
}
static void plugin_info(plugin_info_iface *pii)
{
- pii->names("highpass12", "highpass12", "12dB/oct RBJ Highpass", "lv2:HighpassPlugin");
+ pii->names("highpass12", "12dB/oct RBJ Highpass", "lv2:HighpassPlugin");
port_info(pii);
}
};
@@ -100,7 +100,7 @@ public:
}
static void plugin_info(plugin_info_iface *pii)
{
- pii->names("bandpass6", "bandpass6", "6dB/oct RBJ Bandpass", "lv2:BandpassPlugin");
+ pii->names("bandpass6", "6dB/oct RBJ Bandpass", "lv2:BandpassPlugin");
port_info(pii);
}
};
@@ -114,7 +114,7 @@ public:
}
static void plugin_info(plugin_info_iface *pii)
{
- pii->names("notch6", "notch6", "6dB/oct RBJ Bandpass", "lv2:FilterPlugin");
+ pii->names("notch6", "6dB/oct RBJ Bandpass", "lv2:FilterPlugin");
port_info(pii);
}
};
@@ -156,7 +156,7 @@ public:
}
static void plugin_info(plugin_info_iface *pii)
{
- pii->names("lowpass6", "lowpass6", "6dB/oct Lowpass Filter", "lv2:LowpassPlugin");
+ pii->names("lowpass6", "6dB/oct Lowpass Filter", "lv2:LowpassPlugin");
port_info(pii);
}
};
@@ -172,7 +172,7 @@ public:
}
static void plugin_info(plugin_info_iface *pii)
{
- pii->names("highpass6", "highpass6", "6dB/oct Highpass Filter", "lv2:HighpassPlugin");
+ pii->names("highpass6", "6dB/oct Highpass Filter", "lv2:HighpassPlugin");
port_info(pii);
}
};
@@ -188,7 +188,7 @@ public:
}
static void plugin_info(plugin_info_iface *pii)
{
- pii->names("allpass", "allpass", "1-pole 1-zero Allpass Filter", "lv2:AllpassPlugin");
+ pii->names("allpass", "1-pole 1-zero Allpass Filter", "lv2:AllpassPlugin");
port_info(pii);
}
};
@@ -228,7 +228,7 @@ public:
}
static void plugin_info(plugin_info_iface *pii)
{
- pii->names("min", "min", "Function min", "lv2:UtilityPlugin");
+ pii->names("min", "Function min", "lv2:UtilityPlugin");
port_info(pii);
}
};
@@ -242,7 +242,7 @@ public:
}
static void plugin_info(plugin_info_iface *pii)
{
- pii->names("max", "max", "Function max", "lv2:UtilityPlugin");
+ pii->names("max", "Function max", "lv2:UtilityPlugin");
port_info(pii);
}
};
@@ -256,7 +256,7 @@ public:
}
static void plugin_info(plugin_info_iface *pii)
{
- pii->names("minus", "minus", "Subtract", "lv2:UtilityPlugin");
+ pii->names("minus", "Subtract", "lv2:UtilityPlugin");
port_info(pii);
}
};
@@ -270,7 +270,7 @@ public:
}
static void plugin_info(plugin_info_iface *pii)
{
- pii->names("mul", "mul", "Multiply", "lv2:UtilityPlugin");
+ pii->names("mul", "Multiply", "lv2:UtilityPlugin");
port_info(pii);
}
};
@@ -284,7 +284,7 @@ public:
}
static void plugin_info(plugin_info_iface *pii)
{
- pii->names("neg", "neg", "Negative value", "lv2:UtilityPlugin");
+ pii->names("neg", "Negative value", "lv2:UtilityPlugin");
port_info(pii);
}
};
@@ -300,7 +300,7 @@ public:
static void plugin_info(plugin_info_iface *pii)
{
- pii->names("lin2exp", "lin2exp", "Lin-Exp Mapper", "lv2:UtilityPlugin");
+ pii->names("lin2exp", "Lin-Exp Mapper", "lv2:UtilityPlugin");
pii->control_port("in", "In", 0.f).input();
pii->control_port("from_min", "Min (from)", 0).input();
pii->control_port("from_max", "Max (from)", 1).input();
@@ -391,7 +391,7 @@ public:
}
static void plugin_info(plugin_info_iface *pii)
{
- pii->names("square_osc", "squareosc", "Square Oscillator", "lv2:OscillatorPlugin");
+ pii->names("squareosc", "Square Oscillator", "lv2:OscillatorPlugin");
port_info(pii);
}
};
@@ -407,7 +407,7 @@ public:
}
static void plugin_info(plugin_info_iface *pii)
{
- pii->names("saw_osc", "sawosc", "Saw Oscillator", "lv2:OscillatorPlugin");
+ pii->names("sawosc", "Saw Oscillator", "lv2:OscillatorPlugin");
port_info(pii);
}
};
@@ -422,7 +422,7 @@ public:
static void plugin_info(plugin_info_iface *pii)
{
- pii->names("print", "print", "Print To Console (C)", "lv2:UtilityPlugin");
+ pii->names("print", "Print To Console (C)", "lv2:UtilityPlugin");
pii->control_port("in", "In", 0).input();
}
void set_sample_rate(uint32_t sr) {
@@ -444,7 +444,7 @@ public:
static void plugin_info(plugin_info_iface *pii)
{
- pii->names("print2", "print2", "Print To Console (A)", "lv2:UtilityPlugin");
+ pii->names("print2", "Print To Console (A)", "lv2:UtilityPlugin");
pii->audio_port("in", "In").input();
}
void set_sample_rate(uint32_t sr) {
@@ -456,6 +456,65 @@ public:
}
};
+template<bool audio>
+class small_quadpower_audio_module: public null_audio_module
+{
+public:
+ enum { in_value, in_factor, in_count , out_count = 4 };
+ float *ins[in_count];
+ float *outs[out_count];
+
+ static void plugin_info(plugin_info_iface *pii)
+ {
+ const char *names[8] = {"xa", "x*a^1", "xaa", "x*a^2", "xaaa", "x*a^3", "xaaaa", "x*a^4" };
+ if (audio)
+ pii->names("quadpower_a", "Quad Power (A)", "lv2:UtilityPlugin");
+ else
+ pii->names("quadpower_c", "Quad Power (C)", "lv2:UtilityPlugin");
+ if (audio)
+ pii->audio_port("x", "x").input();
+ else
+ pii->control_port("x", "x", 1).input();
+ pii->control_port("a", "a", 1).input();
+ for (int i = 0; i < 8; i += 2)
+ if (audio)
+ pii->audio_port(names[i], names[i+1]).output();
+ else
+ pii->control_port(names[i], names[i+1], 0).output();
+ }
+};
+
+class small_quadpower_a_audio_module: public small_quadpower_audio_module<true>
+{
+public:
+ void process(uint32_t count)
+ {
+ float a = *ins[in_factor];
+ for (uint32_t i = 0; i < count; i++)
+ {
+ float x = ins[in_value][i];
+ outs[0][i] = x * a;
+ outs[1][i] = x * a * a;
+ outs[2][i] = x * a * a * a;
+ outs[3][i] = x * a * a * a * a;
+ }
+ }
+};
+
+class small_quadpower_c_audio_module: public small_quadpower_audio_module<false>
+{
+public:
+ void process(uint32_t)
+ {
+ float x = *ins[in_value];
+ float a = *ins[in_factor];
+ *outs[0] = x * a;
+ *outs[1] = x * a * a;
+ *outs[2] = x * a * a * a;
+ *outs[3] = x * a * a * a * a;
+ }
+};
+
};
#endif
diff --git a/src/calf/plugininfo.h b/src/calf/plugininfo.h
index 43f353d..7e41c9b 100644
--- a/src/calf/plugininfo.h
+++ b/src/calf/plugininfo.h
@@ -54,7 +54,7 @@ struct control_port_info_iface
struct plugin_info_iface
{
/// Set plugin names (ID, name and label)
- virtual void names(const std::string &id, const std::string &name, const std::string &label, const std::string &category) {}
+ virtual void names(const std::string &name, const std::string &label, const std::string &category) {}
/// Add an audio port (returns a sink which accepts further description)
virtual audio_port_info_iface &audio_port(const std::string &id, const std::string &name)=0;
/// Add a control port (returns a sink which accepts further description)
@@ -68,7 +68,7 @@ struct plugin_info_iface
struct plugin_list_info_iface
{
/// Add an empty plugin object and return the sink to be filled with information
- virtual plugin_info_iface &plugin() = 0;
+ virtual plugin_info_iface &plugin(const std::string &id) = 0;
virtual ~plugin_list_info_iface() {}
};
diff --git a/src/makerdf.cpp b/src/makerdf.cpp
index 36d6995..fe37d32 100644
--- a/src/makerdf.cpp
+++ b/src/makerdf.cpp
@@ -264,8 +264,7 @@ struct lv2_plugin_info: public plugin_info_iface
/// Vector of ports
vector<lv2_port_base *> ports;
/// Set plugin names (ID, name and label)
- virtual void names(const std::string &_id, const std::string &_name, const std::string &_label, const std::string &_category) {
- id = _id;
+ virtual void names(const std::string &_name, const std::string &_label, const std::string &_category) {
name = _name;
label = _label;
category = _category;
@@ -289,8 +288,9 @@ struct lv2_plugin_info: public plugin_info_iface
struct lv2_plugin_list: public plugin_list_info_iface, public vector<lv2_plugin_info *>
{
- virtual plugin_info_iface &plugin() {
+ virtual plugin_info_iface &plugin(const std::string &id) {
lv2_plugin_info *pi = new lv2_plugin_info;
+ pi->id = id;
push_back(pi);
return *pi;
}
diff --git a/src/modules.cpp b/src/modules.cpp
index 1c1aab0..4b7c474 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -182,26 +182,9 @@ ALL_WRAPPERS(monosynth)
#ifdef ENABLE_EXPERIMENTAL
-SMALL_WRAPPERS(small_lp_filter, "lowpass12")
-SMALL_WRAPPERS(small_hp_filter, "highpass12")
-SMALL_WRAPPERS(small_bp_filter, "bandpass6")
-SMALL_WRAPPERS(small_br_filter, "notch6")
-
-SMALL_WRAPPERS(small_onepole_lp_filter, "lowpass6")
-SMALL_WRAPPERS(small_onepole_hp_filter, "highpass6")
-SMALL_WRAPPERS(small_onepole_ap_filter, "allpass")
-
-SMALL_WRAPPERS(small_min, "min")
-SMALL_WRAPPERS(small_max, "max")
-SMALL_WRAPPERS(small_minus, "minus")
-SMALL_WRAPPERS(small_mul, "mul")
-SMALL_WRAPPERS(small_neg, "neg")
-SMALL_WRAPPERS(small_map_lin2exp, "lin2exp")
-
-SMALL_WRAPPERS(small_square_osc, "square_osc")
-SMALL_WRAPPERS(small_saw_osc, "saw_osc")
-SMALL_WRAPPERS(small_print, "print")
-SMALL_WRAPPERS(small_print2, "print2")
+#define PER_MODULE_ITEM(...)
+#define PER_SMALL_MODULE_ITEM(name, id) SMALL_WRAPPERS(name, id)
+#include <calf/modulelist.h>
#endif
@@ -211,7 +194,7 @@ extern "C" {
const LV2_Descriptor *lv2_descriptor(uint32_t index)
{
#define PER_MODULE_ITEM(name, isSynth, jackname) if (!(index--)) return &::lv2_##name.descriptor;
- #define PER_SMALL_MODULE_ITEM(name) if (!(index--)) return &::lv2_##name.descriptor;
+ #define PER_SMALL_MODULE_ITEM(name, id) if (!(index--)) return &::lv2_##name.descriptor;
#include <calf/modulelist.h>
return NULL;
}
@@ -225,7 +208,7 @@ extern "C" {
const LADSPA_Descriptor *ladspa_descriptor(unsigned long Index)
{
#define PER_MODULE_ITEM(name, isSynth, jackname) if (!isSynth && !(Index--)) return &::ladspa_##name.descriptor;
- #define PER_SMALL_MODULE_ITEM(name)
+ #define PER_SMALL_MODULE_ITEM(...)
#include <calf/modulelist.h>
return NULL;
}
@@ -285,7 +268,7 @@ void synth::get_all_plugins(std::vector<giface_plugin_info> &plugins)
void synth::get_all_small_plugins(plugin_list_info_iface *iface)
{
#define PER_MODULE_ITEM(name, isSynth, jackname)
- #define PER_SMALL_MODULE_ITEM(name) { plugin_info_iface *pii = &iface->plugin(); name##_audio_module::plugin_info(pii); pii->finalize(); }
+ #define PER_SMALL_MODULE_ITEM(name, id) { plugin_info_iface *pii = &iface->plugin(id); name##_audio_module::plugin_info(pii); pii->finalize(); }
#include <calf/modulelist.h>
}
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list