[SCM] calf/master: + Small modules: fix assertion in print_em, add a (most likely broken) pass-through module (copy_em)

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


The following commit has been merged in the master branch:
commit 84c43526cf44cec1910dfec2ef021b5374ad6bb3
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date:   Mon Sep 29 21:51:28 2008 +0000

    + Small modules: fix assertion in print_em, add a (most likely broken) pass-through module (copy_em)
    
    
    git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@312 78b06b96-2940-0410-b7fc-879d825d01d8

diff --git a/src/calf/modulelist.h b/src/calf/modulelist.h
index 2c9e1b1..4ed537c 100644
--- a/src/calf/modulelist.h
+++ b/src/calf/modulelist.h
@@ -30,6 +30,7 @@
     PER_SMALL_MODULE_ITEM(print_c, "print_c")
     PER_SMALL_MODULE_ITEM(print_e, "print_e")
     PER_SMALL_MODULE_ITEM(print_em, "print_em")
+    PER_SMALL_MODULE_ITEM(copy_em, "copy_em")
     PER_SMALL_MODULE_ITEM(quadpower_a, "quadpower_a")
     PER_SMALL_MODULE_ITEM(quadpower_c, "quadpower_c")
     PER_SMALL_MODULE_ITEM(crossfader2_a, "crossfader2_a")
diff --git a/src/modules_small.cpp b/src/modules_small.cpp
index 22bc9a7..5ef354f 100644
--- a/src/modules_small.cpp
+++ b/src/modules_small.cpp
@@ -839,7 +839,7 @@ public:
     {
         print_em_audio_module *self =  (print_em_audio_module *)instance;
         printf("message_connect_port %d -> %p\n", port, data);
-        assert(port);
+        assert(!port);
         self->events = (LV2_Event_Buffer *)data;
     }
     static inline const void *ext_data(const char *URI) { 
@@ -853,6 +853,57 @@ public:
     }
 };
 
+class copy_em_audio_module: public small_audio_module_base<0, 0>
+{
+public:    
+    LV2_Event_Buffer *events_in, *events_out;
+    static void plugin_info(plugin_info_iface *pii)
+    {
+        pii->names("copy_em", "Message pass-through (EM)", "lv2:UtilityPlugin");
+        pii->lv2_ttl("lv2:requiredFeature <http://lv2plug.in/ns/dev/contexts> ;");
+        pii->lv2_ttl("lv2:requiredContext lv2ctx:MessageContext ;");
+        pii->event_port("in", "In").input().lv2_ttl("lv2ctx:context lv2ctx:MessageContext ;");
+        pii->event_port("out", "Out").output().lv2_ttl("lv2ctx:context lv2ctx:MessageContext ;");
+    }
+    void process(uint32_t)
+    {
+    }
+    static bool message_run(LV2_Handle instance, uint32_t *outputs_written)
+    {
+        copy_em_audio_module *self =  (copy_em_audio_module *)instance;
+        return self->message_run(outputs_written);
+    }
+    bool message_run(uint32_t *outputs_written)
+    {
+        if (events_in->size > events_in->capacity)
+        {
+            printf("Buffer capacity exceeded!\n");
+            return false;
+        }
+        events_out->event_count = events_in->event_count;
+        events_out->size = events_in->size;
+        memcpy(events_out->data, events_in->data, events_in->size);
+        *outputs_written = (events_in->event_count != 0) ? 2 : 0;
+        return true;
+    }
+    static void message_connect_port(LV2_Handle instance, uint32_t port, void* data)
+    {
+        copy_em_audio_module *self =  (copy_em_audio_module *)instance;
+        printf("message_connect_port %d -> %p\n", port, data);
+        if (port == 0) self->events_in = (LV2_Event_Buffer *)data;
+        if (port == 1) self->events_out = (LV2_Event_Buffer *)data;
+    }
+    static inline const void *ext_data(const char *URI) { 
+        static LV2MessageContext ctx_ext_data = { message_run, message_connect_port };
+        if (!strcmp(URI, LV2_CONTEXT_MESSAGE))
+        {
+            printf("URI=%s\n", URI);
+            return &ctx_ext_data;
+        }
+        return NULL;
+    }
+};
+
 class print_a_audio_module: public small_audio_module_base<1, 0>
 {
 public:    

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list