[SCM] calf/master: + DSSI wrapper, Monosynth: allowed for "static" graphs (graphs that are only dependent on single parameter value), used for waveforms
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:36:55 UTC 2013
The following commit has been merged in the master branch:
commit f89251077160aad3de1aa97f42fcbd722f1049fe
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date: Sun Jan 6 15:23:44 2008 +0000
+ DSSI wrapper, Monosynth: allowed for "static" graphs (graphs that are only dependent on single parameter value), used for waveforms
git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@78 78b06b96-2940-0410-b7fc-879d825d01d8
diff --git a/src/calf/modules.h b/src/calf/modules.h
index 3292eee..4979fec 100644
--- a/src/calf/modules.h
+++ b/src/calf/modules.h
@@ -44,6 +44,7 @@ public:
inline void set_sample_rate(uint32_t sr) { }
inline bool get_graph(int index, int subindex, float *data, int points, cairo_t *context) { return false; }
inline static const char *get_gui_xml() { return NULL; }
+ inline static bool get_static_graph(int index, int subindex, float value, float *data, int points, cairo_t *context) { return false; }
};
class amp_audio_module: public null_audio_module
diff --git a/src/calf/modules_synths.h b/src/calf/modules_synths.h
index 8c95372..6efb65f 100644
--- a/src/calf/modules_synths.h
+++ b/src/calf/modules_synths.h
@@ -45,7 +45,7 @@ public:
float *outs[out_count];
float *params[param_count];
uint32_t srate, crate;
- waveform_family<11> waves[wave_count];
+ static waveform_family<11> waves[wave_count];
waveform_oscillator<11> osc1, osc2;
bool running, stopping, gate;
int last_key;
@@ -65,6 +65,7 @@ public:
static parameter_properties param_props[];
static const char *get_gui_xml();
+ static void generate_waves();
void set_sample_rate(uint32_t sr);
void delayed_note_on();
void note_on(int note, int vel)
@@ -121,6 +122,7 @@ public:
void calculate_buffer_single();
void calculate_buffer_stereo();
bool get_graph(int index, int subindex, float *data, int points, cairo_t *context);
+ static bool get_static_graph(int index, int subindex, float value, float *data, int points, cairo_t *context);
inline bool is_stereo_filter() const
{
return filter_type == flt_2lp12 || filter_type == flt_2bp6;
diff --git a/src/dssigui.cpp b/src/dssigui.cpp
index 52b1a27..d87f9c4 100644
--- a/src/dssigui.cpp
+++ b/src/dssigui.cpp
@@ -82,7 +82,7 @@ struct plugin_proxy_base: public plugin_ctl_iface
};
template<class Module>
-struct plugin_proxy: public plugin_proxy_base
+struct plugin_proxy: public plugin_proxy_base, public line_graph_iface
{
float params[Module::param_count];
virtual parameter_properties *get_param_props(int param_no) {
@@ -115,7 +115,7 @@ struct plugin_proxy: public plugin_proxy_base
return Module::get_gui_xml();
}
virtual line_graph_iface *get_line_graph_iface() {
- return NULL;
+ return this;
}
virtual bool activate_preset(int bank, int program) {
if (send_osc) {
@@ -127,6 +127,9 @@ struct plugin_proxy: public plugin_proxy_base
}
return false;
}
+ virtual bool get_graph(int index, int subindex, float *data, int points, cairo_t *context) {
+ return Module::get_static_graph(index, subindex, params[index], data, points, context);
+ }
};
plugin_proxy_base *create_plugin_proxy(const char *effect_name)
diff --git a/src/monosynth.cpp b/src/monosynth.cpp
index 809a379..a53b0d2 100644
--- a/src/monosynth.cpp
+++ b/src/monosynth.cpp
@@ -64,16 +64,12 @@ static const char *monosynth_gui_xml =
"</table>"
// "<line-graph param=\"o1_wave\"/>"
"<hbox>"
- "<if cond=\"directlink\">"
- "<line-graph param=\"o1_wave\"/>"
- "</if>"
+ "<line-graph param=\"o1_wave\"/>"
"<vbox>"
"<label param=\"o12_mix\"/>"
"<hscale param=\"o12_mix\" position=\"bottom\"/>"
"</vbox>"
- "<if cond=\"directlink\">"
- "<line-graph param=\"o2_wave\"/>"
- "</if>"
+ "<line-graph param=\"o2_wave\"/>"
"</hbox>"
"<hbox>"
"<vbox>"
@@ -241,6 +237,12 @@ void monosynth_audio_module::activate() {
pitchbend = 1.f;
filter.reset();
filter2.reset();
+}
+
+waveform_family<11> monosynth_audio_module::waves[wave_count];
+
+void monosynth_audio_module::generate_waves()
+{
float data[2048];
bandlimiter<11> bl;
@@ -340,19 +342,29 @@ void monosynth_audio_module::activate() {
waves[wave_test8].make(bl, data);
}
-bool monosynth_audio_module::get_graph(int index, int subindex, float *data, int points, cairo_t *context)
+void __attribute__((constructor)) generate_monosynth_waves()
+{
+ monosynth_audio_module::generate_waves();
+}
+
+bool monosynth_audio_module::get_static_graph(int index, int subindex, float value, float *data, int points, cairo_t *context)
{
- // printf("get_graph %d %p %d wave1=%d wave2=%d\n", index, data, points, wave1, wave2);
if (index == par_wave1 || index == par_wave2) {
if (subindex)
return false;
- int wave = dsp::clip(dsp::fastf2i_drm(*params[index]), 0, (int)wave_count - 1);
+ int wave = dsp::clip(dsp::fastf2i_drm(value), 0, (int)wave_count - 1);
float *waveform = waves[wave].get_level(0);
for (int i = 0; i < points; i++)
data[i] = 0.5 * (waveform[i * 2047 / points] + waveform[i * 2047 / points + 1]);
return true;
}
+ return false;
+}
+
+bool monosynth_audio_module::get_graph(int index, int subindex, float *data, int points, cairo_t *context)
+{
+ // printf("get_graph %d %p %d wave1=%d wave2=%d\n", index, data, points, wave1, wave2);
if (index == par_filtertype) {
if (!running)
return false;
@@ -374,7 +386,7 @@ bool monosynth_audio_module::get_graph(int index, int subindex, float *data, int
}
return true;
}
- return false;
+ return get_static_graph(index, subindex, *params[index], data, points, context);
}
void monosynth_audio_module::calculate_buffer_ser()
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list