diff options
author | Hanspeter Portner <dev@open-music-kontrollers.ch> | 2015-06-18 23:22:21 +0200 |
---|---|---|
committer | Hanspeter Portner <dev@open-music-kontrollers.ch> | 2015-06-18 23:22:21 +0200 |
commit | 457a8be07ba67b6d7e268105dd8c65ea91ab63a7 (patch) | |
tree | c2355f5bb9ed9466d43ea7b76060a91ce7edc7a2 /bundle | |
parent | 719419c0eead1eba8492b70cf64fb02c9090eec8 (diff) | |
download | synthpod-457a8be07ba67b6d7e268105dd8c65ea91ab63a7.tar.xz |
outsource synthpod sink/source as private bundle.
Diffstat (limited to 'bundle')
-rw-r--r-- | bundle/CMakeLists.txt | 25 | ||||
-rw-r--r-- | bundle/manifest.ttl | 12 | ||||
-rw-r--r-- | bundle/manifest.ttl.in | 31 | ||||
-rw-r--r-- | bundle/state.ttl | 28 | ||||
-rw-r--r-- | bundle/synthpod_bundle.c | 35 | ||||
-rw-r--r-- | bundle/synthpod_bundle.h | 33 | ||||
-rw-r--r-- | bundle/synthpod_bundle.ttl | 201 | ||||
-rw-r--r-- | bundle/synthpod_sink.c | 128 | ||||
-rw-r--r-- | bundle/synthpod_source.c | 128 |
9 files changed, 579 insertions, 42 deletions
diff --git a/bundle/CMakeLists.txt b/bundle/CMakeLists.txt index 4359ee45..00512cda 100644 --- a/bundle/CMakeLists.txt +++ b/bundle/CMakeLists.txt @@ -1,2 +1,23 @@ -install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/state.ttl DESTINATION ${SYNTHPOD_DATA_DIR}) -install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/manifest.ttl DESTINATION ${SYNTHPOD_DATA_DIR}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +if(WIN32) + set(LIB_EXT ".dll") +elseif(APPLE) + set(LIB_EXT ".so") +else() + set(LIB_EXT ".so") +endif() + +# synthpod +add_library(synthpod_bundle.lv2 MODULE + synthpod_bundle.c + synthpod_sink.c + synthpod_source.c) +target_link_libraries(synthpod_bundle.lv2 synthpod.lib) +set_target_properties(synthpod_bundle.lv2 PROPERTIES PREFIX "" OUTPUT_NAME "synthpod_bundle") +install(TARGETS synthpod_bundle.lv2 DESTINATION ${SYNTHPOD_BUNDLE_DIR}) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/synthpod_bundle.ttl DESTINATION ${SYNTHPOD_BUNDLE_DIR}) + +# manifest +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/manifest.ttl.in ${PROJECT_BINARY_DIR}/bundle/manifest.ttl) +install(FILES ${PROJECT_BINARY_DIR}/bundle/manifest.ttl DESTINATION ${SYNTHPOD_BUNDLE_DIR}) diff --git a/bundle/manifest.ttl b/bundle/manifest.ttl deleted file mode 100644 index 23fdcf5a..00000000 --- a/bundle/manifest.ttl +++ /dev/null @@ -1,12 +0,0 @@ -@prefix atom: <http://lv2plug.in/ns/ext/atom#> . -@prefix lv2: <http://lv2plug.in/ns/lv2core#> . -@prefix pset: <http://lv2plug.in/ns/ext/presets#> . -@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix state: <http://lv2plug.in/ns/ext/state#> . -@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . - -<state.ttl> - a pset:Preset ; - rdfs:seeAlso <state.ttl> ; - lv2:appliesTo <http://open-music-kontrollers.ch/lv2/synthpod#stereo> . diff --git a/bundle/manifest.ttl.in b/bundle/manifest.ttl.in new file mode 100644 index 00000000..73a58c08 --- /dev/null +++ b/bundle/manifest.ttl.in @@ -0,0 +1,31 @@ +# 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. + +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +@prefix synthpod: <http://open-music-kontrollers.ch/lv2/synthpod#> . + +# Synthpod Source +synthpod:source + a lv2:Plugin ; + lv2:binary <synthpod_bundle@LIB_EXT@> ; + rdfs:seeAlso <synthpod_bundle.ttl> . + +# Synthpod Sink +synthpod:sink + a lv2:Plugin ; + lv2:binary <synthpod_bundle@LIB_EXT@> ; + rdfs:seeAlso <synthpod_bundle.ttl> . diff --git a/bundle/state.ttl b/bundle/state.ttl deleted file mode 100644 index 11dd8a00..00000000 --- a/bundle/state.ttl +++ /dev/null @@ -1,28 +0,0 @@ -@prefix atom: <http://lv2plug.in/ns/ext/atom#> . -@prefix lv2: <http://lv2plug.in/ns/lv2core#> . -@prefix pset: <http://lv2plug.in/ns/ext/presets#> . -@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix state: <http://lv2plug.in/ns/ext/state#> . -@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . - -<> - a pset:Preset ; - lv2:appliesTo <http://open-music-kontrollers.ch/lv2/synthpod#stereo> ; - rdfs:label "state" ; - lv2:port [ - lv2:symbol "control_in_1" ; - pset:value 0.0 - ] , [ - lv2:symbol "control_in_2" ; - pset:value 0.0 - ] , [ - lv2:symbol "control_in_3" ; - pset:value 0.0 - ] , [ - lv2:symbol "control_in_4" ; - pset:value 0.0 - ] ; - state:state [ - <http://open-music-kontrollers.ch/lv2/synthpod#json> <state.json> - ] . diff --git a/bundle/synthpod_bundle.c b/bundle/synthpod_bundle.c new file mode 100644 index 00000000..fbcf6fb6 --- /dev/null +++ b/bundle/synthpod_bundle.c @@ -0,0 +1,35 @@ +/* + * 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 <stdlib.h> + +#include <synthpod_bundle.h> + +LV2_SYMBOL_EXPORT const LV2_Descriptor* +lv2_descriptor(uint32_t index) +{ + switch(index) + { + case 0: + return &synthpod_source; + case 1: + return &synthpod_sink; + + default: + return NULL; + } +} diff --git a/bundle/synthpod_bundle.h b/bundle/synthpod_bundle.h new file mode 100644 index 00000000..d3a21f08 --- /dev/null +++ b/bundle/synthpod_bundle.h @@ -0,0 +1,33 @@ +/* + * 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. + */ + +#ifndef _SYNTHPOD_LV2_H +#define _SYNTHPOD_LV2_H + +#include "lv2/lv2plug.in/ns/lv2core/lv2.h" + +// bundle uri +#define SYNTHPOD_URI "http://open-music-kontrollers.ch/lv2/synthpod" + +// plugin uris +#define SYNTHPOD_SOURCE_URI SYNTHPOD_URI"#source" +#define SYNTHPOD_SINK_URI SYNTHPOD_URI"#sink" + +extern const LV2_Descriptor synthpod_source; +extern const LV2_Descriptor synthpod_sink; + +#endif // _SYNTHPOD_LV2_H diff --git a/bundle/synthpod_bundle.ttl b/bundle/synthpod_bundle.ttl new file mode 100644 index 00000000..81dc6892 --- /dev/null +++ b/bundle/synthpod_bundle.ttl @@ -0,0 +1,201 @@ +# 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. + +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix atom: <http://lv2plug.in/ns/ext/atom#> . +@prefix time: <http://lv2plug.in/ns/ext/time#> . +@prefix midi: <http://lv2plug.in/ns/ext/midi#> . +@prefix bufsz: <http://lv2plug.in/ns/ext/buf-size#> . +@prefix pg: <http://lv2plug.in/ns/ext/port-groups#> . +@prefix patch: <http://lv2plug.in/ns/ext/patch#> . + +@prefix lic: <http://opensource.org/licenses/> . +@prefix omk: <http://open-music-kontrollers.ch/ventosus#> . +@prefix proj: <http://open-music-kontrollers.ch/lv2/> . +@prefix synthpod: <http://open-music-kontrollers.ch/lv2/synthpod#> . + +# Maintainer +omk:me + a foaf:Person ; + foaf:name "Hanspeter Portner" ; + foaf:mbox <dev@open-music-kontrollers.ch> ; + foaf:homepage <http://open-music-kontrollers.ch> . + +# Project +proj:synthpod + a doap:Project ; + doap:maintainer omk:me ; + doap:name "Synthpod Bundle" . + +# Audio groups +synthpod:group_in + a pg:InputGroup , + pg:StereoGroup ; + lv2:name "Input" ; + lv2:symbol "in" . + +synthpod:group_out + a pg:OutputGroup , + pg:StereoGroup ; + lv2:name "Output" ; + lv2:symbol "out" . + +# Sink Plugin +synthpod:sink + a lv2:Plugin , + lv2:InstrumentPlugin ; + doap:name "Synthpod System Sink" ; + doap:license lic:Artistic-2.0 ; + lv2:project proj:synthpod ; + lv2:requiredFeature bufsz:boundedBlockLength ; + lv2:optionalFeature lv2:isLive , lv2:hardRTCapable ; + + lv2:port [ + # event in + a lv2:InputPort , + atom:AtomPort ; + atom:bufferType atom:Sequence ; + atom:supports midi:MidiEvent ; + atom:supports atom:Object ; + atom:supports time:Position ; + atom:supports patch:Message ; + lv2:index 0 ; + lv2:symbol "event_in" ; + lv2:name "Event In" ; + lv2:designation lv2:control ; + pg:group synthpod:group_in ; + ] , [ + # audio in 1 + a lv2:InputPort , + lv2:AudioPort ; + lv2:index 1 ; + lv2:symbol "audio_in_1" ; + lv2:name "Audio In 1" ; + lv2:designation pg:left ; + pg:group synthpod:group_in ; + ] , [ + # audio in 2 + a lv2:InputPort , + lv2:AudioPort ; + lv2:index 2 ; + lv2:symbol "audio_in_2" ; + lv2:name "Audio In 2" ; + lv2:designation pg:right ; + pg:group synthpod:group_in ; + ] , [ + # control in + a lv2:InputPort , + lv2:ControlPort ; + lv2:index 3 ; + lv2:symbol "control_in_1" ; + lv2:name "Input 1" ; + pg:group synthpod:group_in ; + ] , [ + a lv2:InputPort , + lv2:ControlPort ; + lv2:index 4 ; + lv2:symbol "control_in_2" ; + lv2:name "Input 2" ; + pg:group synthpod:group_in ; + ] , [ + a lv2:InputPort , + lv2:ControlPort ; + lv2:index 5 ; + lv2:symbol "control_in_3" ; + lv2:name "Input 3" ; + pg:group synthpod:group_in ; + ] , [ + a lv2:InputPort , + lv2:ControlPort ; + lv2:index 6 ; + lv2:symbol "control_in_4" ; + lv2:name "Input 4" ; + pg:group synthpod:group_in ; + ] . + +# Source Plugin +synthpod:source + a lv2:Plugin , + lv2:InstrumentPlugin ; + doap:name "Synthpod System Source" ; + doap:license lic:Artistic-2.0 ; + lv2:project proj:synthpod ; + lv2:requiredFeature bufsz:boundedBlockLength ; + lv2:optionalFeature lv2:isLive , lv2:hardRTCapable ; + + lv2:port [ + # event in + a lv2:OutputPort , + atom:AtomPort ; + atom:bufferType atom:Sequence ; + atom:supports midi:MidiEvent ; + atom:supports atom:Object ; + atom:supports time:Position ; + atom:supports patch:Message ; + lv2:index 0 ; + lv2:symbol "event_out" ; + lv2:name "Event Out" ; + lv2:designation lv2:control ; + pg:group synthpod:group_out ; + ] , [ + # audio in 1 + a lv2:OutputPort , + lv2:AudioPort ; + lv2:index 1 ; + lv2:symbol "audio_out_1" ; + lv2:name "Audio Out 1" ; + lv2:designation pg:left ; + pg:group synthpod:group_out ; + ] , [ + # audio in 2 + a lv2:OutputPort , + lv2:AudioPort ; + lv2:index 2 ; + lv2:symbol "audio_out_2" ; + lv2:name "Audio Out 2" ; + lv2:designation pg:right ; + pg:group synthpod:group_out ; + ] , [ + # control in + a lv2:OutputPort , + lv2:ControlPort ; + lv2:index 3 ; + lv2:symbol "control_out_1" ; + lv2:name "Output 1" ; + pg:group synthpod:group_out ; + ] , [ + a lv2:OutputPort , + lv2:ControlPort ; + lv2:index 4 ; + lv2:symbol "control_out_2" ; + lv2:name "Output 2" ; + pg:group synthpod:group_out ; + ] , [ + a lv2:OutputPort , + lv2:ControlPort ; + lv2:index 5 ; + lv2:symbol "control_out_3" ; + lv2:name "Output 3" ; + pg:group synthpod:group_out ; + ] , [ + a lv2:OutputPort , + lv2:ControlPort ; + lv2:index 6 ; + lv2:symbol "control_out_4" ; + lv2:name "Output 4" ; + pg:group synthpod:group_out ; + ] . diff --git a/bundle/synthpod_sink.c b/bundle/synthpod_sink.c new file mode 100644 index 00000000..10dc0db3 --- /dev/null +++ b/bundle/synthpod_sink.c @@ -0,0 +1,128 @@ +/* + * 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 <string.h> + +#include <synthpod_bundle.h> + +#include <lv2/lv2plug.in/ns/ext/atom/atom.h> + +typedef struct _plughandle_t plughandle_t; + +struct _plughandle_t { + LV2_Atom_Sequence *event_in; + float *audio_in[2]; + float *input[4]; +}; + +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 = instance; + + switch(port) + { + case 0: + handle->event_in = (LV2_Atom_Sequence *)data; + break; + + case 1: + handle->audio_in[0] = (float *)data; + break; + case 2: + handle->audio_in[1] = (float *)data; + break; + + case 3: + handle->input[0] = (float *)data; + break; + case 4: + handle->input[1] = (float *)data; + break; + case 5: + handle->input[2] = (float *)data; + break; + case 6: + handle->input[3] = (float *)data; + break; + + default: + break; + } +} + +static void +activate(LV2_Handle instance) +{ + //plughandle_t *handle = instance; + + // nothing +} + +static void +run(LV2_Handle instance, uint32_t nsamples) +{ + plughandle_t *handle = instance; + + // nothing +} + +static void +deactivate(LV2_Handle instance) +{ + plughandle_t *handle = instance; + + // nothing +} + +static void +cleanup(LV2_Handle instance) +{ + plughandle_t *handle = instance; + + free(handle); +} + +static const void* +extension_data(const char* uri) +{ + return NULL; +} + +const LV2_Descriptor synthpod_sink = { + .URI = SYNTHPOD_SINK_URI, + .instantiate = instantiate, + .connect_port = connect_port, + .activate = activate, + .run = run, + .deactivate = deactivate, + .cleanup = cleanup, + .extension_data = extension_data +}; diff --git a/bundle/synthpod_source.c b/bundle/synthpod_source.c new file mode 100644 index 00000000..2b532d62 --- /dev/null +++ b/bundle/synthpod_source.c @@ -0,0 +1,128 @@ +/* + * 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 <string.h> + +#include <synthpod_bundle.h> + +#include <lv2/lv2plug.in/ns/ext/atom/atom.h> + +typedef struct _plughandle_t plughandle_t; + +struct _plughandle_t { + const LV2_Atom_Sequence *event_out; + const float *audio_out[2]; + const float *output[4]; +}; + +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 = instance; + + switch(port) + { + case 0: + handle->event_out = (const LV2_Atom_Sequence *)data; + break; + + case 1: + handle->audio_out[0] = (const float *)data; + break; + case 2: + handle->audio_out[1] = (const float *)data; + break; + + case 3: + handle->output[0] = (const float *)data; + break; + case 4: + handle->output[1] = (const float *)data; + break; + case 5: + handle->output[2] = (const float *)data; + break; + case 6: + handle->output[3] = (const float *)data; + break; + + default: + break; + } +} + +static void +activate(LV2_Handle instance) +{ + //plughandle_t *handle = instance; + + // nothing +} + +static void +run(LV2_Handle instance, uint32_t nsamples) +{ + plughandle_t *handle = instance; + + // nothing +} + +static void +deactivate(LV2_Handle instance) +{ + plughandle_t *handle = instance; + + // nothing +} + +static void +cleanup(LV2_Handle instance) +{ + plughandle_t *handle = instance; + + free(handle); +} + +static const void* +extension_data(const char* uri) +{ + return NULL; +} + +const LV2_Descriptor synthpod_source = { + .URI = SYNTHPOD_SOURCE_URI, + .instantiate = instantiate, + .connect_port = connect_port, + .activate = activate, + .run = run, + .deactivate = deactivate, + .cleanup = cleanup, + .extension_data = extension_data +}; |