bwpp_note_queue + synthpp_poly + inline all C++ methods

This commit is contained in:
Stefano D'Angelo 2023-06-30 19:44:02 +02:00
parent 5245adea14
commit de52df395e
54 changed files with 1146 additions and 289 deletions

1
TODO
View File

@ -64,6 +64,7 @@ code:
* src post filt?
* bw_env_gen process_multi gate const?
* c++ get coeffs/state? or public?
* bw_buf invert src dest order?
build system:
* make makefiles handle paths with spaces etc

View File

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

View File

@ -0,0 +1,72 @@
/*
* 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_cc {
int param_index;
unsigned char cc;
};
#define NUM_CCS 38
static struct config_cc config_ccs[NUM_CCS] = {
{ 0, 7 }, // Volume
{ 1, 3 }, // Master tune
{ 2, 5 }, // Portamento
{ 3, 9 }, // Modulation mix
{ 4, 14 }, // VCO1 modulation
{ 5, 15 }, // VCO1 coarse
{ 6, 20 }, // VCO1 fine
{ 7, 21 }, // VCO1 waveform
{ 8, 22 }, // VCO1 pulse width/slope
{ 9, 23 }, // VCO1 level
{ 10, 24 }, // VCO2 modulation
{ 11, 25 }, // VCO2 coarse
{ 12, 26 }, // VCO2 fine
{ 13, 27 }, // VCO2 waveform
{ 14, 28 }, // VCO2 pulse width/slope
{ 15, 29 }, // VCO2 level
{ 16, 30 }, // VCO3 keyboard control
{ 17, 31 }, // VCO3 coarse
{ 18, 85 }, // VCO3 fine
{ 19, 86 }, // VCO3 waveform
{ 20, 87 }, // VCO3 puslse width/slope
{ 21, 89 }, // VCO3 level
{ 22, 90 }, // Noise color
{ 23, 102 }, // Noise level
{ 24, 103 }, // VCF modulation
{ 25, 104 }, // VCF keyboard control
{ 26, 74 }, // VCF cutoff
{ 27, 71 }, // VCF Q
{ 28, 105 }, // VCF contour
{ 29, 106 }, // VCF attack
{ 30, 107 }, // VCF decay
{ 31, 108 }, // VCF sustain
{ 32, 109 }, // VCF release
{ 33, 73 }, // VCA attack
{ 34, 110 }, // VCA decay
{ 35, 111 }, // VCA sustain
{ 36, 72 }, // VCA release
{ 37, 112 } // A440
};
#endif

View File

@ -0,0 +1,398 @@
/*
* 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_synthpp_poly.h"
#include <bw_math.h>
#include <bw_buf.h>
#include <bw_voice_alloc.h>
void bw_example_synthpp_poly_init(bw_example_synthpp_poly *instance) {
instance->vco1OscSaw.setAntialiasing(true);
instance->vco1OscPulse.setAntialiasing(true);
instance->vco1OscTri.setAntialiasing(true);
instance->vco2OscSaw.setAntialiasing(true);
instance->vco2OscPulse.setAntialiasing(true);
instance->vco2OscTri.setAntialiasing(true);
instance->vco3OscSaw.setAntialiasing(true);
instance->vco3OscPulse.setAntialiasing(true);
instance->vco3OscTri.setAntialiasing(true);
instance->a440PhaseGen.setFrequency(440.f);
instance->rand_state = 0xbaddecaf600dfeed;
for (int i = 0; i < N_VOICES; i++) {
instance->voices[i].instance = instance;
instance->voices[i].index = i;
}
}
void bw_example_synthpp_poly_set_sample_rate(bw_example_synthpp_poly *instance, float sample_rate) {
instance->vco1OscPulse.setSampleRate(sample_rate);
instance->vco1OscTri.setSampleRate(sample_rate);
instance->vco1Gain.setSampleRate(sample_rate);
instance->vco2OscPulse.setSampleRate(sample_rate);
instance->vco2OscTri.setSampleRate(sample_rate);
instance->vco2Gain.setSampleRate(sample_rate);
instance->vco3OscPulse.setSampleRate(sample_rate);
instance->vco3OscTri.setSampleRate(sample_rate);
instance->vco3Gain.setSampleRate(sample_rate);
instance->noiseGen.setSampleRate(sample_rate);
instance->pinkFilt.setSampleRate(sample_rate);
instance->noiseGain.setSampleRate(sample_rate);
instance->vcfEnvGen.setSampleRate(sample_rate);
instance->vcaEnvGen.setSampleRate(sample_rate);
instance->a440PhaseGen.setSampleRate(sample_rate);
instance->gain.setSampleRate(sample_rate);
instance->ppm.setSampleRate(sample_rate);
for (int i = 0; i < N_VOICES; i++) {
instance->voices[i].vco1PhaseGen.setSampleRate(sample_rate);
instance->voices[i].vco2PhaseGen.setSampleRate(sample_rate);
instance->voices[i].vco3PhaseGen.setSampleRate(sample_rate);
instance->voices[i].vcf.setSampleRate(sample_rate);
}
}
void bw_example_synthpp_poly_reset(bw_example_synthpp_poly *instance) {
const float v = instance->params[p_vcf_cutoff];
const float cutoff = 20.f + (20e3f - 20.f) * v * v * v;
for (int i = 0; i < N_VOICES; i++)
instance->voices[i].vcf.setCutoff(bw_clipf(cutoff, 20.f, 20e3f));
instance->noteQueue = NoteQueue();
instance->vco1OscPulse.reset();
instance->vco1OscTri.reset();
instance->vco1Gain.reset();
instance->vco2OscPulse.reset();
instance->vco2OscTri.reset();
instance->vco2Gain.reset();
instance->vco3OscPulse.reset();
instance->vco3OscTri.reset();
instance->vco3Gain.reset();
instance->oscFilt.reset();
instance->pinkFilt.reset();
instance->noiseGain.reset();
instance->vcfEnvGen.reset();
instance->vcaEnvGen.reset();
instance->a440PhaseGen.reset();
instance->gain.reset();
instance->ppm.reset();
for (int i = 0; i < N_VOICES; i++) {
instance->voices[i].vco1PhaseGen.reset();
instance->voices[i].vco2PhaseGen.reset();
instance->voices[i].vco3PhaseGen.reset();
instance->voices[i].vcf.reset();
instance->voices[i].gate = 0;
}
instance->pitch_bend = 0.f;
instance->mod_wheel = 0.f;
}
static void note_on(void *BW_RESTRICT voice, unsigned char note, float velocity) {
(void)velocity;
bw_example_synthpp_poly_voice *v = (bw_example_synthpp_poly_voice *)voice;
v->note = note;
v->gate = 1;
}
static void note_off(void *BW_RESTRICT voice, float velocity) {
(void)velocity;
bw_example_synthpp_poly_voice *v = (bw_example_synthpp_poly_voice *)voice;
v->gate = 0;
}
static unsigned char get_note(void *BW_RESTRICT voice) {
bw_example_synthpp_poly_voice *v = (bw_example_synthpp_poly_voice *)voice;
return v->note;
}
static char is_free(void *BW_RESTRICT voice) {
bw_example_synthpp_poly_voice *v = (bw_example_synthpp_poly_voice *)voice;
bw_env_gen_phase phase = v->instance->vcaEnvGen.getPhase(v->index);
return !v->gate && phase == bw_env_gen_phase_off;
}
#include <stdio.h>
void bw_example_synthpp_poly_process(bw_example_synthpp_poly *instance, const float** x, float** y, int n_samples) {
// FIXME: control-rate modulations are asynchronous here...
// it's all good as long as hosts gives us buffers whose length is a multiple of 32,
// otherwise it's probably still ok but a bit "swingy"
(void)x;
static bw_voice_alloc_opts alloc_opts = { bw_voice_alloc_mode_low, note_on, note_off, get_note, is_free };
void *voices[N_VOICES];
for (int i = 0; i < N_VOICES; i++)
voices[i] = (void *)(instance->voices + i);
bw_voice_alloc(&alloc_opts, &instance->noteQueue.queue, voices, N_VOICES);
bw_note_queue_clear(&instance->noteQueue.queue);
const float df1 =
6.f * instance->params[p_vco1_coarse] - 3.f
+ 2.f * instance->pitch_bend - 1.f
+ 8.333333333333333e-2f * (2.f * (instance->params[p_master_tune] + instance->params[p_vco1_fine]) - 71.f);
const float df2 =
6.f * instance->params[p_vco2_coarse] - 3.f
+ 2.f * instance->pitch_bend - 1.f
+ 8.333333333333333e-2f * (2.f * (instance->params[p_master_tune] + instance->params[p_vco2_fine]) - 71.f);
const float df3 =
6.f * instance->params[p_vco3_coarse] - 3.f
+ 2.f * instance->pitch_bend - 1.f
+ 8.333333333333333e-2f * (2.f * (instance->params[p_master_tune] + instance->params[p_vco3_fine]) - 71.f);
for (int i = 0; i < N_VOICES; i++) {
int n3 = instance->params[p_vco3_kbd] >= 0.5f ? instance->voices[i].note : 0;
instance->voices[i].vco1PhaseGen.setFrequency(440.f * bw_pow2f_3(df1 + 8.333333333333333e-2f * instance->voices[i].note));
instance->voices[i].vco2PhaseGen.setFrequency(440.f * bw_pow2f_3(df2 + 8.333333333333333e-2f * instance->voices[i].note));
instance->voices[i].vco3PhaseGen.setFrequency(440.f * bw_pow2f_3(df3 + 8.333333333333333e-2f * n3));
}
const float vcf_mod_k = 0.3f * instance->params[p_vcf_mod];
std::array<float *, N_VOICES> b0, b1, b2, b3, b4, na;
std::array<const float *, N_VOICES> cb0, cb1, cb2, cb3, cb4;
std::array<char, N_VOICES> gates;
for (int j = 0; j < N_VOICES; j++) {
b0.data()[j] = instance->voices[j].buf[0];
b1.data()[j] = instance->voices[j].buf[1];
b2.data()[j] = instance->voices[j].buf[2];
b3.data()[j] = instance->voices[j].buf[3];
b4.data()[j] = instance->voices[j].buf[4];
na.data()[j] = nullptr;
cb0.data()[j] = instance->voices[j].buf[0];
cb1.data()[j] = instance->voices[j].buf[1];
cb2.data()[j] = instance->voices[j].buf[2];
cb3.data()[j] = instance->voices[j].buf[3];
cb4.data()[j] = instance->voices[j].buf[4];
gates.data()[j] = instance->voices[j].gate;
}
for (int i = 0; i < n_samples; i += BUFFER_SIZE) {
float *out = y[0] + i;
int n = bw_minf(n_samples - i, BUFFER_SIZE);
for (int j = 0; j < N_VOICES; j++)
instance->voices[j].vco3PhaseGen.process({nullptr}, {b0.data()[j]}, {b1.data()[j]}, n);
if (instance->params[p_vco3_waveform] >= (1.f / 4.f + 1.f / 2.f)) {
instance->vco3OscTri.process(cb0, cb1, b0, n);
instance->vco3OscPulse.reset();
} else if (instance->params[p_vco3_waveform] >= (1.f / 4.f)) {
instance->vco3OscPulse.process(cb0, cb1, b0, n);
instance->vco3OscTri.reset();
} else {
instance->vco3OscSaw.process(cb0, cb1, b0, n);
instance->vco3OscPulse.reset();
instance->vco3OscTri.reset();
}
instance->noiseGen.process(b1, n);
if (instance->params[p_noise_color] >= 0.5f)
instance->pinkFilt.process(cb1, b1, n);
else
instance->pinkFilt.reset(); // FIXME: calling this here is sloppy coding
for (int j = 0; j < N_VOICES; j++)
bw_buf_scale(b1.data()[j], b1.data()[j], 5.f, n);
float vcf_mod[N_VOICES];
for (int j = 0; j < N_VOICES; j++) {
for (int k = 0; k < n; k++)
b2.data()[j][k] = instance->mod_wheel * (b0.data()[j][k] + instance->params[p_mod_mix] * (b1.data()[j][k] - b0.data()[j][k]));
vcf_mod[j] = vcf_mod_k * b2.data()[j][0];
}
for (int j = 0; j < N_VOICES; j++) {
bw_buf_scale(b3.data()[j], b2.data()[j], instance->params[p_vco1_mod], n);
instance->voices[j].vco1PhaseGen.process({b3.data()[j]}, {b3.data()[j]}, {b4.data()[j]}, n);
}
if (instance->params[p_vco1_waveform] >= (1.f / 4.f + 1.f / 2.f)) {
instance->vco1OscTri.process(cb3, cb4, b3, n);
instance->vco1OscPulse.reset();
} else if (instance->params[p_vco1_waveform] >= (1.f / 4.f)) {
instance->vco1OscPulse.process(cb3, cb4, b3, n);
instance->vco1OscTri.reset();
} else {
instance->vco1OscSaw.process(cb3, cb4, b3, n);
instance->vco1OscPulse.reset();
instance->vco1OscTri.reset();
}
for (int j = 0; j < N_VOICES; j++) {
bw_buf_scale(b2.data()[j], b2.data()[j], instance->params[p_vco2_mod], n);
instance->voices[j].vco2PhaseGen.process({b2.data()[j]}, {b2.data()[j]}, {b4.data()[j]}, n);
}
if (instance->params[p_vco2_waveform] >= (1.f / 4.f + 1.f / 2.f)) {
instance->vco2OscTri.process(cb2, cb4, b2, n);
instance->vco2OscPulse.reset();
} else if (instance->params[p_vco2_waveform] >= (1.f / 4.f)) {
instance->vco2OscPulse.process(cb2, cb4, b2, n);
instance->vco2OscTri.reset();
} else {
instance->vco2OscSaw.process(cb2, cb4, b2, n);
instance->vco2OscPulse.reset();
instance->vco2OscTri.reset();
}
instance->vco1Gain.process(cb3, b3, n);
instance->vco2Gain.process(cb2, b2, n);
instance->vco3Gain.process(cb0, b0, n);
instance->noiseGain.process(cb1, b1, n);
for (int j = 0; j < N_VOICES; j++) {
bw_buf_mix(b0.data()[j], b0.data()[j], b2.data()[j], n);
bw_buf_mix(b0.data()[j], b0.data()[j], b3.data()[j], n);
}
instance->oscFilt.process(cb0, b0, n);
const float k = instance->params[p_noise_color] >= 0.5f
? 6.f * instance->noiseGen.getScalingK() * instance->pinkFilt.getScalingK()
: 0.1f * instance->noiseGen.getScalingK();
for (int j = 0; j < N_VOICES; j++) {
bw_buf_scale(b1.data()[j], b1.data()[j], k, n);
bw_buf_mix(b0.data()[j], b0.data()[j], b1.data()[j], n);
}
instance->vcfEnvGen.process(gates, na, n);
for (int j = 0; j < N_VOICES; j++) {
float v = instance->params[p_vcf_cutoff] + instance->params[p_vcf_contour] * instance->vcfEnvGen.getYZ1(j) + vcf_mod[j];
float cutoff = 20.f + (20e3f - 20.f) * v * v * v;
if (instance->params[p_vcf_kbd_ctrl] >= (1.f / 6.f + 2.f / 3.f))
cutoff *= bw_pow2f_3(8.333333333333333e-2f * (instance->voices[j].note - 60));
else if (instance->params[p_vcf_kbd_ctrl] >= (1.f / 6.f + 1.f / 3.f))
cutoff *= bw_pow2f_3((0.793700525984100f * 8.333333333333333e-2f) * (instance->voices[j].note - 60));
else if (instance->params[p_vcf_kbd_ctrl] >= (1.f / 6.f + 2.f / 3.f))
cutoff *= bw_pow2f_3((0.629960524947437f * 8.333333333333333e-2f) * (instance->voices[j].note - 60));
// otherwise no kbd control
instance->voices[j].vcf.setCutoff(bw_clipf(cutoff, 20.f, 20e3f));
instance->voices[j].vcf.process({b0.data()[j]}, {b0.data()[j]}, {nullptr}, {nullptr}, n);
}
instance->vcaEnvGen.process(gates, b1, n);
for (int j = 0; j < N_VOICES; j++)
bw_buf_mul(b0.data()[j], b0.data()[j], b1.data()[j], n);
bw_buf_fill(out, 0.f, n);
for (int j = 0; j < N_VOICES; j++)
bw_buf_mix(out, out, b0.data()[j], n);
instance->a440PhaseGen.process({nullptr}, {instance->buf}, {nullptr}, n);
oscSinProcess<1>({instance->buf}, {instance->buf}, n);
if (instance->params[p_a440] >= 0.5f)
bw_buf_mix(out, out, instance->buf, n);
instance->gain.process({out}, {out}, n);
instance->ppm.process({out}, {nullptr}, n);
}
}
void bw_example_synthpp_poly_set_parameter(bw_example_synthpp_poly *instance, int index, float value) {
instance->params[index] = value;
switch (index) {
case p_volume:
instance->gain.setGainLin(value * value * value);
break;
case p_portamento:
for (int i = 0; i < N_VOICES; i++) {
instance->voices[i].vco1PhaseGen.setPortamentoTau(value);
instance->voices[i].vco2PhaseGen.setPortamentoTau(value);
instance->voices[i].vco3PhaseGen.setPortamentoTau(value);
}
break;
case p_vco1_pw_slope:
instance->vco1OscPulse.setPulseWidth(value);
instance->vco1OscTri.setSlope(bw_clipf(value, 0.001f, 0.999f));
break;
case p_vco1_level:
instance->vco1Gain.setGainLin(value * value * value);
break;
case p_vco2_pw_slope:
instance->vco2OscPulse.setPulseWidth(value);
instance->vco2OscTri.setSlope(bw_clipf(value, 0.001f, 0.999f));
break;
case p_vco2_level:
instance->vco2Gain.setGainLin(value * value * value);
break;
case p_vco3_pw_slope:
instance->vco3OscPulse.setPulseWidth(value);
instance->vco3OscTri.setSlope(bw_clipf(value, 0.001f, 0.999f));
break;
case p_vco3_level:
instance->vco3Gain.setGainLin(value * value * value);
break;
case p_noise_level:
instance->noiseGain.setGainLin(value * value * value);
break;
case p_vcf_Q:
{
const float v = 0.5f + 9.5f * value;
for (int i = 0; i < N_VOICES; i++)
instance->voices[i].vcf.setQ(v);
break;
}
case p_vcf_attack:
instance->vcfEnvGen.setAttack(value);
break;
case p_vcf_decay:
instance->vcfEnvGen.setDecay(value);
break;
case p_vcf_sustain:
instance->vcfEnvGen.setSustain(value);
break;
case p_vcf_release:
instance->vcfEnvGen.setRelease(value);
break;
case p_vca_attack:
instance->vcaEnvGen.setAttack(value);
break;
case p_vca_decay:
instance->vcaEnvGen.setDecay(value);
break;
case p_vca_sustain:
instance->vcaEnvGen.setSustain(value);
break;
case p_vca_release:
instance->vcaEnvGen.setRelease(value);
break;
}
}
float bw_example_synthpp_poly_get_parameter(bw_example_synthpp_poly *instance, int index) {
if (index < p_n)
return instance->params[index];
const float v = instance->ppm.getYZ1(0);
return v < -200.f ? 0.f : bw_clipf(0.01666666666666666f * v + 1.f, 0.f, 1.f);
}
void bw_example_synthpp_poly_note_on(bw_example_synthpp_poly *instance, char note, char velocity) {
instance->noteQueue.add(note, velocity != 0, velocity, false);
}
void bw_example_synthpp_poly_note_off(bw_example_synthpp_poly *instance, char note) {
instance->noteQueue.add(note, false, 0, false);
}
void bw_example_synthpp_poly_pitch_bend(bw_example_synthpp_poly *instance, int value) {
instance->pitch_bend = (value - 0x2000) / (float)0x4000;
}
void bw_example_synthpp_poly_mod_wheel(bw_example_synthpp_poly *instance, char value) {
instance->mod_wheel = (float)value / 0x80;
}

View File

@ -0,0 +1,160 @@
/*
* 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_SYNTHPP_MONO_H
#define _BW_EXAMPLE_SYNTHPP_MONO_H
#include <bwpp_note_queue.h>
#include <bwpp_phase_gen.h>
#include <bwpp_osc_saw.h>
#include <bwpp_osc_pulse.h>
#include <bwpp_osc_tri.h>
#include <bwpp_osc_sin.h>
#include <bwpp_osc_filt.h>
#include <bwpp_noise_gen.h>
#include <bwpp_pink_filt.h>
#include <bwpp_svf.h>
#include <bwpp_env_gen.h>
#include <bwpp_gain.h>
#include <bwpp_ppm.h>
using namespace Brickworks;
extern "C" {
enum {
p_volume,
p_master_tune,
p_portamento,
p_mod_mix,
p_vco1_mod,
p_vco1_coarse,
p_vco1_fine,
p_vco1_waveform,
p_vco1_pw_slope,
p_vco1_level,
p_vco2_mod,
p_vco2_coarse,
p_vco2_fine,
p_vco2_waveform,
p_vco2_pw_slope,
p_vco2_level,
p_vco3_kbd,
p_vco3_coarse,
p_vco3_fine,
p_vco3_waveform,
p_vco3_pw_slope,
p_vco3_level,
p_noise_color,
p_noise_level,
p_vcf_mod,
p_vcf_kbd_ctrl,
p_vcf_cutoff,
p_vcf_Q,
p_vcf_contour,
p_vcf_attack,
p_vcf_decay,
p_vcf_sustain,
p_vcf_release,
p_vca_attack,
p_vca_decay,
p_vca_sustain,
p_vca_release,
p_a440,
p_n
};
#define BUFFER_SIZE 32
#define N_VOICES 8
struct _bw_example_synthpp_poly;
typedef struct _bw_example_synthpp_poly bw_example_synthpp_poly;
struct _bw_example_synthpp_poly_voice {
PhaseGen<1> vco1PhaseGen;
PhaseGen<1> vco2PhaseGen;
PhaseGen<1> vco3PhaseGen;
SVF<1> vcf;
unsigned char note;
char gate;
float buf[5][BUFFER_SIZE];
bw_example_synthpp_poly *instance;
int index;
};
typedef struct _bw_example_synthpp_poly_voice bw_example_synthpp_poly_voice;
struct _bw_example_synthpp_poly {
// Sub-components
NoteQueue noteQueue;
OscSaw<N_VOICES> vco1OscSaw;
OscPulse<N_VOICES> vco1OscPulse;
OscTri<N_VOICES> vco1OscTri;
Gain<N_VOICES> vco1Gain;
OscSaw<N_VOICES> vco2OscSaw;
OscPulse<N_VOICES> vco2OscPulse;
OscTri<N_VOICES> vco2OscTri;
Gain<N_VOICES> vco2Gain;
OscSaw<N_VOICES> vco3OscSaw;
OscPulse<N_VOICES> vco3OscPulse;
OscTri<N_VOICES> vco3OscTri;
Gain<N_VOICES> vco3Gain;
OscFilt<N_VOICES> oscFilt;
NoiseGen<N_VOICES> noiseGen;
PinkFilt<N_VOICES> pinkFilt;
Gain<N_VOICES> noiseGain;
EnvGen<N_VOICES> vcfEnvGen;
EnvGen<N_VOICES> vcaEnvGen;
PhaseGen<1> a440PhaseGen;
Gain<1> gain;
PPM<1> ppm;
bw_example_synthpp_poly_voice voices[N_VOICES];
// Parameters
float params[p_n];
// States
uint64_t rand_state;
float pitch_bend;
float mod_wheel;
// Buffers
float buf[BUFFER_SIZE];
_bw_example_synthpp_poly() : noiseGen(&rand_state) {}
};
void bw_example_synthpp_poly_init(bw_example_synthpp_poly *instance);
void bw_example_synthpp_poly_set_sample_rate(bw_example_synthpp_poly *instance, float sample_rate);
void bw_example_synthpp_poly_reset(bw_example_synthpp_poly *instance);
void bw_example_synthpp_poly_process(bw_example_synthpp_poly *instance, const float** x, float** y, int n_samples);
void bw_example_synthpp_poly_set_parameter(bw_example_synthpp_poly *instance, int index, float value);
float bw_example_synthpp_poly_get_parameter(bw_example_synthpp_poly *instance, int index);
void bw_example_synthpp_poly_note_on(bw_example_synthpp_poly *instance, char note, char velocity);
void bw_example_synthpp_poly_note_off(bw_example_synthpp_poly *instance, char note);
void bw_example_synthpp_poly_pitch_bend(bw_example_synthpp_poly *instance, int value);
void bw_example_synthpp_poly_mod_wheel(bw_example_synthpp_poly *instance, char value);
}
#endif

View File

@ -0,0 +1,125 @@
/*
* 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_synthpp_poly"
#define PLUGIN_VERSION "0.5.0"
#define NUM_BUSES_IN 0
#define NUM_BUSES_OUT 1
#define NUM_CHANNELS_IN 0
#define NUM_CHANNELS_OUT 1
static struct config_io_bus config_buses_out[NUM_BUSES_OUT] = {
{ "Audio out", 1, 0, 0, IO_MONO }
};
#define NUM_PARAMETERS 39
static struct config_parameter config_parameters[NUM_PARAMETERS] = {
{ "Volume", "Volume", "", 0, 0, 0, 0.5f },
{ "Master tune", "Master tune", "st", 0, 0, 0, 0.5f },
{ "Portamento", "Portamento", "s", 0, 0, 0, 0.f },
{ "Modulation mix", "Mod mix", "%", 0, 0, 0, 0.f },
{ "VCO1 modulation", "VCO1 mod", "%", 0, 0, 0, 0.f },
{ "VCO1 coarse", "VCO1 coarse", "", 0, 0, 6, 0.5f },
{ "VCO1 fine", "VCO1 fine", "st", 0, 0, 0, 0.5f },
{ "VCO1 waveform", "VCO1 wave", "", 0, 0, 2, 0.f },
{ "VCO1 pulse width/slope", "VCO1 pw/slope", "%", 0, 0, 0, 0.5f },
{ "VCO1 level", "VCO1 level", "%", 0, 0, 0, 1.f },
{ "VCO2 modulation", "VCO2 mod", "%", 0, 0, 0, 0.f },
{ "VCO2 coarse", "VCO2 coarse", "", 0, 0, 6, 0.5f },
{ "VCO2 fine", "VCO2 fine", "st", 0, 0, 0, 0.5f },
{ "VCO2 waveform", "VCO2 wave", "", 0, 0, 2, 0.f },
{ "VCO2 pulse width/slope", "VCO2 pw/slope", "%", 0, 0, 0, 0.5f },
{ "VCO2 level", "VCO2 level", "%", 0, 0, 0, 0.f },
{ "VCO3 kyboard control", "VCO3 kbd ctrl", "", 0, 0, 1, 1.f },
{ "VCO3 coarse", "VCO3 coarse", "", 0, 0, 6, 0.5f },
{ "VCO3 fine", "VCO3 fine", "st", 0, 0, 0, 0.5f },
{ "VCO3 waveform", "VCO3 wave", "", 0, 0, 2, 0.f },
{ "VCO3 pulse width/slope", "VCO3 pw/slope", "%", 0, 0, 0, 0.5f },
{ "VCO3 level", "VCO3 level", "%", 0, 0, 0, 0.f },
{ "Noise color", "Noise color", "", 0, 0, 1, 0.f },
{ "Noise level", "Noise level", "%", 0, 0, 0, 0.f },
{ "VCF modulation", "VCF mod", "%", 0, 0, 0, 0.f },
{ "VCF keyboard control", "VCF kbd ctrl", "", 0, 0, 3, 0.f },
{ "VCF cutoff", "VCF cutoff", "Hz", 0, 0, 0, 1.f },
{ "VCF Q", "VCF Q", "", 0, 0, 0, 0.f },
{ "VCF contour", "VCF contour", "%", 0, 0, 0, 0.f },
{ "VCF attack", "VCF attack", "s", 0, 0, 0, 0.f },
{ "VCF decay", "VCF decay", "s", 0, 0, 0, 0.f },
{ "VCF sustain", "VCF sustain", "%", 0, 0, 0, 1.f },
{ "VCF release", "VCF release", "s", 0, 0, 0, 0.f },
{ "VCA attack", "VCA attack", "s", 0, 0, 0, 0.f },
{ "VCA decay", "VCA decay", "s", 0, 0, 0, 0.f },
{ "VCA sustain", "VCA sustain", "%", 0, 0, 0, 1.f },
{ "VCA release", "VCA release", "s", 0, 0, 0, 0.f },
{ "A440", "A440", "", 0, 0, 1, 0.f },
{ "Level", "Level", "", 1, 0, 0, 0.f }
};
// Internal API
#include "bw_example_synthpp_poly.h"
#define P_TYPE bw_example_synthpp_poly
#define P_INIT bw_example_synthpp_poly_init
#define P_SET_SAMPLE_RATE bw_example_synthpp_poly_set_sample_rate
#define P_RESET bw_example_synthpp_poly_reset
#define P_PROCESS bw_example_synthpp_poly_process
#define P_SET_PARAMETER bw_example_synthpp_poly_set_parameter
#define P_GET_PARAMETER bw_example_synthpp_poly_get_parameter
#define P_NOTE_ON bw_example_synthpp_poly_note_on
#define P_NOTE_OFF bw_example_synthpp_poly_note_off
#define P_PITCH_BEND bw_example_synthpp_poly_pitch_bend
#define P_MOD_WHEEL bw_example_synthpp_poly_mod_wheel
#endif

View File

@ -0,0 +1,6 @@
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
NAME := bw_example_synthpp_poly
SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_synthpp_poly.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 "Instrument|Synth"
#define PLUGIN_GUID_1 0x7f75d73b
#define PLUGIN_GUID_2 0xf5aa4d9d
#define PLUGIN_GUID_3 0xba2b1d54
#define PLUGIN_GUID_4 0x83d45cfe
#define CTRL_GUID_1 0x183b9664
#define CTRL_GUID_2 0xaca74eaf
#define CTRL_GUID_3 0xad09b16b
#define CTRL_GUID_4 0x5d702155
#endif

View File

@ -46,26 +46,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
AP1<N_CHANNELS>::AP1() {
inline AP1<N_CHANNELS>::AP1() {
bw_ap1_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void AP1<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void AP1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ap1_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void AP1<N_CHANNELS>::reset(float x0) {
inline void AP1<N_CHANNELS>::reset(float x0) {
bw_ap1_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_ap1_reset_state(&coeffs, states + i, x0);
}
template<BW_SIZE_T N_CHANNELS>
void AP1<N_CHANNELS>::process(
inline void AP1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -73,7 +73,7 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void AP1<N_CHANNELS>::setCutoff(float value) {
inline void AP1<N_CHANNELS>::setCutoff(float value) {
bw_ap1_set_cutoff(&coeffs, value);
}
}

View File

@ -47,26 +47,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
AP2<N_CHANNELS>::AP2() {
inline AP2<N_CHANNELS>::AP2() {
bw_ap2_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void AP2<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void AP2<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ap2_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void AP2<N_CHANNELS>::reset(float x0) {
inline void AP2<N_CHANNELS>::reset(float x0) {
bw_ap2_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_ap2_reset_state(&coeffs, states + i, x0);
}
template<BW_SIZE_T N_CHANNELS>
void AP2<N_CHANNELS>::process(
inline void AP2<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -74,12 +74,12 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void AP2<N_CHANNELS>::setCutoff(float value) {
inline void AP2<N_CHANNELS>::setCutoff(float value) {
bw_ap2_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void AP2<N_CHANNELS>::setQ(float value) {
inline void AP2<N_CHANNELS>::setQ(float value) {
bw_ap2_set_Q(&coeffs, value);
}
}

View File

@ -46,22 +46,22 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
Balance<N_CHANNELS>::Balance() {
inline Balance<N_CHANNELS>::Balance() {
bw_balance_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
void Balance<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void Balance<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_balance_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void Balance<N_CHANNELS>::reset() {
inline void Balance<N_CHANNELS>::reset() {
bw_balance_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
void Balance<N_CHANNELS>::process(
inline void Balance<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x_l,
std::array<const float *, N_CHANNELS> x_r,
std::array<float *, N_CHANNELS> y_l,
@ -71,7 +71,7 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void Balance<N_CHANNELS>::setBalance(float value) {
inline void Balance<N_CHANNELS>::setBalance(float value) {
bw_balance_set_balance(&coeffs, value);
}
}

View File

@ -43,17 +43,17 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
BDReduce<N_CHANNELS>::BDReduce() {
inline BDReduce<N_CHANNELS>::BDReduce() {
bw_bd_reduce_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
void BDReduce<N_CHANNELS>::reset() {
inline void BDReduce<N_CHANNELS>::reset() {
bw_bd_reduce_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
void BDReduce<N_CHANNELS>::process(
inline void BDReduce<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -61,7 +61,7 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void BDReduce<N_CHANNELS>::setBitDepth(char value) {
inline void BDReduce<N_CHANNELS>::setBitDepth(char value) {
bw_bd_reduce_set_bit_depth(&coeffs, value);
}
}

View File

@ -48,26 +48,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
Clip<N_CHANNELS>::Clip() {
inline Clip<N_CHANNELS>::Clip() {
bw_clip_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void Clip<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void Clip<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_clip_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void Clip<N_CHANNELS>::reset() {
inline void Clip<N_CHANNELS>::reset() {
bw_clip_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_clip_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
void Clip<N_CHANNELS>::process(
inline void Clip<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -75,17 +75,17 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void Clip<N_CHANNELS>::setBias(float value) {
inline void Clip<N_CHANNELS>::setBias(float value) {
bw_clip_set_bias(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Clip<N_CHANNELS>::setGain(float value) {
inline void Clip<N_CHANNELS>::setGain(float value) {
bw_clip_set_gain(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Clip<N_CHANNELS>::setGainCompensation(bool value) {
inline void Clip<N_CHANNELS>::setGainCompensation(bool value) {
bw_clip_set_gain_compensation(&coeffs, value);
}
}

View File

@ -53,26 +53,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
Comp<N_CHANNELS>::Comp() {
inline Comp<N_CHANNELS>::Comp() {
bw_comp_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void Comp<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void Comp<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_comp_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void Comp<N_CHANNELS>::reset() {
inline void Comp<N_CHANNELS>::reset() {
bw_comp_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_comp_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
void Comp<N_CHANNELS>::process(
inline void Comp<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<const float *, N_CHANNELS> xSC,
std::array<float *, N_CHANNELS> y,
@ -81,37 +81,37 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void Comp<N_CHANNELS>::setTreshLin(float value) {
inline void Comp<N_CHANNELS>::setTreshLin(float value) {
bw_comp_set_thresh_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Comp<N_CHANNELS>::setTreshDBFS(float value) {
inline void Comp<N_CHANNELS>::setTreshDBFS(float value) {
bw_comp_set_thresh_dBFS(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Comp<N_CHANNELS>::setRatio(float value) {
inline void Comp<N_CHANNELS>::setRatio(float value) {
bw_comp_set_ratio(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Comp<N_CHANNELS>::setAttackTau(float value) {
inline void Comp<N_CHANNELS>::setAttackTau(float value) {
bw_comp_set_attack_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Comp<N_CHANNELS>::setReleaseTau(float value) {
inline void Comp<N_CHANNELS>::setReleaseTau(float value) {
bw_comp_set_release_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Comp<N_CHANNELS>::setGainLin(float value) {
inline void Comp<N_CHANNELS>::setGainLin(float value) {
bw_comp_set_gain_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Comp<N_CHANNELS>::setGainDB(float value) {
inline void Comp<N_CHANNELS>::setGainDB(float value) {
bw_comp_set_gain_dB(&coeffs, value);
}
}

View File

@ -48,26 +48,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
Dist<N_CHANNELS>::Dist() {
inline Dist<N_CHANNELS>::Dist() {
bw_dist_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void Dist<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void Dist<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_dist_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void Dist<N_CHANNELS>::reset() {
inline void Dist<N_CHANNELS>::reset() {
bw_dist_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_dist_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
void Dist<N_CHANNELS>::process(
inline void Dist<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -75,17 +75,17 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void Dist<N_CHANNELS>::setDistortion(float value) {
inline void Dist<N_CHANNELS>::setDistortion(float value) {
bw_dist_set_distortion(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Dist<N_CHANNELS>::setTone(float value) {
inline void Dist<N_CHANNELS>::setTone(float value) {
bw_dist_set_tone(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Dist<N_CHANNELS>::setVolume(float value) {
inline void Dist<N_CHANNELS>::setVolume(float value) {
bw_dist_set_volume(&coeffs, value);
}
}

View File

@ -48,26 +48,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
Drive<N_CHANNELS>::Drive() {
inline Drive<N_CHANNELS>::Drive() {
bw_drive_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void Drive<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void Drive<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_drive_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void Drive<N_CHANNELS>::reset() {
inline void Drive<N_CHANNELS>::reset() {
bw_drive_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_drive_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
void Drive<N_CHANNELS>::process(
inline void Drive<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -75,17 +75,17 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void Drive<N_CHANNELS>::setDrive(float value) {
inline void Drive<N_CHANNELS>::setDrive(float value) {
bw_drive_set_drive(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Drive<N_CHANNELS>::setTone(float value) {
inline void Drive<N_CHANNELS>::setTone(float value) {
bw_drive_set_tone(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Drive<N_CHANNELS>::setVolume(float value) {
inline void Drive<N_CHANNELS>::setVolume(float value) {
bw_drive_set_volume(&coeffs, value);
}
}

View File

@ -46,22 +46,22 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
DryWet<N_CHANNELS>::DryWet() {
inline DryWet<N_CHANNELS>::DryWet() {
bw_drywet_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
void DryWet<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void DryWet<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_drywet_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void DryWet<N_CHANNELS>::reset() {
inline void DryWet<N_CHANNELS>::reset() {
bw_drywet_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
void DryWet<N_CHANNELS>::process(
inline void DryWet<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x_dry,
std::array<const float *, N_CHANNELS> x_wet,
std::array<float *, N_CHANNELS> y,
@ -70,12 +70,12 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void DryWet<N_CHANNELS>::setWet(float value) {
inline void DryWet<N_CHANNELS>::setWet(float value) {
bw_drywet_set_wet(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void DryWet<N_CHANNELS>::setSmoothTau(float value) {
inline void DryWet<N_CHANNELS>::setSmoothTau(float value) {
bw_drywet_set_smooth_tau(&coeffs, value);
}
}

View File

@ -49,26 +49,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
EnvFollow<N_CHANNELS>::EnvFollow() {
inline EnvFollow<N_CHANNELS>::EnvFollow() {
bw_env_follow_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void EnvFollow<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void EnvFollow<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_env_follow_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void EnvFollow<N_CHANNELS>::reset() {
inline void EnvFollow<N_CHANNELS>::reset() {
bw_env_follow_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_env_follow_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
void EnvFollow<N_CHANNELS>::process(
inline void EnvFollow<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -76,17 +76,17 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void EnvFollow<N_CHANNELS>::setAttackTau(float value) {
inline void EnvFollow<N_CHANNELS>::setAttackTau(float value) {
bw_env_follow_set_attack_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void EnvFollow<N_CHANNELS>::setReleaseTau(float value) {
inline void EnvFollow<N_CHANNELS>::setReleaseTau(float value) {
bw_env_follow_set_release_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
float EnvFollow<N_CHANNELS>::getYZ1(BW_SIZE_T channel) {
inline float EnvFollow<N_CHANNELS>::getYZ1(BW_SIZE_T channel) {
return bw_env_follow_get_y_z1(states + channel);
}
}

View File

@ -52,26 +52,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
EnvGen<N_CHANNELS>::EnvGen() {
inline EnvGen<N_CHANNELS>::EnvGen() {
bw_env_gen_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void EnvGen<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void EnvGen<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_env_gen_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void EnvGen<N_CHANNELS>::reset() {
inline void EnvGen<N_CHANNELS>::reset() {
bw_env_gen_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_env_gen_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
void EnvGen<N_CHANNELS>::process(
inline void EnvGen<N_CHANNELS>::process(
std::array<char, N_CHANNELS> gate,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -79,32 +79,32 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void EnvGen<N_CHANNELS>::setAttack(float value) {
inline void EnvGen<N_CHANNELS>::setAttack(float value) {
bw_env_gen_set_attack(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void EnvGen<N_CHANNELS>::setDecay(float value) {
inline void EnvGen<N_CHANNELS>::setDecay(float value) {
bw_env_gen_set_decay(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void EnvGen<N_CHANNELS>::setSustain(float value) {
inline void EnvGen<N_CHANNELS>::setSustain(float value) {
bw_env_gen_set_sustain(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void EnvGen<N_CHANNELS>::setRelease(float value) {
inline void EnvGen<N_CHANNELS>::setRelease(float value) {
bw_env_gen_set_release(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
bw_env_gen_phase EnvGen<N_CHANNELS>::getPhase(BW_SIZE_T channel) {
inline bw_env_gen_phase EnvGen<N_CHANNELS>::getPhase(BW_SIZE_T channel) {
return bw_env_gen_get_phase(states + channel);
}
template<BW_SIZE_T N_CHANNELS>
float EnvGen<N_CHANNELS>::getYZ1(BW_SIZE_T channel) {
inline float EnvGen<N_CHANNELS>::getYZ1(BW_SIZE_T channel) {
return bw_env_gen_get_y_z1(states + channel);
}
}

View File

@ -47,26 +47,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
Fuzz<N_CHANNELS>::Fuzz() {
inline Fuzz<N_CHANNELS>::Fuzz() {
bw_fuzz_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void Fuzz<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void Fuzz<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_fuzz_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void Fuzz<N_CHANNELS>::reset() {
inline void Fuzz<N_CHANNELS>::reset() {
bw_fuzz_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_fuzz_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
void Fuzz<N_CHANNELS>::process(
inline void Fuzz<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -74,12 +74,12 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void Fuzz<N_CHANNELS>::setFuzz(float value) {
inline void Fuzz<N_CHANNELS>::setFuzz(float value) {
bw_fuzz_set_fuzz(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Fuzz<N_CHANNELS>::setVolume(float value) {
inline void Fuzz<N_CHANNELS>::setVolume(float value) {
bw_fuzz_set_volume(&coeffs, value);
}
}

View File

@ -48,22 +48,22 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
Gain<N_CHANNELS>::Gain() {
inline Gain<N_CHANNELS>::Gain() {
bw_gain_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
void Gain<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void Gain<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_gain_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void Gain<N_CHANNELS>::reset() {
inline void Gain<N_CHANNELS>::reset() {
bw_gain_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
void Gain<N_CHANNELS>::process(
inline void Gain<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -71,22 +71,22 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void Gain<N_CHANNELS>::setGainLin(float value) {
inline void Gain<N_CHANNELS>::setGainLin(float value) {
bw_gain_set_gain_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Gain<N_CHANNELS>::setGainDB(float value) {
inline void Gain<N_CHANNELS>::setGainDB(float value) {
bw_gain_set_gain_dB(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Gain<N_CHANNELS>::setSmoothTau(float value) {
inline void Gain<N_CHANNELS>::setSmoothTau(float value) {
bw_gain_set_smooth_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
float Gain<N_CHANNELS>::getGain() {
inline float Gain<N_CHANNELS>::getGain() {
return bw_gain_get_gain(&coeffs);
}
}

View File

@ -46,26 +46,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
HP1<N_CHANNELS>::HP1() {
inline HP1<N_CHANNELS>::HP1() {
bw_hp1_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void HP1<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void HP1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_hp1_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void HP1<N_CHANNELS>::reset(float x0) {
inline void HP1<N_CHANNELS>::reset(float x0) {
bw_hp1_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_hp1_reset_state(&coeffs, states + i, x0);
}
template<BW_SIZE_T N_CHANNELS>
void HP1<N_CHANNELS>::process(
inline void HP1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -73,7 +73,7 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void HP1<N_CHANNELS>::setCutoff(float value) {
inline void HP1<N_CHANNELS>::setCutoff(float value) {
bw_hp1_set_cutoff(&coeffs, value);
}
}

View File

@ -48,26 +48,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
HS1<N_CHANNELS>::HS1() {
inline HS1<N_CHANNELS>::HS1() {
bw_hs1_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void HS1<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void HS1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_hs1_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void HS1<N_CHANNELS>::reset(float x0) {
inline void HS1<N_CHANNELS>::reset(float x0) {
bw_hs1_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_hs1_reset_state(&coeffs, states + i, x0);
}
template<BW_SIZE_T N_CHANNELS>
void HS1<N_CHANNELS>::process(
inline void HS1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -75,17 +75,17 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void HS1<N_CHANNELS>::setCutoff(float value) {
inline void HS1<N_CHANNELS>::setCutoff(float value) {
bw_hs1_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void HS1<N_CHANNELS>::setHighGainLin(float value) {
inline void HS1<N_CHANNELS>::setHighGainLin(float value) {
bw_hs1_set_high_gain_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void HS1<N_CHANNELS>::setHighGainDB(float value) {
inline void HS1<N_CHANNELS>::setHighGainDB(float value) {
bw_hs1_set_high_gain_dB(&coeffs, value);
}
}

View File

@ -49,26 +49,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
HS2<N_CHANNELS>::HS2() {
inline HS2<N_CHANNELS>::HS2() {
bw_hs2_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void HS2<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void HS2<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_hs2_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void HS2<N_CHANNELS>::reset(float x0) {
inline void HS2<N_CHANNELS>::reset(float x0) {
bw_hs2_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_hs2_reset_state(&coeffs, states + i, x0);
}
template<BW_SIZE_T N_CHANNELS>
void HS2<N_CHANNELS>::process(
inline void HS2<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -76,22 +76,22 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void HS2<N_CHANNELS>::setCutoff(float value) {
inline void HS2<N_CHANNELS>::setCutoff(float value) {
bw_hs2_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void HS2<N_CHANNELS>::setQ(float value) {
inline void HS2<N_CHANNELS>::setQ(float value) {
bw_hs2_set_Q(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void HS2<N_CHANNELS>::setHighGainLin(float value) {
inline void HS2<N_CHANNELS>::setHighGainLin(float value) {
bw_hs2_set_high_gain_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void HS2<N_CHANNELS>::setHighGainDB(float value) {
inline void HS2<N_CHANNELS>::setHighGainDB(float value) {
bw_hs2_set_high_gain_dB(&coeffs, value);
}
}

View File

@ -48,26 +48,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
LP1<N_CHANNELS>::LP1() {
inline LP1<N_CHANNELS>::LP1() {
bw_lp1_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void LP1<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void LP1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_lp1_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void LP1<N_CHANNELS>::reset(float x0) {
inline void LP1<N_CHANNELS>::reset(float x0) {
bw_lp1_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_lp1_reset_state(&coeffs, states + i, x0);
}
template<BW_SIZE_T N_CHANNELS>
void LP1<N_CHANNELS>::process(
inline void LP1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -75,17 +75,17 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void LP1<N_CHANNELS>::setCutoff(float value) {
inline void LP1<N_CHANNELS>::setCutoff(float value) {
bw_lp1_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void LP1<N_CHANNELS>::setPrewarpAtCutoff(bool value) {
inline void LP1<N_CHANNELS>::setPrewarpAtCutoff(bool value) {
bw_lp1_set_prewarp_at_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void LP1<N_CHANNELS>::setPrewarpFreq(float value) {
inline void LP1<N_CHANNELS>::setPrewarpFreq(float value) {
bw_lp1_set_prewarp_freq(&coeffs, value);
}
}

View File

@ -48,26 +48,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
LS1<N_CHANNELS>::LS1() {
inline LS1<N_CHANNELS>::LS1() {
bw_ls1_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void LS1<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void LS1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ls1_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void LS1<N_CHANNELS>::reset(float x0) {
inline void LS1<N_CHANNELS>::reset(float x0) {
bw_ls1_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_ls1_reset_state(&coeffs, states + i, x0);
}
template<BW_SIZE_T N_CHANNELS>
void LS1<N_CHANNELS>::process(
inline void LS1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -75,17 +75,17 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void LS1<N_CHANNELS>::setCutoff(float value) {
inline void LS1<N_CHANNELS>::setCutoff(float value) {
bw_ls1_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void LS1<N_CHANNELS>::setDcGainLin(float value) {
inline void LS1<N_CHANNELS>::setDcGainLin(float value) {
bw_ls1_set_dc_gain_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void LS1<N_CHANNELS>::setDcGainDB(float value) {
inline void LS1<N_CHANNELS>::setDcGainDB(float value) {
bw_ls1_set_dc_gain_dB(&coeffs, value);
}
}

View File

@ -49,26 +49,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
LS2<N_CHANNELS>::LS2() {
inline LS2<N_CHANNELS>::LS2() {
bw_ls2_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void LS2<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void LS2<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ls2_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void LS2<N_CHANNELS>::reset(float x0) {
inline void LS2<N_CHANNELS>::reset(float x0) {
bw_ls2_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_ls2_reset_state(&coeffs, states + i, x0);
}
template<BW_SIZE_T N_CHANNELS>
void LS2<N_CHANNELS>::process(
inline void LS2<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -76,22 +76,22 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void LS2<N_CHANNELS>::setCutoff(float value) {
inline void LS2<N_CHANNELS>::setCutoff(float value) {
bw_ls2_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void LS2<N_CHANNELS>::setQ(float value) {
inline void LS2<N_CHANNELS>::setQ(float value) {
bw_ls2_set_Q(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void LS2<N_CHANNELS>::setDcGainLin(float value) {
inline void LS2<N_CHANNELS>::setDcGainLin(float value) {
bw_ls2_set_dc_gain_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void LS2<N_CHANNELS>::setDcGainDB(float value) {
inline void LS2<N_CHANNELS>::setDcGainDB(float value) {
bw_ls2_set_dc_gain_dB(&coeffs, value);
}
}

View File

@ -50,26 +50,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
MM1<N_CHANNELS>::MM1() {
inline MM1<N_CHANNELS>::MM1() {
bw_mm1_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void MM1<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void MM1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_mm1_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void MM1<N_CHANNELS>::reset(float x0) {
inline void MM1<N_CHANNELS>::reset(float x0) {
bw_mm1_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_mm1_reset_state(&coeffs, states + i, x0);
}
template<BW_SIZE_T N_CHANNELS>
void MM1<N_CHANNELS>::process(
inline void MM1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -77,27 +77,27 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void MM1<N_CHANNELS>::setCutoff(float value) {
inline void MM1<N_CHANNELS>::setCutoff(float value) {
bw_mm1_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void MM1<N_CHANNELS>::setPrewarpAtCutoff(bool value) {
inline void MM1<N_CHANNELS>::setPrewarpAtCutoff(bool value) {
bw_mm1_set_prewarp_at_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void MM1<N_CHANNELS>::setPrewarpFreq(float value) {
inline void MM1<N_CHANNELS>::setPrewarpFreq(float value) {
bw_mm1_set_prewarp_freq(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void MM1<N_CHANNELS>::setCoeffX(float value) {
inline void MM1<N_CHANNELS>::setCoeffX(float value) {
bw_mm1_set_coeff_x(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void MM1<N_CHANNELS>::setCoeffLp(float value) {
inline void MM1<N_CHANNELS>::setCoeffLp(float value) {
bw_mm1_set_coeff_lp(&coeffs, value);
}
}

View File

@ -53,26 +53,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
MM2<N_CHANNELS>::MM2() {
inline MM2<N_CHANNELS>::MM2() {
bw_mm2_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void MM2<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void MM2<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_mm2_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void MM2<N_CHANNELS>::reset(float x0) {
inline void MM2<N_CHANNELS>::reset(float x0) {
bw_mm2_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_mm2_reset_state(&coeffs, states + i, x0);
}
template<BW_SIZE_T N_CHANNELS>
void MM2<N_CHANNELS>::process(
inline void MM2<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -80,42 +80,42 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void MM2<N_CHANNELS>::setCutoff(float value) {
inline void MM2<N_CHANNELS>::setCutoff(float value) {
bw_mm2_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void MM2<N_CHANNELS>::setQ(float value) {
inline void MM2<N_CHANNELS>::setQ(float value) {
bw_mm2_set_Q(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void MM2<N_CHANNELS>::setPrewarpAtCutoff(bool value) {
inline void MM2<N_CHANNELS>::setPrewarpAtCutoff(bool value) {
bw_mm2_set_prewarp_at_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void MM2<N_CHANNELS>::setPrewarpFreq(float value) {
inline void MM2<N_CHANNELS>::setPrewarpFreq(float value) {
bw_mm2_set_prewarp_freq(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void MM2<N_CHANNELS>::setCoeffX(float value) {
inline void MM2<N_CHANNELS>::setCoeffX(float value) {
bw_mm2_set_coeff_x(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void MM2<N_CHANNELS>::setCoeffLp(float value) {
inline void MM2<N_CHANNELS>::setCoeffLp(float value) {
bw_mm2_set_coeff_lp(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void MM2<N_CHANNELS>::setCoeffBp(float value) {
inline void MM2<N_CHANNELS>::setCoeffBp(float value) {
bw_mm2_set_coeff_bp(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void MM2<N_CHANNELS>::setCoeffHp(float value) {
inline void MM2<N_CHANNELS>::setCoeffHp(float value) {
bw_mm2_set_coeff_hp(&coeffs, value);
}
}

View File

@ -51,26 +51,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
NoiseGate<N_CHANNELS>::NoiseGate() {
inline NoiseGate<N_CHANNELS>::NoiseGate() {
bw_noise_gate_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void NoiseGate<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void NoiseGate<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_noise_gate_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void NoiseGate<N_CHANNELS>::reset() {
inline void NoiseGate<N_CHANNELS>::reset() {
bw_noise_gate_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_noise_gate_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
void NoiseGate<N_CHANNELS>::process(
inline void NoiseGate<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<const float *, N_CHANNELS> xSC,
std::array<float *, N_CHANNELS> y,
@ -79,27 +79,27 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void NoiseGate<N_CHANNELS>::setTreshLin(float value) {
inline void NoiseGate<N_CHANNELS>::setTreshLin(float value) {
bw_noise_gate_set_thresh_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void NoiseGate<N_CHANNELS>::setTreshDBFS(float value) {
inline void NoiseGate<N_CHANNELS>::setTreshDBFS(float value) {
bw_noise_gate_set_thresh_dBFS(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void NoiseGate<N_CHANNELS>::setRatio(float value) {
inline void NoiseGate<N_CHANNELS>::setRatio(float value) {
bw_noise_gate_set_ratio(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void NoiseGate<N_CHANNELS>::setAttackTau(float value) {
inline void NoiseGate<N_CHANNELS>::setAttackTau(float value) {
bw_noise_gate_set_attack_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void NoiseGate<N_CHANNELS>::setReleaseTau(float value) {
inline void NoiseGate<N_CHANNELS>::setReleaseTau(float value) {
bw_noise_gate_set_release_tau(&coeffs, value);
}
}

View File

@ -44,17 +44,17 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
NoiseGen<N_CHANNELS>::NoiseGen(uint64_t *BW_RESTRICT state) {
inline NoiseGen<N_CHANNELS>::NoiseGen(uint64_t *BW_RESTRICT state) {
bw_noise_gen_init(&coeffs, state);
}
template<BW_SIZE_T N_CHANNELS>
void NoiseGen<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void NoiseGen<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_noise_gen_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void NoiseGen<N_CHANNELS>::process(
inline void NoiseGen<N_CHANNELS>::process(
std::array<float *, N_CHANNELS> y,
int nSamples) {
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
@ -62,12 +62,12 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void NoiseGen<N_CHANNELS>::setSampleRateScaling(bool value) {
inline void NoiseGen<N_CHANNELS>::setSampleRateScaling(bool value) {
bw_noise_gen_set_sample_rate_scaling(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
float NoiseGen<N_CHANNELS>::getScalingK() {
inline float NoiseGen<N_CHANNELS>::getScalingK() {
return bw_noise_gen_get_scaling_k(&coeffs);
}
}

View File

@ -47,26 +47,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
Notch<N_CHANNELS>::Notch() {
inline Notch<N_CHANNELS>::Notch() {
bw_notch_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void Notch<N_CHANNELS>::setSampleRate(float sampleRate) {
inline 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) {
inline void Notch<N_CHANNELS>::reset(float x0) {
bw_notch_reset_coeffs(&coeffs);
for (BW_SIZE_T 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(
inline void Notch<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -74,12 +74,12 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void Notch<N_CHANNELS>::setCutoff(float value) {
inline 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) {
inline void Notch<N_CHANNELS>::setQ(float value) {
bw_notch_set_Q(&coeffs, value);
}
}

50
include/bwpp_note_queue.h Normal file
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
*/
#ifndef BWPP_NOTE_QUEUE_H
#define BWPP_NOTE_QUEUE_H
#include <bw_note_queue.h>
namespace Brickworks {
class NoteQueue {
public:
NoteQueue();
void clear();
void add(unsigned char note, bool pressed, float velocity, bool force_went_off);
bw_note_queue queue;
};
inline NoteQueue::NoteQueue() {
bw_note_queue_reset(&queue);
}
inline void NoteQueue::clear() {
bw_note_queue_clear(&queue);
}
inline void NoteQueue::add(unsigned char note, bool pressed, float velocity, bool force_went_off) {
bw_note_queue_add(&queue, note, pressed, velocity, force_went_off);
}
}
#endif

