convert crap_noise to template format
This commit is contained in:
parent
7cfeef142d
commit
0a5c150ca6
4 changed files with 57 additions and 87 deletions
4
Makefile
4
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}
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -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;
|
||||
}
|
55
crap_noise.h
Normal file
55
crap_noise.h
Normal file
|
@ -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) {
|
||||
}
|
||||
|
Loading…
Reference in a new issue