From 0a5c150ca6faddfe6c62b8ea86e4ed99c8431ced Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Wed, 5 Feb 2014 23:28:33 -0800 Subject: [PATCH] convert crap_noise to template format --- Makefile | 4 +-- README.md | 1 - crap_noise-ladspa.c | 84 --------------------------------------------- crap_noise.h | 55 +++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 87 deletions(-) delete mode 100644 crap_noise-ladspa.c create mode 100644 crap_noise.h diff --git a/Makefile b/Makefile index f185ecb..b468910 100755 --- a/Makefile +++ b/Makefile @@ -5,8 +5,8 @@ DISTNAME = crap VERSION = git FULLNAME = ${DISTNAME}-${VERSION} -BOTH = crap_eq crap_eq_const crap_tube -LADSPA_ONLY = crap_noise +BOTH = crap_eq crap_eq_const crap_noise crap_tube +LADSPA_ONLY = VST_ONLY = crap_delay_test LADSPA = ${BOTH:=-ladspa} ${LADSPA_ONLY:=-ladspa} VST = ${BOTH:=-vst} ${VST_ONLY:=-vst} diff --git a/README.md b/README.md index 9aab33f..bd32074 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,6 @@ remember to export `VST_SDK_DIR` to the path of your `vstsdk2.4/` ## TODO -* convert crap\_noise to the template format * rename plugins (fix capitalization consistency and such) * make code style consistent * remove crap\_ prefixes? diff --git a/crap_noise-ladspa.c b/crap_noise-ladspa.c deleted file mode 100644 index 0cdeb66..0000000 --- a/crap_noise-ladspa.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "ladspa.h" -#include "crap_util.h" - -typedef unsigned long ulong; - -#define PLUG_INPUT 0 -#define PLUG_OUTPUT 1 -#define PCOUNT 2 - -const LADSPA_PortDescriptor p_discs[PCOUNT] = { - LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO, - LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO -}; -const LADSPA_PortRangeHint p_hints[PCOUNT] = { - {.HintDescriptor = 0}, - {.HintDescriptor = 0} -}; -const char *p_names[PCOUNT] = {"Input", "Output"}; - -typedef struct { - LADSPA_Data *input; - LADSPA_Data *output; - LADSPA_Data fs; -} plug_t; - -static void -plug_cleanup(LADSPA_Handle instance) { - free(instance); -} - -static void -plug_connect(LADSPA_Handle instance, ulong port, LADSPA_Data *data) { - plug_t *plug = (plug_t *)instance; - if (port == PLUG_INPUT) - plug->input = data; - else if (port == PLUG_OUTPUT) - plug->output = data; -} - -static LADSPA_Handle -plug_instantiate(const LADSPA_Descriptor *descriptor, ulong s_rate) { - plug_t *plug = (plug_t *) calloc(1, sizeof(plug_t)); - plug->fs = s_rate; - return (LADSPA_Handle) plug; -} - -static void -plug_run(LADSPA_Handle instance, ulong sample_count) { - plug_t *plug = (plug_t *) instance; - //const LADSPA_Data *input = plug->input; - LADSPA_Data *output = plug->output; - - for (ulong pos = 0; pos < sample_count; pos++) - output[pos] = whitenoise(); -} - -static const LADSPA_Descriptor eqDescriptor = { - .UniqueID = 0xEC57A71C, - .Label = "crap_noise", - .Properties = 0, - .Name = "crap noise generator", - .Maker = "Connor Olding", - .Copyright = "MIT", - .PortCount = PCOUNT, - .PortDescriptors = p_discs, - .PortRangeHints = p_hints, - .PortNames = p_names, - - .activate = NULL, - .cleanup = plug_cleanup, - .connect_port = plug_connect, - .deactivate = NULL, - .instantiate = plug_instantiate, - .run = plug_run, - .run_adding = NULL, - .set_run_adding_gain = NULL -}; - -const LADSPA_Descriptor * -ladspa_descriptor(ulong index) { - if (index != 0) - return NULL; - return &eqDescriptor; -} diff --git a/crap_noise.h b/crap_noise.h new file mode 100644 index 0000000..f842dc1 --- /dev/null +++ b/crap_noise.h @@ -0,0 +1,55 @@ +#include "crap_util.h" + +#define ID 0xEC57A71C +#define LABEL "crap_noise" +#define NAME "crap noise generator" +#define AUTHOR "Connor Olding" +#define COPYRIGHT "MIT" +#define PARAMETERS 0 + +typedef struct { +} personal; + +static void +process(personal *data, + float *in_L, float *in_R, + float *out_L, float *out_R, + unsigned long count) { + // TODO: separate and preserve mirand for each channel + for (unsigned long pos = 0; pos < count; pos++) + out_L[pos] = whitenoise(); + for (unsigned long pos = 0; pos < count; pos++) + out_R[pos] = whitenoise(); +} + +static void +process_double(personal *data, + double *in_L, double *in_R, + double *out_L, double *out_R, + unsigned long count) { + for (unsigned long pos = 0; pos < count; pos++) + out_L[pos] = whitenoise(); + for (unsigned long pos = 0; pos < count; pos++) + out_R[pos] = whitenoise(); +} + +static void +construct(personal *data) { +} + +static void +destruct(personal *data) { +} + +static void +resume(personal *data) { +} + +static void +pause(personal *data) { +} + +static void +adjust(personal *data, unsigned long fs) { +} +