diff options
author | David Robillard <d@drobilla.net> | 2006-07-26 03:25:08 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-07-26 03:25:08 +0000 |
commit | 2cd84e4209633e59439c445f821bed8410347bab (patch) | |
tree | ba34505505795cff5cf35c2958ed21933b822e12 /examples/plugins/Amp-swh.lv2/amp.c | |
parent | deca2cc89850dffc051d0a0aafc9d681af838934 (diff) | |
download | lilv-2cd84e4209633e59439c445f821bed8410347bab.tar.gz lilv-2cd84e4209633e59439c445f821bed8410347bab.tar.bz2 lilv-2cd84e4209633e59439c445f821bed8410347bab.zip |
- Removed all the unsigned char garbage from the API
- Updated types in lv2.h to be non-machine-dependant (removed unsigned long in favour of uint32_t)
- Updated schema
- Updated example plugin to work with the above (partially)
git-svn-id: http://svn.drobilla.net/lad/libslv2@101 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'examples/plugins/Amp-swh.lv2/amp.c')
-rw-r--r-- | examples/plugins/Amp-swh.lv2/amp.c | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/examples/plugins/Amp-swh.lv2/amp.c b/examples/plugins/Amp-swh.lv2/amp.c deleted file mode 100644 index a30c4bd..0000000 --- a/examples/plugins/Amp-swh.lv2/amp.c +++ /dev/null @@ -1,96 +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://plugin.org.uk/swh-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, unsigned long 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, - unsigned long 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, unsigned long 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; - - unsigned long 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(unsigned long index) { - if (!ampDescriptor) init(); - - switch (index) { - case 0: - return ampDescriptor; - default: - return NULL; - } -} - |