diff options
author | David Robillard <d@drobilla.net> | 2007-02-05 22:34:56 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-02-05 22:34:56 +0000 |
commit | 1988a63b41a0e81f348d5df3394d41d3248d442b (patch) | |
tree | 2ec6758a2554f6456ae0f377cc47b4f1260a8b2d | |
parent | 1f0922ab4982da825ddfbb792ec9f871b2b88804 (diff) | |
download | lilv-1988a63b41a0e81f348d5df3394d41d3248d442b.tar.gz lilv-1988a63b41a0e81f348d5df3394d41d3248d442b.tar.bz2 lilv-1988a63b41a0e81f348d5df3394d41d3248d442b.zip |
Reorganized tree in preparation for beta release.
Split simple (example) jack host and more useful one (with midi).
Working Jack/LV2 midi in lv2_jack_host.
Added lv2_list.
git-svn-id: http://svn.drobilla.net/lad/slv2@279 a436a847-0d15-0410-975c-d299462d15a1
24 files changed, 99 insertions, 627 deletions
diff --git a/Makefile.am b/Makefile.am index 5646891..66af074 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = src slv2 utils examples data doc +SUBDIRS = src slv2 utils hosts data doc pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libslv2.pc diff --git a/configure.ac b/configure.ac index 14fd78a..cde28b8 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,8 @@ AC_PREREQ(2.59) -AC_INIT([libslv2],[0.0.1],[drobilla@connect.carleton.ca]) +AC_INIT([libslv2],[0.0.1],[dave@drobilla.net]) AC_CONFIG_SRCDIR([src/plugin.c]) AC_CONFIG_SRCDIR([slv2/plugin.h]) -AC_CONFIG_SRCDIR([utils/ladspa2lv2.cc]) -AC_CONFIG_SRCDIR([examples/plugins/Amp-swh.lv2/amp.c]) -AC_CONFIG_SRCDIR([examples/hosts/test_host.c]) +AC_CONFIG_SRCDIR([utils/lv2_list.c]) AC_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE @@ -72,25 +70,23 @@ AC_ARG_WITH(lv2-dir, AC_MSG_RESULT($lv2dir) AC_SUBST(lv2dir) -# Build utilities? -build_utilities="no" -AC_ARG_ENABLE(utilities, - [AS_HELP_STRING(--enable-utilities, [Build utilities (no) - EXPERIMENTAL])], - [build_utilities="$enableval"]) -if test "$build_utilities" = "yes"; then +# Build ladspa converter? +build_ladspa2lv2="no" +AC_ARG_ENABLE(ladspa2lv2, + [AS_HELP_STRING(--enable-ladspa2lv2, [Build ladspa2lv2 (no) - BROKEN])], + [build_ladspa2lv2="$enableval"]) +if test "$build_ladspa2lv2" = "yes"; then AC_PROG_CXX PKG_CHECK_MODULES(RAUL, raul >= 0.0.0) fi -AM_CONDITIONAL(BUILD_UTILITIES, [test "$build_utilities" = "yes"]) +AM_CONDITIONAL(BUILD_LADSPA2SLV2, [test "$build_ladspa2lv2" = "yes"]) # Write output files AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([src/Makefile]) AC_CONFIG_FILES([slv2/Makefile]) AC_CONFIG_FILES([utils/Makefile]) -AC_CONFIG_FILES([examples/Makefile]) -AC_CONFIG_FILES([examples/plugins/Makefile]) -AC_CONFIG_FILES([examples/hosts/Makefile]) +AC_CONFIG_FILES([hosts/Makefile]) AC_CONFIG_FILES([data/Makefile]) AC_CONFIG_FILES([libslv2.pc]) AC_CONFIG_FILES([doc/Makefile]) diff --git a/examples/Makefile.am b/examples/Makefile.am deleted file mode 100644 index 94939c3..0000000 --- a/examples/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -SUBDIRS = plugins hosts - diff --git a/examples/hosts/Makefile.am b/examples/hosts/Makefile.am deleted file mode 100644 index f483161..0000000 --- a/examples/hosts/Makefile.am +++ /dev/null @@ -1,37 +0,0 @@ -AM_CFLAGS = -std=c99 -I$(top_srcdir) @RASQAL_CFLAGS@ - -bin_PROGRAMS = slv2_test_host - -if WITH_JACK -bin_PROGRAMS += slv2_simple_jack_host slv2_host -endif - -slv2_test_host_DEPENDENCIES = ../../src/libslv2.la -slv2_test_host_LDADD = ../../src/libslv2.la - -slv2_test_host_SOURCES = \ - test_host.c - - -if WITH_JACK - -slv2_simple_jack_host_CFLAGS = @JACK_CFLAGS@ $(AM_CFLAGS) - -slv2_simple_jack_host_DEPENDENCIES = ../../src/libslv2.la -slv2_simple_jack_host_LDADD = ../../src/libslv2.la @JACK_LIBS@ @RASQAL_LIBS@ - -slv2_simple_jack_host_SOURCES = \ - simple_jack_host.c - - -slv2_host_CFLAGS = @JACK_CFLAGS@ $(AM_CFLAGS) - - -slv2_host_DEPENDENCIES = ../../src/libslv2.la -slv2_host_LDADD = ../../src/libslv2.la @JACK_LIBS@ @RASQAL_LIBS@ - -slv2_host_SOURCES = \ - host.c - - -endif # WITH_JACK diff --git a/examples/hosts/test_host.c b/examples/hosts/test_host.c deleted file mode 100644 index 0eabee5..0000000 --- a/examples/hosts/test_host.c +++ /dev/null @@ -1,170 +0,0 @@ -/* LibSLV2 Test Host - * Copyright (C) 2006 Dave Robillard <drobilla@connect.carleton.ca> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This program 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 GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#define _XOPEN_SOURCE 500 - -#include <rasqal.h> -#include <string.h> -#include <stdlib.h> -#include <assert.h> - -#include <slv2/types.h> -#include <slv2/plugin.h> -#include <slv2/plugininstance.h> -#include <slv2/pluginlist.h> -#include <slv2/port.h> - - -void -create_control_input() -{ - printf("Control Input\n"); -} - - -void -create_control_output() -{ - printf("Control Output\n"); -} - - -void -create_audio_input() -{ - printf("Audio Input\n"); -} - - -void -create_audio_output() -{ - printf("Audio Output\n"); -} - - -void -create_port(SLV2Plugin* plugin, - uint32_t port_index) -{ - enum SLV2PortClass class = slv2_port_get_class(plugin, port_index); - - switch (class) { - case SLV2_CONTROL_RATE_INPUT: - create_control_input(port_index); - break; - case SLV2_CONTROL_RATE_OUTPUT: - create_control_output(port_index); - break; - case SLV2_AUDIO_RATE_INPUT: - create_audio_input(port_index); - break; - case SLV2_AUDIO_RATE_OUTPUT: - create_audio_output(port_index); - break; - default: - printf("Unknown port type, ignored.\n"); - } - //printf("Port %ld class: %d\n", i, slv2_port_get_class(p, i)); -} - - -int -main() -{ - //const char* path = "foo"; - - const char* path = "/home/dave/code/libslv2/examples/plugins"; - - SLV2List plugins = slv2_list_new(); - slv2_list_load_path(plugins, path); - - const char* plugin_uri = "http://plugin.org.uk/swh-plugins/amp"; - printf("URI:\t%s\n", plugin_uri); - - const SLV2Plugin* p = slv2_list_get_plugin_by_uri(plugins, plugin_uri); - if (p) { - /* Get the plugin's name */ - char* name = slv2_plugin_get_name(p); - printf("Name:\t%s\n", name); - free(name); - - uint32_t num_ports = slv2_plugin_get_num_ports(p); - //printf("Number of ports: %ld\n", num_ports); - - for (uint32_t i=0; i < num_ports; ++i) { - enum SLV2PortClass class = slv2_port_get_class(p, i); - - switch (class) { - case SLV2_CONTROL_RATE_INPUT: - create_control_input(i); - break; - case SLV2_CONTROL_RATE_OUTPUT: - create_control_output(i); - break; - case SLV2_AUDIO_RATE_INPUT: - create_audio_input(i); - break; - case SLV2_AUDIO_RATE_OUTPUT: - create_audio_output(i); - break; - default: - printf("Unknown port type, ignored.\n"); - } - //printf("Port %ld class: %d\n", i, slv2_port_get_class(p, i)); - - - } - - SLV2Property prop; - for (uint32_t i=0; i < num_ports; ++i) { - const char* property = "a"; - prop = slv2_port_get_property(p, i, property); - if (prop) - printf("Port %u %s = %s\n", i, property, prop->values[0]); - else - printf("No port %u %s.\n", i, property); - free(prop); - } - printf("\n"); - - SLV2Instance* i = slv2_plugin_instantiate(p, 48000, NULL); - if (i) { - printf("Succesfully instantiated plugin.\n"); - - float gain = 2.0f; - float input = 0.25f; - float output = 0.0f; - slv2_instance_connect_port(i, 0, &gain); - slv2_instance_connect_port(i, 1, &input); - slv2_instance_connect_port(i, 2, &output); - - slv2_instance_activate(i); - slv2_instance_run(i, 1); - slv2_instance_deactivate(i); - - printf("Gain: %f, Input: %f => Output: %f\n", gain, input, output); - slv2_instance_free(i); - } - } - - slv2_list_free(plugins); - - return 0; -} - diff --git a/examples/plugins/Amp-onefile-slv2.lv2/Makefile b/examples/plugins/Amp-onefile-slv2.lv2/Makefile deleted file mode 100644 index eb7dfe1..0000000 --- a/examples/plugins/Amp-onefile-slv2.lv2/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -CFLAGS = -Wall -I../../../include -fPIC -g -O0 - -all: amp.so - -amp.so: amp.o - $(LD) amp.o -o amp.so -shared - rm amp.o - -clean: - rm *.o amp.so diff --git a/examples/plugins/Amp-onefile-slv2.lv2/amp.c b/examples/plugins/Amp-onefile-slv2.lv2/amp.c deleted file mode 100644 index d52e8f4..0000000 --- a/examples/plugins/Amp-onefile-slv2.lv2/amp.c +++ /dev/null @@ -1,108 +0,0 @@ -#include <stdlib.h> -#include <string.h> - -#include <math.h> - -#include "lv2.h" - -#ifdef WIN32 -#define SYMBOL_EXPORT __declspec(dllexport) -#else -#define SYMBOL_EXPORT -#endif - -#define AMP_URI "http://codeson.net/plugins/amponefile" -#define AMP_GAIN 0 -#define AMP_INPUT 1 -#define AMP_OUTPUT 2 - -static LV2_Descriptor *ampDescriptor = NULL; - -typedef struct { - float *gain; - float *input; - float *output; -} Amp; - - -static void -cleanupAmp(LV2_Handle instance) { - free(instance); -} - - -static void -connectPortAmp(LV2_Handle instance, uint32_t port, - void *data) { - Amp *plugin = (Amp *)instance; - - switch (port) { - case AMP_GAIN: - plugin->gain = data; - break; - case AMP_INPUT: - plugin->input = data; - break; - case AMP_OUTPUT: - plugin->output = data; - break; - } -} - - -static LV2_Handle -instantiateAmp(const LV2_Descriptor *descriptor, - uint32_t s_rate, const char *path , const LV2_Host_Feature **features) { - Amp *plugin_data = (Amp *)malloc(sizeof(Amp)); - - return (LV2_Handle)plugin_data; -} - - -#define DB_CO(g) ((g) > -90.0f ? powf(10.0f, (g) * 0.05f) : 0.0f) - -static void -runAmp(LV2_Handle instance, uint32_t sample_count) { - Amp *plugin_data = (Amp *)instance; - - const float gain = *(plugin_data->gain); - const float * const input = plugin_data->input; - float * const output = plugin_data->output; - - uint32_t pos; - float coef = DB_CO(gain); - - for (pos = 0; pos < sample_count; pos++) { - output[pos] = input[pos] * coef; - } -} - - -static void -init() { - ampDescriptor = - (LV2_Descriptor *)malloc(sizeof(LV2_Descriptor)); - - ampDescriptor->URI = AMP_URI; - ampDescriptor->activate = NULL; - ampDescriptor->cleanup = cleanupAmp; - ampDescriptor->connect_port = connectPortAmp; - ampDescriptor->deactivate = NULL; - ampDescriptor->instantiate = instantiateAmp; - ampDescriptor->run = runAmp; -} - - -SYMBOL_EXPORT -const LV2_Descriptor* -lv2_descriptor(uint32_t index) { - if (!ampDescriptor) init(); - - switch (index) { - case 0: - return ampDescriptor; - default: - return NULL; - } -} - diff --git a/examples/plugins/Amp-onefile-slv2.lv2/manifest.ttl b/examples/plugins/Amp-onefile-slv2.lv2/manifest.ttl deleted file mode 100644 index 8113dec..0000000 --- a/examples/plugins/Amp-onefile-slv2.lv2/manifest.ttl +++ /dev/null @@ -1,58 +0,0 @@ -@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix lv2: <http://lv2plug.in/ontology#> . -@prefix foaf: <http://xmlns.com/foaf/0.1/> . -@prefix doap: <http://usefulinc.com/ns/doap#> . - -<http://codeson.net/plugins/amponefile> a lv2:Plugin ; - lv2:binary <amp.so> ; - a lv2:AmplifierPlugin ; - doap:maintainer [ - foaf:name "Dave Robillard"; - foaf:homepage <http://codeson.net/> ; - foaf:mbox <mailto:drobilla@connect.carleton.ca> - ] ; - doap:name "Simple Amplifier" ; - doap:name "Einfacher Verst¿¿rker"@de ; - doap:licence <http://usefulinc.com/doap/licenses/gpl> ; - - lv2:property lv2:hardRTCapable ; - - lv2:port [ - a lv2:ControlRateInputPort ; - lv2:datatype lv2:float ; - lv2:index 0 ; - lv2:symbol "gain" ; - lv2:name "Gain" ; - lv2:name "Gewinn"@de ; - lv2:default [ rdf:value 0.0 ] ; - lv2:minimum [ rdf:value -90.0 ] ; - lv2:maximum [ rdf:value 24.0 ] ; - lv2:scalePoint [ - rdfs:label "+5" ; - rdf:value 5.0 - ] , [ - rdfs:label "Unity" ; - rdf:value 1.0 - ] , [ - rdfs:label "-5" ; - rdf:value -5.0 - ] , [ - rdfs:label "-10" ; - rdf:value -10.0 - ] - ] , [ - a lv2:AudioRateInputPort ; - lv2:datatype lv2:float ; - lv2:index 1 ; - lv2:symbol "in" ; - lv2:name "Input" - ] , [ - a lv2:AudioRateOutputPort ; - lv2:datatype lv2:float ; - lv2:index 2 ; - lv2:symbol "out" ; - lv2:name "Output" - ] -. - diff --git a/examples/plugins/Amp-slv2.lv2/Makefile b/examples/plugins/Amp-slv2.lv2/Makefile deleted file mode 100644 index eb7dfe1..0000000 --- a/examples/plugins/Amp-slv2.lv2/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -CFLAGS = -Wall -I../../../include -fPIC -g -O0 - -all: amp.so - -amp.so: amp.o - $(LD) amp.o -o amp.so -shared - rm amp.o - -clean: - rm *.o amp.so diff --git a/examples/plugins/Amp-slv2.lv2/amp.c b/examples/plugins/Amp-slv2.lv2/amp.c deleted file mode 100644 index c9d6b73..0000000 --- a/examples/plugins/Amp-slv2.lv2/amp.c +++ /dev/null @@ -1,108 +0,0 @@ -#include <stdlib.h> -#include <string.h> - -#include <math.h> - -#include "lv2.h" - -#ifdef WIN32 -#define SYMBOL_EXPORT __declspec(dllexport) -#else -#define SYMBOL_EXPORT -#endif - -#define AMP_URI "http://codeson.net/plugins/amp" -#define AMP_GAIN 0 -#define AMP_INPUT 1 -#define AMP_OUTPUT 2 - -static LV2_Descriptor *ampDescriptor = NULL; - -typedef struct { - float *gain; - float *input; - float *output; -} Amp; - - -static void -cleanupAmp(LV2_Handle instance) { - free(instance); -} - - -static void -connectPortAmp(LV2_Handle instance, uint32_t port, - void *data) { - Amp *plugin = (Amp *)instance; - - switch (port) { - case AMP_GAIN: - plugin->gain = data; - break; - case AMP_INPUT: - plugin->input = data; - break; - case AMP_OUTPUT: - plugin->output = data; - break; - } -} - - -static LV2_Handle -instantiateAmp(const LV2_Descriptor *descriptor, - uint32_t s_rate, const char *path , const LV2_Host_Feature **features) { - Amp *plugin_data = (Amp *)malloc(sizeof(Amp)); - - return (LV2_Handle)plugin_data; -} - - -#define DB_CO(g) ((g) > -90.0f ? powf(10.0f, (g) * 0.05f) : 0.0f) - -static void -runAmp(LV2_Handle instance, uint32_t sample_count) { - Amp *plugin_data = (Amp *)instance; - - const float gain = *(plugin_data->gain); - const float * const input = plugin_data->input; - float * const output = plugin_data->output; - - uint32_t pos; - float coef = DB_CO(gain); - - for (pos = 0; pos < sample_count; pos++) { - output[pos] = input[pos] * coef; - } -} - - -static void -init() { - ampDescriptor = - (LV2_Descriptor *)malloc(sizeof(LV2_Descriptor)); - - ampDescriptor->URI = AMP_URI; - ampDescriptor->activate = NULL; - ampDescriptor->cleanup = cleanupAmp; - ampDescriptor->connect_port = connectPortAmp; - ampDescriptor->deactivate = NULL; - ampDescriptor->instantiate = instantiateAmp; - ampDescriptor->run = runAmp; -} - - -SYMBOL_EXPORT -const LV2_Descriptor* -lv2_descriptor(uint32_t index) { - if (!ampDescriptor) init(); - - switch (index) { - case 0: - return ampDescriptor; - default: - return NULL; - } -} - diff --git a/examples/plugins/Amp-slv2.lv2/amp.ttl b/examples/plugins/Amp-slv2.lv2/amp.ttl deleted file mode 100644 index abc5b33..0000000 --- a/examples/plugins/Amp-slv2.lv2/amp.ttl +++ /dev/null @@ -1,57 +0,0 @@ -@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix lv2: <http://lv2plug.in/ontology#> . -@prefix foaf: <http://xmlns.com/foaf/0.1/> . -@prefix doap: <http://usefulinc.com/ns/doap#> . - -<http://codeson.net/plugins/amp> a lv2:Plugin ; - a lv2:AmplifierPlugin ; - doap:maintainer [ - foaf:name "Dave Robillard"; - foaf:homepage <http://codeson.net/> ; - foaf:mbox <mailto:drobilla@connect.carleton.ca> - ] ; - doap:name "Simple Amplifier" ; - doap:name "Einfacher Verst¿¿rker"@de ; - doap:licence <http://usefulinc.com/doap/licenses/gpl> ; - - lv2:property lv2:hardRTCapable ; - - lv2:port [ - a lv2:ControlRateInputPort ; - lv2:datatype lv2:float ; - lv2:index 0 ; - lv2:symbol "gain" ; - lv2:name "Gain" ; - lv2:name "Gewinn"@de ; - lv2:default [ rdf:value 0.0 ] ; - lv2:minimum [ rdf:value -90.0 ] ; - lv2:maximum [ rdf:value 24.0 ] ; - lv2:scalePoint [ - rdfs:label "+5" ; - rdf:value 5.0 - ] , [ - rdfs:label "Unity" ; - rdf:value 1.0 - ] , [ - rdfs:label "-5" ; - rdf:value -5.0 - ] , [ - rdfs:label "-10" ; - rdf:value -10.0 - ] - ] , [ - a lv2:AudioRateInputPort ; - lv2:datatype lv2:float ; - lv2:index 1 ; - lv2:symbol "in" ; - lv2:name "Input" - ] , [ - a lv2:AudioRateOutputPort ; - lv2:datatype lv2:float ; - lv2:index 2 ; - lv2:symbol "out" ; - lv2:name "Output" - ] -. - diff --git a/examples/plugins/Amp-slv2.lv2/manifest.ttl b/examples/plugins/Amp-slv2.lv2/manifest.ttl deleted file mode 100644 index 94456e6..0000000 --- a/examples/plugins/Amp-slv2.lv2/manifest.ttl +++ /dev/null @@ -1,11 +0,0 @@ -# LV2 Plugin Manifest -# Lists where plugins' data files and shared objects reside. - -@prefix lv2: <http://lv2plug.in/ontology#> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . - -<http://codeson.net/plugins/amp> - lv2:binary <amp.so> ; - rdfs:seeAlso <amp.ttl> . - - diff --git a/examples/plugins/Makefile.am b/examples/plugins/Makefile.am deleted file mode 100644 index 8044bc9..0000000 --- a/examples/plugins/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -#AM_CFLAGS = -I$(top_srcdir)/include -#AM_LDFLAGS = -module -avoidversion -Wc,-nostartfiles -# -#plugindir = @umpdir@ -# -#plugin_LTLIBRARIES = \ -# test_plugin.la -# -## Stolen from swh-plugins, makes stupid libtool versions go away -#install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) -# mkdir -p @umpdir@ -# list='$(plugin_LTLIBRARIES)'; \ -# for file in $$list; do \ -# sofile=`basename $$file .la`.so; \ -# $(INSTALL_PROGRAM) .libs/$$sofile @umpdir@; \ -# done -# -#uninstall-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) -# list='$(plugin_LTLIBRARIES)'; \ -# for file in $$list; do \ -# sofile=`basename $$file .la`.so; \ -# rm -f @umpdir@/$$sofile; \ -# done -# diff --git a/hosts/Makefile.am b/hosts/Makefile.am new file mode 100644 index 0000000..aa794c5 --- /dev/null +++ b/hosts/Makefile.am @@ -0,0 +1,18 @@ +AM_CFLAGS = -std=c99 -I$(top_srcdir) @RASQAL_CFLAGS@ + +if WITH_JACK + +bin_PROGRAMS = lv2_jack_host lv2_simple_jack_host + +lv2_jack_host_CFLAGS = @JACK_CFLAGS@ $(AM_CFLAGS) + +lv2_jack_host_DEPENDENCIES = ../src/libslv2.la +lv2_jack_host_LDADD = ../src/libslv2.la @JACK_LIBS@ @RASQAL_LIBS@ + +lv2_simple_jack_host_LDADD = ../src/libslv2.la @JACK_LIBS@ @RASQAL_LIBS@ + +lv2_jack_host_SOURCES = \ + lv2_jack_host.c + +endif + diff --git a/examples/hosts/lv2-midifunctions.h b/hosts/lv2-midifunctions.h index 68691f3..3a17395 100644 --- a/examples/hosts/lv2-midifunctions.h +++ b/hosts/lv2-midifunctions.h @@ -148,7 +148,7 @@ static int lv2midi_put_event(LV2_MIDIState* state, state->midi->size += sizeof(double); *(size_t*)(state->midi->data + state->midi->size) = size; state->midi->size += sizeof(size_t); - memcpy(state->midi->data + state->midi->size, data, size); + memcpy(state->midi->data + state->midi->size, data, (size_t)size); state->midi->size += size; ++state->midi->event_count; diff --git a/examples/hosts/lv2-miditype.h b/hosts/lv2-miditype.h index 465d5d5..465d5d5 100644 --- a/examples/hosts/lv2-miditype.h +++ b/hosts/lv2-miditype.h diff --git a/examples/hosts/host.c b/hosts/lv2_jack_host.c index 97937a8..e5e51a3 100644 --- a/examples/hosts/host.c +++ b/hosts/lv2_jack_host.c @@ -1,5 +1,5 @@ -/* LibSLV2 Jack Example Host - * Copyright (C) 2006 Dave Robillard <drobilla@connect.carleton.ca> +/* jack_host - SLV2 Jack Host + * Copyright (C) 2007 Dave Robillard <drobilla.net> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -204,13 +204,11 @@ create_port(struct JackHost* host, slv2_instance_connect_port(host->instance, port_index, &port->control); break; case SLV2_AUDIO_RATE_INPUT: - printf("AI!\n"); port->direction = INPUT; port->jack_port = jack_port_register(host->jack_client, symbol, JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0); break; case SLV2_AUDIO_RATE_OUTPUT: - printf("AO!\n"); port->direction = OUTPUT; port->jack_port = jack_port_register(host->jack_client, symbol, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0); @@ -221,7 +219,6 @@ create_port(struct JackHost* host, } else if (port->type == MIDI) { - printf("MIDI! %s\n", symbol); if (class == SLV2_CONTROL_RATE_INPUT) { port->direction = INPUT; port->jack_port = jack_port_register(host->jack_client, diff --git a/examples/hosts/simple_jack_host.c b/hosts/lv2_simple_jack_host.c index 655c939..f0a266d 100644 --- a/examples/hosts/simple_jack_host.c +++ b/hosts/lv2_simple_jack_host.c @@ -1,5 +1,5 @@ -/* LibSLV2 Jack Example Host - * Copyright (C) 2006 Dave Robillard <drobilla@connect.carleton.ca> +/* SLV2 Simple Jack Host Example + * Copyright (C) 2007 Dave Robillard <drobilla.net> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free diff --git a/src/plugininstance.c b/src/plugininstance.c index edc6e4f..9c6bf15 100644 --- a/src/plugininstance.c +++ b/src/plugininstance.c @@ -48,14 +48,14 @@ slv2_plugin_instantiate(const SLV2Plugin* plugin, dlerror(); void* lib = dlopen((char*)lib_path, RTLD_NOW); if (!lib) { - printf("Unable to open library %s (%s)\n", lib_path, dlerror()); + fprintf(stderr, "Unable to open library %s (%s)\n", lib_path, dlerror()); return NULL; } LV2_Descriptor_Function df = dlsym(lib, "lv2_descriptor"); if (!df) { - printf("Could not find symbol 'lv2_descriptor', " + fprintf(stderr, "Could not find symbol 'lv2_descriptor', " "%s is not a LV2 plugin.\n", lib_path); dlclose(lib); return NULL; @@ -68,12 +68,12 @@ slv2_plugin_instantiate(const SLV2Plugin* plugin, const LV2_Descriptor* ld = df(i); if (!ld) { - printf("Did not find plugin %s in %s\n", + fprintf(stderr, "Did not find plugin %s in %s\n", plugin->plugin_uri, plugin->lib_url); dlclose(lib); break; // return NULL } else if (!strcmp(ld->URI, (char*)plugin->plugin_uri)) { - printf("Found %s at index %u in:\n\t%s\n\n", plugin->plugin_uri, i, lib_path); + //printf("Found %s at index %u in:\n\t%s\n\n", plugin->plugin_uri, i, lib_path); assert(ld->instantiate); diff --git a/src/pluginlist.c b/src/pluginlist.c index 6818cf5..18bb44f 100644 --- a/src/pluginlist.c +++ b/src/pluginlist.c @@ -64,7 +64,7 @@ slv2_list_load_all(SLV2List list) const char* const suffix = "/.lv2:/usr/local/lib/lv2:usr/lib/lv2"; slv2_path = strjoin(home, suffix, NULL); - printf("$LV2_PATH is unset. Using default path %s\n", slv2_path); + fprintf(stderr, "$LV2_PATH is unset. Using default path %s\n", slv2_path); slv2_list_load_path(list, slv2_path); free(slv2_path); diff --git a/utils/Makefile.am b/utils/Makefile.am index 8d23d38..36a06ec 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -1,9 +1,16 @@ -if BUILD_UTILITIES +AM_CFLAGS = -I$(top_srcdir) @RASQAL_CFLAGS@ -bin_PROGRAMS = ladspa2lv2 +bin_PROGRAMS = lv2_list + +lv2_list_SOURCES = lv2_list.c +lv2_list_LDADD = ../src/libslv2.la + +if BUILD_LADSPA2SLV2 + +bin_PROGRAMS += ladspa2lv2 ladspa2lv2_CXXFLAGS = @RAUL_CFLAGS@ @RAPTOR_CFLAGS@ ladspa2lv2_LDADD = -ldl @RAUL_LIBS@ @RAPTOR_LIBS@ -ladspa2lv2_SOURCES = ladspa2lv2.cc +ladspa2lv2_SOURCES = ladspa2lv2.cpp endif diff --git a/utils/README b/utils/README new file mode 100644 index 0000000..c7ded0e --- /dev/null +++ b/utils/README @@ -0,0 +1,3 @@ +This is still in development, and depends on Raptor 1.4.14. + +Soon.... diff --git a/utils/ladspa2lv2.cc b/utils/ladspa2lv2.cpp index f3a4d14..23cd561 100644 --- a/utils/ladspa2lv2.cc +++ b/utils/ladspa2lv2.cpp @@ -166,7 +166,10 @@ write_lv2_turtle(LADSPA_Descriptor* descriptor, const char* uri, const char* fil void print_usage() { - printf("Usage: ladspa2slv2 /path/to/laddspalib.so index lv2_uri\n\n"); + printf("Usage: ladspa2slv2 /path/to/laddspalib.so ladspa_index lv2_uri\n"); + printf("Partially convert a LADSPA plugin to an LV2 plugin."); + printf("(This is a utility for developers, it will not generate a usable\n"); + printf("LV2 plugin directly).\n\n"); } diff --git a/utils/lv2_list.c b/utils/lv2_list.c new file mode 100644 index 0000000..e1cba6d --- /dev/null +++ b/utils/lv2_list.c @@ -0,0 +1,43 @@ +/* lv2_list - List system installed LV2 plugins. + * Copyright (C) 2007 Dave Robillard <drobilla.net> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program 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 GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include <stdio.h> +#include <slv2/slv2.h> + + +void +list_plugins(SLV2List list) +{ + for (size_t i=0; i < slv2_list_get_length(list); ++i) { + const SLV2Plugin* const p = slv2_list_get_plugin_by_index(list, i); + printf("%s\n", slv2_plugin_get_uri(p)); + } +} + + +int +main()//int argc, char** argv) +{ + SLV2List plugins = slv2_list_new(); + slv2_list_load_all(plugins); + + list_plugins(plugins); + + return 0; +} + |