new bwpp_{notch,wah} + examples

This commit is contained in:
Stefano D'Angelo 2023-06-20 15:12:45 +02:00
parent dbff09f83c
commit 65bc52b55e
16 changed files with 722 additions and 0 deletions

View File

@ -0,0 +1,7 @@
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
TARGET = bw_example_fxpp_notch
CPP_SOURCES_EXTRA = ${ROOT_DIR}/../src/bw_example_fxpp_notch.cpp
include ${ROOT_DIR}/../../common/daisy-seed/daisy-seed.mk

View File

@ -0,0 +1,36 @@
/*
* 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 2
static struct config_pin config_pins[NUM_PINS] = {
{ 0, 15 },
{ 1, 16 }
};
#endif

View File

@ -0,0 +1,53 @@
/*
* 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_fxpp_notch.h"
void bw_example_fxpp_notch_init(bw_example_fxpp_notch *instance) {
(void)instance;
}
void bw_example_fxpp_notch_set_sample_rate(bw_example_fxpp_notch *instance, float sample_rate) {
instance->notch.setSampleRate(sample_rate);
}
void bw_example_fxpp_notch_reset(bw_example_fxpp_notch *instance) {
instance->notch.reset();
}
void bw_example_fxpp_notch_process(bw_example_fxpp_notch *instance, const float** x, float** y, int n_samples) {
instance->notch.process({x[0]}, {y[0]}, n_samples);
}
void bw_example_fxpp_notch_set_parameter(bw_example_fxpp_notch *instance, int index, float value) {
instance->params[index] = value;
switch (index) {
case p_cutoff:
instance->notch.setCutoff((20e3f - 20.f) * value * value * value + 20.f);
break;
case p_Q:
instance->notch.setQ(0.5f + 9.5f * value);
break;
}
}
float bw_example_fxpp_notch_get_parameter(bw_example_fxpp_notch *instance, int index) {
return instance->params[index];
}

View File

@ -0,0 +1,54 @@
/*
* 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_FXPP_NOTCH_H
#define _BW_EXAMPLE_FXPP_NOTCH_H
#include <bwpp_notch.h>
using namespace Brickworks;
extern "C" {
enum {
p_cutoff,
p_Q,
p_n
};
struct _bw_example_fxpp_notch {
// Sub-components
Notch<1> notch;
// Parameters
float params[p_n];
};
typedef struct _bw_example_fxpp_notch bw_example_fxpp_notch;
void bw_example_fxpp_notch_init(bw_example_fxpp_notch *instance);
void bw_example_fxpp_notch_set_sample_rate(bw_example_fxpp_notch *instance, float sample_rate);
void bw_example_fxpp_notch_reset(bw_example_fxpp_notch *instance);
void bw_example_fxpp_notch_process(bw_example_fxpp_notch *instance, const float** x, float** y, int n_samples);
void bw_example_fxpp_notch_set_parameter(bw_example_fxpp_notch *instance, int index, float value);
float bw_example_fxpp_notch_get_parameter(bw_example_fxpp_notch *instance, int index);
}
#endif

View File

@ -0,0 +1,88 @@
/*
* 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_fxpp_notch"
#define PLUGIN_VERSION "0.5.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] = {
{ "Cutoff", "Cutoff", "Hz", 0, 0, 0, 0.5f },
{ "Q", "Q", "", 0, 0, 0, 0.f }
};
// Internal API
#include "bw_example_fxpp_notch.h"
#define P_TYPE bw_example_fxpp_notch
#define P_INIT bw_example_fxpp_notch_init
#define P_SET_SAMPLE_RATE bw_example_fxpp_notch_set_sample_rate
#define P_RESET bw_example_fxpp_notch_reset
#define P_PROCESS bw_example_fxpp_notch_process
#define P_SET_PARAMETER bw_example_fxpp_notch_set_parameter
#define P_GET_PARAMETER bw_example_fxpp_notch_get_parameter
#endif

View File

@ -0,0 +1,6 @@
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
NAME := bw_example_fxpp_notch
SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_fxpp_notch.cpp
include ${ROOT_DIR}/../../common/vst3/vst3.mk

View File

@ -0,0 +1,36 @@
/*
* 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, Paolo Marrone
*/
#ifndef _VST3_CONFIG_H
#define _VST3_CONFIG_H
#define PLUGIN_SUBCATEGORY "Fx|Filter"
#define PLUGIN_GUID_1 0x42ed7e51
#define PLUGIN_GUID_2 0xd2294b82
#define PLUGIN_GUID_3 0xae102911
#define PLUGIN_GUID_4 0x1cd55cdd
#define CTRL_GUID_1 0xafd02bdf
#define CTRL_GUID_2 0xe0054347
#define CTRL_GUID_3 0xb1b0faca
#define CTRL_GUID_4 0x968932f2
#endif

View File

@ -0,0 +1,7 @@
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
TARGET = bw_example_fxpp_wah
CPP_SOURCES_EXTRA = ${ROOT_DIR}/../src/bw_example_fxpp_wah.cpp
include ${ROOT_DIR}/../../common/daisy-seed/daisy-seed.mk

View File

