From d17387f3771149adb93db927baedfd4974f57c7e Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Wed, 14 Feb 2024 05:18:42 +0100 Subject: [PATCH] fx(pp)_noise_gate --- examples/fx_noise_gate/android/Makefile | 6 -- examples/fx_noise_gate/daisy-seed/Makefile | 7 -- .../daisy-seed/config_daisy_seed.h | 38 -------- examples/fx_noise_gate/ios/Makefile | 6 -- examples/fx_noise_gate/src/android.json | 5 ++ .../src/bw_example_fx_noise_gate.c | 60 ------------- .../src/bw_example_fx_noise_gate.h | 61 ------------- examples/fx_noise_gate/src/cmd.json | 6 ++ examples/fx_noise_gate/src/config.h | 90 ------------------- examples/fx_noise_gate/src/config.js | 53 ----------- examples/fx_noise_gate/src/daisy-seed.json | 5 ++ examples/fx_noise_gate/src/ios.json | 5 ++ examples/fx_noise_gate/src/lv2.json | 12 +++ examples/fx_noise_gate/src/plugin.h | 67 ++++++++++++++ examples/fx_noise_gate/src/product.json | 85 ++++++++++++++++++ examples/fx_noise_gate/src/vst3.json | 11 +++ examples/fx_noise_gate/vst3/Makefile | 9 -- examples/fx_noise_gate/vst3/config_vst3.h | 36 -------- examples/fx_noise_gate/web/Makefile | 4 - examples/fxpp_noise_gate/src/android.json | 5 ++ examples/fxpp_noise_gate/src/cmd.json | 6 ++ examples/fxpp_noise_gate/src/daisy-seed.json | 5 ++ examples/fxpp_noise_gate/src/impl.cpp | 77 ++++++++++++++++ examples/fxpp_noise_gate/src/ios.json | 5 ++ examples/fxpp_noise_gate/src/lv2.json | 12 +++ examples/fxpp_noise_gate/src/product.json | 85 ++++++++++++++++++ examples/fxpp_noise_gate/src/vst3.json | 11 +++ examples/tibia_clean.sh | 2 +- examples/tibia_gen.sh | 2 +- 29 files changed, 404 insertions(+), 372 deletions(-) delete mode 100644 examples/fx_noise_gate/android/Makefile delete mode 100644 examples/fx_noise_gate/daisy-seed/Makefile delete mode 100644 examples/fx_noise_gate/daisy-seed/config_daisy_seed.h delete mode 100644 examples/fx_noise_gate/ios/Makefile create mode 100644 examples/fx_noise_gate/src/android.json delete mode 100644 examples/fx_noise_gate/src/bw_example_fx_noise_gate.c delete mode 100644 examples/fx_noise_gate/src/bw_example_fx_noise_gate.h create mode 100644 examples/fx_noise_gate/src/cmd.json delete mode 100644 examples/fx_noise_gate/src/config.h delete mode 100644 examples/fx_noise_gate/src/config.js create mode 100644 examples/fx_noise_gate/src/daisy-seed.json create mode 100644 examples/fx_noise_gate/src/ios.json create mode 100644 examples/fx_noise_gate/src/lv2.json create mode 100644 examples/fx_noise_gate/src/plugin.h create mode 100644 examples/fx_noise_gate/src/product.json create mode 100644 examples/fx_noise_gate/src/vst3.json delete mode 100644 examples/fx_noise_gate/vst3/Makefile delete mode 100644 examples/fx_noise_gate/vst3/config_vst3.h delete mode 100644 examples/fx_noise_gate/web/Makefile create mode 100644 examples/fxpp_noise_gate/src/android.json create mode 100644 examples/fxpp_noise_gate/src/cmd.json create mode 100644 examples/fxpp_noise_gate/src/daisy-seed.json create mode 100644 examples/fxpp_noise_gate/src/impl.cpp create mode 100644 examples/fxpp_noise_gate/src/ios.json create mode 100644 examples/fxpp_noise_gate/src/lv2.json create mode 100644 examples/fxpp_noise_gate/src/product.json create mode 100644 examples/fxpp_noise_gate/src/vst3.json diff --git a/examples/fx_noise_gate/android/Makefile b/examples/fx_noise_gate/android/Makefile deleted file mode 100644 index bd6c7a8..0000000 --- a/examples/fx_noise_gate/android/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) - -NAME := bw_example_fx_noise_gate -SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_fx_noise_gate.c - -include ${ROOT_DIR}/../../common/android/android.mk diff --git a/examples/fx_noise_gate/daisy-seed/Makefile b/examples/fx_noise_gate/daisy-seed/Makefile deleted file mode 100644 index 471c13f..0000000 --- a/examples/fx_noise_gate/daisy-seed/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) - -TARGET = bw_example_fx_noise_gate - -C_SOURCES += ${ROOT_DIR}/../src/bw_example_fx_noise_gate.c - -include ${ROOT_DIR}/../../common/daisy-seed/daisy-seed.mk diff --git a/examples/fx_noise_gate/daisy-seed/config_daisy_seed.h b/examples/fx_noise_gate/daisy-seed/config_daisy_seed.h deleted file mode 100644 index 10d3292..0000000 --- a/examples/fx_noise_gate/daisy-seed/config_daisy_seed.h +++ /dev/null @@ -1,38 +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 . - * - * 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 4 - -static struct config_pin config_pins[NUM_PINS] = { - { 0, 15 }, - { 1, 16 }, - { 2, 17 }, - { 3, 18 } -}; - -#endif diff --git a/examples/fx_noise_gate/ios/Makefile b/examples/fx_noise_gate/ios/Makefile deleted file mode 100644 index 0eb278a..0000000 --- a/examples/fx_noise_gate/ios/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) - -NAME := bw_example_fx_noise_gate -SOURCE := ${NAME}.c - -include ${ROOT_DIR}/../../common/ios/ios.mk diff --git a/examples/fx_noise_gate/src/android.json b/examples/fx_noise_gate/src/android.json new file mode 100644 index 0000000..c8180bf --- /dev/null +++ b/examples/fx_noise_gate/src/android.json @@ -0,0 +1,5 @@ +{ + "android": { + "javaPackageName": "com.orastron.bw_example_fx_noise_gate" + } +} diff --git a/examples/fx_noise_gate/src/bw_example_fx_noise_gate.c b/examples/fx_noise_gate/src/bw_example_fx_noise_gate.c deleted file mode 100644 index 7f8aab9..0000000 --- a/examples/fx_noise_gate/src/bw_example_fx_noise_gate.c +++ /dev/null @@ -1,60 +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 . - * - * File author: Stefano D'Angelo - */ - -#include "bw_example_fx_noise_gate.h" - -void bw_example_fx_noise_gate_init(bw_example_fx_noise_gate *instance) { - bw_noise_gate_init(&instance->noise_gate_coeffs); -} - -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) { - bw_noise_gate_reset_coeffs(&instance->noise_gate_coeffs); - bw_noise_gate_reset_state(&instance->noise_gate_coeffs, &instance->noise_gate_state, 0.f, 0.f); -} - -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) { - instance->params[index] = value; - switch (index) { - case p_thresh: - bw_noise_gate_set_thresh_dBFS(&instance->noise_gate_coeffs, 60.f * value - 60.f); - break; - case p_attenuation: - bw_noise_gate_set_ratio(&instance->noise_gate_coeffs, value < 0.999f ? 1.f / (1.f - value) : INFINITY); - break; - case p_attack: - bw_noise_gate_set_attack_tau(&instance->noise_gate_coeffs, value); - break; - case p_release: - bw_noise_gate_set_release_tau(&instance->noise_gate_coeffs, value); - break; - } -} - -float bw_example_fx_noise_gate_get_parameter(bw_example_fx_noise_gate *instance, int index) { - return instance->params[index]; -} diff --git a/examples/fx_noise_gate/src/bw_example_fx_noise_gate.h b/examples/fx_noise_gate/src/bw_example_fx_noise_gate.h deleted file mode 100644 index 9e588ce..0000000 --- a/examples/fx_noise_gate/src/bw_example_fx_noise_gate.h +++ /dev/null @@ -1,61 +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 . - * - * File author: Stefano D'Angelo - */ - -#ifndef _BW_EXAMPLE_FX_NOISE_GATE_H -#define _BW_EXAMPLE_FX_NOISE_GATE_H - -#include "platform.h" - -#include - -#ifdef __cplusplus -extern "C" { -#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]; -}; -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 -} -#endif - -#endif diff --git a/examples/fx_noise_gate/src/cmd.json b/examples/fx_noise_gate/src/cmd.json new file mode 100644 index 0000000..7611348 --- /dev/null +++ b/examples/fx_noise_gate/src/cmd.json @@ -0,0 +1,6 @@ +{ + "cmd": { + "busIds": [ "input", "output", "sidechain_in" ], + "parameterIds": [ "threshold", "ratio", "attack", "release", "ext_sidechain" ] + } +} diff --git a/examples/fx_noise_gate/src/config.h b/examples/fx_noise_gate/src/config.h deleted file mode 100644 index 4b5bafe..0000000 --- a/examples/fx_noise_gate/src/config.h +++ /dev/null @@ -1,90 +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 . - * - * 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_noise_gate" -#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 4 - -static struct config_parameter config_parameters[NUM_PARAMETERS] = { - { "Threshold", "Thresh", "", 0, 0, 0, 0.f }, - { "Attenuation", "Attenuation", "%", 0, 0, 0, 0.f }, - { "Attack", "Attack", "s", 0, 0, 0, 0.f }, - { "Release", "Release", "s", 0, 0, 0, 0.f } -}; - -// Internal API - -#include "bw_example_fx_noise_gate.h" - -#define P_TYPE bw_example_fx_noise_gate -#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 -#define P_SET_PARAMETER bw_example_fx_noise_gate_set_parameter -#define P_GET_PARAMETER bw_example_fx_noise_gate_get_parameter - -#endif diff --git a/examples/fx_noise_gate/src/config.js b/examples/fx_noise_gate/src/config.js deleted file mode 100644 index 0b281be..0000000 --- a/examples/fx_noise_gate/src/config.js +++ /dev/null @@ -1,53 +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 . - * - * File author: Stefano D'Angelo - */ - -var buses = [ - { - stereo: false, - output: false - }, - { - stereo: false, - output: true - } -]; - -var parameters = [ - { - name: "Threshold", - output: false, - defaultValue: 0.0 - }, - { - name: "Attenuation", - output: false, - defaultValue: 0.0 - }, - { - name: "Attack", - output: false, - defaultValue: 0.0 - }, - { - name: "Release", - output: false, - defaultValue: 0.0 - } -]; diff --git a/examples/fx_noise_gate/src/daisy-seed.json b/examples/fx_noise_gate/src/daisy-seed.json new file mode 100644 index 0000000..e915b99 --- /dev/null +++ b/examples/fx_noise_gate/src/daisy-seed.json @@ -0,0 +1,5 @@ +{ + "daisy_seed": { + "parameterPins": [ 15, 16, 17, 18, 19 ] + } +} diff --git a/examples/fx_noise_gate/src/ios.json b/examples/fx_noise_gate/src/ios.json new file mode 100644 index 0000000..22ff63b --- /dev/null +++ b/examples/fx_noise_gate/src/ios.json @@ -0,0 +1,5 @@ +{ + "ios": { + "productBundleIdentifier": "com.orastron.bw_example_fx_noise_gate" + } +} diff --git a/examples/fx_noise_gate/src/lv2.json b/examples/fx_noise_gate/src/lv2.json new file mode 100644 index 0000000..b813f7b --- /dev/null +++ b/examples/fx_noise_gate/src/lv2.json @@ -0,0 +1,12 @@ +{ + "lv2": { + "prefixes": { + "bw_examples": "https://www.orastron.com/brickworks/examples/" + }, + "uri": "@bw_examples:fx_noise_gate", + "types": [ "@lv2:GatePlugin" ], + "version": "1.0", + "busSymbols": [ "input", "output", "sidechain_in" ], + "parameterSymbols": [ "threshold", "ratio", "attack", "release", "ext_sidechain" ] + } +} diff --git a/examples/fx_noise_gate/src/plugin.h b/examples/fx_noise_gate/src/plugin.h new file mode 100644 index 0000000..1a2b485 --- /dev/null +++ b/examples/fx_noise_gate/src/plugin.h @@ -0,0 +1,67 @@ +#include "common.h" +#include + +typedef struct plugin { + bw_noise_gate_coeffs noise_gate_coeffs; + bw_noise_gate_state noise_gate_state; + char ext_sidechain; +} plugin; + +static void plugin_init(plugin *instance) { + bw_noise_gate_init(&instance->noise_gate_coeffs); +} + +static void plugin_fini(plugin *instance) { + (void)instance; +} + +static void plugin_set_sample_rate(plugin *instance, float sample_rate) { + bw_noise_gate_set_sample_rate(&instance->noise_gate_coeffs, 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_noise_gate_reset_coeffs(&instance->noise_gate_coeffs); + bw_noise_gate_reset_state(&instance->noise_gate_coeffs, &instance->noise_gate_state, 0.f, 0.f); +} + +static void plugin_set_parameter(plugin *instance, size_t index, float value) { + switch (index) { + case 0: + bw_noise_gate_set_thresh_dBFS(&instance->noise_gate_coeffs, value); + break; + case 1: + bw_noise_gate_set_ratio(&instance->noise_gate_coeffs, value); + break; + case 2: + // using rise time 10% -> 90%: tau = rise time / log(9) + bw_noise_gate_set_attack_tau(&instance->noise_gate_coeffs, (0.001f * 0.4551196133134186f) * value); + break; + case 3: + // as before + bw_noise_gate_set_release_tau(&instance->noise_gate_coeffs, (0.001f * 0.4551196133134186f) * value); + break; + case 4: + instance->ext_sidechain = (char)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) { + bw_noise_gate_process(&instance->noise_gate_coeffs, &instance->noise_gate_state, inputs[0], instance->ext_sidechain ? inputs[1] : inputs[0], outputs[0], n_samples); +} diff --git a/examples/fx_noise_gate/src/product.json b/examples/fx_noise_gate/src/product.json new file mode 100644 index 0000000..1bb21e4 --- /dev/null +++ b/examples/fx_noise_gate/src/product.json @@ -0,0 +1,85 @@ +{ + "product": { + "name": "Brickworks noise gate example", + "version": "1.1.0", + "buildVersion": "1", + "bundleName": "bw_example_fx_noise_gate", + "buses": [ + { + "type": "audio", + "direction": "input", + "channels": "mono", + "name": "Input", + "shortName": "Input" + }, + { + "type": "audio", + "direction": "output", + "channels": "mono", + "name": "Output", + "shortName": "Output" + }, + { + "type": "audio", + "direction": "input", + "channels": "mono", + "name": "Sidechain input", + "shortName": "Sidechain in", + "sidechain": true, + "cv": false, + "optional": true + } + ], + "parameters": [ + { + "name": "Threshold", + "shortName": "Threshold", + "direction": "input", + "defaultValue": 0.0, + "minimum": -60.0, + "maximum": 0.0, + "unit": "db", + "map": "linear" + }, + { + "name": "Ratio", + "shortName": "Ratio", + "direction": "input", + "defaultValue": 1.0, + "minimum": 1.0, + "maximum": 20.0, + "map": "linear" + }, + { + "name": "Attack", + "shortName": "Attack", + "direction": "input", + "defaultValue": 20.0, + "minimum": 1.0, + "maximum": 2000.0, + "unit": "ms", + "map": "logarithmic" + }, + { + "name": "Release", + "shortName": "Release", + "direction": "input", + "defaultValue": 250.0, + "minimum": 1.0, + "maximum": 2000.0, + "unit": "ms", + "map": "logarithmic" + }, + { + "name": "External sidechain", + "shortName": "Ext sidechain", + "direction": "input", + "defaultValue": 0.0, + "minimum": 0.0, + "maximum": 1.0, + "toggled": true, + "map": "linear" + } + ] + } +} diff --git a/examples/fx_noise_gate/src/vst3.json b/examples/fx_noise_gate/src/vst3.json new file mode 100644 index 0000000..d9959c7 --- /dev/null +++ b/examples/fx_noise_gate/src/vst3.json @@ -0,0 +1,11 @@ +{ + "vst3": { + "plugin": { + "cid": "f3f6d724ee614367a68a7cc521cee762" + }, + "controller": { + "cid": "4b89bee05c6141d083b5b8fd97c663e0" + }, + "subCategory": "Fx|Dynamics" + } +} diff --git a/examples/fx_noise_gate/vst3/Makefile b/examples/fx_noise_gate/vst3/Makefile deleted file mode 100644 index f10ad5b..0000000 --- a/examples/fx_noise_gate/vst3/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) - -NAME := bw_example_fx_noise_gate -SOURCE := bw_example_fx_noise_gate.c - -include ${ROOT_DIR}/../../common/vst3/vst3.mk - -CXXFLAGS += -DRELEASE=1 -DNDEBUG -DBW_NO_DEBUG -#CXXFLAGS += -DDEVELOPMENT=1 -DBW_DEBUG_DEEP diff --git a/examples/fx_noise_gate/vst3/config_vst3.h b/examples/fx_noise_gate/vst3/config_vst3.h deleted file mode 100644 index 2ac2cf3..0000000 --- a/examples/fx_noise_gate/vst3/config_vst3.h +++ /dev/null @@ -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 . - * - * File authors: Stefano D'Angelo, Paolo Marrone - */ - -#ifndef _VST3_CONFIG_H -#define _VST3_CONFIG_H - -#define PLUGIN_SUBCATEGORY "Fx|Restoration" - -#define PLUGIN_GUID_1 0xf3f6d724 -#define PLUGIN_GUID_2 0xee614367 -#define PLUGIN_GUID_3 0xa68a7cc5 -#define PLUGIN_GUID_4 0x21cee762 - -#define CTRL_GUID_1 0x4b89bee0 -#define CTRL_GUID_2 0x5c6141d0 -#define CTRL_GUID_3 0x83b5b8fd -#define CTRL_GUID_4 0x97c663e0 - -#endif diff --git a/examples/fx_noise_gate/web/Makefile b/examples/fx_noise_gate/web/Makefile deleted file mode 100644 index 7d41a4a..0000000 --- a/examples/fx_noise_gate/web/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) -SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_fx_noise_gate.c - -include ${ROOT_DIR}/../../common/web/web.mk diff --git a/examples/fxpp_noise_gate/src/android.json b/examples/fxpp_noise_gate/src/android.json new file mode 100644 index 0000000..04c70f3 --- /dev/null +++ b/examples/fxpp_noise_gate/src/android.json @@ -0,0 +1,5 @@ +{ + "android": { + "javaPackageName": "com.orastron.bw_example_fxpp_noise_gate" + } +} diff --git a/examples/fxpp_noise_gate/src/cmd.json b/examples/fxpp_noise_gate/src/cmd.json new file mode 100644 index 0000000..7611348 --- /dev/null +++ b/examples/fxpp_noise_gate/src/cmd.json @@ -0,0 +1,6 @@ +{ + "cmd": { + "busIds": [ "input", "output", "sidechain_in" ], + "parameterIds": [ "threshold", "ratio", "attack", "release", "ext_sidechain" ] + } +} diff --git a/examples/fxpp_noise_gate/src/daisy-seed.json b/examples/fxpp_noise_gate/src/daisy-seed.json new file mode 100644 index 0000000..e915b99 --- /dev/null +++ b/examples/fxpp_noise_gate/src/daisy-seed.json @@ -0,0 +1,5 @@ +{ + "daisy_seed": { + "parameterPins": [ 15, 16, 17, 18, 19 ] + } +} diff --git a/examples/fxpp_noise_gate/src/impl.cpp b/examples/fxpp_noise_gate/src/impl.cpp new file mode 100644 index 0000000..23ae459 --- /dev/null +++ b/examples/fxpp_noise_gate/src/impl.cpp @@ -0,0 +1,77 @@ +#include "impl.h" + +#include "common.h" +#include + +using namespace Brickworks; + +class Engine { +public: + NoiseGate<1> noise_gate; + bool extSidechain; +}; + +extern "C" { + +impl impl_new(void) { + Engine *instance = new Engine(); + return reinterpret_cast(instance); +} + +void impl_free(impl handle) { + Engine *instance = reinterpret_cast(handle); + delete instance; +} + +void impl_set_sample_rate(impl handle, float sample_rate) { + Engine *instance = reinterpret_cast(handle); + instance->noise_gate.setSampleRate(sample_rate); +} + +void impl_reset(impl handle) { + Engine *instance = reinterpret_cast(handle); + instance->noise_gate.reset(); +} + +void impl_set_parameter(impl handle, size_t index, float value) { + Engine *instance = reinterpret_cast(handle); + switch (index) { + case 0: + instance->noise_gate.setThreshDBFS(value); + break; + case 1: + instance->noise_gate.setRatio(value); + break; + case 2: + // using rise time 10% -> 90%: tau = rise time / log(9) + instance->noise_gate.setAttackTau((0.001f * 0.4551196133134186f) * value); + break; + case 3: + // as before + instance->noise_gate.setReleaseTau((0.001f * 0.4551196133134186f) * value); + break; + case 4: + instance->extSidechain = value >= 0.5f; + 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) { + Engine *instance = reinterpret_cast(handle); +#ifdef WASM + const float *x[1] = {inputs[0]}; + const float *xSc[1] = {instance->extSidechain ? inputs[1] : inputs[0]}; + float *y[1] = {outputs[0]}; + instance->noise_gate.process(x, xSc, y, n_samples); +#else + instance->noise_gate.process({inputs[0]}, {instance->extSidechain ? inputs[1] : inputs[0]}, {outputs[0]}, n_samples); +#endif +} + +} diff --git a/examples/fxpp_noise_gate/src/ios.json b/examples/fxpp_noise_gate/src/ios.json new file mode 100644 index 0000000..0d14084 --- /dev/null +++ b/examples/fxpp_noise_gate/src/ios.json @@ -0,0 +1,5 @@ +{ + "ios": { + "productBundleIdentifier": "com.orastron.bw_example_fxpp_noise_gate" + } +} diff --git a/examples/fxpp_noise_gate/src/lv2.json b/examples/fxpp_noise_gate/src/lv2.json new file mode 100644 index 0000000..426b8b4 --- /dev/null +++ b/examples/fxpp_noise_gate/src/lv2.json @@ -0,0 +1,12 @@ +{ + "lv2": { + "prefixes": { + "bw_examples": "https://www.orastron.com/brickworks/examples/" + }, + "uri": "@bw_examples:fxpp_noise_gate", + "types": [ "@lv2:GatePlugin" ], + "version": "1.0", + "busSymbols": [ "input", "output", "sidechain_in" ], + "parameterSymbols": [ "threshold", "ratio", "attack", "release", "ext_sidechain" ] + } +} diff --git a/examples/fxpp_noise_gate/src/product.json b/examples/fxpp_noise_gate/src/product.json new file mode 100644 index 0000000..83b7f05 --- /dev/null +++ b/examples/fxpp_noise_gate/src/product.json @@ -0,0 +1,85 @@ +{ + "product": { + "name": "Brickworks noise gate example (C++)", + "version": "1.1.0", + "buildVersion": "1", + "bundleName": "bw_example_fxpp_noise_gate", + "buses": [ + { + "type": "audio", + "direction": "input", + "channels": "mono", + "name": "Input", + "shortName": "Input" + }, + { + "type": "audio", + "direction": "output", + "channels": "mono", + "name": "Output", + "shortName": "Output" + }, + { + "type": "audio", + "direction": "input", + "channels": "mono", + "name": "Sidechain input", + "shortName": "Sidechain in", + "sidechain": true, + "cv": false, + "optional": true + } + ], + "parameters": [ + { + "name": "Threshold", + "shortName": "Threshold", + "direction": "input", + "defaultValue": 0.0, + "minimum": -60.0, + "maximum": 0.0, + "unit": "db", + "map": "linear" + }, + { + "name": "Ratio", + "shortName": "Ratio", + "direction": "input", + "defaultValue": 1.0, + "minimum": 1.0, + "maximum": 20.0, + "map": "linear" + }, + { + "name": "Attack", + "shortName": "Attack", + "direction": "input", + "defaultValue": 20.0, + "minimum": 1.0, + "maximum": 2000.0, + "unit": "ms", + "map": "logarithmic" + }, + { + "name": "Release", + "shortName": "Release", + "direction": "input", + "defaultValue": 250.0, + "minimum": 1.0, + "maximum": 2000.0, + "unit": "ms", + "map": "logarithmic" + }, + { + "name": "External sidechain", + "shortName": "Ext sidechain", + "direction": "input", + "defaultValue": 0.0, + "minimum": 0.0, + "maximum": 1.0, + "toggled": true, + "map": "linear" + } + ] + } +} diff --git a/examples/fxpp_noise_gate/src/vst3.json b/examples/fxpp_noise_gate/src/vst3.json new file mode 100644 index 0000000..9100a63 --- /dev/null +++ b/examples/fxpp_noise_gate/src/vst3.json @@ -0,0 +1,11 @@ +{ + "vst3": { + "plugin": { + "cid": "61e80a3948ec44ca924cd7b65f784609" + }, + "controller": { + "cid": "9630e7c773d64256bf06438cb4d914c0" + }, + "subCategory": "Fx|Dynamics" + } +} diff --git a/examples/tibia_clean.sh b/examples/tibia_clean.sh index 02687b9..fb2770b 100755 --- a/examples/tibia_clean.sh +++ b/examples/tibia_clean.sh @@ -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 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" +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 fx_noise_gate 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 fxpp_noise_gate synthpp_simple" for d in $dirs; do echo Removing data files for $d diff --git a/examples/tibia_gen.sh b/examples/tibia_gen.sh index 1872fa9..e239882 100755 --- a/examples/tibia_gen.sh +++ b/examples/tibia_gen.sh @@ -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 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" + 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 fx_noise_gate 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 fxpp_noise_gate synthpp_simple" else dirs="$1" fi