[SCM] calf/master: + Small plugins: renamed print and print2 to include data type, added Schmitt trigger and two comparison operators - less-than and between

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


The following commit has been merged in the master branch:
commit 0bfc1f3ff4d1e49d826b6e0e580b01d87223aeb6
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date:   Fri Sep 26 19:06:48 2008 +0000

    + Small plugins: renamed print and print2 to include data type, added Schmitt trigger and two comparison operators - less-than and between
    
    
    git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@300 78b06b96-2940-0410-b7fc-879d825d01d8

diff --git a/src/calf/modulelist.h b/src/calf/modulelist.h
index 94a2e66..88ea32a 100644
--- a/src/calf/modulelist.h
+++ b/src/calf/modulelist.h
@@ -26,8 +26,8 @@
     PER_SMALL_MODULE_ITEM(square_lfo, "square_lfo")
     PER_SMALL_MODULE_ITEM(saw_lfo, "saw_lfo")
     PER_SMALL_MODULE_ITEM(pulse_lfo, "pulse_lfo")
-    PER_SMALL_MODULE_ITEM(print, "print")
-    PER_SMALL_MODULE_ITEM(print2, "print2")
+    PER_SMALL_MODULE_ITEM(print_a, "print_a")
+    PER_SMALL_MODULE_ITEM(print_c, "print_c")
     PER_SMALL_MODULE_ITEM(quadpower_a, "quadpower_a")
     PER_SMALL_MODULE_ITEM(quadpower_c, "quadpower_c")
     PER_SMALL_MODULE_ITEM(linear_inertia_c, "linear_inertia_c")
@@ -38,6 +38,9 @@
     PER_SMALL_MODULE_ITEM(logical_or_c, "logical_or_c")
     PER_SMALL_MODULE_ITEM(logical_not_c, "logical_not_c")
     PER_SMALL_MODULE_ITEM(flipflop_c, "flipflop_c")
+    PER_SMALL_MODULE_ITEM(schmitt_c, "schmitt_c")
+    PER_SMALL_MODULE_ITEM(between_c, "between_c")
+    PER_SMALL_MODULE_ITEM(less_c, "less_c")
 #endif
 #undef PER_MODULE_ITEM
 #undef PER_SMALL_MODULE_ITEM
diff --git a/src/modules_small.cpp b/src/modules_small.cpp
index 687d8ba..91af504 100644
--- a/src/modules_small.cpp
+++ b/src/modules_small.cpp
@@ -231,7 +231,7 @@ public:
     }
     static void plugin_info(plugin_info_iface *pii)
     {
-        pii->names("min", "Function min (A)", "kf:MathOperatorPlugin");
+        pii->names("min", "Min (A)", "kf:MathOperatorPlugin");
         port_info(pii);
     }
 };
@@ -245,7 +245,7 @@ public:
     }
     static void plugin_info(plugin_info_iface *pii)
     {
-        pii->names("max", "Function max (A)", "kf:MathOperatorPlugin");
+        pii->names("max", "Max (A)", "kf:MathOperatorPlugin");
         port_info(pii);
     }
 };
@@ -287,7 +287,7 @@ public:
     }
     static void plugin_info(plugin_info_iface *pii)
     {
-        pii->names("neg", "Negative value (A)", "kf:MathOperatorPlugin");
+        pii->names("neg", "Negative (A)", "kf:MathOperatorPlugin");
         port_info(pii);
     }
 };
@@ -311,6 +311,21 @@ public:
     }
 };
 
+class less_c_audio_module: public control_operator_audio_module<2>
+{
+public:
+    void process(uint32_t count) {
+        *outs[0] = *ins[0] < *ins[1];
+    }
+    static void plugin_info(plugin_info_iface *pii)
+    {
+        pii->names("less_c", "Less than (C)", "kf:MathOperatorPlugin");
+        control_port_info_iface *cports[2];
+        port_info(pii, cports);
+        cports[2]->toggle();
+    }
+};
+
 class level2edge_c_audio_module: public control_operator_audio_module<1>
 {
 public:
@@ -424,12 +439,74 @@ public:
         pii->control_port("to_max", "Max (to)", 20000).input();
         pii->control_port("out", "Out", 0.f).output();
     }
