fx(pp)_vibrato
This commit is contained in:
parent
da25dcde75
commit
2bb3d1c9f5
5
examples/fx_vibrato/src/android.json
Normal file
5
examples/fx_vibrato/src/android.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"android": {
|
||||||
|
"javaPackageName": "com.orastron.bw_example_fx_vibrato"
|
||||||
|
}
|
||||||
|
}
|
@ -1,69 +0,0 @@
|
|||||||
/*
|
|
||||||
* Brickworks
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, version 3 of the License.
|
|
||||||
*
|
|
||||||
* Brickworks is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Brickworks. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* File author: Stefano D'Angelo
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "bw_example_fx_vibrato.h"
|
|
||||||
|
|
||||||
void bw_example_fx_vibrato_init(bw_example_fx_vibrato *instance) {
|
|
||||||
bw_chorus_init(&instance->chorus_coeffs, 0.005f);
|
|
||||||
bw_chorus_set_coeff_x(&instance->chorus_coeffs, 0.f);
|
|
||||||
bw_chorus_set_coeff_mod(&instance->chorus_coeffs, 1.f);
|
|
||||||
bw_chorus_set_coeff_fb(&instance->chorus_coeffs, 0.f);
|
|
||||||
}
|
|
||||||
|
|
||||||
void bw_example_fx_vibrato_set_sample_rate(bw_example_fx_vibrato *instance, float sample_rate) {
|
|
||||||
bw_chorus_set_sample_rate(&instance->chorus_coeffs, sample_rate);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t bw_example_fx_vibrato_mem_req(bw_example_fx_vibrato *instance) {
|
|
||||||
return bw_chorus_mem_req(&instance->chorus_coeffs);
|
|
||||||
}
|
|
||||||
|
|
||||||
void bw_example_fx_vibrato_mem_set(bw_example_fx_vibrato *instance, void *mem) {
|
|
||||||
bw_chorus_mem_set(&instance->chorus_coeffs, &instance->chorus_state, mem);
|
|
||||||
}
|
|
||||||
|
|
||||||
void bw_example_fx_vibrato_reset(bw_example_fx_vibrato *instance) {
|
|
||||||
bw_chorus_reset_coeffs(&instance->chorus_coeffs);
|
|
||||||
bw_chorus_reset_state(&instance->chorus_coeffs, &instance->chorus_state, 0.f);
|
|
||||||
}
|
|
||||||
|
|
||||||
void bw_example_fx_vibrato_process(bw_example_fx_vibrato *instance, const float** x, float** y, int n_samples) {
|
|
||||||
bw_chorus_process(&instance->chorus_coeffs, &instance->chorus_state, x[0], y[0], n_samples);
|
|
||||||
}
|
|
||||||
|
|
||||||
void bw_example_fx_vibrato_set_parameter(bw_example_fx_vibrato *instance, int index, float value) {
|
|
||||||
instance->params[index] = value;
|
|
||||||
switch (index) {
|
|
||||||
case p_rate:
|
|
||||||
bw_chorus_set_rate(&instance->chorus_coeffs, 2.f + 8.f * value * value * value);
|
|
||||||
break;
|
|
||||||
case p_amount:
|
|
||||||
{
|
|
||||||
float v = 0.0025f * value;
|
|
||||||
bw_chorus_set_delay(&instance->chorus_coeffs, v);
|
|
||||||
bw_chorus_set_amount(&instance->chorus_coeffs, v);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float bw_example_fx_vibrato_get_parameter(bw_example_fx_vibrato *instance, int index) {
|
|
||||||
return instance->params[index];
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
/*
|
|
||||||
* Brickworks
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, version 3 of the License.
|
|
||||||
*
|
|
||||||
* Brickworks is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Brickworks. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* File author: Stefano D'Angelo
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _BW_EXAMPLE_FX_VIBRATO_H
|
|
||||||
#define _BW_EXAMPLE_FX_VIBRATO_H
|
|
||||||
|
|
||||||
#include "platform.h"
|
|
||||||
|
|
||||||
#include <bw_chorus.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum {
|
|
||||||
p_rate,
|
|
||||||
p_amount,
|
|
||||||
p_n
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _bw_example_fx_vibrato {
|
|
||||||
// Sub-components
|
|
||||||
bw_chorus_coeffs chorus_coeffs;
|
|
||||||
bw_chorus_state chorus_state;
|
|
||||||
|
|
||||||
// Parameters
|
|
||||||
float params[p_n];
|
|
||||||
};
|
|
||||||
typedef struct _bw_example_fx_vibrato bw_example_fx_vibrato;
|
|
||||||
|
|
||||||
void bw_example_fx_vibrato_init(bw_example_fx_vibrato *instance);
|
|
||||||
void bw_example_fx_vibrato_set_sample_rate(bw_example_fx_vibrato *instance, float sample_rate);
|
|
||||||
size_t bw_example_fx_vibrato_mem_req(bw_example_fx_vibrato *instance);
|
|
||||||
void bw_example_fx_vibrato_mem_set(bw_example_fx_vibrato *instance, void *mem);
|
|
||||||
void bw_example_fx_vibrato_reset(bw_example_fx_vibrato *instance);
|
|
||||||
void bw_example_fx_vibrato_process(bw_example_fx_vibrato *instance, const float** x, float** y, int n_samples);
|
|
||||||
void bw_example_fx_vibrato_set_parameter(bw_example_fx_vibrato *instance, int index, float value);
|
|
||||||
float bw_example_fx_vibrato_get_parameter(bw_example_fx_vibrato *instance, int index);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
6
examples/fx_vibrato/src/cmd.json
Normal file
6
examples/fx_vibrato/src/cmd.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"cmd": {
|
||||||
|
"busIds": [ "input", "output" ],
|
||||||
|
"parameterIds": [ "rate", "amount" ]
|
||||||
|
}
|
||||||
|
}
|
@ -1,90 +0,0 @@
|
|||||||
/*
|
|
||||||
* Brickworks
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, version 3 of the License.
|
|
||||||
*
|
|
||||||
* Brickworks is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Brickworks. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* File authors: Stefano D'Angelo
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _CONFIG_H
|
|
||||||
#define _CONFIG_H
|
|
||||||
|
|
||||||
// Definitions
|
|
||||||
|
|
||||||
#define IO_MONO 1
|
|
||||||
#define IO_STEREO (1<<1)
|
|
||||||
|
|
||||||
struct config_io_bus {
|
|
||||||
const char *name;
|
|
||||||
char out;
|
|
||||||
char aux;
|
|
||||||
char cv;
|
|
||||||
char configs;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct config_parameter {
|
|
||||||
const char *name;
|
|
||||||
const char *shortName;
|
|
||||||
const char *units;
|
|
||||||
char out;
|
|
||||||
char bypass;
|
|
||||||
int steps;
|
|
||||||
float defaultValueUnmapped;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Data
|
|
||||||
|
|
||||||
#define COMPANY_NAME "Orastron"
|
|
||||||
#define COMPANY_WEBSITE "https://www.orastron.com/"
|
|
||||||
#define COMPANY_MAILTO "mailto:info@orastron.com"
|
|
||||||
|
|
||||||
#define PLUGIN_NAME "bw_example_fx_vibrato"
|
|
||||||
#define PLUGIN_VERSION "1.0.0"
|
|
||||||
|
|
||||||
#define NUM_BUSES_IN 1
|
|
||||||
#define NUM_BUSES_OUT 1
|
|
||||||
#define NUM_CHANNELS_IN 1
|
|
||||||
#define NUM_CHANNELS_OUT 1
|
|
||||||
|
|
||||||
static struct config_io_bus config_buses_in[NUM_BUSES_IN] = {
|
|
||||||
{ "Audio in", 0, 0, 0, IO_MONO }
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct config_io_bus config_buses_out[NUM_BUSES_OUT] = {
|
|
||||||
{ "Audio out", 1, 0, 0, IO_MONO }
|
|
||||||
};
|
|
||||||
|
|
||||||
#define NUM_PARAMETERS 2
|
|
||||||
|
|
||||||
static struct config_parameter config_parameters[NUM_PARAMETERS] = {
|
|
||||||
{ "Rate", "Rate", "", 0, 0, 0, 0.5f },
|
|
||||||
{ "Depth", "Depth", "", 0, 0, 0, 0.5f },
|
|
||||||
};
|
|
||||||
|
|
||||||
// Internal API
|
|
||||||
|
|
||||||
#include "bw_example_fx_vibrato.h"
|
|
||||||
|
|
||||||
#define P_TYPE bw_example_fx_vibrato
|
|
||||||
#define P_INIT bw_example_fx_vibrato_init
|
|
||||||
#define P_SET_SAMPLE_RATE bw_example_fx_vibrato_set_sample_rate
|
|
||||||
#define P_MEM_REQ bw_example_fx_vibrato_mem_req
|
|
||||||
#define P_MEM_SET bw_example_fx_vibrato_mem_set
|
|
||||||
#define P_RESET bw_example_fx_vibrato_reset
|
|
||||||
#define P_PROCESS bw_example_fx_vibrato_process
|
|
||||||
#define P_SET_PARAMETER bw_example_fx_vibrato_set_parameter
|
|
||||||
#define P_GET_PARAMETER bw_example_fx_vibrato_get_parameter
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* Brickworks
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, version 3 of the License.
|
|
||||||
*
|
|
||||||
* Brickworks is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Brickworks. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* File author: Stefano D'Angelo
|
|
||||||
*/
|
|
||||||
|
|
||||||
var buses = [
|
|
||||||
{
|
|
||||||
stereo: false,
|
|
||||||
output: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
stereo: false,
|
|
||||||
output: true
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
var parameters = [
|
|
||||||
{
|
|
||||||
name: "Rate",
|
|
||||||
output: false,
|
|
||||||
defaultValue: 0.5
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Amount",
|
|
||||||
output: false,
|
|
||||||
defaultValue: 0.5
|
|
||||||
}
|
|
||||||
];
|
|
5
examples/fx_vibrato/src/daisy-seed.json
Normal file
5
examples/fx_vibrato/src/daisy-seed.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"daisy_seed": {
|
||||||
|
"parameterPins": [ 15, 16 ]
|
||||||
|
}
|
||||||
|
}
|
5
examples/fx_vibrato/src/ios.json
Normal file
5
examples/fx_vibrato/src/ios.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"ios": {
|
||||||
|
"productBundleIdentifier": "com.orastron.bw_example_fx_vibrato"
|
||||||
|
}
|
||||||
|
}
|
12
examples/fx_vibrato/src/lv2.json
Normal file
12
examples/fx_vibrato/src/lv2.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"lv2": {
|
||||||
|
"prefixes": {
|
||||||
|
"bw_examples": "https://www.orastron.com/brickworks/examples/"
|
||||||
|
},
|
||||||
|
"uri": "@bw_examples:fx_vibrato",
|
||||||
|
"types": [ "@lv2:ModulatorPlugin" ],
|
||||||
|
"version": "1.0",
|
||||||
|
"busSymbols": [ "input", "output" ],
|
||||||
|
"parameterSymbols": [ "rate", "amount" ]
|
||||||
|
}
|
||||||
|
}
|
65
examples/fx_vibrato/src/plugin.h
Normal file
65
examples/fx_vibrato/src/plugin.h
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#include "common.h"
|
||||||
|
#include <bw_chorus.h>
|
||||||
|
|
||||||
|
typedef struct plugin {
|
||||||
|
bw_chorus_coeffs chorus_coeffs;
|
||||||
|
bw_chorus_state chorus_state;
|
||||||
|
float rate_k;
|
||||||
|
float amount_k;
|
||||||
|
} plugin;
|
||||||
|
|
||||||
|
static void plugin_init(plugin*instance) {
|
||||||
|
bw_chorus_init(&instance->chorus_coeffs, 0.04f); // = 2 semitones * 2 @ 1hz, rounded up
|
||||||
|
bw_chorus_set_coeff_x(&instance->chorus_coeffs, 0.f);
|
||||||
|
bw_chorus_set_coeff_mod(&instance->chorus_coeffs, 1.f);
|
||||||
|
// for the first plugin_set_parameter()
|
||||||
|
instance->rate_k = 0.1591549430918953f;
|
||||||
|
instance->rate_k = 1.f / 6.283185307179586f;
|
||||||
|
instance->amount_k = 0.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void plugin_fini(plugin *instance) {
|
||||||
|
(void)instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void plugin_set_sample_rate(plugin *instance, float sample_rate) {
|
||||||
|
bw_chorus_set_sample_rate(&instance->chorus_coeffs, sample_rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
static size_t plugin_mem_req(plugin *instance) {
|
||||||
|
return bw_chorus_mem_req(&instance->chorus_coeffs);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void plugin_mem_set(plugin *instance, void *mem) {
|
||||||
|
bw_chorus_mem_set(&instance->chorus_coeffs, &instance->chorus_state, mem);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void plugin_reset(plugin *instance) {
|
||||||
|
bw_chorus_reset_coeffs(&instance->chorus_coeffs);
|
||||||
|
bw_chorus_reset_state(&instance->chorus_coeffs, &instance->chorus_state, 0.f);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void plugin_set_parameter(plugin *instance, size_t index, float value) {
|
||||||
|
switch (index) {
|
||||||
|
case 0:
|
||||||
|
bw_chorus_set_rate(&instance->chorus_coeffs, value);
|
||||||
|
instance->rate_k = (1.f / 6.283185307179586f) * bw_rcpf(value);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
instance->amount_k = bw_pow2f((1.f / 12.f) * value) - 1.f;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
float v = instance->rate_k * instance->amount_k;
|
||||||
|
bw_chorus_set_delay(&instance->chorus_coeffs, v);
|
||||||
|
bw_chorus_set_amount(&instance->chorus_coeffs, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
static float plugin_get_parameter(plugin *instance, size_t index) {
|
||||||
|
(void)instance;
|
||||||
|
(void)index;
|
||||||
|
return 0.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void plugin_process(plugin *instance, const float **inputs, float **outputs, size_t n_samples) {
|
||||||
|
bw_chorus_process(&instance->chorus_coeffs, &instance->chorus_state, inputs[0], outputs[0], n_samples);
|
||||||
|
}
|
46
examples/fx_vibrato/src/product.json
Normal file
46
examples/fx_vibrato/src/product.json
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"product": {
|
||||||
|
"name": "Brickworks vibrato example",
|
||||||
|
"version": "1.1.0",
|
||||||
|
"buildVersion": "1",
|
||||||
|
"bundleName": "bw_example_fx_vibrato",
|
||||||
|
"buses": [
|
||||||
|
{
|
||||||
|
"type": "audio",
|
||||||
|
"direction": "input",
|
||||||
|
"channels": "mono",
|
||||||
|
"name": "Input",
|
||||||
|
"shortName": "Input"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "audio",
|
||||||
|
"direction": "output",
|
||||||
|
"channels": "mono",
|
||||||
|
"name": "Output",
|
||||||
|
"shortName": "Output"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "Rate",
|
||||||
|
"shortName": "Rate",
|
||||||
|
"direction": "input",
|
||||||
|
"defaultValue": 3.0,
|
||||||
|
"minimum": 1.0,
|
||||||
|
"maximum": 10.0,
|
||||||
|
"unit": "hz",
|
||||||
|
"map": "logarithmic"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Amount",
|
||||||
|
"shortName": "Amount",
|
||||||
|
"direction": "input",
|
||||||
|
"defaultValue": 0.0,
|
||||||
|
"minimum": 0.0,
|
||||||
|
"maximum": 2.0,
|
||||||
|
"unit": "semitone12TET",
|
||||||
|
"map": "linear"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
11
examples/fx_vibrato/src/vst3.json
Normal file
11
examples/fx_vibrato/src/vst3.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"vst3": {
|
||||||
|
"plugin": {
|
||||||
|
"cid": "3356ce159a104154835fcf71baca0d28"
|
||||||
|
},
|
||||||
|
"controller": {
|
||||||
|
"cid": "fc98ee02f56b4e5aa448d84cab1f3c15"
|
||||||
|
},
|
||||||
|
"subCategory": "Fx|Modulation"
|
||||||
|
}
|
||||||
|
}
|
5
examples/fxpp_vibrato/src/android.json
Normal file
5
examples/fxpp_vibrato/src/android.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"android": {
|
||||||
|
"javaPackageName": "com.orastron.bw_example_fxpp_vibrato"
|
||||||
|
}
|
||||||
|
}
|
6
examples/fxpp_vibrato/src/cmd.json
Normal file
6
examples/fxpp_vibrato/src/cmd.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"cmd": {
|
||||||
|
"busIds": [ "input", "output" ],
|
||||||
|
"parameterIds": [ "rate", "amount" ]
|
||||||
|
}
|
||||||
|
}
|
5
examples/fxpp_vibrato/src/daisy-seed.json
Normal file
5
examples/fxpp_vibrato/src/daisy-seed.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"daisy_seed": {
|
||||||
|
"parameterPins": [ 15, 16 ]
|
||||||
|
}
|
||||||
|
}
|
71
examples/fxpp_vibrato/src/impl.cpp
Normal file
71
examples/fxpp_vibrato/src/impl.cpp
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
#include "impl.h"
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
#include <bw_chorus.h>
|
||||||
|
|
||||||
|
using namespace Brickworks;
|
||||||
|
|
||||||
|
class Engine {
|
||||||
|
public:
|
||||||
|
Engine() : chorus(0.04f) {} // = 2 semitones * 2 @ 1hz, rounded up
|
||||||
|
|
||||||
|
Chorus<1> chorus;
|
||||||
|
float rateK;
|
||||||
|
float amountK;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
|
impl impl_new(void) {
|
||||||
|
Engine *instance = new Engine();
|
||||||
|
instance->chorus.setCoeffX(0.f);
|
||||||
|
instance->chorus.setCoeffMod(1.f);
|
||||||
|
// for the first plugin_set_parameter()
|
||||||
|
instance->rateK = 1.f / 6.283185307179586f;
|
||||||
|
instance->amountK = 0.f;
|
||||||
|
return reinterpret_cast<impl>(instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
void impl_free(impl handle) {
|
||||||
|
Engine *instance = reinterpret_cast<Engine *>(handle);
|
||||||
|
delete instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
void impl_set_sample_rate(impl handle, float sample_rate) {
|
||||||
|
Engine *instance = reinterpret_cast<Engine *>(handle);
|
||||||
|
instance->chorus.setSampleRate(sample_rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
void impl_reset(impl handle) {
|
||||||
|
Engine *instance = reinterpret_cast<Engine *>(handle);
|
||||||
|
instance->chorus.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void impl_set_parameter(impl handle, size_t index, float value) {
|
||||||
|
Engine *instance = reinterpret_cast<Engine *>(handle);
|
||||||
|
switch (index) {
|
||||||
|
case 0:
|
||||||
|
instance->chorus.setRate(value);
|
||||||
|
instance->rateK = (1.f / 6.283185307179586f) * bw_rcpf(value);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
instance->amountK = bw_pow2f((1.f / 12.f) * value) - 1.f;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
float v = instance->rateK * instance->amountK;
|
||||||
|
instance->chorus.setDelay(v);
|
||||||
|
instance->chorus.setAmount(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
float impl_get_parameter(impl handle, size_t index) {
|
||||||
|
(void)handle;
|
||||||
|
(void)index;
|
||||||
|
return 0.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
void impl_process(impl handle, const float **inputs, float **outputs, size_t n_samples) {
|
||||||
|
Engine *instance = reinterpret_cast<Engine *>(handle);
|
||||||
|
instance->chorus.process(inputs, outputs, n_samples);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
5
examples/fxpp_vibrato/src/ios.json
Normal file
5
examples/fxpp_vibrato/src/ios.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"ios": {
|
||||||
|
"productBundleIdentifier": "com.orastron.bw_example_fxpp_vibrato"
|
||||||
|
}
|
||||||
|
}
|
12
examples/fxpp_vibrato/src/lv2.json
Normal file
12
examples/fxpp_vibrato/src/lv2.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"lv2": {
|
||||||
|
"prefixes": {
|
||||||
|
"bw_examples": "https://www.orastron.com/brickworks/examples/"
|
||||||
|
},
|
||||||
|
"uri": "@bw_examples:fxpp_vibrato",
|
||||||
|
"types": [ "@lv2:ModulatorPlugin" ],
|
||||||
|
"version": "1.0",
|
||||||
|
"busSymbols": [ "input", "output" ],
|
||||||
|
"parameterSymbols": [ "rate", "amount" ]
|
||||||
|
}
|
||||||
|
}
|
46
examples/fxpp_vibrato/src/product.json
Normal file
46
examples/fxpp_vibrato/src/product.json
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"product": {
|
||||||
|
"name": "Brickworks vibrato example (C++)",
|
||||||
|
"version": "1.1.0",
|
||||||
|
"buildVersion": "1",
|
||||||
|
"bundleName": "bw_example_fxpp_vibrato",
|
||||||
|
"buses": [
|
||||||
|
{
|
||||||
|
"type": "audio",
|
||||||
|
"direction": "input",
|
||||||
|
"channels": "mono",
|
||||||
|
"name": "Input",
|
||||||
|
"shortName": "Input"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "audio",
|
||||||
|
"direction": "output",
|
||||||
|
"channels": "mono",
|
||||||
|
"name": "Output",
|
||||||
|
"shortName": "Output"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "Rate",
|
||||||
|
"shortName": "Rate",
|
||||||
|
"direction": "input",
|
||||||
|
"defaultValue": 3.0,
|
||||||
|
"minimum": 1.0,
|
||||||
|
"maximum": 10.0,
|
||||||
|
"unit": "hz",
|
||||||
|
"map": "logarithmic"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Amount",
|
||||||
|
"shortName": "Amount",
|
||||||
|
"direction": "input",
|
||||||
|
"defaultValue": 0.0,
|
||||||
|
"minimum": 0.0,
|
||||||
|
"maximum": 2.0,
|
||||||
|
"unit": "semitone12TET",
|
||||||
|
"map": "linear"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
11
examples/fxpp_vibrato/src/vst3.json
Normal file
11
examples/fxpp_vibrato/src/vst3.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"vst3": {
|
||||||
|
"plugin": {
|
||||||
|
"cid": "64cde9d93afe4d7996d61599be1fdfe2"
|
||||||
|
},
|
||||||
|
"controller": {
|
||||||
|
"cid": "bdb79309267049a6b1ae13f9d371e2c0"
|
||||||
|
},
|
||||||
|
"subCategory": "Fx|Modulation"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user