fx(pp)_mm2
This commit is contained in:
parent
4769d090c4
commit
763a024f07
@ -1,6 +0,0 @@
|
||||
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||
|
||||
NAME := bw_example_fx_mm2
|
||||
SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_fx_mm2.c
|
||||
|
||||
include ${ROOT_DIR}/../../common/android/android.mk
|
@ -1,7 +0,0 @@
|
||||
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||
|
||||
TARGET = bw_example_fx_mm2
|
||||
|
||||
C_SOURCES += ${ROOT_DIR}/../src/bw_example_fx_mm2.c
|
||||
|
||||
include ${ROOT_DIR}/../../common/daisy-seed/daisy-seed.mk
|
@ -1,39 +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_DAISY_SEED_H
|
||||
#define _CONFIG_DAISY_SEED_H
|
||||
|
||||
struct config_pin {
|
||||
int param_index;
|
||||
int pin;
|
||||
};
|
||||
|
||||
#define NUM_PINS 5
|
||||
|
||||
static struct config_pin config_pins[NUM_PINS] = {
|
||||
{ 0, 15 },
|
||||
{ 1, 16 },
|
||||
{ 2, 17 },
|
||||
{ 3, 18 },
|
||||
{ 4, 19 }
|
||||
};
|
||||
|
||||
#endif
|
@ -1,6 +0,0 @@
|
||||
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||
|
||||
NAME := bw_example_fx_mm2
|
||||
SOURCE := ${NAME}.c
|
||||
|
||||
include ${ROOT_DIR}/../../common/ios/ios.mk
|
5
examples/fx_mm2/src/android.json
Normal file
5
examples/fx_mm2/src/android.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"android": {
|
||||
"javaPackageName": "com.orastron.bw_example_fx_mm2"
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* 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
|
||||
* 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_mm2.h"
|
||||
|
||||
void bw_example_fx_mm2_init(bw_example_fx_mm2 *instance) {
|
||||
bw_mm2_init(&instance->mm2_coeffs);
|
||||
}
|
||||
|
||||
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) {
|
||||
bw_mm2_reset_coeffs(&instance->mm2_coeffs);
|
||||
bw_mm2_reset_state(&instance->mm2_coeffs, &instance->mm2_state, 0.f);
|
||||
}
|
||||
|
||||
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) {
|
||||
instance->params[index] = value;
|
||||
switch (index) {
|
||||
case p_cutoff:
|
||||
bw_mm2_set_cutoff(&instance->mm2_coeffs, (20e3f - 20.f) * value * value * value + 20.f);
|
||||
break;
|
||||
case p_Q:
|
||||
bw_mm2_set_Q(&instance->mm2_coeffs, 0.5f + 9.5f * value);
|
||||
break;
|
||||
case p_input_coeff:
|
||||
bw_mm2_set_coeff_x(&instance->mm2_coeffs, 2.f * value - 1.f);
|
||||
break;
|
||||
case p_lp_coeff:
|
||||
bw_mm2_set_coeff_lp(&instance->mm2_coeffs, 2.f * value - 1.f);
|
||||
break;
|
||||
case p_bp_coeff:
|
||||
bw_mm2_set_coeff_bp(&instance->mm2_coeffs, 2.f * value - 1.f);
|
||||
break;
|
||||
case p_hp_coeff:
|
||||
bw_mm2_set_coeff_hp(&instance->mm2_coeffs, 2.f * value - 1.f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float bw_example_fx_mm2_get_parameter(bw_example_fx_mm2 *instance, int index) {
|
||||
return instance->params[index];
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* 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
|
||||
* 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_MM2_H
|
||||
#define _BW_EXAMPLE_FX_MM2_H
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_mm2.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#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];
|
||||
};
|
||||
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
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
6
examples/fx_mm2/src/cmd.json
Normal file
6
examples/fx_mm2/src/cmd.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"cmd": {
|
||||
"busIds": [ "input", "output" ],
|
||||
"parameterIds": [ "cutoff", "q", "in", "lp", "bp", "hp" ]
|
||||
}
|
||||
}
|
@ -1,92 +0,0 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* 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
|
||||
* 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_mm2"
|
||||
#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 6
|
||||
|
||||
static struct config_parameter config_parameters[NUM_PARAMETERS] = {
|
||||
{ "Cutoff", "Cutoff", "Hz", 0, 0, 0, 0.5f },
|
||||
{ "Q", "Q", "", 0, 0, 0, 0.f },
|
||||
{ "Input coefficient", "In coeff", "", 0, 0, 0, 1.f },
|
||||
{ "Lowpass coefficient", "LP coeff", "", 0, 0, 0, 0.5f },
|
||||
{ "Bandpass coefficient", "BP coeff", "", 0, 0, 0, 0.5f },
|
||||
{ "Highpass coefficient", "HP coeff", "", 0, 0, 0, 0.5f }
|
||||
};
|
||||
|
||||
// Internal API
|
||||
|
||||
#include "bw_example_fx_mm2.h"
|
||||
|
||||
#define P_TYPE bw_example_fx_mm2
|
||||
#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
|
||||
#define P_SET_PARAMETER bw_example_fx_mm2_set_parameter
|
||||
#define P_GET_PARAMETER bw_example_fx_mm2_get_parameter
|
||||
|
||||
#endif
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 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: "Cutoff",
|
||||
output: false,
|
||||
defaultValue: 0.5
|
||||
},
|
||||
{
|
||||
name: "Q",
|
||||
output: false,
|
||||
defaultValue: 0.5
|
||||
},
|
||||
{
|
||||
name: "Input coefficient",
|
||||
output: false,
|
||||
defaultValue: 1.0
|
||||
},
|
||||
{
|
||||
name: "Lowpass coefficient",
|
||||
output: false,
|
||||
defaultValue: 0.5
|
||||
},
|
||||
{
|
||||
name: "Bandpass coefficient",
|
||||
output: false,
|
||||
defaultValue: 0.5
|
||||
},
|
||||
{
|
||||
name: "Highpass coefficient",
|
||||
output: false,
|
||||
defaultValue: 0.5
|
||||
}
|
||||
];
|
5
examples/fx_mm2/src/daisy-seed.json
Normal file
5
examples/fx_mm2/src/daisy-seed.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"daisy_seed": {
|
||||
"parameterPins": [ 15, 16, 17, 18, 19, 20 ]
|
||||
}
|
||||
}
|
5
examples/fx_mm2/src/ios.json
Normal file
5
examples/fx_mm2/src/ios.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"ios": {
|
||||
"productBundleIdentifier": "com.orastron.bw_example_fx_mm2"
|
||||
}
|
||||
}
|
12
examples/fx_mm2/src/lv2.json
Normal file
12
examples/fx_mm2/src/lv2.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"lv2": {
|
||||
"prefixes": {
|
||||
"bw_examples": "https://www.orastron.com/brickworks/examples/"
|
||||
},
|
||||
"uri": "@bw_examples:fx_mm2",
|
||||
"types": [ "@lv2:FilterPlugin" ],
|
||||
"version": "1.0",
|
||||
"busSymbols": [ "input", "output" ],
|
||||
"parameterSymbols": [ "cutoff", "q", "in", "lp", "bp", "hp" ]
|
||||
}
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
#include "common.h"
|
||||
#include <bw_ls1.h>
|
||||
#include <bw_mm2.h>
|
||||
|
||||
typedef struct plugin {
|
||||
bw_ls1_coeffs ls1_coeffs;
|
||||
bw_ls1_state ls1_state;
|
||||
bw_mm2_coeffs mm2_coeffs;
|
||||
bw_mm2_state mm2_state;
|
||||
} plugin;
|
||||
|
||||
static void plugin_init(plugin *instance) {
|
||||
bw_ls1_init(&instance->ls1_coeffs);
|
||||
bw_mm2_init(&instance->mm2_coeffs);
|
||||
}
|
||||
|
||||
static void plugin_fini(plugin *instance) {
|
||||
@ -15,7 +15,7 @@ static void plugin_fini(plugin *instance) {
|
||||
}
|
||||
|
||||
static void plugin_set_sample_rate(plugin *instance, float sample_rate) {
|
||||
bw_ls1_set_sample_rate(&instance->ls1_coeffs, sample_rate);
|
||||
bw_mm2_set_sample_rate(&instance->mm2_coeffs, sample_rate);
|
||||
}
|
||||
|
||||
static size_t plugin_mem_req(plugin *instance) {
|
||||
@ -29,17 +29,29 @@ static void plugin_mem_set(plugin *instance, void *mem) {
|
||||
}
|
||||
|
||||
static void plugin_reset(plugin *instance) {
|
||||
bw_ls1_reset_coeffs(&instance->ls1_coeffs);
|
||||
bw_ls1_reset_state(&instance->ls1_coeffs, &instance->ls1_state, 0.f);
|
||||
bw_mm2_reset_coeffs(&instance->mm2_coeffs);
|
||||
bw_mm2_reset_state(&instance->mm2_coeffs, &instance->mm2_state, 0.f);
|
||||
}
|
||||
|
||||
static void plugin_set_parameter(plugin *instance, size_t index, float value) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
bw_ls1_set_cutoff(&instance->ls1_coeffs, value);
|
||||
bw_mm2_set_cutoff(&instance->mm2_coeffs, value);
|
||||
break;
|
||||
case 1:
|
||||
bw_ls1_set_dc_gain_dB(&instance->ls1_coeffs, value);
|
||||
bw_mm2_set_Q(&instance->mm2_coeffs, value);
|
||||
break;
|
||||
case 2:
|
||||
bw_mm2_set_coeff_x(&instance->mm2_coeffs, value);
|
||||
break;
|
||||
case 3:
|
||||
bw_mm2_set_coeff_lp(&instance->mm2_coeffs, value);
|
||||
break;
|
||||
case 4:
|
||||
bw_mm2_set_coeff_bp(&instance->mm2_coeffs, value);
|
||||
break;
|
||||
case 5:
|
||||
bw_mm2_set_coeff_hp(&instance->mm2_coeffs, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -51,5 +63,5 @@ static float plugin_get_parameter(plugin *instance, size_t index) {
|
||||
}
|
||||
|
||||
static void plugin_process(plugin *instance, const float **inputs, float **outputs, size_t n_samples) {
|
||||
bw_ls1_process(&instance->ls1_coeffs, &instance->ls1_state, inputs[0], outputs[0], n_samples);
|
||||
bw_mm2_process(&instance->mm2_coeffs, &instance->mm2_state, inputs[0], outputs[0], n_samples);
|
||||
}
|
81
examples/fx_mm2/src/product.json
Normal file
81
examples/fx_mm2/src/product.json
Normal file
@ -0,0 +1,81 @@
|
||||
{
|
||||
"product": {
|
||||
"name": "Brickworks 2nd-order multimode filter example",
|
||||
"version": "1.1.0",
|
||||
"buildVersion": "1",
|
||||
"bundleName": "bw_example_fx_mm2",
|
||||
"buses": [
|
||||
{
|
||||
"type": "audio",
|
||||
"direction": "input",
|
||||
"channels": "mono",
|
||||
"name": "Input",
|
||||
"shortName": "Input"
|
||||
},
|
||||
{
|
||||
"type": "audio",
|
||||
"direction": "output",
|
||||
"channels": "mono",
|
||||
"name": "Output",
|
||||
"shortName": "Output"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Cutoff",
|
||||
"shortName": "Cutoff",
|
||||
"direction": "input",
|
||||
"defaultValue": 1000.0,
|
||||
"minimum": 20.0,
|
||||
"maximum": 20000.0,
|
||||
"unit": "hz",
|
||||
"map": "logarithmic"
|
||||
},
|
||||
{
|
||||
"name": "Q",
|
||||
"shortName": "Q",
|
||||
"direction": "input",
|
||||
"defaultValue": 0.5,
|
||||
"minimum": 0.5,
|
||||
"maximum": 10.0,
|
||||
"map": "linear"
|
||||
},
|
||||
{
|
||||
"name": "Input coefficient",
|
||||
"shortName": "In coeff",
|
||||
"direction": "input",
|
||||
"defaultValue": 1.0,
|
||||
"minimum": -1.0,
|
||||
"maximum": 1.0,
|
||||
"map": "linear"
|
||||
},
|
||||
{
|
||||
"name": "Lowpass coefficient",
|
||||
"shortName": "LP coeff",
|
||||
"direction": "input",
|
||||
"defaultValue": 0.0,
|
||||
"minimum": -1.0,
|
||||
"maximum": 1.0,
|
||||
"map": "linear"
|
||||
},
|
||||
{
|
||||
"name": "Bandpass coefficient",
|
||||
"shortName": "BP coeff",
|
||||
"direction": "input",
|
||||
"defaultValue": 0.0,
|
||||
"minimum": -1.0,
|
||||
"maximum": 1.0,
|
||||
"map": "linear"
|
||||
},
|
||||
{
|
||||
"name": "Highpass coefficient",
|
||||
"shortName": "HP coeff",
|
||||
"direction": "input",
|
||||
"defaultValue": 0.0,
|
||||
"minimum": -1.0,
|
||||
"maximum": 1.0,
|
||||
"map": "linear"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
11
examples/fx_mm2/src/vst3.json
Normal file
11
examples/fx_mm2/src/vst3.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"vst3": {
|
||||
"plugin": {
|
||||
"cid": "6121bcd4fa37419581f04bc1f4545553"
|
||||
},
|
||||
"controller": {
|
||||
"cid": "dd88ff11c6fc41859bfa3d4862647918"
|
||||
},
|
||||
"subCategory": "Fx|Filter"
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||
|
||||
NAME := bw_example_fx_mm2
|
||||
SOURCE := bw_example_fx_mm2.c
|
||||
|
||||
include ${ROOT_DIR}/../../common/vst3/vst3.mk
|
||||
|
||||
CXXFLAGS += -DRELEASE=1 -DNDEBUG -DBW_NO_DEBUG
|
||||
#CXXFLAGS += -DDEVELOPMENT=1 -DBW_DEBUG_DEEP
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Brickworks
|
||||
*
|
||||
* Copyright (C) 2022 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, Paolo Marrone
|
||||
*/
|
||||
|
||||
#ifndef _VST3_CONFIG_H
|
||||
#define _VST3_CONFIG_H
|
||||
|
||||
#define PLUGIN_SUBCATEGORY "Fx|Filter"
|
||||
|
||||
#define PLUGIN_GUID_1 0x6121bcd4
|
||||
#define PLUGIN_GUID_2 0xfa374195
|
||||
#define PLUGIN_GUID_3 0x81f04bc1
|
||||
#define PLUGIN_GUID_4 0xf4545553
|
||||
|
||||
#define CTRL_GUID_1 0xdd88ff11
|
||||
#define CTRL_GUID_2 0xc6fc4185
|
||||
#define CTRL_GUID_3 0x9bfa3d48
|
||||
#define CTRL_GUID_4 0x62647918
|
||||
|
||||
#endif
|
@ -1,4 +0,0 @@
|
||||
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||
SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_fx_mm2.c
|
||||
|
||||
include ${ROOT_DIR}/../../common/web/web.mk
|
@ -1,78 +0,0 @@
|
||||
#include "common.h"
|
||||
#include <bw_dist.h>
|
||||
#include <bw_src_int.h>
|
||||
|
||||
#define BUF_SIZE 32
|
||||
|
||||
typedef struct plugin {
|
||||
bw_dist_coeffs dist_coeffs;
|
||||
bw_dist_state dist_state;
|
||||
bw_src_int_coeffs src_up_coeffs;
|
||||
bw_src_int_state src_up_state;
|
||||
bw_src_int_coeffs src_down_coeffs;
|
||||
bw_src_int_state src_down_state;
|
||||
|
||||
float buf[BUF_SIZE];
|
||||
} plugin;
|
||||
|
||||
static void plugin_init(plugin *instance) {
|
||||
bw_dist_init(&instance->dist_coeffs);
|
||||
bw_src_int_init(&instance->src_up_coeffs, 2);
|
||||
bw_src_int_init(&instance->src_down_coeffs, -2);
|
||||
}
|
||||
|
||||
static void plugin_fini(plugin *instance) {
|
||||
(void)instance;
|
||||
}
|
||||
|
||||
static void plugin_set_sample_rate(plugin *instance, float sample_rate) {
|
||||
bw_dist_set_sample_rate(&instance->dist_coeffs, 2.f * sample_rate);
|
||||
}
|
||||
|
||||
static size_t plugin_mem_req(plugin *instance) {
|
||||
(void)instance;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void plugin_mem_set(plugin *instance, void *mem) {
|
||||
(void)instance;
|
||||
(void)mem;
|
||||
}
|
||||
|
||||
static void plugin_reset(plugin *instance) {
|
||||
bw_dist_reset_coeffs(&instance->dist_coeffs);
|
||||
bw_dist_reset_state(&instance->dist_coeffs, &instance->dist_state, 0.f);
|
||||
bw_src_int_reset_state(&instance->src_up_coeffs, &instance->src_up_state, 0.f);
|
||||
bw_src_int_reset_state(&instance->src_down_coeffs, &instance->src_down_state, 0.f);
|
||||
}
|
||||
|
||||
static void plugin_set_parameter(plugin *instance, size_t index, float value) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
bw_dist_set_distortion(&instance->dist_coeffs, 0.01f * value);
|
||||
break;
|
||||
case 1:
|
||||
bw_dist_set_tone(&instance->dist_coeffs, 0.01f * value);
|
||||
break;
|
||||
case 2:
|
||||
bw_dist_set_volume(&instance->dist_coeffs, 0.01f * value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
size_t i = 0;
|
||||
while (i < n_samples) {
|
||||
int n = bw_mini32(n_samples - i, BUF_SIZE >> 1);
|
||||
bw_src_int_process(&instance->src_up_coeffs, &instance->src_up_state, inputs[0] + i, instance->buf, n);
|
||||
bw_dist_process(&instance->dist_coeffs, &instance->dist_state, instance->buf, instance->buf, n << 1);
|
||||
bw_src_int_process(&instance->src_down_coeffs, &instance->src_down_state, instance->buf, outputs[0] + i, n << 1);
|
||||
i += n;
|
||||
}
|
||||
}
|
5
examples/fxpp_mm2/src/android.json
Normal file
5
examples/fxpp_mm2/src/android.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"android": {
|
||||
"javaPackageName": "com.orastron.bw_example_fxpp_mm2"
|
||||
}
|
||||
}
|
6
examples/fxpp_mm2/src/cmd.json
Normal file
6
examples/fxpp_mm2/src/cmd.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"cmd": {
|
||||
"busIds": [ "input", "output" ],
|
||||
"parameterIds": [ "cutoff", "q", "in", "lp", "bp", "hp" ]
|
||||
}
|
||||
}
|
5
examples/fxpp_mm2/src/daisy-seed.json
Normal file
5
examples/fxpp_mm2/src/daisy-seed.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"daisy_seed": {
|
||||
"parameterPins": [ 15, 16, 17, 18, 19, 20 ]
|
||||
}
|
||||
}
|
65
examples/fxpp_mm2/src/impl.cpp
Normal file
65
examples/fxpp_mm2/src/impl.cpp
Normal file
@ -0,0 +1,65 @@
|
||||
#include "impl.h"
|
||||
|
||||
#include "common.h"
|
||||
#include <bw_mm2.h>
|
||||
|
||||
using namespace Brickworks;
|
||||
|
||||
extern "C" {
|
||||
|
||||
impl impl_new(void) {
|
||||
MM2<1> *instance = new MM2<1>();
|
||||
return reinterpret_cast<impl>(instance);
|
||||
}
|
||||
|
||||
void impl_free(impl handle) {
|
||||
MM2<1> *instance = reinterpret_cast<MM2<1> *>(handle);
|
||||
delete instance;
|
||||
}
|
||||
|
||||
void impl_set_sample_rate(impl handle, float sample_rate) {
|
||||
MM2<1> *instance = reinterpret_cast<MM2<1> *>(handle);
|
||||
instance->setSampleRate(sample_rate);
|
||||
}
|
||||
|
||||
void impl_reset(impl handle) {
|
||||
MM2<1> *instance = reinterpret_cast<MM2<1> *>(handle);
|
||||
instance->reset();
|
||||
}
|
||||
|
||||
void impl_set_parameter(impl handle, size_t index, float value) {
|
||||
MM2<1> *instance = reinterpret_cast<MM2<1> *>(handle);
|
||||
switch (index) {
|
||||
case 0:
|
||||
instance->setCutoff(value);
|
||||
break;
|
||||
case 1:
|
||||
instance->setQ(value);
|
||||
break;
|
||||
case 2:
|
||||
instance->setCoeffX(value);
|
||||
break;
|
||||
case 3:
|
||||
instance->setCoeffLp(value);
|
||||
break;
|
||||
case 4:
|
||||
instance->setCoeffBp(value);
|
||||
break;
|
||||
case 5:
|
||||
instance->setCoeffHp(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
MM2<1> *instance = reinterpret_cast<MM2<1> *>(handle);
|
||||
instance->process(inputs, outputs, n_samples);
|
||||
}
|
||||
|
||||
}
|
5
examples/fxpp_mm2/src/ios.json
Normal file
5
examples/fxpp_mm2/src/ios.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"ios": {
|
||||
"productBundleIdentifier": "com.orastron.bw_example_fxpp_mm2"
|
||||
}
|
||||
}
|
12
examples/fxpp_mm2/src/lv2.json
Normal file
12
examples/fxpp_mm2/src/lv2.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"lv2": {
|
||||
"prefixes": {
|
||||
"bw_examples": "https://www.orastron.com/brickworks/examples/"
|
||||
},
|
||||
"uri": "@bw_examples:fxpp_mm2",
|
||||
"types": [ "@lv2:FilterPlugin" ],
|
||||
"version": "1.0",
|
||||
"busSymbols": [ "input", "output" ],
|
||||
"parameterSymbols": [ "cutoff", "q", "in", "lp", "bp", "hp" ]
|
||||
}
|
||||
}
|
81
examples/fxpp_mm2/src/product.json
Normal file
81
examples/fxpp_mm2/src/product.json
Normal file
@ -0,0 +1,81 @@
|
||||
{
|
||||
"product": {
|
||||
"name": "Brickworks 2nd-order multimode filter example (C++)",
|
||||
"version": "1.1.0",
|
||||
"buildVersion": "1",
|
||||
"bundleName": "bw_example_fxpp_mm2",
|
||||
"buses": [
|
||||
{
|
||||
"type": "audio",
|
||||
"direction": "input",
|
||||
"channels": "mono",
|
||||
"name": "Input",
|
||||
"shortName": "Input"
|
||||
},
|
||||
{
|
||||
"type": "audio",
|
||||
"direction": "output",
|
||||
"channels": "mono",
|
||||
"name": "Output",
|
||||
"shortName": "Output"
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Cutoff",
|
||||
"shortName": "Cutoff",
|
||||
"direction": "input",
|
||||
"defaultValue": 1000.0,
|
||||
"minimum": 20.0,
|
||||
"maximum": 20000.0,
|
||||
"unit": "hz",
|
||||
"map": "logarithmic"
|
||||
},
|
||||
{
|
||||
"name": "Q",
|
||||
"shortName": "Q",
|
||||
"direction": "input",
|
||||
"defaultValue": 0.5,
|
||||
"minimum": 0.5,
|
||||
"maximum": 10.0,
|
||||
"map": "linear"
|
||||
},
|
||||
{
|
||||
"name": "Input coefficient",
|
||||
"shortName": "In coeff",
|
||||
"direction": "input",
|
||||
"defaultValue": 1.0,
|
||||
"minimum": -1.0,
|
||||
"maximum": 1.0,
|
||||
"map": "linear"
|
||||
},
|
||||
{
|
||||
"name": "Lowpass coefficient",
|
||||
"shortName": "LP coeff",
|
||||
"direction": "input",
|
||||
"defaultValue": 0.0,
|
||||
"minimum": -1.0,
|
||||
"maximum": 1.0,
|
||||
"map": "linear"
|
||||
},
|
||||
{
|
||||
"name": "Bandpass coefficient",
|
||||
"shortName": "BP coeff",
|
||||
"direction": "input",
|
||||
"defaultValue": 0.0,
|
||||
"minimum": -1.0,
|
||||
"maximum": 1.0,
|
||||
"map": "linear"
|
||||
},
|
||||
{
|
||||
"name": "Highpass coefficient",
|
||||
"shortName": "HP coeff",
|
||||
"direction": "input",
|
||||
"defaultValue": 0.0,
|
||||
"minimum": -1.0,
|
||||
"maximum": 1.0,
|
||||
"map": "linear"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
11
examples/fxpp_mm2/src/vst3.json
Normal file
11
examples/fxpp_mm2/src/vst3.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"vst3": {
|
||||
"plugin": {
|
||||
"cid": "7f7180153b6740f5aef697a81ede0a4e"
|
||||
},
|
||||
"controller": {
|
||||
"cid": "5c6c769df77e4c79918b11a927788f1e"
|
||||
},
|
||||
"subCategory": "Fx|Filter"
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ echo Removing common files
|
||||
|
||||
rm -fr common/cmd common/web common/daisy-seed common/lv2 common/vst3 common/android common/ios
|
||||
|
||||
dirs="fx_ap1 fx_ap2 fx_balance fx_bitcrush fx_cab fx_chorus fx_clip fx_comb fx_comp fx_delay fx_dist fx_drive fx_eq_3band fx_flanger fx_fuzz fx_hp1 fx_hs1 fx_lp1 fx_ls1 fx_mm1 synth_simple fxpp_ap1 fxpp_ap2 fxpp_balance fxpp_bitcrush fxpp_cab fxpp_chorus fxpp_clip fxpp_comb fxpp_comp fxpp_delay fxpp_dist fxpp_drive fxpp_eq_3band fxpp_flanger fxpp_fuzz fxpp_hp1 fxpp_hs1 fxpp_lp1 fxpp_ls1 fxpp_mm1 synthpp_simple"
|
||||
dirs="fx_ap1 fx_ap2 fx_balance fx_bitcrush fx_cab fx_chorus fx_clip fx_comb fx_comp fx_delay fx_dist fx_drive fx_eq_3band fx_flanger fx_fuzz fx_hp1 fx_hs1 fx_lp1 fx_ls1 fx_mm1 fx_mm2 synth_simple fxpp_ap1 fxpp_ap2 fxpp_balance fxpp_bitcrush fxpp_cab fxpp_chorus fxpp_clip fxpp_comb fxpp_comp fxpp_delay fxpp_dist fxpp_drive fxpp_eq_3band fxpp_flanger fxpp_fuzz fxpp_hp1 fxpp_hs1 fxpp_lp1 fxpp_ls1 fxpp_mm1 fxpp_mm2 synthpp_simple"
|
||||
|
||||
for d in $dirs; do
|
||||
echo Removing data files for $d
|
||||
|
@ -33,7 +33,7 @@ if [ "$1" = "common" ]; then
|
||||
fi
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
dirs="fx_ap1 fx_ap2 fx_balance fx_bitcrush fx_cab fx_chorus fx_clip fx_comb fx_comp fx_delay fx_dist fx_drive fx_eq_3band fx_flanger fx_fuzz fx_hp1 fx_hs1 fx_lp1 fx_ls1 fx_mm1 synth_simple fxpp_ap1 fxpp_ap2 fxpp_balance fxpp_bitcrush fxpp_cab fxpp_chorus fxpp_clip fxpp_comb fxpp_comp fxpp_delay fxpp_dist fxpp_drive fxpp_eq_3band fxpp_flanger fxpp_fuzz fxpp_hp1 fxpp_hs1 fxpp_lp1 fxpp_ls1 fxpp_mm1 synthpp_simple"
|
||||
dirs="fx_ap1 fx_ap2 fx_balance fx_bitcrush fx_cab fx_chorus fx_clip fx_comb fx_comp fx_delay fx_dist fx_drive fx_eq_3band fx_flanger fx_fuzz fx_hp1 fx_hs1 fx_lp1 fx_ls1 fx_mm1 fx_mm2 synth_simple fxpp_ap1 fxpp_ap2 fxpp_balance fxpp_bitcrush fxpp_cab fxpp_chorus fxpp_clip fxpp_comb fxpp_comp fxpp_delay fxpp_dist fxpp_drive fxpp_eq_3band fxpp_flanger fxpp_fuzz fxpp_hp1 fxpp_hs1 fxpp_lp1 fxpp_ls1 fxpp_mm1 fxpp_mm2 synthpp_simple"
|
||||
else
|
||||
dirs="$1"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user