[SCM] calf/master: + Small modules: added Set Channel, Key Less-than, Key Range, Channel Less-than plugins (mostly untested, might be very buggy), renamed transpose_em to transpose_m (stupid mistake)

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


The following commit has been merged in the master branch:
commit cb0957a70869db388af8a9a214b3c2c34a382311
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date:   Sat Oct 11 19:21:28 2008 +0000

    + Small modules: added Set Channel, Key Less-than, Key Range, Channel Less-than plugins (mostly untested, might be very buggy), renamed transpose_em to transpose_m (stupid mistake)
    
    
    
    git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@330 78b06b96-2940-0410-b7fc-879d825d01d8

diff --git a/src/calf/modulelist.h b/src/calf/modulelist.h
index 2eb48be..e7f2b69 100644
--- a/src/calf/modulelist.h
+++ b/src/calf/modulelist.h
@@ -47,6 +47,10 @@
     PER_SMALL_MODULE_ITEM(pitchbendfilter_m, "pitchbendfilter_m")
     PER_SMALL_MODULE_ITEM(systemfilter_m, "systemfilter_m")
     PER_SMALL_MODULE_ITEM(channelfilter_m, "channelfilter_m")
+    PER_SMALL_MODULE_ITEM(keyfilter_m, "keyfilter_m")
+    PER_SMALL_MODULE_ITEM(setchannel_m, "setchannel_m")
+    PER_SMALL_MODULE_ITEM(key_less_than_m, "key_less_than_m")
+    PER_SMALL_MODULE_ITEM(channel_less_than_m, "channel_less_than_m")
     PER_SMALL_MODULE_ITEM(transpose_m, "transpose_m")
     PER_SMALL_MODULE_ITEM(eventmerge_e, "eventmerge_e")
     PER_SMALL_MODULE_ITEM(quadpower_a, "quadpower_a")
diff --git a/src/modules_small.cpp b/src/modules_small.cpp
index b093f2d..b369744 100644
--- a/src/modules_small.cpp
+++ b/src/modules_small.cpp
@@ -1,5 +1,5 @@
 /* Calf DSP Library
- * Example audio modules - parameters and LADSPA wrapper instantiation
+ * Small modules for modular synthesizers
  *
  * Copyright (C) 2001-2008 Krzysztof Foltman
  *
@@ -1395,7 +1395,50 @@ public:
         int chnl = 1 + (data[0] & 0xF);
         return data[0] < 0xF0 && chnl >= *ins[1] && chnl <= *ins[2];
     }
-    static inline const char **strings() { static const char *s[] = { "channelfilter_m", "Channel Filter", "range", "Range" }; return s;}
+    static inline const char **strings() { static const char *s[] = { "channelfilter_m", "Channel Range Filter", "range", "Range" }; return s;}
+};
+
+class keyfilter_m_audio_module: public miditypefilter_m_audio_module<keyfilter_m_audio_module, 3>
+{
+public:
+    static inline void extra_inputs(plugin_info_iface *pii)
+    {
+        pii->control_port("min", "Min Note", 0).input().integer().lin_range(0, 127);
+        pii->control_port("max", "Max Note", 127).input().integer().lin_range(0, 127);
+    }
+    static inline bool is_in_range(const uint8_t *data, float **ins) { 
+        // XXXKF doesn't handle polyphonic aftertouch
+        return (data[0] >= 0x80 && data[0] <= 0x9F) && data[0] >= *ins[1] && data[1] <= *ins[2];
+    }
+    static inline const char **strings() { static const char *s[] = { "keyfilter_m", "Key Range Filter", "range", "Range" }; return s;}
+};
+
+class key_less_than_m_audio_module: public miditypefilter_m_audio_module<key_less_than_m_audio_module, 2>
+{
+public:
+    static inline void extra_inputs(plugin_info_iface *pii)
+    {
+        pii->control_port("threshold", "Threshold", 60).input().integer().lin_range(0, 128);
+    }
+    static inline bool is_in_range(const uint8_t *data, float **ins) { 
+        // XXXKF doesn't handle polyphonic aftertouch
+        return (data[0] >= 0x80 && data[0] <= 0x9F) && data[1] < *ins[1];
+    }
+    static inline const char **strings() { static const char *s[] = { "key_less_than_m", "Key Less-Than Filter", "less", "Less" }; return s;}
+};
+
+class channel_less_than_m_audio_module: public miditypefilter_m_audio_module<channel_less_than_m_audio_module, 2>
+{
+public:
+    static inline void extra_inputs(plugin_info_iface *pii)
+    {
+        pii->control_port("threshold", "Threshold", 10).input().integer().lin_range(1, 16);
+    }
+    static inline bool is_in_range(const uint8_t *data, float **ins) { 
+        // XXXKF doesn't handle polyphonic aftertouch
+        return (data[0] < 0xF0) && (1 + (data[0] & 0xF)) < *ins[1];
+    }
+    static inline const char **strings() { static const char *s[] = { "channel_less_than_m", "Channel Less-Than Filter", "less", "Less" }; return s;}
 };
 
 class transpose_m_audio_module: public midi_mixin<small_audio_module_base<2, 1> >
@@ -1403,7 +1446,7 @@ class transpose_m_audio_module: public midi_mixin<small_audio_module_base<2, 1>
 public:    
     static void plugin_info(plugin_info_iface *pii)
     {
-        pii->names("transpose_em", "Transpose", "kf:MIDIPlugin");
+        pii->names("transpose_m", "Transpose", "kf:MIDIPlugin");
         pii->event_port("in", "In").input();
         pii->control_port("transpose", "Transpose", 12).input().integer();
         pii->event_port("out", "Out").output();
@@ -1434,6 +1477,36 @@ public:
     }
 };
 
+class setchannel_m_audio_module: public midi_mixin<small_audio_module_base<2, 1> >
+{
+public:    
+    static void plugin_info(plugin_info_iface *pii)
+    {
+        pii->names("setchannel_m", "Set Channel", "kf:MIDIPlugin");
+        pii->event_port("in", "In").input();
+        pii->control_port("channel", "Channel", 1).input().integer().lin_range(1, 16);
+        pii->event_port("out", "Out").output();
+    }
+    void process(uint32_t)
+    {
+        event_port_read_iterator ri((LV2_Event_Buffer *)ins[0]);
+        event_port_write_iterator wi((LV2_Event_Buffer *)outs[0]);
+        while(ri)
+        {
+            const lv2_event &event = *ri++;
+            if (event.type == this->midi_event_type && (event.data[0] >= 0x80 && event.data[0] <= 0xEF))
+            {
+                *wi = event;
+                // modify channel number in the first byte 
+                wi->data[0] = (wi->data[0] & 0xF0) | (((int)*ins[1] - 1) & 0xF);
+                wi++;
+            }
+            else
+                *wi++ = event;
+        }
+    }
+};
+
 class eventmerge_e_audio_module: public event_mixin<small_audio_module_base<2, 1> >
 {
 public:    

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list