From 1988a63b41a0e81f348d5df3394d41d3248d442b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 5 Feb 2007 22:34:56 +0000 Subject: 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 --- examples/plugins/Amp-slv2.lv2/amp.c | 108 ------------------------------------ 1 file changed, 108 deletions(-) delete mode 100644 examples/plugins/Amp-slv2.lv2/amp.c (limited to 'examples/plugins/Amp-slv2.lv2/amp.c') 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 -#include - -#include - -#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; - } -} - -- cgit v1.2.1