-    void process(uint32_t count) {
+    void process(uint32_t count)
+    {
         float normalized = (*ins[in_signal] - *ins[in_from_min]) / (*ins[in_from_max] - *ins[in_from_min]);
         *outs[out_signal] = *ins[in_to_min] * pow(*ins[in_to_max] / *ins[in_to_min], normalized);
     }
 };
 
+/// Schmitt trigger - http://en.wikipedia.org/wiki/Schmitt_trigger - also outputs a change signal (positive spike whenever output value is changed)
+class schmitt_c_audio_module: public null_small_audio_module
+{
+public:    
+    enum { in_signal, in_low, in_high, in_count };
+    enum { out_signal, out_change, out_count };
+    float *ins[in_count]; 
+    float *outs[out_count];
+    bool state;
+    
+    void activate()
+    {
+        state = false;
+    }
+    static void plugin_info(plugin_info_iface *pii)
+    {
+        pii->names("schmitt_c", "Schmitt Trigger (C)", "kf:BooleanPlugin");
+        pii->control_port("in", "In", 0.f).input();
+        pii->control_port("low", "Low threshold", 0).input();
+        pii->control_port("high", "High threshold", 0.5).input();
+        pii->control_port("out", "Out", 0.f).output();
+        pii->control_port("change", "Change", 0.f).output();
+    }
+    void process(uint32_t count)
+    {
+        float value = *ins[in_signal];
+        bool new_state = state;
+        if (value <= *ins[in_low])
+            new_state = false;
+        if (value >= *ins[in_high])
+            new_state = true;
+        *outs[out_signal] = new_state ? 1.f : 0.f;
+        *outs[out_change] = (new_state != state) ? 1.f : 0.f;
+        state = new_state;
+    }
+};
+
+/// Stateless 'between' operator (lo <= in <= hi)
+class between_c_audio_module: public null_small_audio_module
+{
+public:    
+    enum { in_signal, in_low, in_high, in_count };
+    enum { out_signal, out_count };
+    float *ins[in_count]; 
+    float *outs[out_count];
+    
+    static void plugin_info(plugin_info_iface *pii)
+    {
+        pii->names("between_c", "Between (C)", "kf:MathOperatorPlugin");
+        pii->control_port("in", "In", 0.f).input();
+        pii->control_port("low", "Low threshold", 0).input();
+        pii->control_port("high", "High threshold", 0.5).input();
+        pii->control_port("out", "Out", 0.f).output();
+    }
+    void process(uint32_t count)
+    {
+        float value = *ins[in_signal];
+        *outs[out_signal] = (value >= *ins[in_low] && value <= *ins[in_high]) ? 1.f : 0.f;
+    }
+};
+
 class freq_phase_lfo_base: public small_audio_module_base<2, 1>
 {
 public:
@@ -600,12 +677,12 @@ public:
     }
 };
 
-class print_audio_module: public small_audio_module_base<1, 0>
+class print_c_audio_module: public small_audio_module_base<1, 0>
 {
 public:    
     static void plugin_info(plugin_info_iface *pii)
     {
-        pii->names("print", "Print To Console (C)", "lv2:UtilityPlugin");
+        pii->names("print_c", "Print To Console (C)", "lv2:UtilityPlugin");
         pii->control_port("in", "In", 0).input();
     }
     void process(uint32_t)
@@ -614,12 +691,12 @@ public:
     }
 };
 
-class print2_audio_module: public small_audio_module_base<1, 0>
+class print_a_audio_module: public small_audio_module_base<1, 0>
 {
 public:    
     static void plugin_info(plugin_info_iface *pii)
     {
-        pii->names("print2", "Print To Console (A)", "lv2:UtilityPlugin");
+        pii->names("print_a", "Print To Console (A)", "lv2:UtilityPlugin");
         pii->audio_port("in", "In").input();
     }
     void process(uint32_t)

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list