@ -0,0 +1,35 @@
/*
* 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 1
static struct config_pin config_pins[NUM_PINS] = {
{ 0, 15 }
};
#endif

View File

@ -0,0 +1,50 @@
/*
* 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_fxpp_wah.h"
void bw_example_fxpp_wah_init(bw_example_fxpp_wah *instance) {
(void)instance;
}
void bw_example_fxpp_wah_set_sample_rate(bw_example_fxpp_wah *instance, float sample_rate) {
instance->wah.setSampleRate(sample_rate);
}
void bw_example_fxpp_wah_reset(bw_example_fxpp_wah *instance) {
instance->wah.reset();
}
void bw_example_fxpp_wah_process(bw_example_fxpp_wah *instance, const float** x, float** y, int n_samples) {
instance->wah.process({x[0]}, {y[0]}, n_samples);
}
void bw_example_fxpp_wah_set_parameter(bw_example_fxpp_wah *instance, int index, float value) {
instance->params[index] = value;
switch (index) {
case p_wah:
instance->wah.setWah(value);
break;
}
}
float bw_example_fxpp_wah_get_parameter(bw_example_fxpp_wah *instance, int index) {
return instance->params[index];
}

View File

@ -0,0 +1,53 @@
/*
* 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_FXPP_WAH_H
#define _BW_EXAMPLE_FXPP_WAH_H
#include <bwpp_wah.h>
using namespace Brickworks;
extern "C" {
enum {
p_wah,
p_n
};
struct _bw_example_fxpp_wah {
// Sub-components
Wah<1> wah;
// Parameters
float params[p_n];
};
typedef struct _bw_example_fxpp_wah bw_example_fxpp_wah;
void bw_example_fxpp_wah_init(bw_example_fxpp_wah *instance);
void bw_example_fxpp_wah_set_sample_rate(bw_example_fxpp_wah *instance, float sample_rate);
void bw_example_fxpp_wah_reset(bw_example_fxpp_wah *instance);
void bw_example_fxpp_wah_process(bw_example_fxpp_wah *instance, const float** x, float** y, int n_samples);
void bw_example_fxpp_wah_set_parameter(bw_example_fxpp_wah *instance, int index, float value);
float bw_example_fxpp_wah_get_parameter(bw_example_fxpp_wah *instance, int index);
}
#endif

View File

@ -0,0 +1,87 @@
/*
* 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_fxpp_wah"
#define PLUGIN_VERSION "0.5.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 1
static struct config_parameter config_parameters[NUM_PARAMETERS] = {
{ "Wah", "Wah", "", 0, 0, 0, 0.5f }
};
// Internal API
#include "bw_example_fxpp_wah.h"
#define P_TYPE bw_example_fxpp_wah
#define P_INIT bw_example_fxpp_wah_init
#define P_SET_SAMPLE_RATE bw_example_fxpp_wah_set_sample_rate
#define P_RESET bw_example_fxpp_wah_reset
#define P_PROCESS bw_example_fxpp_wah_process
#define P_SET_PARAMETER bw_example_fxpp_wah_set_parameter
#define P_GET_PARAMETER bw_example_fxpp_wah_get_parameter
#endif

View File

@ -0,0 +1,6 @@
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
NAME := bw_example_fxpp_wah
SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_fxpp_wah.cpp
include ${ROOT_DIR}/../../common/vst3/vst3.mk

View File

@ -0,0 +1,36 @@
/*
* 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, Paolo Marrone
*/
#ifndef _VST3_CONFIG_H
#define _VST3_CONFIG_H
#define PLUGIN_SUBCATEGORY "Fx|Filter"
#define PLUGIN_GUID_1 0x18b26026
#define PLUGIN_GUID_2 0xc0ab4b9c
#define PLUGIN_GUID_3 0x815e8de8
#define PLUGIN_GUID_4 0xa85b3417
#define CTRL_GUID_1 0x6c3a4f05
#define CTRL_GUID_2 0xe0444e70
#define CTRL_GUID_3 0xa581c0d2
#define CTRL_GUID_4 0x6a5bd4be
#endif

87
include/bwpp_notch.h Normal file
View File

@ -0,0 +1,87 @@
/*
* 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 BWPP_NOTCH_H
#define BWPP_NOTCH_H
#include <bw_notch.h>
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Notch {
public:
Notch();
void setSampleRate(float sampleRate);
void reset(float x0 = 0.f);
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
void setCutoff(float value);
void setQ(float value);
private:
bw_notch_coeffs coeffs;
bw_notch_state states[N_CHANNELS];
bw_notch_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
Notch<N_CHANNELS>::Notch() {
bw_notch_init(&coeffs);
for (unsigned int i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void Notch<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_notch_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void Notch<N_CHANNELS>::reset(float x0) {
bw_notch_reset_coeffs(&coeffs);
for (unsigned int i = 0; i < N_CHANNELS; i++)
bw_notch_reset_state(&coeffs, states + i, x0);
}
template<BW_SIZE_T N_CHANNELS>
void Notch<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_notch_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
void Notch<N_CHANNELS>::setCutoff(float value) {
bw_notch_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Notch<N_CHANNELS>::setQ(float value) {
bw_notch_set_Q(&coeffs, value);
}
}
#endif

81
include/bwpp_wah.h Normal file
View File

@ -0,0 +1,81 @@
/*
* 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 BWPP_WAH_H
#define BWPP_WAH_H
#include <bw_wah.h>
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Wah {
public:
Wah();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
void setWah(float value);
private:
bw_wah_coeffs coeffs;
bw_wah_state states[N_CHANNELS];
bw_wah_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
Wah<N_CHANNELS>::Wah() {
bw_wah_init(&coeffs);
for (unsigned int i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void Wah<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_wah_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void Wah<N_CHANNELS>::reset() {
bw_wah_reset_coeffs(&coeffs);
for (unsigned int i = 0; i < N_CHANNELS; i++)
bw_wah_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
void Wah<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_wah_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
void Wah<N_CHANNELS>::setWah(float value) {
bw_wah_set_wah(&coeffs, value);
}
}
#endif