[SCM] calf/master: + SubSyn: added a non-working crappy saw resynthesizer plugin (just an experiment)

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:37:46 UTC 2013


The following commit has been merged in the master branch:
commit 8d5ba3d7d5b90dc1aaa9da1e86b48b368f738912
Author: Krzysztof Foltman <kfoltman at ubuntu.(none)>
Date:   Mon Oct 27 19:28:00 2008 +0000

    + SubSyn: added a non-working crappy saw resynthesizer plugin (just an experiment)

diff --git a/src/calf/modulelist.h b/src/calf/modulelist.h
index db3f261..09a226c 100644
--- a/src/calf/modulelist.h
+++ b/src/calf/modulelist.h
@@ -7,6 +7,7 @@
     PER_MODULE_ITEM(organ, true, "organ")
     PER_MODULE_ITEM(rotary_speaker, false, "rotaryspeaker")
     PER_MODULE_ITEM(phaser, false, "phaser")
+    PER_MODULE_ITEM(subsaw, false, "subsaw")
 #undef PER_MODULE_ITEM
 #endif
 #ifdef PER_SMALL_MODULE_ITEM
diff --git a/src/calf/modules.h b/src/calf/modules.h
index 462541d..f6e3a53 100644
--- a/src/calf/modules.h
+++ b/src/calf/modules.h
@@ -776,6 +776,96 @@ public:
     static const char *get_label() { return "Rotary Speaker"; }
 };
 
+class subsaw
+{
+public:
+    dsp::onepole<float> antidc, amp;
+    float last, state, last_amp;
+    bool cnt;
+public:
+    void set_sample_rate(uint32_t sr)
+    {
+        antidc.set_hp(10.0, sr);
+        amp.set_lp(10.0, sr);
+        state = 0;
+        last = 0.f;
+        last_amp = 0.f;
+        cnt = false;
+    }
+    inline float process(float value)
+    {
+        if (last >= 0.f && value < 0.f) // && 0 == (cnt = !cnt))
+        {
+            if (amp.y1 < state)
+                amp.y1 = state;
+            state = 0;
+        }
+        else
+        {
+            state += fabs(value);
+            last_amp = amp.process(0);
+        }
+        
+        last = value;
+        return antidc.process_hp(0.25f * state);
+    }
+};
+
+// A sub-osc thingy 
+class subsaw_audio_module: public null_audio_module
+{
+public:    
+    enum { par_cutoff, param_count };
+    enum { in_count = 2, out_count = 2, rt_capable = true, support_midi = false };
+    float *ins[in_count]; 
+    float *outs[out_count];
+    float *params[param_count];
+    static const char *port_names[];
+    dsp::biquad<float> filter_left, filter_right;
+    dsp::biquad<float> filter2_left, filter2_right;
+    dsp::biquad<float> filter3_left, filter3_right;
+    subsaw state_left, state_right;
+    uint32_t srate;
+    static parameter_properties param_props[];
+    static synth::ladspa_plugin_info plugin_info;
+public:    
+    subsaw_audio_module()
+    {
+    }
+    
+    void params_changed()
+    {
+        filter_left.set_bp_rbj(*params[par_cutoff], 2, srate);
+        filter_right.copy_coeffs(filter_left);
+        filter2_left.set_lp_rbj(*params[par_cutoff], 0.7, srate);
+        filter2_right.copy_coeffs(filter2_left);
+    }
+    void activate() {
+        params_changed();
+    }
+    void set_sample_rate(uint32_t sr) {
+        srate = sr;
+        state_left.set_sample_rate(sr);
+        state_right.set_sample_rate(sr);
+    }
+    uint32_t process(uint32_t offset, uint32_t numsamples, uint32_t inputs_mask, uint32_t outputs_mask) {
+//        printf("sr=%d cutoff=%f res=%f mode=%f\n", srate, *params[par_cutoff], *params[par_resonance], *params[par_mode]);
+        uint32_t ostate = 3;
+        numsamples += offset;
+        filter3_left.set_lp_rbj(clip<double>(20000.0 * state_left.last_amp, 20.0, srate * 0.48), 3, srate);
+        filter3_right.set_lp_rbj(clip<double>(20000.0 * state_right.last_amp, 20.0, srate * 0.48), 3, srate);
+        while(offset < numsamples) {
+            outs[0][offset] = filter3_left.process_d1(state_left.process(filter2_left.process_d1(filter_left.process_d1(ins[0][offset]))));
+            outs[1][offset] = filter3_right.process_d1(state_right.process(filter2_right.process_d1(filter_right.process_d1(ins[1][offset]))));
+            offset ++;
+        }
+        return ostate;
+    }
+    static const char *get_id() { return "subsaw"; }
+    static const char *get_name() { return "subsaw"; }
+    static const char *get_label() { return "SubSaw"; }
+};
+
 extern std::string get_builtin_modules_rdf();
 extern const char *calf_copyright_info;
 
diff --git a/src/jackhost.cpp b/src/jackhost.cpp
index e71ab45..8b83c20 100644
--- a/src/jackhost.cpp
+++ b/src/jackhost.cpp
@@ -49,26 +49,9 @@ const char *client_name = "calfhost";
 
 jack_host_base *synth::create_jack_host(const char *effect_name)
 {
-    if (!strcasecmp(effect_name, "reverb"))
-        return new jack_host<reverb_audio_module>();
-    else if (!strcasecmp(effect_name, "flanger"))
-        return new jack_host<flanger_audio_module>();
-    else if (!strcasecmp(effect_name, "filter"))
-        return new jack_host<filter_audio_module>();
-    else if (!strcasecmp(effect_name, "monosynth"))
-        return new jack_host<monosynth_audio_module>();
-    else if (!strcasecmp(effect_name, "vintagedelay"))
-        return new jack_host<vintage_delay_audio_module>();
-    else if (!strcasecmp(effect_name, "organ"))
-        return new jack_host<organ_audio_module>();
-    else if (!strcasecmp(effect_name, "rotaryspeaker"))
-        return new jack_host<rotary_speaker_audio_module>();
-    else if (!strcasecmp(effect_name, "phaser"))
-        return new jack_host<phaser_audio_module>();
-#ifdef ENABLE_EXPERIMENTAL
-#endif
-    else
-        return NULL;
+    #define PER_MODULE_ITEM(name, isSynth, jackname) if (!strcasecmp(effect_name, jackname)) return new jack_host<name##_audio_module>();
+    #include <calf/modulelist.h>
+    return NULL;
 }
 
 void destroy(GtkWindow *window, gpointer data)
diff --git a/src/modules.cpp b/src/modules.cpp
index 1ba1bc6..ffce0c2 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -163,6 +163,16 @@ synth::ladspa_plugin_info monosynth_audio_module::plugin_info = { 0x8480, "Monos
 
 ////////////////////////////////////////////////////////////////////////////
 
+const char *subsaw_audio_module::port_names[] = {"In L", "In R", "Out L", "Out R"};
+
+parameter_properties subsaw_audio_module::param_props[] = {
+    { 2000,      10,20000,    0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ, NULL, "cutoff", "Pre Cutoff" },
+};
+
+synth::ladspa_plugin_info subsaw_audio_module::plugin_info = { 0x8500, "SubSaw", "Calf SubSaw", "Krzysztof Foltman", synth::calf_copyright_info, "UtilityPlugin" };
+
+////////////////////////////////////////////////////////////////////////////
+
 template<class Module>
 giface_plugin_info create_plugin_info(ladspa_plugin_info &info)
 {

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list