aboutsummaryrefslogtreecommitdiff
path: root/atom_inspector.c
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2015-03-16 18:27:10 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2015-03-16 18:27:10 +0100
commite4c7d813eeab43865abb5595da6f4b4633239eb3 (patch)
treed1323b2813abf5a7adfd0d8e757d4720e0dac7cc /atom_inspector.c
parente1b01fc6d4069f216478527c0f79544072279e46 (diff)
downloadsherlock.lv2-e4c7d813eeab43865abb5595da6f4b4633239eb3.tar.xz
single input port.
* single input port * migrate to atomTrasfer protocol * no through port * not output port
Diffstat (limited to 'atom_inspector.c')
-rw-r--r--atom_inspector.c112
1 files changed, 112 insertions, 0 deletions
diff --git a/atom_inspector.c b/atom_inspector.c
new file mode 100644
index 0000000..6430ec1
--- /dev/null
+++ b/atom_inspector.c
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2015 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 implied 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 <stdio.h>
+#include <stdlib.h>
+
+#include <sherlock.h>
+
+typedef struct _handle_t handle_t;
+
+struct _handle_t {
+ LV2_URID_Map *map;
+ const LV2_Atom_Sequence *control_in;
+};
+
+static LV2_Handle
+instantiate(const LV2_Descriptor* descriptor, double rate,
+ const char *bundle_path, const LV2_Feature *const *features)
+{
+ int i;
+ handle_t *handle = calloc(1, sizeof(handle_t));
+ if(!handle)
+ return NULL;
+
+ for(i=0; features[i]; i++)
+ if(!strcmp(features[i]->URI, LV2_URID__map))
+ handle->map = (LV2_URID_Map *)features[i]->data;
+
+ if(!handle->map)
+ {
+ fprintf(stderr, "%s: Host does not support urid:map\n", descriptor->URI);
+ free(handle);
+ return NULL;
+ }
+
+ return handle;
+}
+
+static void
+connect_port(LV2_Handle instance, uint32_t port, void *data)
+{
+ handle_t *handle = (handle_t *)instance;
+
+ switch(port)
+ {
+ case 0:
+ handle->control_in = (const LV2_Atom_Sequence *)data;
+ break;
+ default:
+ break;
+ }
+}
+
+static void
+activate(LV2_Handle instance)
+{
+ handle_t *handle = (handle_t *)instance;
+ //nothing
+}
+
+static void
+run(LV2_Handle instance, uint32_t nsamples)
+{
+ handle_t *handle = (handle_t *)instance;
+ //nothing
+}
+
+static void
+deactivate(LV2_Handle instance)
+{
+ handle_t *handle = (handle_t *)instance;
+ //nothing
+}
+
+static void
+cleanup(LV2_Handle instance)
+{
+ handle_t *handle = (handle_t *)instance;
+
+ free(handle);
+}
+
+static const void*
+extension_data(const char* uri)
+{
+ return NULL;
+}
+
+const LV2_Descriptor atom_inspector = {
+ .URI = SHERLOCK_ATOM_INSPECTOR_URI,
+ .instantiate = instantiate,
+ .connect_port = connect_port,
+ .activate = activate,
+ .run = run,
+ .deactivate = deactivate,
+ .cleanup = cleanup,
+ .extension_data = extension_data
+};