View File

@ -55,26 +55,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
OnePole<N_CHANNELS>::OnePole() {
inline OnePole<N_CHANNELS>::OnePole() {
bw_one_pole_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void OnePole<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void OnePole<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_one_pole_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void OnePole<N_CHANNELS>::reset(float y_z1) {
inline void OnePole<N_CHANNELS>::reset(float y_z1) {
bw_one_pole_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_one_pole_reset_state(&coeffs, states + i, y_z1);
}
template<BW_SIZE_T N_CHANNELS>
void OnePole<N_CHANNELS>::process(
inline void OnePole<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -82,47 +82,47 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void OnePole<N_CHANNELS>::setCutoff(float value) {
inline void OnePole<N_CHANNELS>::setCutoff(float value) {
bw_one_pole_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void OnePole<N_CHANNELS>::setCutoffUp(float value) {
inline void OnePole<N_CHANNELS>::setCutoffUp(float value) {
bw_one_pole_set_cutoff_up(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void OnePole<N_CHANNELS>::setCutoffDown(float value) {
inline void OnePole<N_CHANNELS>::setCutoffDown(float value) {
bw_one_pole_set_cutoff_down(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void OnePole<N_CHANNELS>::setTau(float value) {
inline void OnePole<N_CHANNELS>::setTau(float value) {
bw_one_pole_set_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void OnePole<N_CHANNELS>::setTauUp(float value) {
inline void OnePole<N_CHANNELS>::setTauUp(float value) {
bw_one_pole_set_tau_up(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void OnePole<N_CHANNELS>::setTauDown(float value) {
inline void OnePole<N_CHANNELS>::setTauDown(float value) {
bw_one_pole_set_tau_down(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void OnePole<N_CHANNELS>::setStickyThresh(float value) {
inline void OnePole<N_CHANNELS>::setStickyThresh(float value) {
bw_one_pole_set_sticky_thresh(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void OnePole<N_CHANNELS>::setStickyMode(bw_one_pole_sticky_mode value) {
inline void OnePole<N_CHANNELS>::setStickyMode(bw_one_pole_sticky_mode value) {
bw_one_pole_set_sticky_mode(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
float OnePole<N_CHANNELS>::getYZ1(BW_SIZE_T channel) {
inline float OnePole<N_CHANNELS>::getYZ1(BW_SIZE_T channel) {
return bw_one_pole_get_y_z1(states + channel);
}
}

View File

@ -39,13 +39,13 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
void OscFilt<N_CHANNELS>::reset() {
inline void OscFilt<N_CHANNELS>::reset() {
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_osc_filt_reset_state(states + i);
}
template<BW_SIZE_T N_CHANNELS>
void OscFilt<N_CHANNELS>::process(
inline void OscFilt<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {

View File

@ -46,22 +46,22 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
OscPulse<N_CHANNELS>::OscPulse() {
inline OscPulse<N_CHANNELS>::OscPulse() {
bw_osc_pulse_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
void OscPulse<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void OscPulse<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_osc_pulse_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void OscPulse<N_CHANNELS>::reset() {
inline void OscPulse<N_CHANNELS>::reset() {
bw_osc_pulse_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
void OscPulse<N_CHANNELS>::process(
inline void OscPulse<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<const float *, N_CHANNELS> x_phase_inc,
std::array<float *, N_CHANNELS> y,
@ -70,12 +70,12 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void OscPulse<N_CHANNELS>::setAntialiasing(bool value) {
inline void OscPulse<N_CHANNELS>::setAntialiasing(bool value) {
bw_osc_pulse_set_antialiasing(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void OscPulse<N_CHANNELS>::setPulseWidth(float value) {
inline void OscPulse<N_CHANNELS>::setPulseWidth(float value) {
bw_osc_pulse_set_pulse_width(&coeffs, value);
}
}

View File

@ -43,12 +43,12 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
OscSaw<N_CHANNELS>::OscSaw() {
inline OscSaw<N_CHANNELS>::OscSaw() {
bw_osc_saw_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
void OscSaw<N_CHANNELS>::process(
inline void OscSaw<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<const float *, N_CHANNELS> x_phase_inc,
std::array<float *, N_CHANNELS> y,
@ -58,7 +58,7 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void OscSaw<N_CHANNELS>::setAntialiasing(bool value) {
inline void OscSaw<N_CHANNELS>::setAntialiasing(bool value) {
bw_osc_saw_set_antialiasing(&coeffs, value);
}
}

View File

@ -32,7 +32,7 @@ namespace Brickworks {
int nSamples);
template<BW_SIZE_T N_CHANNELS>
void oscSinProcess(
inline void oscSinProcess(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {

View File

@ -46,22 +46,22 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
OscTri<N_CHANNELS>::OscTri() {
inline OscTri<N_CHANNELS>::OscTri() {
bw_osc_tri_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
void OscTri<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void OscTri<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_osc_tri_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void OscTri<N_CHANNELS>::reset() {
inline void OscTri<N_CHANNELS>::reset() {
bw_osc_tri_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
void OscTri<N_CHANNELS>::process(
inline void OscTri<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<const float *, N_CHANNELS> x_phase_inc,
std::array<float *, N_CHANNELS> y,
@ -70,12 +70,12 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void OscTri<N_CHANNELS>::setAntialiasing(bool value) {
inline void OscTri<N_CHANNELS>::setAntialiasing(bool value) {
bw_osc_tri_set_antialiasing(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void OscTri<N_CHANNELS>::setSlope(float value) {
inline void OscTri<N_CHANNELS>::setSlope(float value) {
bw_osc_tri_set_slope(&coeffs, value);
}
}

View File

@ -45,22 +45,22 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
Pan<N_CHANNELS>::Pan() {
inline Pan<N_CHANNELS>::Pan() {
bw_pan_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
void Pan<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void Pan<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_pan_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void Pan<N_CHANNELS>::reset() {
inline void Pan<N_CHANNELS>::reset() {
bw_pan_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
void Pan<N_CHANNELS>::process(
inline void Pan<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y_l,
std::array<float *, N_CHANNELS> y_r,
@ -69,7 +69,7 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void Pan<N_CHANNELS>::setPan(float value) {
inline void Pan<N_CHANNELS>::setPan(float value) {
bw_pan_set_pan(&coeffs, value);
}
}

View File

@ -51,26 +51,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
Peak<N_CHANNELS>::Peak() {
inline Peak<N_CHANNELS>::Peak() {
bw_peak_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void Peak<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void Peak<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_peak_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void Peak<N_CHANNELS>::reset(float x0) {
inline void Peak<N_CHANNELS>::reset(float x0) {
bw_peak_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_peak_reset_state(&coeffs, states + i, x0);
}
template<BW_SIZE_T N_CHANNELS>
void Peak<N_CHANNELS>::process(
inline void Peak<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -78,32 +78,32 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void Peak<N_CHANNELS>::setCutoff(float value) {
inline void Peak<N_CHANNELS>::setCutoff(float value) {
bw_peak_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Peak<N_CHANNELS>::setQ(float value) {
inline void Peak<N_CHANNELS>::setQ(float value) {
bw_peak_set_Q(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Peak<N_CHANNELS>::setPeakGainLin(float value) {
inline void Peak<N_CHANNELS>::setPeakGainLin(float value) {
bw_peak_set_peak_gain_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Peak<N_CHANNELS>::setPeakGainDB(float value) {
inline void Peak<N_CHANNELS>::setPeakGainDB(float value) {
bw_peak_set_peak_gain_dB(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Peak<N_CHANNELS>::setBandwidth(float value) {
inline void Peak<N_CHANNELS>::setBandwidth(float value) {
bw_peak_set_bandwidth(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Peak<N_CHANNELS>::setUseBandwidth(bool value) {
inline void Peak<N_CHANNELS>::setUseBandwidth(bool value) {
bw_peak_set_use_bandwidth(&coeffs, value);
}
}

View File

@ -48,26 +48,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
PhaseGen<N_CHANNELS>::PhaseGen() {
inline PhaseGen<N_CHANNELS>::PhaseGen() {
bw_phase_gen_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void PhaseGen<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void PhaseGen<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_phase_gen_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void PhaseGen<N_CHANNELS>::reset(float phase_0) {
inline void PhaseGen<N_CHANNELS>::reset(float phase_0) {
bw_phase_gen_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_phase_gen_reset_state(&coeffs, states + i, phase_0);
}
template<BW_SIZE_T N_CHANNELS>
void PhaseGen<N_CHANNELS>::process(
inline void PhaseGen<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x_mod,
std::array<float *, N_CHANNELS> y,
std::array<float *, N_CHANNELS> y_phase_inc,
@ -76,12 +76,12 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void PhaseGen<N_CHANNELS>::setFrequency(float value) {
inline void PhaseGen<N_CHANNELS>::setFrequency(float value) {
bw_phase_gen_set_frequency(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void PhaseGen<N_CHANNELS>::setPortamentoTau(float value) {
inline void PhaseGen<N_CHANNELS>::setPortamentoTau(float value) {
bw_phase_gen_set_portamento_tau(&coeffs, value);
}
}

View File

@ -48,26 +48,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
Phaser<N_CHANNELS>::Phaser() {
inline Phaser<N_CHANNELS>::Phaser() {
bw_phaser_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void Phaser<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void Phaser<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_phaser_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void Phaser<N_CHANNELS>::reset() {
inline void Phaser<N_CHANNELS>::reset() {
bw_phaser_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_phaser_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
void Phaser<N_CHANNELS>::process(
inline void Phaser<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -75,17 +75,17 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void Phaser<N_CHANNELS>::setRate(float value) {
inline void Phaser<N_CHANNELS>::setRate(float value) {
bw_phaser_set_rate(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Phaser<N_CHANNELS>::setCenter(float value) {
inline void Phaser<N_CHANNELS>::setCenter(float value) {
bw_phaser_set_center(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Phaser<N_CHANNELS>::setAmount(float value) {
inline void Phaser<N_CHANNELS>::setAmount(float value) {
bw_phaser_set_amount(&coeffs, value);
}
}

View File

@ -47,23 +47,23 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
PinkFilt<N_CHANNELS>::PinkFilt() {
inline PinkFilt<N_CHANNELS>::PinkFilt() {
bw_pink_filt_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
void PinkFilt<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void PinkFilt<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_pink_filt_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void PinkFilt<N_CHANNELS>::reset() {
inline void PinkFilt<N_CHANNELS>::reset() {
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_pink_filt_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
void PinkFilt<N_CHANNELS>::process(
inline void PinkFilt<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -72,12 +72,12 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void PinkFilt<N_CHANNELS>::setSampleRateScaling(bool value) {
inline void PinkFilt<N_CHANNELS>::setSampleRateScaling(bool value) {
bw_pink_filt_set_sample_rate_scaling(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
float PinkFilt<N_CHANNELS>::getScalingK() {
inline float PinkFilt<N_CHANNELS>::getScalingK() {
return bw_pink_filt_get_scaling_k(&coeffs);
}
}

View File

@ -48,26 +48,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
PPM<N_CHANNELS>::PPM() {
inline PPM<N_CHANNELS>::PPM() {
bw_ppm_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void PPM<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void PPM<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ppm_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void PPM<N_CHANNELS>::reset() {
inline void PPM<N_CHANNELS>::reset() {
bw_ppm_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_ppm_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
void PPM<N_CHANNELS>::process(
inline void PPM<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -75,12 +75,12 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void PPM<N_CHANNELS>::setIntegrationTau(float value) {
inline void PPM<N_CHANNELS>::setIntegrationTau(float value) {
bw_ppm_set_integration_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
float PPM<N_CHANNELS>::getYZ1(BW_SIZE_T channel) {
inline float PPM<N_CHANNELS>::getYZ1(BW_SIZE_T channel) {
return bw_ppm_get_y_z1(states + channel);
}
}

View File

@ -45,22 +45,22 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
RingMod<N_CHANNELS>::RingMod() {
inline RingMod<N_CHANNELS>::RingMod() {
bw_ringmod_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
void RingMod<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void RingMod<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ringmod_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void RingMod<N_CHANNELS>::reset() {
inline void RingMod<N_CHANNELS>::reset() {
bw_ringmod_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
void RingMod<N_CHANNELS>::process(
inline void RingMod<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x_mod,
std::array<const float *, N_CHANNELS> x_car,
std::array<float *, N_CHANNELS> y,
@ -69,7 +69,7 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void RingMod<N_CHANNELS>::setAmount(float value) {
inline void RingMod<N_CHANNELS>::setAmount(float value) {
bw_ringmod_set_amount(&coeffs, value);
}
}

View File

@ -48,26 +48,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
Satur<N_CHANNELS>::Satur() {
inline Satur<N_CHANNELS>::Satur() {
bw_satur_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void Satur<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void Satur<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_satur_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void Satur<N_CHANNELS>::reset() {
inline void Satur<N_CHANNELS>::reset() {
bw_satur_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_satur_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
void Satur<N_CHANNELS>::process(
inline void Satur<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -75,17 +75,17 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void Satur<N_CHANNELS>::setBias(float value) {
inline void Satur<N_CHANNELS>::setBias(float value) {
bw_satur_set_bias(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Satur<N_CHANNELS>::setGain(float value) {
inline void Satur<N_CHANNELS>::setGain(float value) {
bw_satur_set_gain(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Satur<N_CHANNELS>::setGainCompensation(bool value) {
inline void Satur<N_CHANNELS>::setGainCompensation(bool value) {
bw_satur_set_gain_compensation(&coeffs, value);
}
}

View File

@ -50,26 +50,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
SlewLim<N_CHANNELS>::SlewLim() {
inline SlewLim<N_CHANNELS>::SlewLim() {
bw_slew_lim_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void SlewLim<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void SlewLim<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_slew_lim_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void SlewLim<N_CHANNELS>::reset(float y_z1) {
inline void SlewLim<N_CHANNELS>::reset(float y_z1) {
bw_slew_lim_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_slew_lim_reset_state(&coeffs, states + i, y_z1);
}
template<BW_SIZE_T N_CHANNELS>
void SlewLim<N_CHANNELS>::process(
inline void SlewLim<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -77,22 +77,22 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void SlewLim<N_CHANNELS>::setMaxRate(float value) {
inline void SlewLim<N_CHANNELS>::setMaxRate(float value) {
bw_slew_lim_set_max_rate(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void SlewLim<N_CHANNELS>::setMaxRateUp(float value) {
inline void SlewLim<N_CHANNELS>::setMaxRateUp(float value) {
bw_slew_lim_set_max_rate_up(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void SlewLim<N_CHANNELS>::setMaxRateDown(float value) {
inline void SlewLim<N_CHANNELS>::setMaxRateDown(float value) {
bw_slew_lim_set_max_rate_down(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
float SlewLim<N_CHANNELS>::getYZ1(BW_SIZE_T channel) {
inline float SlewLim<N_CHANNELS>::getYZ1(BW_SIZE_T channel) {
return bw_slew_lim_get_y_z1(states + channel);
}
}

View File

@ -44,18 +44,18 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
SRReduce<N_CHANNELS>::SRReduce() {
inline SRReduce<N_CHANNELS>::SRReduce() {
bw_sr_reduce_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
void SRReduce<N_CHANNELS>::reset() {
inline void SRReduce<N_CHANNELS>::reset() {
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_sr_reduce_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
void SRReduce<N_CHANNELS>::process(
inline void SRReduce<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -64,7 +64,7 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void SRReduce<N_CHANNELS>::setRatio(float value) {
inline void SRReduce<N_CHANNELS>::setRatio(float value) {
bw_sr_reduce_set_ratio(&coeffs, value);
}
}

View File

@ -42,18 +42,18 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
SRCInt<N_CHANNELS>::SRCInt(int ratio) {
inline SRCInt<N_CHANNELS>::SRCInt(int ratio) {
bw_src_int_init(&coeffs, ratio);
}
template<BW_SIZE_T N_CHANNELS>
void SRCInt<N_CHANNELS>::reset(float x0) {
inline void SRCInt<N_CHANNELS>::reset(float x0) {
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_src_int_reset_state(&coeffs, states + i, x0);
}
template<BW_SIZE_T N_CHANNELS>
void SRCInt<N_CHANNELS>::process(
inline void SRCInt<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nInSamples) {

View File

@ -51,26 +51,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
SVF<N_CHANNELS>::SVF() {
inline SVF<N_CHANNELS>::SVF() {
bw_svf_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void SVF<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void SVF<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_svf_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void SVF<N_CHANNELS>::reset(float x0) {
inline void SVF<N_CHANNELS>::reset(float x0) {
bw_svf_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_svf_reset_state(&coeffs, states + i, x0);
}
template<BW_SIZE_T N_CHANNELS>
void SVF<N_CHANNELS>::process(
inline void SVF<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y_lp,
std::array<float *, N_CHANNELS> y_bp,
@ -80,22 +80,22 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void SVF<N_CHANNELS>::setCutoff(float value) {
inline void SVF<N_CHANNELS>::setCutoff(float value) {
bw_svf_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void SVF<N_CHANNELS>::setQ(float value) {
inline void SVF<N_CHANNELS>::setQ(float value) {
bw_svf_set_Q(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void SVF<N_CHANNELS>::setPrewarpAtCutoff(bool value) {
inline void SVF<N_CHANNELS>::setPrewarpAtCutoff(bool value) {
bw_svf_set_prewarp_at_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void SVF<N_CHANNELS>::setPrewarpFreq(float value) {
inline void SVF<N_CHANNELS>::setPrewarpFreq(float value) {
bw_svf_set_prewarp_freq(&coeffs, value);
}
}

View File

@ -47,26 +47,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
Trem<N_CHANNELS>::Trem() {
inline Trem<N_CHANNELS>::Trem() {
bw_trem_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void Trem<N_CHANNELS>::setSampleRate(float sampleRate) {
inline void Trem<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_trem_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
void Trem<N_CHANNELS>::reset() {
inline void Trem<N_CHANNELS>::reset() {
bw_trem_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_trem_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
void Trem<N_CHANNELS>::process(
inline void Trem<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -74,12 +74,12 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void Trem<N_CHANNELS>::setRate(float value) {
inline void Trem<N_CHANNELS>::setRate(float value) {
bw_trem_set_rate(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
void Trem<N_CHANNELS>::setAmount(float value) {
inline void Trem<N_CHANNELS>::setAmount(float value) {
bw_trem_set_amount(&coeffs, value);
}
}

View File

@ -46,26 +46,26 @@ namespace Brickworks {
};
template<BW_SIZE_T N_CHANNELS>
Wah<N_CHANNELS>::Wah() {
inline Wah<N_CHANNELS>::Wah() {
bw_wah_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
void Wah<N_CHANNELS>::setSampleRate(float sampleRate) {
inline 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() {
inline void Wah<N_CHANNELS>::reset() {
bw_wah_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_wah_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
void Wah<N_CHANNELS>::process(
inline void Wah<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
@ -73,7 +73,7 @@ namespace Brickworks {
}
template<BW_SIZE_T N_CHANNELS>
void Wah<N_CHANNELS>::setWah(float value) {
inline void Wah<N_CHANNELS>::setWah(float value) {
bw_wah_set_wah(&coeffs, value);
}
}