make bw_wah bandpass, don't use malloc in examples
This commit is contained in:
parent
1972040cb0
commit
e199678912
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -152,15 +152,11 @@ Plugin::Plugin() {
|
||||
}
|
||||
|
||||
tresult PLUGIN_API Plugin::initialize(FUnknown *context) {
|
||||
instance = P_NEW();
|
||||
if (instance == nullptr)
|
||||
return kResultFalse;
|
||||
|
||||
tresult r = AudioEffect::initialize(context);
|
||||
if (r != kResultTrue) {
|
||||
P_FREE(instance);
|
||||
if (r != kResultTrue)
|
||||
return r;
|
||||
}
|
||||
|
||||
P_INIT(&instance);
|
||||
|
||||
#ifdef P_NOTE_ON
|
||||
addEventInput(ConstStringTable::instance()->getString("MIDI Input"));
|
||||
@ -192,7 +188,7 @@ tresult PLUGIN_API Plugin::initialize(FUnknown *context) {
|
||||
#if NUM_PARAMETERS != 0
|
||||
for (int i = 0; i < NUM_PARAMETERS; i++) {
|
||||
parameters[i] = config_parameters[i].defaultValueUnmapped;
|
||||
P_SET_PARAMETER(instance, i, parameters[i]);
|
||||
P_SET_PARAMETER(&instance, i, parameters[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -200,15 +196,13 @@ tresult PLUGIN_API Plugin::initialize(FUnknown *context) {
|
||||
}
|
||||
|
||||
tresult PLUGIN_API Plugin::terminate() {
|
||||
P_FREE(instance);
|
||||
|
||||
return AudioEffect::terminate();
|
||||
}
|
||||
|
||||
tresult PLUGIN_API Plugin::setActive(TBool state) {
|
||||
if (state) {
|
||||
P_SET_SAMPLE_RATE(instance, sampleRate);
|
||||
P_RESET(instance);
|
||||
P_SET_SAMPLE_RATE(&instance, sampleRate);
|
||||
P_RESET(&instance);
|
||||
}
|
||||
return AudioEffect::setActive(state);
|
||||
}
|
||||
@ -236,17 +230,17 @@ tresult PLUGIN_API Plugin::process(ProcessData &data) {
|
||||
switch (pi) {
|
||||
#ifdef P_PITCH_BEND
|
||||
case TAG_PITCH_BEND:
|
||||
P_PITCH_BEND(instance, static_cast<int>(16383.f * std::min(std::max(static_cast<float>(v), 0.f), 1.f)));
|
||||
P_PITCH_BEND(&instance, static_cast<int>(16383.f * std::min(std::max(static_cast<float>(v), 0.f), 1.f)));
|
||||
break;
|
||||
#endif
|
||||
#ifdef P_MOD_WHEEL
|
||||
case TAG_MOD_WHEEL:
|
||||
P_MOD_WHEEL(instance, static_cast<char>(127.f * std::min(std::max(static_cast<float>(v), 0.f), 1.f)));
|
||||
P_MOD_WHEEL(&instance, static_cast<char>(127.f * std::min(std::max(static_cast<float>(v), 0.f), 1.f)));
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
parameters[pi] = v;
|
||||
P_SET_PARAMETER(instance, pi, std::min(std::max(static_cast<float>(v), 0.f), 1.f));
|
||||
P_SET_PARAMETER(&instance, pi, std::min(std::max(static_cast<float>(v), 0.f), 1.f));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -263,10 +257,10 @@ tresult PLUGIN_API Plugin::process(ProcessData &data) {
|
||||
continue;
|
||||
switch (e.type) {
|
||||
case Event::kNoteOnEvent:
|
||||
P_NOTE_ON(instance, e.noteOn.pitch, 127.f * e.noteOn.velocity);
|
||||
P_NOTE_ON(&instance, e.noteOn.pitch, 127.f * e.noteOn.velocity);
|
||||
break;
|
||||
case Event::kNoteOffEvent:
|
||||
P_NOTE_OFF(instance, e.noteOff.pitch);
|
||||
P_NOTE_OFF(&instance, e.noteOff.pitch);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -301,7 +295,7 @@ tresult PLUGIN_API Plugin::process(ProcessData &data) {
|
||||
#if NUM_BUSES_OUT == 0
|
||||
float **outputs = nullptr;
|
||||
#endif
|
||||
P_PROCESS(instance, inputs, outputs, data.numSamples);
|
||||
P_PROCESS(&instance, inputs, outputs, data.numSamples);
|
||||
|
||||
#ifndef NO_DAZ_FTZ
|
||||
_MM_SET_FLUSH_ZERO_MODE(flush_zero_mode);
|
||||
@ -312,7 +306,7 @@ tresult PLUGIN_API Plugin::process(ProcessData &data) {
|
||||
for (int i = 0; i < NUM_PARAMETERS; i++) {
|
||||
if (!config_parameters[i].out)
|
||||
continue;
|
||||
float v = P_GET_PARAMETER(instance, i);
|
||||
float v = P_GET_PARAMETER(&instance, i);
|
||||
if (parameters[i] == v)
|
||||
continue;
|
||||
parameters[i] = v;
|
||||
@ -363,7 +357,7 @@ tresult PLUGIN_API Plugin::setState(IBStream *state) {
|
||||
if (streamer.readFloat(f) == false)
|
||||
return kResultFalse;
|
||||
parameters[i] = f;
|
||||
P_SET_PARAMETER(instance, i, f);
|
||||
P_SET_PARAMETER(&instance, i, f);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
CC := clang
|
||||
CFLAGS := \
|
||||
-D__WASM__ \
|
||||
-I${ROOT_DIR}/../src \
|
||||
-I${ROOT_DIR}/../../common/web \
|
||||
-I${ROOT_DIR}/../../../include \
|
||||
@ -49,21 +48,21 @@ endif
|
||||
|
||||
all: build/web/module.wasm build/web/index.html build/web/config.js build/web/processor.js build/web/cert.pem build/web/key.pem
|
||||
|
||||
build/web/module.wasm: build/web ${SOURCES}
|
||||
build/web/module.wasm: ${SOURCES} | build/web
|
||||
${CC} ${SOURCES} ${CFLAGS} ${LDFLAGS} -o $@
|
||||
|
||||
build/web/index.html: build/web ${INDEX}
|
||||
build/web/index.html: ${INDEX} | build/web
|
||||
cp ${INDEX} $@
|
||||
|
||||
build/web/processor.js: build/web ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web/processor.js
|
||||
build/web/processor.js: ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web/processor.js | build/web
|
||||
cat ${ROOT_DIR}/config.js ${ROOT_DIR}/../../common/web//processor.js > $@
|
||||
|
||||
build/web/config.js: build/web ${ROOT_DIR}/config.js
|
||||
build/web/config.js: ${ROOT_DIR}/config.js | build/web
|
||||
cp ${ROOT_DIR}/config.js $@
|
||||
|
||||
build/web/key.pem: build/web/cert.pem
|
||||
|
||||
build/web/cert.pem: build/web
|
||||
build/web/cert.pem: | build/web
|
||||
yes "" | openssl req -x509 -newkey rsa:2048 -keyout build/web/key.pem -out build/web/cert.pem -days 365 -nodes 2>/dev/null
|
||||
|
||||
build/web:
|
||||
|
@ -46,11 +46,7 @@ wrapper wrapper_new(float sample_rate) {
|
||||
if (ret == NULL)
|
||||
return NULL;
|
||||
|
||||
ret->instance = P_NEW();
|
||||
if (ret->instance == NULL) {
|
||||
free(ret);
|
||||
return NULL;
|
||||
}
|
||||
P_INIT(&ret->instance);
|
||||
|
||||
#if NUM_BUSES_IN != 0
|
||||
int dx = 0;
|
||||
@ -86,14 +82,13 @@ wrapper wrapper_new(float sample_rate) {
|
||||
wrapper_set_parameter(ret, i, config_parameters[i].defaultValueUnmapped);
|
||||
#endif
|
||||
|
||||
P_SET_SAMPLE_RATE(ret->instance, sample_rate);
|
||||
P_RESET(ret->instance);
|
||||
P_SET_SAMPLE_RATE(&ret->instance, sample_rate);
|
||||
P_RESET(&ret->instance);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void wrapper_free(wrapper w) {
|
||||
P_FREE(w->instance);
|
||||
free(w);
|
||||
}
|
||||
|
||||
@ -132,41 +127,41 @@ void wrapper_process(wrapper w, int n_samples) {
|
||||
#else
|
||||
float **y = NULL;
|
||||
#endif
|
||||
P_PROCESS(w->instance, x, y, n_samples);
|
||||
P_PROCESS(&w->instance, x, y, n_samples);
|
||||
|
||||
#if NUM_PARAMETERS != 0
|
||||
for (int i = 0; i < NUM_PARAMETERS; i++)
|
||||
w->param_values[i] = P_GET_PARAMETER(w->instance, i);
|
||||
w->param_values[i] = P_GET_PARAMETER(&w->instance, i);
|
||||
#endif
|
||||
}
|
||||
|
||||
void wrapper_set_parameter(wrapper w, int index, float value) {
|
||||
#if NUM_PARAMETERS != 0
|
||||
P_SET_PARAMETER(w->instance, index, value);
|
||||
P_SET_PARAMETER(&w->instance, index, value);
|
||||
w->param_values[index] = value;
|
||||
#endif
|
||||
}
|
||||
|
||||
void wrapper_note_on(wrapper w, int note, int velocity) {
|
||||
#ifdef P_NOTE_ON
|
||||
P_NOTE_ON(w->instance, note, velocity);
|
||||
P_NOTE_ON(&w->instance, note, velocity);
|
||||
#endif
|
||||
}
|
||||
|
||||
void wrapper_note_off(wrapper w, int note) {
|
||||
#ifdef P_NOTE_OFF
|
||||
P_NOTE_OFF(w->instance, note);
|
||||
P_NOTE_OFF(&w->instance, note);
|
||||
#endif
|
||||
}
|
||||
|
||||
void wrapper_pitch_bend(wrapper w, int bend) {
|
||||
#ifdef P_PITCH_BEND
|
||||
P_PITCH_BEND(w->instance, bend);
|
||||
P_PITCH_BEND(&w->instance, bend);
|
||||
#endif
|
||||
}
|
||||
|
||||
void wrapper_mod_wheel(wrapper w, int wheel) {
|
||||
#ifdef P_MOD_WHEEL
|
||||
P_MOD_WHEEL(w->instance, wheel);
|
||||
P_MOD_WHEEL(&w->instance, wheel);
|
||||
#endif
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -20,57 +20,25 @@
|
||||
|
||||
#include "bw_example_fx_bitcrush.h"
|
||||
|
||||
#include <bw_sr_reduce.h>
|
||||
#include <bw_bd_reduce.h>
|
||||
#ifdef __WASM__
|
||||
# include "walloc.h"
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_sr_ratio,
|
||||
p_bit_depth,
|
||||
p_n
|
||||
};
|
||||
|
||||
struct _bw_example_fx_bitcrush {
|
||||
// Sub-components
|
||||
bw_sr_reduce_coeffs sr_reduce_coeffs;
|
||||
bw_sr_reduce_state sr_reduce_state;
|
||||
bw_bd_reduce_coeffs bd_reduce_coeffs;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
};
|
||||
|
||||
bw_example_fx_bitcrush bw_example_fx_bitcrush_new() {
|
||||
bw_example_fx_bitcrush instance = (bw_example_fx_bitcrush)malloc(sizeof(struct _bw_example_fx_bitcrush));
|
||||
if (instance == NULL)
|
||||
return NULL;
|
||||
void bw_example_fx_bitcrush_init(bw_example_fx_bitcrush *instance) {
|
||||
bw_sr_reduce_init(&instance->sr_reduce_coeffs);
|
||||
bw_bd_reduce_init(&instance->bd_reduce_coeffs);
|
||||
return instance;
|
||||
}
|
||||
|
||||
void bw_example_fx_bitcrush_free(bw_example_fx_bitcrush instance) {
|
||||
free(instance);
|
||||
void bw_example_fx_bitcrush_set_sample_rate(bw_example_fx_bitcrush *instance, float sample_rate) {
|
||||
}
|
||||
|
||||
void bw_example_fx_bitcrush_set_sample_rate(bw_example_fx_bitcrush instance, float sample_rate) {
|
||||
}
|
||||
|
||||
void bw_example_fx_bitcrush_reset(bw_example_fx_bitcrush instance) {
|
||||
void bw_example_fx_bitcrush_reset(bw_example_fx_bitcrush *instance) {
|
||||
bw_sr_reduce_reset_state(&instance->sr_reduce_coeffs, &instance->sr_reduce_state);
|
||||
bw_bd_reduce_reset_coeffs(&instance->bd_reduce_coeffs);
|
||||
}
|
||||
|
||||
void bw_example_fx_bitcrush_process(bw_example_fx_bitcrush instance, const float** x, float** y, int n_samples) {
|
||||
void bw_example_fx_bitcrush_process(bw_example_fx_bitcrush *instance, const float** x, float** y, int n_samples) {
|
||||
bw_sr_reduce_process(&instance->sr_reduce_coeffs, &instance->sr_reduce_state, x[0], y[0], n_samples);
|
||||
bw_bd_reduce_process(&instance->bd_reduce_coeffs, y[0], y[0], n_samples);
|
||||
}
|
||||
|
||||
void bw_example_fx_bitcrush_set_parameter(bw_example_fx_bitcrush instance, int index, float value) {
|
||||
void bw_example_fx_bitcrush_set_parameter(bw_example_fx_bitcrush *instance, int index, float value) {
|
||||
instance->params[index] = value;
|
||||
switch (index) {
|
||||
case p_sr_ratio:
|
||||
@ -82,6 +50,6 @@ void bw_example_fx_bitcrush_set_parameter(bw_example_fx_bitcrush instance, int i
|
||||
}
|
||||
}
|
||||
|
||||
float bw_example_fx_bitcrush_get_parameter(bw_example_fx_bitcrush instance, int index) {
|
||||
float bw_example_fx_bitcrush_get_parameter(bw_example_fx_bitcrush *instance, int index) {
|
||||
return instance->params[index];
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -25,15 +25,32 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _bw_example_fx_bitcrush* bw_example_fx_bitcrush;
|
||||
#include <bw_sr_reduce.h>
|
||||
#include <bw_bd_reduce.h>
|
||||
|
||||
bw_example_fx_bitcrush bw_example_fx_bitcrush_new();
|
||||
void bw_example_fx_bitcrush_free(bw_example_fx_bitcrush instance);
|
||||
void bw_example_fx_bitcrush_set_sample_rate(bw_example_fx_bitcrush instance, float sample_rate);
|
||||
void bw_example_fx_bitcrush_reset(bw_example_fx_bitcrush instance);
|
||||
void bw_example_fx_bitcrush_process(bw_example_fx_bitcrush instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_fx_bitcrush_set_parameter(bw_example_fx_bitcrush instance, int index, float value);
|
||||
float bw_example_fx_bitcrush_get_parameter(bw_example_fx_bitcrush instance, int index);
|
||||
enum {
|
||||
p_sr_ratio,
|
||||
p_bit_depth,
|
||||
p_n
|
||||
};
|
||||
|
||||
struct _bw_example_fx_bitcrush {
|
||||
// Sub-components
|
||||
bw_sr_reduce_coeffs sr_reduce_coeffs;
|
||||
bw_sr_reduce_state sr_reduce_state;
|
||||
bw_bd_reduce_coeffs bd_reduce_coeffs;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
};
|
||||
typedef struct _bw_example_fx_bitcrush bw_example_fx_bitcrush;
|
||||
|
||||
void bw_example_fx_bitcrush_init(bw_example_fx_bitcrush *instance);
|
||||
void bw_example_fx_bitcrush_set_sample_rate(bw_example_fx_bitcrush *instance, float sample_rate);
|
||||
void bw_example_fx_bitcrush_reset(bw_example_fx_bitcrush *instance);
|
||||
void bw_example_fx_bitcrush_process(bw_example_fx_bitcrush *instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_fx_bitcrush_set_parameter(bw_example_fx_bitcrush *instance, int index, float value);
|
||||
float bw_example_fx_bitcrush_get_parameter(bw_example_fx_bitcrush *instance, int index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -78,8 +78,7 @@ static struct config_parameter config_parameters[NUM_PARAMETERS] = {
|
||||
#include "bw_example_fx_bitcrush.h"
|
||||
|
||||
#define P_TYPE bw_example_fx_bitcrush
|
||||
#define P_NEW bw_example_fx_bitcrush_new
|
||||
#define P_FREE bw_example_fx_bitcrush_free
|
||||
#define P_INIT bw_example_fx_bitcrush_init
|
||||
#define P_SET_SAMPLE_RATE bw_example_fx_bitcrush_set_sample_rate
|
||||
#define P_RESET bw_example_fx_bitcrush_reset
|
||||
#define P_PROCESS bw_example_fx_bitcrush_process
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -20,56 +20,24 @@
|
||||
|
||||
#include "bw_example_fx_comp.h"
|
||||
|
||||
#include <bw_comp.h>
|
||||
#ifdef __WASM__
|
||||
# include "walloc.h"
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_thresh,
|
||||
p_ratio,
|
||||
p_attack,
|
||||
p_release,
|
||||
p_gain,
|
||||
p_n
|
||||
};
|
||||
|
||||
struct _bw_example_fx_comp {
|
||||
// Sub-components
|
||||
bw_comp_coeffs comp_coeffs;
|
||||
bw_comp_state comp_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
};
|
||||
|
||||
bw_example_fx_comp bw_example_fx_comp_new() {
|
||||
bw_example_fx_comp instance = (bw_example_fx_comp)malloc(sizeof(struct _bw_example_fx_comp));
|
||||
if (instance != NULL)
|
||||
bw_comp_init(&instance->comp_coeffs);
|
||||
return instance;
|
||||
void bw_example_fx_comp_init(bw_example_fx_comp *instance) {
|
||||
bw_comp_init(&instance->comp_coeffs);
|
||||
}
|
||||
|
||||
void bw_example_fx_comp_free(bw_example_fx_comp instance) {
|
||||
free(instance);
|
||||
}
|
||||
|
||||
void bw_example_fx_comp_set_sample_rate(bw_example_fx_comp instance, float sample_rate) {
|
||||
void bw_example_fx_comp_set_sample_rate(bw_example_fx_comp *instance, float sample_rate) {
|
||||
bw_comp_set_sample_rate(&instance->comp_coeffs, sample_rate);
|
||||
}
|
||||
|
||||
void bw_example_fx_comp_reset(bw_example_fx_comp instance) {
|
||||
void bw_example_fx_comp_reset(bw_example_fx_comp *instance) {
|
||||
bw_comp_reset_coeffs(&instance->comp_coeffs);
|
||||
bw_comp_reset_state(&instance->comp_coeffs, &instance->comp_state);
|
||||
}
|
||||
|
||||
void bw_example_fx_comp_process(bw_example_fx_comp instance, const float** x, float** y, int n_samples) {
|
||||
void bw_example_fx_comp_process(bw_example_fx_comp *instance, const float** x, float** y, int n_samples) {
|
||||
bw_comp_process(&instance->comp_coeffs, &instance->comp_state, x[0], x[0], y[0], n_samples);
|
||||
}
|
||||
|
||||
void bw_example_fx_comp_set_parameter(bw_example_fx_comp instance, int index, float value) {
|
||||
void bw_example_fx_comp_set_parameter(bw_example_fx_comp *instance, int index, float value) {
|
||||
instance->params[index] = value;
|
||||
switch (index) {
|
||||
case p_thresh:
|
||||
@ -90,6 +58,6 @@ void bw_example_fx_comp_set_parameter(bw_example_fx_comp instance, int index, fl
|
||||
}
|
||||
}
|
||||
|
||||
float bw_example_fx_comp_get_parameter(bw_example_fx_comp instance, int index) {
|
||||
float bw_example_fx_comp_get_parameter(bw_example_fx_comp *instance, int index) {
|
||||
return instance->params[index];
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -25,15 +25,33 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _bw_example_fx_comp* bw_example_fx_comp;
|
||||
#include <bw_comp.h>
|
||||
|
||||
bw_example_fx_comp bw_example_fx_comp_new();
|
||||
void bw_example_fx_comp_free(bw_example_fx_comp instance);
|
||||
void bw_example_fx_comp_set_sample_rate(bw_example_fx_comp instance, float sample_rate);
|
||||
void bw_example_fx_comp_reset(bw_example_fx_comp instance);
|
||||
void bw_example_fx_comp_process(bw_example_fx_comp instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_fx_comp_set_parameter(bw_example_fx_comp instance, int index, float value);
|
||||
float bw_example_fx_comp_get_parameter(bw_example_fx_comp instance, int index);
|
||||
enum {
|
||||
p_thresh,
|
||||
p_ratio,
|
||||
p_attack,
|
||||
p_release,
|
||||
p_gain,
|
||||
p_n
|
||||
};
|
||||
|
||||
struct _bw_example_fx_comp {
|
||||
// Sub-components
|
||||
bw_comp_coeffs comp_coeffs;
|
||||
bw_comp_state comp_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
};
|
||||
typedef struct _bw_example_fx_comp bw_example_fx_comp;
|
||||
|
||||
void bw_example_fx_comp_init(bw_example_fx_comp *instance);
|
||||
void bw_example_fx_comp_set_sample_rate(bw_example_fx_comp *instance, float sample_rate);
|
||||
void bw_example_fx_comp_reset(bw_example_fx_comp *instance);
|
||||
void bw_example_fx_comp_process(bw_example_fx_comp *instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_fx_comp_set_parameter(bw_example_fx_comp *instance, int index, float value);
|
||||
float bw_example_fx_comp_get_parameter(bw_example_fx_comp *instance, int index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -81,8 +81,7 @@ static struct config_parameter config_parameters[NUM_PARAMETERS] = {
|
||||
#include "bw_example_fx_comp.h"
|
||||
|
||||
#define P_TYPE bw_example_fx_comp
|
||||
#define P_NEW bw_example_fx_comp_new
|
||||
#define P_FREE bw_example_fx_comp_free
|
||||
#define P_INIT bw_example_fx_comp_init
|
||||
#define P_SET_SAMPLE_RATE bw_example_fx_comp_set_sample_rate
|
||||
#define P_RESET bw_example_fx_comp_reset
|
||||
#define P_PROCESS bw_example_fx_comp_process
|
||||
|
@ -20,62 +20,19 @@
|
||||
|
||||
#include "bw_example_fx_eq_3band.h"
|
||||
|
||||
#include <bw_ls2.h>
|
||||
#include <bw_hs2.h>
|
||||
#include <bw_peak.h>
|
||||
#ifdef __WASM__
|
||||
# include "walloc.h"
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_ls_cutoff,
|
||||
p_ls_gain,
|
||||
p_ls_Q,
|
||||
p_peak_cutoff,
|
||||
p_peak_gain,
|
||||
p_peak_bw,
|
||||
p_hs_cutoff,
|
||||
p_hs_gain,
|
||||
p_hs_Q,
|
||||
p_n
|
||||
};
|
||||
|
||||
struct _bw_example_fx_eq_3band {
|
||||
// Sub-components
|
||||
bw_ls2_coeffs ls2_coeffs;
|
||||
bw_ls2_state ls2_state;
|
||||
bw_peak_coeffs peak_coeffs;
|
||||
bw_peak_state peak_state;
|
||||
bw_hs2_coeffs hs2_coeffs;
|
||||
bw_hs2_state hs2_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
};
|
||||
|
||||
bw_example_fx_eq_3band bw_example_fx_eq_3band_new() {
|
||||
bw_example_fx_eq_3band instance = (bw_example_fx_eq_3band)malloc(sizeof(struct _bw_example_fx_eq_3band));
|
||||
if (instance == NULL)
|
||||
return NULL;
|
||||
void bw_example_fx_eq_3band_init(bw_example_fx_eq_3band *instance) {
|
||||
bw_ls2_init(&instance->ls2_coeffs);
|
||||
bw_peak_init(&instance->peak_coeffs);
|
||||
bw_hs2_init(&instance->hs2_coeffs);
|
||||
return instance;
|
||||
}
|
||||
|
||||
void bw_example_fx_eq_3band_free(bw_example_fx_eq_3band instance) {
|
||||
free(instance);
|
||||
}
|
||||
|
||||
void bw_example_fx_eq_3band_set_sample_rate(bw_example_fx_eq_3band instance, float sample_rate) {
|
||||
void bw_example_fx_eq_3band_set_sample_rate(bw_example_fx_eq_3band *instance, float sample_rate) {
|
||||
bw_ls2_set_sample_rate(&instance->ls2_coeffs, sample_rate);
|
||||
bw_peak_set_sample_rate(&instance->peak_coeffs, sample_rate);
|
||||
bw_hs2_set_sample_rate(&instance->hs2_coeffs, sample_rate);
|
||||
}
|
||||
|
||||
void bw_example_fx_eq_3band_reset(bw_example_fx_eq_3band instance) {
|
||||
void bw_example_fx_eq_3band_reset(bw_example_fx_eq_3band *instance) {
|
||||
bw_ls2_reset_coeffs(&instance->ls2_coeffs);
|
||||
bw_ls2_reset_state(&instance->ls2_coeffs, &instance->ls2_state);
|
||||
bw_peak_reset_coeffs(&instance->peak_coeffs);
|
||||
@ -84,13 +41,13 @@ void bw_example_fx_eq_3band_reset(bw_example_fx_eq_3band instance) {
|
||||
bw_hs2_reset_state(&instance->hs2_coeffs, &instance->hs2_state);
|
||||
}
|
||||
|
||||
void bw_example_fx_eq_3band_process(bw_example_fx_eq_3band instance, const float** x, float** y, int n_samples) {
|
||||
void bw_example_fx_eq_3band_process(bw_example_fx_eq_3band *instance, const float** x, float** y, int n_samples) {
|
||||
bw_ls2_process(&instance->ls2_coeffs, &instance->ls2_state, x[0], y[0], n_samples);
|
||||
bw_peak_process(&instance->peak_coeffs, &instance->peak_state, y[0], y[0], n_samples);
|
||||
bw_hs2_process(&instance->hs2_coeffs, &instance->hs2_state, y[0], y[0], n_samples);
|
||||
}
|
||||
|
||||
void bw_example_fx_eq_3band_set_parameter(bw_example_fx_eq_3band instance, int index, float value) {
|
||||
void bw_example_fx_eq_3band_set_parameter(bw_example_fx_eq_3band *instance, int index, float value) {
|
||||
instance->params[index] = value;
|
||||
switch (index) {
|
||||
case p_ls_cutoff:
|
||||
@ -123,6 +80,6 @@ void bw_example_fx_eq_3band_set_parameter(bw_example_fx_eq_3band instance, int i
|
||||
}
|
||||
}
|
||||
|
||||
float bw_example_fx_eq_3band_get_parameter(bw_example_fx_eq_3band instance, int index) {
|
||||
float bw_example_fx_eq_3band_get_parameter(bw_example_fx_eq_3band *instance, int index) {
|
||||
return instance->params[index];
|
||||
}
|
||||
|
@ -25,15 +25,43 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _bw_example_fx_eq_3band* bw_example_fx_eq_3band;
|
||||
#include <bw_ls2.h>
|
||||
#include <bw_hs2.h>
|
||||
#include <bw_peak.h>
|
||||
|
||||
bw_example_fx_eq_3band bw_example_fx_eq_3band_new();
|
||||
void bw_example_fx_eq_3band_free(bw_example_fx_eq_3band instance);
|
||||
void bw_example_fx_eq_3band_set_sample_rate(bw_example_fx_eq_3band instance, float sample_rate);
|
||||
void bw_example_fx_eq_3band_reset(bw_example_fx_eq_3band instance);
|
||||
void bw_example_fx_eq_3band_process(bw_example_fx_eq_3band instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_fx_eq_3band_set_parameter(bw_example_fx_eq_3band instance, int index, float value);
|
||||
float bw_example_fx_eq_3band_get_parameter(bw_example_fx_eq_3band instance, int index);
|
||||
enum {
|
||||
p_ls_cutoff,
|
||||
p_ls_gain,
|
||||
p_ls_Q,
|
||||
p_peak_cutoff,
|
||||
p_peak_gain,
|
||||
p_peak_bw,
|
||||
p_hs_cutoff,
|
||||
p_hs_gain,
|
||||
p_hs_Q,
|
||||
p_n
|
||||
};
|
||||
|
||||
struct _bw_example_fx_eq_3band {
|
||||
// Sub-components
|
||||
bw_ls2_coeffs ls2_coeffs;
|
||||
bw_ls2_state ls2_state;
|
||||
bw_peak_coeffs peak_coeffs;
|
||||
bw_peak_state peak_state;
|
||||
bw_hs2_coeffs hs2_coeffs;
|
||||
bw_hs2_state hs2_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
};
|
||||
typedef struct _bw_example_fx_eq_3band bw_example_fx_eq_3band;
|
||||
|
||||
void bw_example_fx_eq_3band_init(bw_example_fx_eq_3band *instance);
|
||||
void bw_example_fx_eq_3band_set_sample_rate(bw_example_fx_eq_3band *instance, float sample_rate);
|
||||
void bw_example_fx_eq_3band_reset(bw_example_fx_eq_3band *instance);
|
||||
void bw_example_fx_eq_3band_process(bw_example_fx_eq_3band *instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_fx_eq_3band_set_parameter(bw_example_fx_eq_3band *instance, int index, float value);
|
||||
float bw_example_fx_eq_3band_get_parameter(bw_example_fx_eq_3band *instance, int index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -85,8 +85,7 @@ static struct config_parameter config_parameters[NUM_PARAMETERS] = {
|
||||
#include "bw_example_fx_eq_3band.h"
|
||||
|
||||
#define P_TYPE bw_example_fx_eq_3band
|
||||
#define P_NEW bw_example_fx_eq_3band_new
|
||||
#define P_FREE bw_example_fx_eq_3band_free
|
||||
#define P_INIT bw_example_fx_eq_3band_init
|
||||
#define P_SET_SAMPLE_RATE bw_example_fx_eq_3band_set_sample_rate
|
||||
#define P_RESET bw_example_fx_eq_3band_reset
|
||||
#define P_PROCESS bw_example_fx_eq_3band_process
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -20,54 +20,24 @@
|
||||
|
||||
#include "bw_example_fx_mm1.h"
|
||||
|
||||
#include <bw_mm1.h>
|
||||
#ifdef __WASM__
|
||||
# include "walloc.h"
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_cutoff,
|
||||
p_input_coeff,
|
||||
p_lp_coeff,
|
||||
p_n
|
||||
};
|
||||
|
||||
struct _bw_example_fx_mm1 {
|
||||
// Sub-components
|
||||
bw_mm1_coeffs mm1_coeffs;
|
||||
bw_mm1_state mm1_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
};
|
||||
|
||||
bw_example_fx_mm1 bw_example_fx_mm1_new() {
|
||||
bw_example_fx_mm1 instance = (bw_example_fx_mm1)malloc(sizeof(struct _bw_example_fx_mm1));
|
||||
if (instance != NULL)
|
||||
bw_mm1_init(&instance->mm1_coeffs);
|
||||
return instance;
|
||||
void bw_example_fx_mm1_init(bw_example_fx_mm1 *instance) {
|
||||
bw_mm1_init(&instance->mm1_coeffs);
|
||||
}
|
||||
|
||||
void bw_example_fx_mm1_free(bw_example_fx_mm1 instance) {
|
||||
free(instance);
|
||||
}
|
||||
|
||||
void bw_example_fx_mm1_set_sample_rate(bw_example_fx_mm1 instance, float sample_rate) {
|
||||
void bw_example_fx_mm1_set_sample_rate(bw_example_fx_mm1 *instance, float sample_rate) {
|
||||
bw_mm1_set_sample_rate(&instance->mm1_coeffs, sample_rate);
|
||||
}
|
||||
|
||||
void bw_example_fx_mm1_reset(bw_example_fx_mm1 instance) {
|
||||
void bw_example_fx_mm1_reset(bw_example_fx_mm1 *instance) {
|
||||
bw_mm1_reset_coeffs(&instance->mm1_coeffs);
|
||||
bw_mm1_reset_state(&instance->mm1_coeffs, &instance->mm1_state);
|
||||
}
|
||||
|
||||
void bw_example_fx_mm1_process(bw_example_fx_mm1 instance, const float** x, float** y, int n_samples) {
|
||||
void bw_example_fx_mm1_process(bw_example_fx_mm1 *instance, const float** x, float** y, int n_samples) {
|
||||
bw_mm1_process(&instance->mm1_coeffs, &instance->mm1_state, x[0], y[0], n_samples);
|
||||
}
|
||||
|
||||
void bw_example_fx_mm1_set_parameter(bw_example_fx_mm1 instance, int index, float value) {
|
||||
void bw_example_fx_mm1_set_parameter(bw_example_fx_mm1 *instance, int index, float value) {
|
||||
instance->params[index] = value;
|
||||
switch (index) {
|
||||
case p_cutoff:
|
||||
@ -82,6 +52,6 @@ void bw_example_fx_mm1_set_parameter(bw_example_fx_mm1 instance, int index, floa
|
||||
}
|
||||
}
|
||||
|
||||
float bw_example_fx_mm1_get_parameter(bw_example_fx_mm1 instance, int index) {
|
||||
float bw_example_fx_mm1_get_parameter(bw_example_fx_mm1 *instance, int index) {
|
||||
return instance->params[index];
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -25,15 +25,31 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _bw_example_fx_mm1* bw_example_fx_mm1;
|
||||
#include <bw_mm1.h>
|
||||
|
||||
bw_example_fx_mm1 bw_example_fx_mm1_new();
|
||||
void bw_example_fx_mm1_free(bw_example_fx_mm1 instance);
|
||||
void bw_example_fx_mm1_set_sample_rate(bw_example_fx_mm1 instance, float sample_rate);
|
||||
void bw_example_fx_mm1_reset(bw_example_fx_mm1 instance);
|
||||
void bw_example_fx_mm1_process(bw_example_fx_mm1 instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_fx_mm1_set_parameter(bw_example_fx_mm1 instance, int index, float value);
|
||||
float bw_example_fx_mm1_get_parameter(bw_example_fx_mm1 instance, int index);
|
||||
enum {
|
||||
p_cutoff,
|
||||
p_input_coeff,
|
||||
p_lp_coeff,
|
||||
p_n
|
||||
};
|
||||
|
||||
struct _bw_example_fx_mm1 {
|
||||
// Sub-components
|
||||
bw_mm1_coeffs mm1_coeffs;
|
||||
bw_mm1_state mm1_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
};
|
||||
typedef struct _bw_example_fx_mm1 bw_example_fx_mm1;
|
||||
|
||||
void bw_example_fx_mm1_init(bw_example_fx_mm1 *instance);
|
||||
void bw_example_fx_mm1_set_sample_rate(bw_example_fx_mm1 *instance, float sample_rate);
|
||||
void bw_example_fx_mm1_reset(bw_example_fx_mm1 *instance);
|
||||
void bw_example_fx_mm1_process(bw_example_fx_mm1 *instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_fx_mm1_set_parameter(bw_example_fx_mm1 *instance, int index, float value);
|
||||
float bw_example_fx_mm1_get_parameter(bw_example_fx_mm1 *instance, int index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -79,8 +79,7 @@ static struct config_parameter config_parameters[NUM_PARAMETERS] = {
|
||||
#include "bw_example_fx_mm1.h"
|
||||
|
||||
#define P_TYPE bw_example_fx_mm1
|
||||
#define P_NEW bw_example_fx_mm1_new
|
||||
#define P_FREE bw_example_fx_mm1_free
|
||||
#define P_INIT bw_example_fx_mm1_init
|
||||
#define P_SET_SAMPLE_RATE bw_example_fx_mm1_set_sample_rate
|
||||
#define P_RESET bw_example_fx_mm1_reset
|
||||
#define P_PROCESS bw_example_fx_mm1_process
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -20,57 +20,24 @@
|
||||
|
||||
#include "bw_example_fx_mm2.h"
|
||||
|
||||
#include <bw_mm2.h>
|
||||
#ifdef __WASM__
|
||||
# include "walloc.h"
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_cutoff,
|
||||
p_Q,
|
||||
p_input_coeff,
|
||||
p_lp_coeff,
|
||||
p_bp_coeff,
|
||||
p_hp_coeff,
|
||||
p_n
|
||||
};
|
||||
|
||||
struct _bw_example_fx_mm2 {
|
||||
// Sub-components
|
||||
bw_mm2_coeffs mm2_coeffs;
|
||||
bw_mm2_state mm2_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
};
|
||||
|
||||
bw_example_fx_mm2 bw_example_fx_mm2_new() {
|
||||
bw_example_fx_mm2 instance = (bw_example_fx_mm2)malloc(sizeof(struct _bw_example_fx_mm2));
|
||||
if (instance != NULL)
|
||||
bw_mm2_init(&instance->mm2_coeffs);
|
||||
return instance;
|
||||
void bw_example_fx_mm2_init(bw_example_fx_mm2 *instance) {
|
||||
bw_mm2_init(&instance->mm2_coeffs);
|
||||
}
|
||||
|
||||
void bw_example_fx_mm2_free(bw_example_fx_mm2 instance) {
|
||||
free(instance);
|
||||
}
|
||||
|
||||
void bw_example_fx_mm2_set_sample_rate(bw_example_fx_mm2 instance, float sample_rate) {
|
||||
void bw_example_fx_mm2_set_sample_rate(bw_example_fx_mm2 *instance, float sample_rate) {
|
||||
bw_mm2_set_sample_rate(&instance->mm2_coeffs, sample_rate);
|
||||
}
|
||||
|
||||
void bw_example_fx_mm2_reset(bw_example_fx_mm2 instance) {
|
||||
void bw_example_fx_mm2_reset(bw_example_fx_mm2 *instance) {
|
||||
bw_mm2_reset_coeffs(&instance->mm2_coeffs);
|
||||
bw_mm2_reset_state(&instance->mm2_coeffs, &instance->mm2_state);
|
||||
}
|
||||
|
||||
void bw_example_fx_mm2_process(bw_example_fx_mm2 instance, const float** x, float** y, int n_samples) {
|
||||
void bw_example_fx_mm2_process(bw_example_fx_mm2 *instance, const float** x, float** y, int n_samples) {
|
||||
bw_mm2_process(&instance->mm2_coeffs, &instance->mm2_state, x[0], y[0], n_samples);
|
||||
}
|
||||
|
||||
void bw_example_fx_mm2_set_parameter(bw_example_fx_mm2 instance, int index, float value) {
|
||||
void bw_example_fx_mm2_set_parameter(bw_example_fx_mm2 *instance, int index, float value) {
|
||||
instance->params[index] = value;
|
||||
switch (index) {
|
||||
case p_cutoff:
|
||||
@ -94,6 +61,6 @@ void bw_example_fx_mm2_set_parameter(bw_example_fx_mm2 instance, int index, floa
|
||||
}
|
||||
}
|
||||
|
||||
float bw_example_fx_mm2_get_parameter(bw_example_fx_mm2 instance, int index) {
|
||||
float bw_example_fx_mm2_get_parameter(bw_example_fx_mm2 *instance, int index) {
|
||||
return instance->params[index];
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -25,15 +25,34 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _bw_example_fx_mm2* bw_example_fx_mm2;
|
||||
#include <bw_mm2.h>
|
||||
|
||||
bw_example_fx_mm2 bw_example_fx_mm2_new();
|
||||
void bw_example_fx_mm2_free(bw_example_fx_mm2 instance);
|
||||
void bw_example_fx_mm2_set_sample_rate(bw_example_fx_mm2 instance, float sample_rate);
|
||||
void bw_example_fx_mm2_reset(bw_example_fx_mm2 instance);
|
||||
void bw_example_fx_mm2_process(bw_example_fx_mm2 instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_fx_mm2_set_parameter(bw_example_fx_mm2 instance, int index, float value);
|
||||
float bw_example_fx_mm2_get_parameter(bw_example_fx_mm2 instance, int index);
|
||||
enum {
|
||||
p_cutoff,
|
||||
p_Q,
|
||||
p_input_coeff,
|
||||
p_lp_coeff,
|
||||
p_bp_coeff,
|
||||
p_hp_coeff,
|
||||
p_n
|
||||
};
|
||||
|
||||
struct _bw_example_fx_mm2 {
|
||||
// Sub-components
|
||||
bw_mm2_coeffs mm2_coeffs;
|
||||
bw_mm2_state mm2_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
};
|
||||
typedef struct _bw_example_fx_mm2 bw_example_fx_mm2;
|
||||
|
||||
void bw_example_fx_mm2_init(bw_example_fx_mm2 *instance);
|
||||
void bw_example_fx_mm2_set_sample_rate(bw_example_fx_mm2 *instance, float sample_rate);
|
||||
void bw_example_fx_mm2_reset(bw_example_fx_mm2 *instance);
|
||||
void bw_example_fx_mm2_process(bw_example_fx_mm2 *instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_fx_mm2_set_parameter(bw_example_fx_mm2 *instance, int index, float value);
|
||||
float bw_example_fx_mm2_get_parameter(bw_example_fx_mm2 *instance, int index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -82,8 +82,7 @@ static struct config_parameter config_parameters[NUM_PARAMETERS] = {
|
||||
#include "bw_example_fx_mm2.h"
|
||||
|
||||
#define P_TYPE bw_example_fx_mm2
|
||||
#define P_NEW bw_example_fx_mm2_new
|
||||
#define P_FREE bw_example_fx_mm2_free
|
||||
#define P_INIT bw_example_fx_mm2_init
|
||||
#define P_SET_SAMPLE_RATE bw_example_fx_mm2_set_sample_rate
|
||||
#define P_RESET bw_example_fx_mm2_reset
|
||||
#define P_PROCESS bw_example_fx_mm2_process
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -20,55 +20,24 @@
|
||||
|
||||
#include "bw_example_fx_noise_gate.h"
|
||||
|
||||
#include <bw_noise_gate.h>
|
||||
#ifdef __WASM__
|
||||
# include "walloc.h"
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_thresh,
|
||||
p_attenuation,
|
||||
p_attack,
|
||||
p_release,
|
||||
p_n
|
||||
};
|
||||
|
||||
struct _bw_example_fx_noise_gate {
|
||||
// Sub-noise_gateonents
|
||||
bw_noise_gate_coeffs noise_gate_coeffs;
|
||||
bw_noise_gate_state noise_gate_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
};
|
||||
|
||||
bw_example_fx_noise_gate bw_example_fx_noise_gate_new() {
|
||||
bw_example_fx_noise_gate instance = (bw_example_fx_noise_gate)malloc(sizeof(struct _bw_example_fx_noise_gate));
|
||||
if (instance != NULL)
|
||||
bw_noise_gate_init(&instance->noise_gate_coeffs);
|
||||
return instance;
|
||||
void bw_example_fx_noise_gate_free(bw_example_fx_noise_gate *instance) {
|
||||
bw_noise_gate_init(&instance->noise_gate_coeffs);
|
||||
}
|
||||
|
||||
void bw_example_fx_noise_gate_free(bw_example_fx_noise_gate instance) {
|
||||
free(instance);
|
||||
}
|
||||
|
||||
void bw_example_fx_noise_gate_set_sample_rate(bw_example_fx_noise_gate instance, float sample_rate) {
|
||||
void bw_example_fx_noise_gate_set_sample_rate(bw_example_fx_noise_gate *instance, float sample_rate) {
|
||||
bw_noise_gate_set_sample_rate(&instance->noise_gate_coeffs, sample_rate);
|
||||
}
|
||||
|
||||
void bw_example_fx_noise_gate_reset(bw_example_fx_noise_gate instance) {
|
||||
void bw_example_fx_noise_gate_reset(bw_example_fx_noise_gate *instance) {
|
||||
bw_noise_gate_reset_coeffs(&instance->noise_gate_coeffs);
|
||||
bw_noise_gate_reset_state(&instance->noise_gate_coeffs, &instance->noise_gate_state);
|
||||
}
|
||||
|
||||
void bw_example_fx_noise_gate_process(bw_example_fx_noise_gate instance, const float** x, float** y, int n_samples) {
|
||||
void bw_example_fx_noise_gate_process(bw_example_fx_noise_gate *instance, const float** x, float** y, int n_samples) {
|
||||
bw_noise_gate_process(&instance->noise_gate_coeffs, &instance->noise_gate_state, x[0], x[0], y[0], n_samples);
|
||||
}
|
||||
|
||||
void bw_example_fx_noise_gate_set_parameter(bw_example_fx_noise_gate instance, int index, float value) {
|
||||
void bw_example_fx_noise_gate_set_parameter(bw_example_fx_noise_gate *instance, int index, float value) {
|
||||
instance->params[index] = value;
|
||||
switch (index) {
|
||||
case p_thresh:
|
||||
@ -86,6 +55,6 @@ void bw_example_fx_noise_gate_set_parameter(bw_example_fx_noise_gate instance, i
|
||||
}
|
||||
}
|
||||
|
||||
float bw_example_fx_noise_gate_get_parameter(bw_example_fx_noise_gate instance, int index) {
|
||||
float bw_example_fx_noise_gate_get_parameter(bw_example_fx_noise_gate *instance, int index) {
|
||||
return instance->params[index];
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -25,15 +25,32 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _bw_example_fx_noise_gate* bw_example_fx_noise_gate;
|
||||
#include <bw_noise_gate.h>
|
||||
|
||||
bw_example_fx_noise_gate bw_example_fx_noise_gate_new();
|
||||
void bw_example_fx_noise_gate_free(bw_example_fx_noise_gate instance);
|
||||
void bw_example_fx_noise_gate_set_sample_rate(bw_example_fx_noise_gate instance, float sample_rate);
|
||||
void bw_example_fx_noise_gate_reset(bw_example_fx_noise_gate instance);
|
||||
void bw_example_fx_noise_gate_process(bw_example_fx_noise_gate instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_fx_noise_gate_set_parameter(bw_example_fx_noise_gate instance, int index, float value);
|
||||
float bw_example_fx_noise_gate_get_parameter(bw_example_fx_noise_gate instance, int index);
|
||||
enum {
|
||||
p_thresh,
|
||||
p_attenuation,
|
||||
p_attack,
|
||||
p_release,
|
||||
p_n
|
||||
};
|
||||
|
||||
struct _bw_example_fx_noise_gate {
|
||||
// Sub-noise_gateonents
|
||||
bw_noise_gate_coeffs noise_gate_coeffs;
|
||||
bw_noise_gate_state noise_gate_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
};
|
||||
typedef struct _bw_example_fx_noise_gate bw_example_fx_noise_gate;
|
||||
|
||||
void bw_example_fx_noise_gate_init(bw_example_fx_noise_gate *instance);
|
||||
void bw_example_fx_noise_gate_set_sample_rate(bw_example_fx_noise_gate *instance, float sample_rate);
|
||||
void bw_example_fx_noise_gate_reset(bw_example_fx_noise_gate *instance);
|
||||
void bw_example_fx_noise_gate_process(bw_example_fx_noise_gate *instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_fx_noise_gate_set_parameter(bw_example_fx_noise_gate *instance, int index, float value);
|
||||
float bw_example_fx_noise_gate_get_parameter(bw_example_fx_noise_gate *instance, int index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -80,8 +80,7 @@ static struct config_parameter config_parameters[NUM_PARAMETERS] = {
|
||||
#include "bw_example_fx_noise_gate.h"
|
||||
|
||||
#define P_TYPE bw_example_fx_noise_gate
|
||||
#define P_NEW bw_example_fx_noise_gate_new
|
||||
#define P_FREE bw_example_fx_noise_gate_free
|
||||
#define P_INIT bw_example_fx_noise_gate_init
|
||||
#define P_SET_SAMPLE_RATE bw_example_fx_noise_gate_set_sample_rate
|
||||
#define P_RESET bw_example_fx_noise_gate_reset
|
||||
#define P_PROCESS bw_example_fx_noise_gate_process
|
||||
|
@ -20,53 +20,24 @@
|
||||
|
||||
#include "bw_example_fx_notch.h"
|
||||
|
||||
#include <bw_notch.h>
|
||||
#ifdef __WASM__
|
||||
# include "walloc.h"
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_cutoff,
|
||||
p_Q,
|
||||
p_n
|
||||
};
|
||||
|
||||
struct _bw_example_fx_notch {
|
||||
// Sub-components
|
||||
bw_notch_coeffs notch_coeffs;
|
||||
bw_notch_state notch_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
};
|
||||
|
||||
bw_example_fx_notch bw_example_fx_notch_new() {
|
||||
bw_example_fx_notch instance = (bw_example_fx_notch)malloc(sizeof(struct _bw_example_fx_notch));
|
||||
if (instance != NULL)
|
||||
bw_notch_init(&instance->notch_coeffs);
|
||||
return instance;
|
||||
void bw_example_fx_notch_init(bw_example_fx_notch *instance) {
|
||||
bw_notch_init(&instance->notch_coeffs);
|
||||
}
|
||||
|
||||
void bw_example_fx_notch_free(bw_example_fx_notch instance) {
|
||||
free(instance);
|
||||
}
|
||||
|
||||
void bw_example_fx_notch_set_sample_rate(bw_example_fx_notch instance, float sample_rate) {
|
||||
void bw_example_fx_notch_set_sample_rate(bw_example_fx_notch *instance, float sample_rate) {
|
||||
bw_notch_set_sample_rate(&instance->notch_coeffs, sample_rate);
|
||||
}
|
||||
|
||||
void bw_example_fx_notch_reset(bw_example_fx_notch instance) {
|
||||
void bw_example_fx_notch_reset(bw_example_fx_notch *instance) {
|
||||
bw_notch_reset_coeffs(&instance->notch_coeffs);
|
||||
bw_notch_reset_state(&instance->notch_coeffs, &instance->notch_state);
|
||||
}
|
||||
|
||||
void bw_example_fx_notch_process(bw_example_fx_notch instance, const float** x, float** y, int n_samples) {
|
||||
void bw_example_fx_notch_process(bw_example_fx_notch *instance, const float** x, float** y, int n_samples) {
|
||||
bw_notch_process(&instance->notch_coeffs, &instance->notch_state, x[0], y[0], n_samples);
|
||||
}
|
||||
|
||||
void bw_example_fx_notch_set_parameter(bw_example_fx_notch instance, int index, float value) {
|
||||
void bw_example_fx_notch_set_parameter(bw_example_fx_notch *instance, int index, float value) {
|
||||
instance->params[index] = value;
|
||||
switch (index) {
|
||||
case p_cutoff:
|
||||
@ -78,6 +49,6 @@ void bw_example_fx_notch_set_parameter(bw_example_fx_notch instance, int index,
|
||||
}
|
||||
}
|
||||
|
||||
float bw_example_fx_notch_get_parameter(bw_example_fx_notch instance, int index) {
|
||||
float bw_example_fx_notch_get_parameter(bw_example_fx_notch *instance, int index) {
|
||||
return instance->params[index];
|
||||
}
|
||||
|
@ -25,15 +25,30 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _bw_example_fx_notch* bw_example_fx_notch;
|
||||
#include <bw_notch.h>
|
||||
|
||||
bw_example_fx_notch bw_example_fx_notch_new();
|
||||
void bw_example_fx_notch_free(bw_example_fx_notch instance);
|
||||
void bw_example_fx_notch_set_sample_rate(bw_example_fx_notch instance, float sample_rate);
|
||||
void bw_example_fx_notch_reset(bw_example_fx_notch instance);
|
||||
void bw_example_fx_notch_process(bw_example_fx_notch instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_fx_notch_set_parameter(bw_example_fx_notch instance, int index, float value);
|
||||
float bw_example_fx_notch_get_parameter(bw_example_fx_notch instance, int index);
|
||||
enum {
|
||||
p_cutoff,
|
||||
p_Q,
|
||||
p_n
|
||||
};
|
||||
|
||||
struct _bw_example_fx_notch {
|
||||
// Sub-components
|
||||
bw_notch_coeffs notch_coeffs;
|
||||
bw_notch_state notch_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
};
|
||||
typedef struct _bw_example_fx_notch bw_example_fx_notch;
|
||||
|
||||
void bw_example_fx_notch_init(bw_example_fx_notch *instance);
|
||||
void bw_example_fx_notch_set_sample_rate(bw_example_fx_notch *instance, float sample_rate);
|
||||
void bw_example_fx_notch_reset(bw_example_fx_notch *instance);
|
||||
void bw_example_fx_notch_process(bw_example_fx_notch *instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_fx_notch_set_parameter(bw_example_fx_notch *instance, int index, float value);
|
||||
float bw_example_fx_notch_get_parameter(bw_example_fx_notch *instance, int index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -78,8 +78,7 @@ static struct config_parameter config_parameters[NUM_PARAMETERS] = {
|
||||
#include "bw_example_fx_notch.h"
|
||||
|
||||
#define P_TYPE bw_example_fx_notch
|
||||
#define P_NEW bw_example_fx_notch_new
|
||||
#define P_FREE bw_example_fx_notch_free
|
||||
#define P_INIT bw_example_fx_notch_init
|
||||
#define P_SET_SAMPLE_RATE bw_example_fx_notch_set_sample_rate
|
||||
#define P_RESET bw_example_fx_notch_reset
|
||||
#define P_PROCESS bw_example_fx_notch_process
|
||||
|
@ -20,57 +20,24 @@
|
||||
|
||||
#include "bw_example_fx_pan.h"
|
||||
|
||||
#include <bw_pan.h>
|
||||
#include <bw_ppm.h>
|
||||
#include <bw_math.h>
|
||||
#ifdef __WASM__
|
||||
# include "walloc.h"
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_pan,
|
||||
p_n
|
||||
};
|
||||
|
||||
struct _bw_example_fx_pan {
|
||||
// Sub-components
|
||||
bw_pan_coeffs pan_coeffs;
|
||||
bw_ppm_coeffs ppm_coeffs;
|
||||
bw_ppm_state ppm_l_state;
|
||||
bw_ppm_state ppm_r_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
};
|
||||
|
||||
bw_example_fx_pan bw_example_fx_pan_new() {
|
||||
bw_example_fx_pan instance = (bw_example_fx_pan)malloc(sizeof(struct _bw_example_fx_pan));
|
||||
if (instance == NULL)
|
||||
return NULL;
|
||||
void bw_example_fx_pan_init(bw_example_fx_pan *instance) {
|
||||
bw_pan_init(&instance->pan_coeffs);
|
||||
bw_ppm_init(&instance->ppm_coeffs);
|
||||
return instance;
|
||||
}
|
||||
|
||||
void bw_example_fx_pan_free(bw_example_fx_pan instance) {
|
||||
free(instance);
|
||||
}
|
||||
|
||||
void bw_example_fx_pan_set_sample_rate(bw_example_fx_pan instance, float sample_rate) {
|
||||
void bw_example_fx_pan_set_sample_rate(bw_example_fx_pan *instance, float sample_rate) {
|
||||
bw_pan_set_sample_rate(&instance->pan_coeffs, sample_rate);
|
||||
bw_ppm_set_sample_rate(&instance->ppm_coeffs, sample_rate);
|
||||
}
|
||||
|
||||
void bw_example_fx_pan_reset(bw_example_fx_pan instance) {
|
||||
void bw_example_fx_pan_reset(bw_example_fx_pan *instance) {
|
||||
bw_pan_reset_coeffs(&instance->pan_coeffs);
|
||||
bw_ppm_reset_coeffs(&instance->ppm_coeffs);
|
||||
bw_ppm_reset_state(&instance->ppm_coeffs, &instance->ppm_l_state);
|
||||
bw_ppm_reset_state(&instance->ppm_coeffs, &instance->ppm_r_state);
|
||||
}
|
||||
|
||||
void bw_example_fx_pan_process(bw_example_fx_pan instance, const float** x, float** y, int n_samples) {
|
||||
void bw_example_fx_pan_process(bw_example_fx_pan *instance, const float** x, float** y, int n_samples) {
|
||||
bw_pan_process(&instance->pan_coeffs, x[0], y[0], y[1], n_samples);
|
||||
bw_ppm_update_coeffs_ctrl(&instance->ppm_coeffs);
|
||||
for (int i = 0; i < n_samples; i++) {
|
||||
@ -80,7 +47,7 @@ void bw_example_fx_pan_process(bw_example_fx_pan instance, const float** x, floa
|
||||
}
|
||||
}
|
||||
|
||||
void bw_example_fx_pan_set_parameter(bw_example_fx_pan instance, int index, float value) {
|
||||
void bw_example_fx_pan_set_parameter(bw_example_fx_pan *instance, int index, float value) {
|
||||
instance->params[index] = value;
|
||||
switch (index) {
|
||||
case p_pan:
|
||||
@ -89,7 +56,7 @@ void bw_example_fx_pan_set_parameter(bw_example_fx_pan instance, int index, floa
|
||||
}
|
||||
}
|
||||
|
||||
float bw_example_fx_pan_get_parameter(bw_example_fx_pan instance, int index) {
|
||||
float bw_example_fx_pan_get_parameter(bw_example_fx_pan *instance, int index) {
|
||||
float r;
|
||||
switch (index) {
|
||||
case p_pan:
|
||||
|
@ -25,15 +25,33 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _bw_example_fx_pan* bw_example_fx_pan;
|
||||
#include <bw_pan.h>
|
||||
#include <bw_ppm.h>
|
||||
#include <bw_math.h>
|
||||
|
||||
bw_example_fx_pan bw_example_fx_pan_new();
|
||||
void bw_example_fx_pan_free(bw_example_fx_pan instance);
|
||||
void bw_example_fx_pan_set_sample_rate(bw_example_fx_pan instance, float sample_rate);
|
||||
void bw_example_fx_pan_reset(bw_example_fx_pan instance);
|
||||
void bw_example_fx_pan_process(bw_example_fx_pan instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_fx_pan_set_parameter(bw_example_fx_pan instance, int index, float value);
|
||||
float bw_example_fx_pan_get_parameter(bw_example_fx_pan instance, int index);
|
||||
enum {
|
||||
p_pan,
|
||||
p_n
|
||||
};
|
||||
|
||||
struct _bw_example_fx_pan {
|
||||
// Sub-components
|
||||
bw_pan_coeffs pan_coeffs;
|
||||
bw_ppm_coeffs ppm_coeffs;
|
||||
bw_ppm_state ppm_l_state;
|
||||
bw_ppm_state ppm_r_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
};
|
||||
typedef struct _bw_example_fx_pan bw_example_fx_pan;
|
||||
|
||||
void bw_example_fx_pan_init(bw_example_fx_pan *instance);
|
||||
void bw_example_fx_pan_set_sample_rate(bw_example_fx_pan *instance, float sample_rate);
|
||||
void bw_example_fx_pan_reset(bw_example_fx_pan *instance);
|
||||
void bw_example_fx_pan_process(bw_example_fx_pan *instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_fx_pan_set_parameter(bw_example_fx_pan *instance, int index, float value);
|
||||
float bw_example_fx_pan_get_parameter(bw_example_fx_pan *instance, int index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -79,8 +79,7 @@ static struct config_parameter config_parameters[NUM_PARAMETERS] = {
|
||||
#include "bw_example_fx_pan.h"
|
||||
|
||||
#define P_TYPE bw_example_fx_pan
|
||||
#define P_NEW bw_example_fx_pan_new
|
||||
#define P_FREE bw_example_fx_pan_free
|
||||
#define P_INIT bw_example_fx_pan_init
|
||||
#define P_SET_SAMPLE_RATE bw_example_fx_pan_set_sample_rate
|
||||
#define P_RESET bw_example_fx_pan_reset
|
||||
#define P_PROCESS bw_example_fx_pan_process
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -20,54 +20,24 @@
|
||||
|
||||
#include "bw_example_fx_satur.h"
|
||||
|
||||
#include <bw_satur.h>
|
||||
#ifdef __WASM__
|
||||
# include "walloc.h"
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
|
||||
enum {
|
||||
p_bias,
|
||||
p_gain,
|
||||
p_n
|
||||
};
|
||||
|
||||
struct _bw_example_fx_satur {
|
||||
// Sub-components
|
||||
bw_satur_coeffs satur_coeffs;
|
||||
bw_satur_state satur_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
};
|
||||
|
||||
bw_example_fx_satur bw_example_fx_satur_new() {
|
||||
bw_example_fx_satur instance = (bw_example_fx_satur)malloc(sizeof(struct _bw_example_fx_satur));
|
||||
if (instance != NULL)
|
||||
bw_satur_init(&instance->satur_coeffs);
|
||||
return instance;
|
||||
void bw_example_fx_satur_init(bw_example_fx_satur *instance) {
|
||||
bw_satur_init(&instance->satur_coeffs);
|
||||
}
|
||||
|
||||
void bw_example_fx_satur_free(bw_example_fx_satur instance) {
|
||||
free(instance);
|
||||
}
|
||||
|
||||
void bw_example_fx_satur_set_sample_rate(bw_example_fx_satur instance, float sample_rate) {
|
||||
void bw_example_fx_satur_set_sample_rate(bw_example_fx_satur *instance, float sample_rate) {
|
||||
bw_satur_set_sample_rate(&instance->satur_coeffs, sample_rate);
|
||||
}
|
||||
|
||||
void bw_example_fx_satur_reset(bw_example_fx_satur instance) {
|
||||
void bw_example_fx_satur_reset(bw_example_fx_satur *instance) {
|
||||
bw_satur_reset_coeffs(&instance->satur_coeffs);
|
||||
bw_satur_reset_state(&instance->satur_coeffs, &instance->satur_state);
|
||||
}
|
||||
|
||||
void bw_example_fx_satur_process(bw_example_fx_satur instance, const float** x, float** y, int n_samples) {
|
||||
void bw_example_fx_satur_process(bw_example_fx_satur *instance, const float** x, float** y, int n_samples) {
|
||||
bw_satur_process(&instance->satur_coeffs, &instance->satur_state, x[0], y[0], n_samples);
|
||||
}
|
||||
|
||||
void bw_example_fx_satur_set_parameter(bw_example_fx_satur instance, int index, float value) {
|
||||
void bw_example_fx_satur_set_parameter(bw_example_fx_satur *instance, int index, float value) {
|
||||
instance->params[index] = value;
|
||||
switch (index) {
|
||||
case p_bias:
|
||||
@ -79,6 +49,6 @@ void bw_example_fx_satur_set_parameter(bw_example_fx_satur instance, int index,
|
||||
}
|
||||
}
|
||||
|
||||
float bw_example_fx_satur_get_parameter(bw_example_fx_satur instance, int index) {
|
||||
float bw_example_fx_satur_get_parameter(bw_example_fx_satur *instance, int index) {
|
||||
return instance->params[index];
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -25,15 +25,30 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _bw_example_fx_satur* bw_example_fx_satur;
|
||||
#include <bw_satur.h>
|
||||
|
||||
bw_example_fx_satur bw_example_fx_satur_new();
|
||||
void bw_example_fx_satur_free(bw_example_fx_satur instance);
|
||||
void bw_example_fx_satur_set_sample_rate(bw_example_fx_satur instance, float sample_rate);
|
||||
void bw_example_fx_satur_reset(bw_example_fx_satur instance);
|
||||
void bw_example_fx_satur_process(bw_example_fx_satur instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_fx_satur_set_parameter(bw_example_fx_satur instance, int index, float value);
|
||||
float bw_example_fx_satur_get_parameter(bw_example_fx_satur instance, int index);
|
||||
enum {
|
||||
p_bias,
|
||||
p_gain,
|
||||
p_n
|
||||
};
|
||||
|
||||
struct _bw_example_fx_satur {
|
||||
// Sub-components
|
||||
bw_satur_coeffs satur_coeffs;
|
||||
bw_satur_state satur_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
};
|
||||
typedef struct _bw_example_fx_satur bw_example_fx_satur;
|
||||
|
||||
void bw_example_fx_satur_init(bw_example_fx_satur *instance);
|
||||
void bw_example_fx_satur_set_sample_rate(bw_example_fx_satur *instance, float sample_rate);
|
||||
void bw_example_fx_satur_reset(bw_example_fx_satur *instance);
|
||||
void bw_example_fx_satur_process(bw_example_fx_satur *instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_fx_satur_set_parameter(bw_example_fx_satur *instance, int index, float value);
|
||||
float bw_example_fx_satur_get_parameter(bw_example_fx_satur *instance, int index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -51,7 +51,7 @@ struct config_parameter {
|
||||
#define COMPANY_MAILTO "mailto:info@orastron.com"
|
||||
|
||||
#define PLUGIN_NAME "bw_example_fx_satur"
|
||||
#define PLUGIN_VERSION "0.2.0"
|
||||
#define PLUGIN_VERSION "0.3.0"
|
||||
|
||||
#define NUM_BUSES_IN 1
|
||||
#define NUM_BUSES_OUT 1
|
||||
@ -78,8 +78,7 @@ static struct config_parameter config_parameters[NUM_PARAMETERS] = {
|
||||
#include "bw_example_fx_satur.h"
|
||||
|
||||
#define P_TYPE bw_example_fx_satur
|
||||
#define P_NEW bw_example_fx_satur_new
|
||||
#define P_FREE bw_example_fx_satur_free
|
||||
#define P_INIT bw_example_fx_satur_init
|
||||
#define P_SET_SAMPLE_RATE bw_example_fx_satur_set_sample_rate
|
||||
#define P_RESET bw_example_fx_satur_reset
|
||||
#define P_PROCESS bw_example_fx_satur_process
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -20,53 +20,24 @@
|
||||
|
||||
#include "bw_example_fx_svf.h"
|
||||
|
||||
#include <bw_svf.h>
|
||||
#ifdef __WASM__
|
||||
# include "walloc.h"
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_cutoff,
|
||||
p_Q,
|
||||
p_n
|
||||
};
|
||||
|
||||
struct _bw_example_fx_svf {
|
||||
// Sub-components
|
||||
bw_svf_coeffs svf_coeffs;
|
||||
bw_svf_state svf_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
};
|
||||
|
||||
bw_example_fx_svf bw_example_fx_svf_new() {
|
||||
bw_example_fx_svf instance = (bw_example_fx_svf)malloc(sizeof(struct _bw_example_fx_svf));
|
||||
if (instance != NULL)
|
||||
bw_svf_init(&instance->svf_coeffs);
|
||||
return instance;
|
||||
void bw_example_fx_svf_free(bw_example_fx_svf *instance) {
|
||||
bw_svf_init(&instance->svf_coeffs);
|
||||
}
|
||||
|
||||
void bw_example_fx_svf_free(bw_example_fx_svf instance) {
|
||||
free(instance);
|
||||
}
|
||||
|
||||
void bw_example_fx_svf_set_sample_rate(bw_example_fx_svf instance, float sample_rate) {
|
||||
void bw_example_fx_svf_set_sample_rate(bw_example_fx_svf *instance, float sample_rate) {
|
||||
bw_svf_set_sample_rate(&instance->svf_coeffs, sample_rate);
|
||||
}
|
||||
|
||||
void bw_example_fx_svf_reset(bw_example_fx_svf instance) {
|
||||
void bw_example_fx_svf_reset(bw_example_fx_svf *instance) {
|
||||
bw_svf_reset_coeffs(&instance->svf_coeffs);
|
||||
bw_svf_reset_state(&instance->svf_coeffs, &instance->svf_state);
|
||||
}
|
||||
|
||||
void bw_example_fx_svf_process(bw_example_fx_svf instance, const float** x, float** y, int n_samples) {
|
||||
void bw_example_fx_svf_process(bw_example_fx_svf *instance, const float** x, float** y, int n_samples) {
|
||||
bw_svf_process(&instance->svf_coeffs, &instance->svf_state, x[0], y[0], NULL, NULL, n_samples);
|
||||
}
|
||||
|
||||
void bw_example_fx_svf_set_parameter(bw_example_fx_svf instance, int index, float value) {
|
||||
void bw_example_fx_svf_set_parameter(bw_example_fx_svf *instance, int index, float value) {
|
||||
instance->params[index] = value;
|
||||
switch (index) {
|
||||
case p_cutoff:
|
||||
@ -78,6 +49,6 @@ void bw_example_fx_svf_set_parameter(bw_example_fx_svf instance, int index, floa
|
||||
}
|
||||
}
|
||||
|
||||
float bw_example_fx_svf_get_parameter(bw_example_fx_svf instance, int index) {
|
||||
float bw_example_fx_svf_get_parameter(bw_example_fx_svf *instance, int index) {
|
||||
return instance->params[index];
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -25,15 +25,30 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _bw_example_fx_svf* bw_example_fx_svf;
|
||||
#include <bw_svf.h>
|
||||
|
||||
bw_example_fx_svf bw_example_fx_svf_new();
|
||||
void bw_example_fx_svf_free(bw_example_fx_svf instance);
|
||||
void bw_example_fx_svf_set_sample_rate(bw_example_fx_svf instance, float sample_rate);
|
||||
void bw_example_fx_svf_reset(bw_example_fx_svf instance);
|
||||
void bw_example_fx_svf_process(bw_example_fx_svf instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_fx_svf_set_parameter(bw_example_fx_svf instance, int index, float value);
|
||||
float bw_example_fx_svf_get_parameter(bw_example_fx_svf instance, int index);
|
||||
enum {
|
||||
p_cutoff,
|
||||
p_Q,
|
||||
p_n
|
||||
};
|
||||
|
||||
struct _bw_example_fx_svf {
|
||||
// Sub-components
|
||||
bw_svf_coeffs svf_coeffs;
|
||||
bw_svf_state svf_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
};
|
||||
typedef struct _bw_example_fx_svf bw_example_fx_svf;
|
||||
|
||||
void bw_example_fx_svf_init(bw_example_fx_svf *instance);
|
||||
void bw_example_fx_svf_set_sample_rate(bw_example_fx_svf *instance, float sample_rate);
|
||||
void bw_example_fx_svf_reset(bw_example_fx_svf *instance);
|
||||
void bw_example_fx_svf_process(bw_example_fx_svf *instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_fx_svf_set_parameter(bw_example_fx_svf *instance, int index, float value);
|
||||
float bw_example_fx_svf_get_parameter(bw_example_fx_svf *instance, int index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -51,7 +51,7 @@ struct config_parameter {
|
||||
#define COMPANY_MAILTO "mailto:info@orastron.com"
|
||||
|
||||
#define PLUGIN_NAME "bw_example_fx_svf"
|
||||
#define PLUGIN_VERSION "0.2.0"
|
||||
#define PLUGIN_VERSION "0.3.0"
|
||||
|
||||
#define NUM_BUSES_IN 1
|
||||
#define NUM_BUSES_OUT 1
|
||||
@ -78,8 +78,7 @@ static struct config_parameter config_parameters[NUM_PARAMETERS] = {
|
||||
#include "bw_example_fx_svf.h"
|
||||
|
||||
#define P_TYPE bw_example_fx_svf
|
||||
#define P_NEW bw_example_fx_svf_new
|
||||
#define P_FREE bw_example_fx_svf_free
|
||||
#define P_INIT bw_example_fx_svf_init
|
||||
#define P_SET_SAMPLE_RATE bw_example_fx_svf_set_sample_rate
|
||||
#define P_RESET bw_example_fx_svf_reset
|
||||
#define P_PROCESS bw_example_fx_svf_process
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -20,57 +20,28 @@
|
||||
|
||||
#include "bw_example_fx_wah.h"
|
||||
|
||||
#include <bw_wah.h>
|
||||
#ifdef __WASM__
|
||||
# include "walloc.h"
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
|
||||
enum {
|
||||
p_wah,
|
||||
p_n
|
||||
};
|
||||
|
||||
struct _bw_example_fx_wah {
|
||||
// Sub-components
|
||||
bw_wah_coeffs wah_coeffs;
|
||||
bw_wah_state wah_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
};
|
||||
|
||||
bw_example_fx_wah bw_example_fx_wah_new() {
|
||||
bw_example_fx_wah instance = (bw_example_fx_wah)malloc(sizeof(struct _bw_example_fx_wah));
|
||||
if (instance != NULL)
|
||||
bw_wah_init(&instance->wah_coeffs);
|
||||
return instance;
|
||||
void bw_example_fx_wah_init(bw_example_fx_wah *instance) {
|
||||
bw_wah_init(&instance->wah_coeffs);
|
||||
}
|
||||
|
||||
void bw_example_fx_wah_free(bw_example_fx_wah instance) {
|
||||
free(instance);
|
||||
}
|
||||
|
||||
void bw_example_fx_wah_set_sample_rate(bw_example_fx_wah instance, float sample_rate) {
|
||||
void bw_example_fx_wah_set_sample_rate(bw_example_fx_wah *instance, float sample_rate) {
|
||||
bw_wah_set_sample_rate(&instance->wah_coeffs, sample_rate);
|
||||
}
|
||||
|
||||
void bw_example_fx_wah_reset(bw_example_fx_wah instance) {
|
||||
void bw_example_fx_wah_reset(bw_example_fx_wah *instance) {
|
||||
bw_wah_reset_coeffs(&instance->wah_coeffs);
|
||||
bw_wah_reset_state(&instance->wah_coeffs, &instance->wah_state);
|
||||
}
|
||||
|
||||
void bw_example_fx_wah_process(bw_example_fx_wah instance, const float** x, float** y, int n_samples) {
|
||||
void bw_example_fx_wah_process(bw_example_fx_wah *instance, const float** x, float** y, int n_samples) {
|
||||
bw_wah_process(&instance->wah_coeffs, &instance->wah_state, x[0], y[0], n_samples);
|
||||
}
|
||||
|
||||
void bw_example_fx_wah_set_parameter(bw_example_fx_wah instance, int index, float value) {
|
||||
void bw_example_fx_wah_set_parameter(bw_example_fx_wah *instance, int index, float value) {
|
||||
instance->params[index] = value;
|
||||
bw_wah_set_wah(&instance->wah_coeffs, value);
|
||||
}
|
||||
|
||||
float bw_example_fx_wah_get_parameter(bw_example_fx_wah instance, int index) {
|
||||
float bw_example_fx_wah_get_parameter(bw_example_fx_wah *instance, int index) {
|
||||
return instance->params[index];
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -25,15 +25,29 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _bw_example_fx_wah* bw_example_fx_wah;
|
||||
#include <bw_wah.h>
|
||||
|
||||
bw_example_fx_wah bw_example_fx_wah_new();
|
||||
void bw_example_fx_wah_free(bw_example_fx_wah instance);
|
||||
void bw_example_fx_wah_set_sample_rate(bw_example_fx_wah instance, float sample_rate);
|
||||
void bw_example_fx_wah_reset(bw_example_fx_wah instance);
|
||||
void bw_example_fx_wah_process(bw_example_fx_wah instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_fx_wah_set_parameter(bw_example_fx_wah instance, int index, float value);
|
||||
float bw_example_fx_wah_get_parameter(bw_example_fx_wah instance, int index);
|
||||
enum {
|
||||
p_wah,
|
||||
p_n
|
||||
};
|
||||
|
||||
struct _bw_example_fx_wah {
|
||||
// Sub-components
|
||||
bw_wah_coeffs wah_coeffs;
|
||||
bw_wah_state wah_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
};
|
||||
typedef struct _bw_example_fx_wah bw_example_fx_wah;
|
||||
|
||||
void bw_example_fx_wah_init(bw_example_fx_wah *instance);
|
||||
void bw_example_fx_wah_set_sample_rate(bw_example_fx_wah *instance, float sample_rate);
|
||||
void bw_example_fx_wah_reset(bw_example_fx_wah *instance);
|
||||
void bw_example_fx_wah_process(bw_example_fx_wah *instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_fx_wah_set_parameter(bw_example_fx_wah *instance, int index, float value);
|
||||
float bw_example_fx_wah_get_parameter(bw_example_fx_wah *instance, int index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -51,7 +51,7 @@ struct config_parameter {
|
||||
#define COMPANY_MAILTO "mailto:info@orastron.com"
|
||||
|
||||
#define PLUGIN_NAME "bw_example_fx_wah"
|
||||
#define PLUGIN_VERSION "0.2.0"
|
||||
#define PLUGIN_VERSION "0.3.0"
|
||||
|
||||
#define NUM_BUSES_IN 1
|
||||
#define NUM_BUSES_OUT 1
|
||||
@ -77,8 +77,7 @@ static struct config_parameter config_parameters[NUM_PARAMETERS] = {
|
||||
#include "bw_example_fx_wah.h"
|
||||
|
||||
#define P_TYPE bw_example_fx_wah
|
||||
#define P_NEW bw_example_fx_wah_new
|
||||
#define P_FREE bw_example_fx_wah_free
|
||||
#define P_INIT bw_example_fx_wah_init
|
||||
#define P_SET_SAMPLE_RATE bw_example_fx_wah_set_sample_rate
|
||||
#define P_RESET bw_example_fx_wah_reset
|
||||
#define P_PROCESS bw_example_fx_wah_process
|
||||
|
@ -20,126 +20,7 @@
|
||||
|
||||
#include "bw_example_synth_mono.h"
|
||||
|
||||
#ifdef __WASM__
|
||||
# include "walloc.h"
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <bw_math.h>
|
||||
#include <bw_phase_gen.h>
|
||||
#include <bw_osc_saw.h>
|
||||
#include <bw_osc_pulse.h>
|
||||
#include <bw_osc_tri.h>
|
||||
#include <bw_osc_sin.h>
|
||||
#include <bw_osc_filt.h>
|
||||
#include <bw_noise_gen.h>
|
||||
#include <bw_pink_filt.h>
|
||||
#include <bw_svf.h>
|
||||
#include <bw_env_gen.h>
|
||||
#include <bw_gain.h>
|
||||
#include <bw_env_follow.h>
|
||||
#include <bw_buf.h>
|
||||
|
||||
enum {
|
||||
p_volume,
|
||||
p_master_tune,
|
||||
p_portamento,
|
||||
p_mod_mix,
|
||||
p_vco1_mod,
|
||||
p_vco1_coarse,
|
||||
p_vco1_fine,
|
||||
p_vco1_waveform,
|
||||
p_vco1_pw_slope,
|
||||
p_vco1_level,
|
||||
p_vco2_mod,
|
||||
p_vco2_coarse,
|
||||
p_vco2_fine,
|
||||
p_vco2_waveform,
|
||||
p_vco2_pw_slope,
|
||||
p_vco2_level,
|
||||
p_vco3_kbd,
|
||||
p_vco3_coarse,
|
||||
p_vco3_fine,
|
||||
p_vco3_waveform,
|
||||
p_vco3_pw_slope,
|
||||
p_vco3_level,
|
||||
p_noise_color,
|
||||
p_noise_level,
|
||||
p_vcf_mod,
|
||||
p_vcf_kbd_ctrl,
|
||||
p_vcf_cutoff,
|
||||
p_vcf_Q,
|
||||
p_vcf_contour,
|
||||
p_vcf_attack,
|
||||
p_vcf_decay,
|
||||
p_vcf_sustain,
|
||||
p_vcf_release,
|
||||
p_vca_attack,
|
||||
p_vca_decay,
|
||||
p_vca_sustain,
|
||||
p_vca_release,
|
||||
p_a440,
|
||||
p_n
|
||||
};
|
||||
|
||||
#define BUFFER_SIZE 32
|
||||
|
||||
struct _bw_example_synth_mono {
|
||||
// Sub-components
|
||||
bw_osc_saw_coeffs vco_saw_coeffs;
|
||||
bw_phase_gen_coeffs vco1_phase_gen_coeffs;
|
||||
bw_phase_gen_state vco1_phase_gen_state;
|
||||
bw_osc_pulse_coeffs vco1_pulse_coeffs;
|
||||
bw_osc_tri_coeffs vco1_tri_coeffs;
|
||||
bw_gain_coeffs vco1_gain_coeffs;
|
||||
bw_phase_gen_coeffs vco2_phase_gen_coeffs;
|
||||
bw_phase_gen_state vco2_phase_gen_state;
|
||||
bw_osc_pulse_coeffs vco2_pulse_coeffs;
|
||||
bw_osc_tri_coeffs vco2_tri_coeffs;
|
||||
bw_gain_coeffs vco2_gain_coeffs;
|
||||
bw_phase_gen_coeffs vco3_phase_gen_coeffs;
|
||||
bw_phase_gen_state vco3_phase_gen_state;
|
||||
bw_osc_pulse_coeffs vco3_pulse_coeffs;
|
||||
bw_osc_tri_coeffs vco3_tri_coeffs;
|
||||
bw_gain_coeffs vco3_gain_coeffs;
|
||||
bw_osc_filt_state osc_filt_state;
|
||||
bw_noise_gen_coeffs noise_gen_coeffs;
|
||||
bw_pink_filt_coeffs pink_filt_coeffs;
|
||||
bw_pink_filt_state pink_filt_state;
|
||||
bw_gain_coeffs noise_gain_coeffs;
|
||||
bw_env_gen_coeffs vcf_env_gen_coeffs;
|
||||
bw_env_gen_state vcf_env_gen_state;
|
||||
bw_svf_coeffs vcf_coeffs;
|
||||
bw_svf_state vcf_state;
|
||||
bw_env_gen_coeffs vca_env_gen_coeffs;
|
||||
bw_env_gen_state vca_env_gen_state;
|
||||
bw_phase_gen_coeffs a440_phase_gen_coeffs;
|
||||
bw_phase_gen_state a440_phase_gen_state;
|
||||
bw_gain_coeffs gain_coeffs;
|
||||
bw_env_follow_coeffs env_follow_coeffs;
|
||||
bw_env_follow_state env_follow_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
|
||||
// States
|
||||
uint64_t rand_state;
|
||||
int note;
|
||||
char gate;
|
||||
float pitch_bend;
|
||||
float mod_wheel;
|
||||
char notes_pressed[128];
|
||||
|
||||
// Buffers
|
||||
float buf[4][BUFFER_SIZE];
|
||||
};
|
||||
|
||||
bw_example_synth_mono bw_example_synth_mono_new() {
|
||||
bw_example_synth_mono instance = (bw_example_synth_mono)malloc(sizeof(struct _bw_example_synth_mono));
|
||||
if (instance == NULL)
|
||||
return NULL;
|
||||
|
||||
void bw_example_synth_mono_init(bw_example_synth_mono *instance) {
|
||||
bw_osc_saw_init(&instance->vco_saw_coeffs);
|
||||
bw_phase_gen_init(&instance->vco1_phase_gen_coeffs);
|
||||
bw_osc_pulse_init(&instance->vco1_pulse_coeffs);
|
||||
@ -177,15 +58,9 @@ bw_example_synth_mono bw_example_synth_mono_new() {
|
||||
bw_env_follow_set_release_tau(&instance->env_follow_coeffs, 1.f);
|
||||
|
||||
instance->rand_state = 0xbaddecaf600dfeed;
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
void bw_example_synth_mono_free(bw_example_synth_mono instance) {
|
||||
free(instance);
|
||||
}
|
||||
|
||||
void bw_example_synth_mono_set_sample_rate(bw_example_synth_mono instance, float sample_rate) {
|
||||
void bw_example_synth_mono_set_sample_rate(bw_example_synth_mono *instance, float sample_rate) {
|
||||
bw_phase_gen_set_sample_rate(&instance->vco1_phase_gen_coeffs, sample_rate);
|
||||
bw_osc_pulse_set_sample_rate(&instance->vco1_pulse_coeffs, sample_rate);
|
||||
bw_osc_tri_set_sample_rate(&instance->vco1_tri_coeffs, sample_rate);
|
||||
@ -209,7 +84,7 @@ void bw_example_synth_mono_set_sample_rate(bw_example_synth_mono instance, float
|
||||
bw_env_follow_set_sample_rate(&instance->env_follow_coeffs, sample_rate);
|
||||
}
|
||||
|
||||
void bw_example_synth_mono_reset(bw_example_synth_mono instance) {
|
||||
void bw_example_synth_mono_reset(bw_example_synth_mono *instance) {
|
||||
const float v = instance->params[p_vcf_cutoff];
|
||||
const float cutoff = 20.f + (20e3f - 20.f) * v * v * v;
|
||||
bw_svf_set_cutoff(&instance->vcf_coeffs, bw_clipf(cutoff, 20.f, 20e3f));
|
||||
@ -251,7 +126,7 @@ void bw_example_synth_mono_reset(bw_example_synth_mono instance) {
|
||||
instance->notes_pressed[i] = 0;
|
||||
}
|
||||
|
||||
void bw_example_synth_mono_process(bw_example_synth_mono instance, const float** x, float** y, int n_samples) {
|
||||
void bw_example_synth_mono_process(bw_example_synth_mono *instance, const float** x, float** y, int n_samples) {
|
||||
// FIXME: control-rate modulations are asynchronous here...
|
||||
// it's all good as long as hosts gives us buffers whose length is a multiple of 32,
|
||||
// otherwise it's probably still ok but a bit "swingy"
|
||||
@ -370,7 +245,7 @@ void bw_example_synth_mono_process(bw_example_synth_mono instance, const float**
|
||||
}
|
||||
}
|
||||
|
||||
void bw_example_synth_mono_set_parameter(bw_example_synth_mono instance, int index, float value) {
|
||||
void bw_example_synth_mono_set_parameter(bw_example_synth_mono *instance, int index, float value) {
|
||||
if (instance->params[index] == value)
|
||||
return;
|
||||
instance->params[index] = value;
|
||||
@ -437,11 +312,11 @@ void bw_example_synth_mono_set_parameter(bw_example_synth_mono instance, int ind
|
||||
}
|
||||
}
|
||||
|
||||
float bw_example_synth_mono_get_parameter(bw_example_synth_mono instance, int index) {
|
||||
float bw_example_synth_mono_get_parameter(bw_example_synth_mono *instance, int index) {
|
||||
return index < p_n ? instance->params[index] : bw_clipf(bw_env_follow_get_y_z1(&instance->env_follow_state), 0.f, 1.f);
|
||||
}
|
||||
|
||||
static void update_note_gate(bw_example_synth_mono instance) {
|
||||
static void update_note_gate(bw_example_synth_mono *instance) {
|
||||
for (int i = 0; i < 128; i++)
|
||||
if (instance->notes_pressed[i]) {
|
||||
instance->note = i;
|
||||
@ -451,7 +326,7 @@ static void update_note_gate(bw_example_synth_mono instance) {
|
||||
instance->gate = 0;
|
||||
}
|
||||
|
||||
void bw_example_synth_mono_note_on(bw_example_synth_mono instance, char note, char velocity) {
|
||||
void bw_example_synth_mono_note_on(bw_example_synth_mono *instance, char note, char velocity) {
|
||||
if (velocity == 0)
|
||||
bw_example_synth_mono_note_off(instance, note);
|
||||
else {
|
||||
@ -460,17 +335,17 @@ void bw_example_synth_mono_note_on(bw_example_synth_mono instance, char note, ch
|
||||
}
|
||||
}
|
||||
|
||||
void bw_example_synth_mono_note_off(bw_example_synth_mono instance, char note) {
|
||||
void bw_example_synth_mono_note_off(bw_example_synth_mono *instance, char note) {
|
||||
if (instance->notes_pressed[note]) {
|
||||
instance->notes_pressed[note] = 0;
|
||||
update_note_gate(instance);
|
||||
}
|
||||
}
|
||||
|
||||
void bw_example_synth_mono_pitch_bend(bw_example_synth_mono instance, int value) {
|
||||
void bw_example_synth_mono_pitch_bend(bw_example_synth_mono *instance, int value) {
|
||||
instance->pitch_bend = (value - 0x2000) / (float)0x4000;
|
||||
}
|
||||
|
||||
void bw_example_synth_mono_mod_wheel(bw_example_synth_mono instance, char value) {
|
||||
void bw_example_synth_mono_mod_wheel(bw_example_synth_mono *instance, char value) {
|
||||
instance->mod_wheel = (float)value / 0x80;
|
||||
}
|
||||
|
@ -25,19 +25,126 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _bw_example_synth_mono* bw_example_synth_mono;
|
||||
#include <bw_math.h>
|
||||
#include <bw_phase_gen.h>
|
||||
#include <bw_osc_saw.h>
|
||||
#include <bw_osc_pulse.h>
|
||||
#include <bw_osc_tri.h>
|
||||
#include <bw_osc_sin.h>
|
||||
#include <bw_osc_filt.h>
|
||||
#include <bw_noise_gen.h>
|
||||
#include <bw_pink_filt.h>
|
||||
#include <bw_svf.h>
|
||||
#include <bw_env_gen.h>
|
||||
#include <bw_gain.h>
|
||||
#include <bw_env_follow.h>
|
||||
#include <bw_buf.h>
|
||||
|
||||
bw_example_synth_mono bw_example_synth_mono_new();
|
||||
void bw_example_synth_mono_free(bw_example_synth_mono instance);
|
||||
void bw_example_synth_mono_set_sample_rate(bw_example_synth_mono instance, float sample_rate);
|
||||
void bw_example_synth_mono_reset(bw_example_synth_mono instance);
|
||||
void bw_example_synth_mono_process(bw_example_synth_mono instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_synth_mono_set_parameter(bw_example_synth_mono instance, int index, float value);
|
||||
float bw_example_synth_mono_get_parameter(bw_example_synth_mono instance, int index);
|
||||
void bw_example_synth_mono_note_on(bw_example_synth_mono instance, char note, char velocity);
|
||||
void bw_example_synth_mono_note_off(bw_example_synth_mono instance, char note);
|
||||
void bw_example_synth_mono_pitch_bend(bw_example_synth_mono instance, int value);
|
||||
void bw_example_synth_mono_mod_wheel(bw_example_synth_mono instance, char value);
|
||||
enum {
|
||||
p_volume,
|
||||
p_master_tune,
|
||||
p_portamento,
|
||||
p_mod_mix,
|
||||
p_vco1_mod,
|
||||
p_vco1_coarse,
|
||||
p_vco1_fine,
|
||||
p_vco1_waveform,
|
||||
p_vco1_pw_slope,
|
||||
p_vco1_level,
|
||||
p_vco2_mod,
|
||||
p_vco2_coarse,
|
||||
p_vco2_fine,
|
||||
p_vco2_waveform,
|
||||
p_vco2_pw_slope,
|
||||
p_vco2_level,
|
||||
p_vco3_kbd,
|
||||
p_vco3_coarse,
|
||||
p_vco3_fine,
|
||||
p_vco3_waveform,
|
||||
p_vco3_pw_slope,
|
||||
p_vco3_level,
|
||||
p_noise_color,
|
||||
p_noise_level,
|
||||
p_vcf_mod,
|
||||
p_vcf_kbd_ctrl,
|
||||
p_vcf_cutoff,
|
||||
p_vcf_Q,
|
||||
p_vcf_contour,
|
||||
p_vcf_attack,
|
||||
p_vcf_decay,
|
||||
p_vcf_sustain,
|
||||
p_vcf_release,
|
||||
p_vca_attack,
|
||||
p_vca_decay,
|
||||
p_vca_sustain,
|
||||
p_vca_release,
|
||||
p_a440,
|
||||
p_n
|
||||
};
|
||||
|
||||
#define BUFFER_SIZE 32
|
||||
|
||||
struct _bw_example_synth_mono {
|
||||
// Sub-components
|
||||
bw_osc_saw_coeffs vco_saw_coeffs;
|
||||
bw_phase_gen_coeffs vco1_phase_gen_coeffs;
|
||||
bw_phase_gen_state vco1_phase_gen_state;
|
||||
bw_osc_pulse_coeffs vco1_pulse_coeffs;
|
||||
bw_osc_tri_coeffs vco1_tri_coeffs;
|
||||
bw_gain_coeffs vco1_gain_coeffs;
|
||||
bw_phase_gen_coeffs vco2_phase_gen_coeffs;
|
||||
bw_phase_gen_state vco2_phase_gen_state;
|
||||
bw_osc_pulse_coeffs vco2_pulse_coeffs;
|
||||
bw_osc_tri_coeffs vco2_tri_coeffs;
|
||||
bw_gain_coeffs vco2_gain_coeffs;
|
||||
bw_phase_gen_coeffs vco3_phase_gen_coeffs;
|
||||
bw_phase_gen_state vco3_phase_gen_state;
|
||||
bw_osc_pulse_coeffs vco3_pulse_coeffs;
|
||||
bw_osc_tri_coeffs vco3_tri_coeffs;
|
||||
bw_gain_coeffs vco3_gain_coeffs;
|
||||
bw_osc_filt_state osc_filt_state;
|
||||
bw_noise_gen_coeffs noise_gen_coeffs;
|
||||
bw_pink_filt_coeffs pink_filt_coeffs;
|
||||
bw_pink_filt_state pink_filt_state;
|
||||
bw_gain_coeffs noise_gain_coeffs;
|
||||
bw_env_gen_coeffs vcf_env_gen_coeffs;
|
||||
bw_env_gen_state vcf_env_gen_state;
|
||||
bw_svf_coeffs vcf_coeffs;
|
||||
bw_svf_state vcf_state;
|
||||
bw_env_gen_coeffs vca_env_gen_coeffs;
|
||||
bw_env_gen_state vca_env_gen_state;
|
||||
bw_phase_gen_coeffs a440_phase_gen_coeffs;
|
||||
bw_phase_gen_state a440_phase_gen_state;
|
||||
bw_gain_coeffs gain_coeffs;
|
||||
bw_env_follow_coeffs env_follow_coeffs;
|
||||
bw_env_follow_state env_follow_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
|
||||
// States
|
||||
uint64_t rand_state;
|
||||
int note;
|
||||
char gate;
|
||||
float pitch_bend;
|
||||
float mod_wheel;
|
||||
char notes_pressed[128];
|
||||
|
||||
// Buffers
|
||||
float buf[4][BUFFER_SIZE];
|
||||
};
|
||||
typedef struct _bw_example_synth_mono bw_example_synth_mono;
|
||||
|
||||
void bw_example_synth_mono_init(bw_example_synth_mono *instance);
|
||||
void bw_example_synth_mono_set_sample_rate(bw_example_synth_mono *instance, float sample_rate);
|
||||
void bw_example_synth_mono_reset(bw_example_synth_mono *instance);
|
||||
void bw_example_synth_mono_process(bw_example_synth_mono *instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_synth_mono_set_parameter(bw_example_synth_mono *instance, int index, float value);
|
||||
float bw_example_synth_mono_get_parameter(bw_example_synth_mono *instance, int index);
|
||||
void bw_example_synth_mono_note_on(bw_example_synth_mono *instance, char note, char velocity);
|
||||
void bw_example_synth_mono_note_off(bw_example_synth_mono *instance, char note);
|
||||
void bw_example_synth_mono_pitch_bend(bw_example_synth_mono *instance, int value);
|
||||
void bw_example_synth_mono_mod_wheel(bw_example_synth_mono *instance, char value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -51,7 +51,7 @@ struct config_parameter {
|
||||
#define COMPANY_MAILTO "mailto:info@orastron.com"
|
||||
|
||||
#define PLUGIN_NAME "bw_example_synth_mono"
|
||||
#define PLUGIN_VERSION "0.2.0"
|
||||
#define PLUGIN_VERSION "0.3.0"
|
||||
|
||||
#define NUM_BUSES_IN 0
|
||||
#define NUM_BUSES_OUT 1
|
||||
@ -111,8 +111,7 @@ static struct config_parameter config_parameters[NUM_PARAMETERS] = {
|
||||
#include "bw_example_synth_mono.h"
|
||||
|
||||
#define P_TYPE bw_example_synth_mono
|
||||
#define P_NEW bw_example_synth_mono_new
|
||||
#define P_FREE bw_example_synth_mono_free
|
||||
#define P_INIT bw_example_synth_mono_init
|
||||
#define P_SET_SAMPLE_RATE bw_example_synth_mono_set_sample_rate
|
||||
#define P_RESET bw_example_synth_mono_reset
|
||||
#define P_PROCESS bw_example_synth_mono_process
|
||||
|
@ -20,68 +20,7 @@
|
||||
|
||||
#include "bw_example_synth_simple.h"
|
||||
|
||||
#ifdef __WASM__
|
||||
# include "walloc.h"
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <bw_math.h>
|
||||
#include <bw_phase_gen.h>
|
||||
#include <bw_osc_pulse.h>
|
||||
#include <bw_osc_filt.h>
|
||||
#include <bw_svf.h>
|
||||
#include <bw_env_gen.h>
|
||||
#include <bw_gain.h>
|
||||
#include <bw_ppm.h>
|
||||
#include <bw_buf.h>
|
||||
|
||||
enum {
|
||||
p_volume,
|
||||
p_master_tune,
|
||||
p_portamento,
|
||||
p_pulse_width,
|
||||
p_cutoff,
|
||||
p_Q,
|
||||
p_attack,
|
||||
p_decay,
|
||||
p_sustain,
|
||||
p_release,
|
||||
p_n
|
||||
};
|
||||
|
||||
#define BUFFER_SIZE 128
|
||||
|
||||
struct _bw_example_synth_simple {
|
||||
// Sub-components
|
||||
bw_phase_gen_coeffs phase_gen_coeffs;
|
||||
bw_phase_gen_state phase_gen_state;
|
||||
bw_osc_pulse_coeffs osc_pulse_coeffs;
|
||||
bw_osc_filt_state osc_filt_state;
|
||||
bw_svf_coeffs svf_coeffs;
|
||||
bw_svf_state svf_state;
|
||||
bw_env_gen_coeffs env_gen_coeffs;
|
||||
bw_env_gen_state env_gen_state;
|
||||
bw_gain_coeffs gain_coeffs;
|
||||
bw_ppm_coeffs ppm_coeffs;
|
||||
bw_ppm_state ppm_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
|
||||
// States
|
||||
uint64_t rand_state;
|
||||
int note;
|
||||
|
||||
// Buffers
|
||||
float buf[BUFFER_SIZE];
|
||||
};
|
||||
|
||||
bw_example_synth_simple bw_example_synth_simple_new() {
|
||||
bw_example_synth_simple instance = (bw_example_synth_simple)malloc(sizeof(struct _bw_example_synth_simple));
|
||||
if (instance == NULL)
|
||||
return NULL;
|
||||
|
||||
void bw_example_synth_simple_init(bw_example_synth_simple *instance) {
|
||||
bw_phase_gen_init(&instance->phase_gen_coeffs);
|
||||
bw_osc_pulse_init(&instance->osc_pulse_coeffs);
|
||||
bw_svf_init(&instance->svf_coeffs);
|
||||
@ -92,15 +31,9 @@ bw_example_synth_simple bw_example_synth_simple_new() {
|
||||
bw_osc_pulse_set_antialiasing(&instance->osc_pulse_coeffs, 1);
|
||||
|
||||
instance->rand_state = 0xbaddecaf600dfeed;
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
void bw_example_synth_simple_free(bw_example_synth_simple instance) {
|
||||
free(instance);
|
||||
}
|
||||
|
||||
void bw_example_synth_simple_set_sample_rate(bw_example_synth_simple instance, float sample_rate) {
|
||||
void bw_example_synth_simple_set_sample_rate(bw_example_synth_simple *instance, float sample_rate) {
|
||||
bw_phase_gen_set_sample_rate(&instance->phase_gen_coeffs, sample_rate);
|
||||
bw_osc_pulse_set_sample_rate(&instance->osc_pulse_coeffs, sample_rate);
|
||||
bw_svf_set_sample_rate(&instance->svf_coeffs, sample_rate);
|
||||
@ -109,7 +42,7 @@ void bw_example_synth_simple_set_sample_rate(bw_example_synth_simple instance, f
|
||||
bw_ppm_set_sample_rate(&instance->ppm_coeffs, sample_rate);
|
||||
}
|
||||
|
||||
void bw_example_synth_simple_reset(bw_example_synth_simple instance) {
|
||||
void bw_example_synth_simple_reset(bw_example_synth_simple *instance) {
|
||||
bw_phase_gen_reset_coeffs(&instance->phase_gen_coeffs);
|
||||
bw_phase_gen_reset_state(&instance->phase_gen_coeffs, &instance->phase_gen_state, 0.f);
|
||||
bw_osc_pulse_reset_coeffs(&instance->osc_pulse_coeffs);
|
||||
@ -124,7 +57,7 @@ void bw_example_synth_simple_reset(bw_example_synth_simple instance) {
|
||||
instance->note = -1;
|
||||
}
|
||||
|
||||
void bw_example_synth_simple_process(bw_example_synth_simple instance, const float** x, float** y, int n_samples) {
|
||||
void bw_example_synth_simple_process(bw_example_synth_simple *instance, const float** x, float** y, int n_samples) {
|
||||
char gate = instance->note >= 0 ? 1 : 0;
|
||||
bw_env_gen_set_gate(&instance->env_gen_coeffs, gate);
|
||||
if (instance->note >= 0)
|
||||
@ -146,7 +79,7 @@ void bw_example_synth_simple_process(bw_example_synth_simple instance, const flo
|
||||
}
|
||||
}
|
||||
|
||||
void bw_example_synth_simple_set_parameter(bw_example_synth_simple instance, int index, float value) {
|
||||
void bw_example_synth_simple_set_parameter(bw_example_synth_simple *instance, int index, float value) {
|
||||
if (instance->params[index] == value)
|
||||
return;
|
||||
instance->params[index] = value;
|
||||
@ -181,21 +114,21 @@ void bw_example_synth_simple_set_parameter(bw_example_synth_simple instance, int
|
||||
}
|
||||
}
|
||||
|
||||
float bw_example_synth_simple_get_parameter(bw_example_synth_simple instance, int index) {
|
||||
float bw_example_synth_simple_get_parameter(bw_example_synth_simple *instance, int index) {
|
||||
if (index < p_n)
|
||||
return instance->params[index];
|
||||
const float v = bw_ppm_get_y_z1(&instance->ppm_state);
|
||||
return v < -200.f ? 0.f : bw_clipf(0.01666666666666666f * v + 1.f, 0.f, 1.f);
|
||||
}
|
||||
|
||||
void bw_example_synth_simple_note_on(bw_example_synth_simple instance, char note, char velocity) {
|
||||
void bw_example_synth_simple_note_on(bw_example_synth_simple *instance, char note, char velocity) {
|
||||
if (velocity == 0)
|
||||
bw_example_synth_simple_note_off(instance, note);
|
||||
else
|
||||
instance->note = note;
|
||||
}
|
||||
|
||||
void bw_example_synth_simple_note_off(bw_example_synth_simple instance, char note) {
|
||||
void bw_example_synth_simple_note_off(bw_example_synth_simple *instance, char note) {
|
||||
if (note == instance->note)
|
||||
instance->note = -1;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -25,17 +25,66 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _bw_example_synth_simple* bw_example_synth_simple;
|
||||
#include <bw_math.h>
|
||||
#include <bw_phase_gen.h>
|
||||
#include <bw_osc_pulse.h>
|
||||
#include <bw_osc_filt.h>
|
||||
#include <bw_svf.h>
|
||||
#include <bw_env_gen.h>
|
||||
#include <bw_gain.h>
|
||||
#include <bw_ppm.h>
|
||||
#include <bw_buf.h>
|
||||
|
||||
bw_example_synth_simple bw_example_synth_simple_new();
|
||||
void bw_example_synth_simple_free(bw_example_synth_simple instance);
|
||||
void bw_example_synth_simple_set_sample_rate(bw_example_synth_simple instance, float sample_rate);
|
||||
void bw_example_synth_simple_reset(bw_example_synth_simple instance);
|
||||
void bw_example_synth_simple_process(bw_example_synth_simple instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_synth_simple_set_parameter(bw_example_synth_simple instance, int index, float value);
|
||||
float bw_example_synth_simple_get_parameter(bw_example_synth_simple instance, int index);
|
||||
void bw_example_synth_simple_note_on(bw_example_synth_simple instance, char note, char velocity);
|
||||
void bw_example_synth_simple_note_off(bw_example_synth_simple instance, char note);
|
||||
enum {
|
||||
p_volume,
|
||||
p_master_tune,
|
||||
p_portamento,
|
||||
p_pulse_width,
|
||||
p_cutoff,
|
||||
p_Q,
|
||||
p_attack,
|
||||
p_decay,
|
||||
p_sustain,
|
||||
p_release,
|
||||
p_n
|
||||
};
|
||||
|
||||
#define BUFFER_SIZE 128
|
||||
|
||||
struct _bw_example_synth_simple {
|
||||
// Sub-components
|
||||
bw_phase_gen_coeffs phase_gen_coeffs;
|
||||
bw_phase_gen_state phase_gen_state;
|
||||
bw_osc_pulse_coeffs osc_pulse_coeffs;
|
||||
bw_osc_filt_state osc_filt_state;
|
||||
bw_svf_coeffs svf_coeffs;
|
||||
bw_svf_state svf_state;
|
||||
bw_env_gen_coeffs env_gen_coeffs;
|
||||
bw_env_gen_state env_gen_state;
|
||||
bw_gain_coeffs gain_coeffs;
|
||||
bw_ppm_coeffs ppm_coeffs;
|
||||
bw_ppm_state ppm_state;
|
||||
|
||||
// Parameters
|
||||
float params[p_n];
|
||||
|
||||
// States
|
||||
uint64_t rand_state;
|
||||
int note;
|
||||
|
||||
// Buffers
|
||||
float buf[BUFFER_SIZE];
|
||||
};
|
||||
typedef struct _bw_example_synth_simple bw_example_synth_simple;
|
||||
|
||||
void bw_example_synth_simple_init(bw_example_synth_simple *instance);
|
||||
void bw_example_synth_simple_set_sample_rate(bw_example_synth_simple *instance, float sample_rate);
|
||||
void bw_example_synth_simple_reset(bw_example_synth_simple *instance);
|
||||
void bw_example_synth_simple_process(bw_example_synth_simple *instance, const float** x, float** y, int n_samples);
|
||||
void bw_example_synth_simple_set_parameter(bw_example_synth_simple *instance, int index, float value);
|
||||
float bw_example_synth_simple_get_parameter(bw_example_synth_simple *instance, int index);
|
||||
void bw_example_synth_simple_note_on(bw_example_synth_simple *instance, char note, char velocity);
|
||||
void bw_example_synth_simple_note_off(bw_example_synth_simple *instance, char note);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -51,7 +51,7 @@ struct config_parameter {
|
||||
#define COMPANY_MAILTO "mailto:info@orastron.com"
|
||||
|
||||
#define PLUGIN_NAME "bw_example_synth_simple"
|
||||
#define PLUGIN_VERSION "0.2.0"
|
||||
#define PLUGIN_VERSION "0.3.0"
|
||||
|
||||
#define NUM_BUSES_IN 0
|
||||
#define NUM_BUSES_OUT 1
|
||||
@ -83,8 +83,7 @@ static struct config_parameter config_parameters[NUM_PARAMETERS] = {
|
||||
#include "bw_example_synth_simple.h"
|
||||
|
||||
#define P_TYPE bw_example_synth_simple
|
||||
#define P_NEW bw_example_synth_simple_new
|
||||
#define P_FREE bw_example_synth_simple_free
|
||||
#define P_INIT bw_example_synth_simple_init
|
||||
#define P_SET_SAMPLE_RATE bw_example_synth_simple_set_sample_rate
|
||||
#define P_RESET bw_example_synth_simple_reset
|
||||
#define P_PROCESS bw_example_synth_simple_process
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 Orastron Srl unipersonale
|
||||
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
|
||||
*
|
||||
* Brickworks is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -20,7 +20,7 @@
|
||||
|
||||
/*!
|
||||
* module_type {{{ dsp }}}
|
||||
* version {{{ 0.2.0 }}}
|
||||
* version {{{ 0.3.0 }}}
|
||||
* requires {{{ bw_config bw_common bw_one_pole bw_math bw_svf }}}
|
||||
* description {{{
|
||||
* Wah effect.
|
||||
@ -29,6 +29,11 @@
|
||||
* }}}
|
||||
* changelog {{{
|
||||
* <ul>
|
||||
* <li>Version <strong>0.3.0</strong>:
|
||||
* <ul>
|
||||
* <li>Use bandpass SVF output rather than lowpass.</li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* <li>Version <strong>0.2.0</strong>:
|
||||
* <ul>
|
||||
* <li>First release.</li>
|
||||
@ -167,7 +172,7 @@ static inline void bw_wah_update_coeffs_audio(bw_wah_coeffs *BW_RESTRICT coeffs)
|
||||
static inline float bw_wah_process1(const bw_wah_coeffs *BW_RESTRICT coeffs, bw_wah_state *BW_RESTRICT state, float x) {
|
||||
float v_lp, v_hp, v_bp;
|
||||
bw_svf_process1(&coeffs->svf_coeffs, &state->svf_state, x, &v_lp, &v_bp, &v_hp);
|
||||
return v_lp;
|
||||
return v_bp;
|
||||
}
|
||||
|
||||
static inline void bw_wah_process(bw_wah_coeffs *BW_RESTRICT coeffs, bw_wah_state *BW_RESTRICT state, const float *x, float *y, int n_samples) {
|
||||
|
Loading…
Reference in New Issue
Block a user