aboutsummaryrefslogtreecommitdiff
path: root/eo_ui.lv2/test/eo.c
diff options
context:
space:
mode:
Diffstat (limited to 'eo_ui.lv2/test/eo.c')
-rw-r--r--eo_ui.lv2/test/eo.c103
1 files changed, 103 insertions, 0 deletions
diff --git a/eo_ui.lv2/test/eo.c b/eo_ui.lv2/test/eo.c
new file mode 100644
index 0000000..91573b9
--- /dev/null
+++ b/eo_ui.lv2/test/eo.c
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2016 Hanspeter Portner (dev@open-music-kontrollers.ch)
+ *
+ * This is free software: you can redistribute it and/or modify
+ * it under the terms of the Artistic License 2.0 as published by
+ * The Perl Foundation.
+ *
+ * This source is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the voiceied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Artistic License 2.0 for more details.
+ *
+ * You should have received a copy of the Artistic License 2.0
+ * along the source as a COPYING file. If not, obtain it from
+ * http://www.perlfoundation.org/artistic_license_2_0.
+ */
+
+#include <stdlib.h>
+
+#include <lv2/lv2plug.in/ns/lv2core/lv2.h>
+
+#define EO_PREFIX "http://open-music-kontrollers.ch/lv2/eo#"
+#define EO_TEST_URI EO_PREFIX"test"
+
+typedef struct _plughandle_t plughandle_t;
+
+struct _plughandle_t {
+ const float *x_in;
+ const float *y_in;
+};
+
+static LV2_Handle
+instantiate(const LV2_Descriptor* descriptor, double rate,
+ const char *bundle_path, const LV2_Feature *const *features)
+{
+ plughandle_t *handle = calloc(1, sizeof(plughandle_t));
+ if(!handle)
+ return NULL;
+
+ return handle;
+}
+
+static void
+connect_port(LV2_Handle instance, uint32_t port, void *data)
+{
+ plughandle_t *handle = (plughandle_t *)instance;
+
+ switch(port)
+ {
+ case 0:
+ handle->x_in = (const float *)data;
+ break;
+ case 1:
+ handle->y_in = (const float *)data;
+ break;
+ default:
+ break;
+ }
+}
+
+static void
+run(LV2_Handle instance, uint32_t nsamples)
+{
+ plughandle_t *handle = instance;
+
+ // do nothing
+}
+
+static void
+cleanup(LV2_Handle instance)
+{
+ plughandle_t *handle = instance;
+
+ free(handle);
+}
+
+const LV2_Descriptor eo_test = {
+ .URI = EO_TEST_URI,
+ .instantiate = instantiate,
+ .connect_port = connect_port,
+ .activate = NULL,
+ .run = run,
+ .deactivate = NULL,
+ .cleanup = cleanup,
+ .extension_data = NULL
+};
+
+#ifdef _WIN32
+__declspec(dllexport)
+#else
+__attribute__((visibility("default")))
+#endif
+const LV2_Descriptor*
+lv2_descriptor(uint32_t index)
+{
+ switch(index)
+ {
+ case 0:
+ return &eo_test;
+ default:
+ return NULL;
+ }
+}