[SCM] calf/master: + LV2: fix compile error due to lv2_event.h update in the previous check-in + Small modules: add Channel Filter MIDI plugin (a filter that checks if channel number is within the specified range)

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 c0a1f1ffeeb9f958965d1bd2d95394c27eeafe5a
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date:   Fri Oct 10 21:12:29 2008 +0000

    + LV2: fix compile error due to lv2_event.h update in the previous check-in
    + Small modules: add Channel Filter MIDI plugin (a filter that checks if channel number is within the specified range)
    
    
    
    git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@328 78b06b96-2940-0410-b7fc-879d825d01d8

diff --git a/src/calf/lv2wrap.h b/src/calf/lv2wrap.h
index 72dd9c5..7711200 100644
--- a/src/calf/lv2wrap.h
+++ b/src/calf/lv2wrap.h
@@ -254,7 +254,7 @@ struct lv2_wrapper
                 }
                 else
                 if (item->type == 0 && mod->event_feature)
-                    mod->event_feature->lv2_event_drop(mod->event_feature->callback_data, item, 0);
+                    mod->event_feature->lv2_event_unref(mod->event_feature->callback_data, item);
                 // printf("timestamp %f item size %d first byte %x\n", item->timestamp, item->size, item->data[0]);
                 data += ((sizeof(LV2_Event) + item->size + 7))&~7;
             }
diff --git a/src/calf/modulelist.h b/src/calf/modulelist.h
index bd2eda0..128b917 100644
--- a/src/calf/modulelist.h
+++ b/src/calf/modulelist.h
@@ -46,6 +46,7 @@
     PER_SMALL_MODULE_ITEM(pressurefilter_m, "pressurefilter_m")
     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(eventmerge_e, "eventmerge_e")
     PER_SMALL_MODULE_ITEM(quadpower_a, "quadpower_a")
     PER_SMALL_MODULE_ITEM(quadpower_c, "quadpower_c")
diff --git a/src/modules_small.cpp b/src/modules_small.cpp
index fcabfb7..ce48011 100644
--- a/src/modules_small.cpp
+++ b/src/modules_small.cpp
@@ -1306,8 +1306,8 @@ public:
     }
 };
 
-template<class Range>
-class miditypefilter_m_audio_module: public midi_mixin<small_audio_module_base<1, 2> >
+template<class Range, int Inputs = 1>
+class miditypefilter_m_audio_module: public midi_mixin<small_audio_module_base<Inputs, 2> >
 {
 public:    
     static inline void extra_inputs(plugin_info_iface *pii)
@@ -1327,13 +1327,13 @@ public:
     }
     void process(uint32_t)
     {
-        event_port_read_iterator ri((LV2_Event_Buffer *)ins[0]);
-        event_port_write_iterator wi((LV2_Event_Buffer *)outs[0]);
-        event_port_write_iterator wi2((LV2_Event_Buffer *)outs[1]);
+        event_port_read_iterator ri((LV2_Event_Buffer *)this->ins[0]);
+        event_port_write_iterator wi((LV2_Event_Buffer *)this->outs[0]);
+        event_port_write_iterator wi2((LV2_Event_Buffer *)this->outs[1]);
         while(ri)
         {
             const lv2_event &event = *ri++;
-            if (event.type == midi_event_type && event.size && Range::is_in_range(event.data, ins))
+            if (event.type == this->midi_event_type && event.size && Range::is_in_range(event.data, this->ins))
                 *wi++ = event;
             else 
                 *wi2++ = event;
@@ -1383,6 +1383,21 @@ public:
     static inline const char **strings() { static const char *s[] = { "systemfilter_m", "System Msg Filter", "system", "System" }; return s;}
 };
 
+class channelfilter_m_audio_module: public miditypefilter_m_audio_module<channelfilter_m_audio_module, 3>
+{
+public:
+    static inline void extra_inputs(plugin_info_iface *pii)
+    {
+        pii->control_port("min", "Min Channel", 1).input().integer().lin_range(1, 16);
+        pii->control_port("max", "Max Channel", 16).input().integer().lin_range(1, 16);
+    }
+    static inline bool is_in_range(const uint8_t *data, float **ins) { 
+        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;}
+};
+
 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