This commit is contained in:
Stefano D'Angelo 2023-07-12 12:07:50 +02:00
parent bd3a6367e0
commit bddbf72462
51 changed files with 3610 additions and 2983 deletions

View File

@ -25,57 +25,69 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class AP1 {
public:
AP1();
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);
/*! api {{{
* ##### Brickworks::AP1
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class AP1 {
public:
AP1();
void setCutoff(float value);
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);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_ap1_coeffs coeffs;
bw_ap1_state states[N_CHANNELS];
bw_ap1_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void AP1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ap1_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void AP1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_ap1_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void AP1<N_CHANNELS>::setCutoff(float value) {
bw_ap1_set_cutoff(&coeffs, value);
}
private:
bw_ap1_coeffs coeffs;
bw_ap1_state states[N_CHANNELS];
bw_ap1_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void AP1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ap1_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void AP1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_ap1_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void AP1<N_CHANNELS>::setCutoff(float value) {
bw_ap1_set_cutoff(&coeffs, value);
}
}
#endif

View File

@ -25,63 +25,75 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class AP2 {
public:
AP2();
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);
/*! api {{{
* ##### Brickworks::AP2
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class AP2 {
public:
AP2();
void setCutoff(float value);
void setQ(float value);
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);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_ap2_coeffs coeffs;
bw_ap2_state states[N_CHANNELS];
bw_ap2_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void AP2<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ap2_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void AP2<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_ap2_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void AP2<N_CHANNELS>::setCutoff(float value) {
bw_ap2_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void AP2<N_CHANNELS>::setQ(float value) {
bw_ap2_set_Q(&coeffs, value);
}
private:
bw_ap2_coeffs coeffs;
bw_ap2_state states[N_CHANNELS];
bw_ap2_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void AP2<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ap2_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void AP2<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_ap2_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void AP2<N_CHANNELS>::setCutoff(float value) {
bw_ap2_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void AP2<N_CHANNELS>::setQ(float value) {
bw_ap2_set_Q(&coeffs, value);
}
}
#endif

View File

@ -25,55 +25,67 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Balance {
public:
Balance();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x_l,
std::array<const float *, N_CHANNELS> x_r,
std::array<float *, N_CHANNELS> y_l,
std::array<float *, N_CHANNELS> y_r,
int nSamples);
/*! api {{{
* ##### Brickworks::Balance
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Balance {
public:
Balance();
void setBalance(float value);
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x_l,
std::array<const float *, N_CHANNELS> x_r,
std::array<float *, N_CHANNELS> y_l,
std::array<float *, N_CHANNELS> y_r,
int nSamples);
void setBalance(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_balance_coeffs coeffs;
};
template<BW_SIZE_T N_CHANNELS>
inline Balance<N_CHANNELS>::Balance() {
bw_balance_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
inline void Balance<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_balance_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
inline void Balance<N_CHANNELS>::reset() {
bw_balance_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
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,
std::array<float *, N_CHANNELS> y_r,
int nSamples) {
bw_balance_process_multi(&coeffs, x_l.data(), x_r.data(), y_l.data(), y_r.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Balance<N_CHANNELS>::setBalance(float value) {
bw_balance_set_balance(&coeffs, value);
}
private:
bw_balance_coeffs coeffs;
};
template<BW_SIZE_T N_CHANNELS>
inline Balance<N_CHANNELS>::Balance() {
bw_balance_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
inline void Balance<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_balance_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
inline void Balance<N_CHANNELS>::reset() {
bw_balance_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
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,
std::array<float *, N_CHANNELS> y_r,
int nSamples) {
bw_balance_process_multi(&coeffs, x_l.data(), x_r.data(), y_l.data(), y_r.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Balance<N_CHANNELS>::setBalance(float value) {
bw_balance_set_balance(&coeffs, value);
}
}
#endif

View File

@ -25,45 +25,57 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class BDReduce {
public:
BDReduce();
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
void setBitDepth(char value);
/*! api {{{
* ##### Brickworks::BDReduce
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class BDReduce {
public:
BDReduce();
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
void setBitDepth(char value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_bd_reduce_coeffs coeffs;
};
template<BW_SIZE_T N_CHANNELS>
inline BDReduce<N_CHANNELS>::BDReduce() {
bw_bd_reduce_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
inline void BDReduce<N_CHANNELS>::reset() {
bw_bd_reduce_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
inline void BDReduce<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_bd_reduce_process_multi(&coeffs, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void BDReduce<N_CHANNELS>::setBitDepth(char value) {
bw_bd_reduce_set_bit_depth(&coeffs, value);
}
private:
bw_bd_reduce_coeffs coeffs;
};
template<BW_SIZE_T N_CHANNELS>
inline BDReduce<N_CHANNELS>::BDReduce() {
bw_bd_reduce_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
inline void BDReduce<N_CHANNELS>::reset() {
bw_bd_reduce_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
inline void BDReduce<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_bd_reduce_process_multi(&coeffs, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void BDReduce<N_CHANNELS>::setBitDepth(char value) {
bw_bd_reduce_set_bit_depth(&coeffs, value);
}
}
#endif

View File

@ -25,97 +25,124 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
void bufFill(
std::array<float *, N_CHANNELS> dest,
float k,
int nSamples);
template<BW_SIZE_T N_CHANNELS>
void bufNeg(
std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src,
int nSamples);
template<BW_SIZE_T N_CHANNELS>
void bufAdd(
std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src,
float k,
int nSamples);
template<BW_SIZE_T N_CHANNELS>
void bufScale(
std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src,
float k,
int nSamples);
/*! api {{{
* ##### Brickworks::bufFill
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
void bufFill(
std::array<float *, N_CHANNELS> dest,
float k,
int nSamples);
/*! <<<```
*
* ##### Brickworks::bufNeg
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
void bufNeg(
std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src,
int nSamples);
/*! <<<```
*
* ##### Brickworks::bufAdd
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
void bufAdd(
std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src,
float k,
int nSamples);
/*! <<<```
*
* ##### Brickworks::bufScale
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
void bufScale(
std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src,
float k,
int nSamples);
/*! <<<```
*
* ##### Brickworks::bufMix
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
void bufMix(
std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src1,
std::array<const float *, N_CHANNELS> src2,
int nSamples);
/*! <<<```
*
* ##### Brickworks::bufMul
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
void bufMul(
std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src1,
std::array<const float *, N_CHANNELS> src2,
int nSamples);
/*! <<<```
* }}} */
template<BW_SIZE_T N_CHANNELS>
void bufMix(
std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src1,
std::array<const float *, N_CHANNELS> src2,
int nSamples);
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
template<BW_SIZE_T N_CHANNELS>
inline void bufFill(
std::array<float *, N_CHANNELS> dest,
float k,
int nSamples) {
bw_buf_fill_multi(dest.data(), k, N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void bufNeg(
std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src,
int nSamples) {
bw_buf_neg_multi(dest.data(), src.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void bufAdd(
std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src,
float k,
int nSamples) {
bw_buf_add_multi(dest.data(), src.data(), k, N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void bufScale(
std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src,
float k,
int nSamples) {
bw_buf_scale_multi(dest.data(), src.data(), k, N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void bufMix(
std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src1,
std::array<const float *, N_CHANNELS> src2,
int nSamples) {
bw_buf_mix_multi(dest.data(), src1.data(), src2.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void bufMul(
std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src1,
std::array<const float *, N_CHANNELS> src2,
int nSamples) {
bw_buf_mul_multi(dest.data(), src1.data(), src2.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
void bufMul(
std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src1,
std::array<const float *, N_CHANNELS> src2,
int nSamples);
template<BW_SIZE_T N_CHANNELS>
inline void bufFill(
std::array<float *, N_CHANNELS> dest,
float k,
int nSamples) {
bw_buf_fill_multi(dest.data(), k, N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void bufNeg(
std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src,
int nSamples) {
bw_buf_neg_multi(dest.data(), src.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void bufAdd(
std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src,
float k,
int nSamples) {
bw_buf_add_multi(dest.data(), src.data(), k, N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void bufScale(
std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src,
float k,
int nSamples) {
bw_buf_scale_multi(dest.data(), src.data(), k, N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void bufMix(
std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src1,
std::array<const float *, N_CHANNELS> src2,
int nSamples) {
bw_buf_mix_multi(dest.data(), src1.data(), src2.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void bufMul(
std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src1,
std::array<const float *, N_CHANNELS> src2,
int nSamples) {
bw_buf_mul_multi(dest.data(), src1.data(), src2.data(), N_CHANNELS, nSamples);
}
}
#endif

View File

@ -25,103 +25,115 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Chorus {
public:
Chorus(float maxDelay = 0.01f);
~Chorus();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! api {{{
* ##### Brickworks::Chorus
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Chorus {
public:
Chorus(float maxDelay = 0.01f);
~Chorus();
void setRate(float value);
void setDelay(float value);
void setAmount(float value);
void setCoeffX(float value);
void setCoeffMod(float value);
void setCoeffFB(float value);
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
void setRate(float value);
void setDelay(float value);
void setAmount(float value);
void setCoeffX(float value);
void setCoeffMod(float value);
void setCoeffFB(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_chorus_coeffs coeffs;
bw_chorus_state states[N_CHANNELS];
bw_chorus_state *statesP[N_CHANNELS];
void *mem;
};
template<BW_SIZE_T N_CHANNELS>
inline Chorus<N_CHANNELS>::Chorus(float maxDelay) {
bw_chorus_init(&coeffs, maxDelay);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
mem = nullptr;
}
template<BW_SIZE_T N_CHANNELS>
inline Chorus<N_CHANNELS>::~Chorus() {
if (mem != nullptr)
operator delete(mem);
}
template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_chorus_set_sample_rate(&coeffs, sampleRate);
BW_SIZE_T req = bw_chorus_mem_req(&coeffs);
if (mem != nullptr)
operator delete(mem);
mem = operator new(req * N_CHANNELS);
void *m = mem;
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++, m = static_cast<char *>(m) + req)
bw_chorus_mem_set(&coeffs, states + i, m);
}
template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::reset() {
bw_chorus_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_chorus_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_chorus_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::setRate(float value) {
bw_chorus_set_rate(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::setDelay(float value) {
bw_chorus_set_delay(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::setAmount(float value) {
bw_chorus_set_amount(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::setCoeffX(float value) {
bw_chorus_set_coeff_x(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::setCoeffMod(float value) {
bw_chorus_set_coeff_mod(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::setCoeffFB(float value) {
bw_chorus_set_coeff_fb(&coeffs, value);
}
private:
bw_chorus_coeffs coeffs;
bw_chorus_state states[N_CHANNELS];
bw_chorus_state *statesP[N_CHANNELS];
void *mem;
};
template<BW_SIZE_T N_CHANNELS>
inline Chorus<N_CHANNELS>::Chorus(float maxDelay) {
bw_chorus_init(&coeffs, maxDelay);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
mem = nullptr;
}
template<BW_SIZE_T N_CHANNELS>
inline Chorus<N_CHANNELS>::~Chorus() {
if (mem != nullptr)
operator delete(mem);
}
template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_chorus_set_sample_rate(&coeffs, sampleRate);
BW_SIZE_T req = bw_chorus_mem_req(&coeffs);
if (mem != nullptr)
operator delete(mem);
mem = operator new(req * N_CHANNELS);
void *m = mem;
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++, m = static_cast<char *>(m) + req)
bw_chorus_mem_set(&coeffs, states + i, m);
}
template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::reset() {
bw_chorus_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_chorus_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_chorus_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::setRate(float value) {
bw_chorus_set_rate(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::setDelay(float value) {
bw_chorus_set_delay(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::setAmount(float value) {
bw_chorus_set_amount(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::setCoeffX(float value) {
bw_chorus_set_coeff_x(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::setCoeffMod(float value) {
bw_chorus_set_coeff_mod(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::setCoeffFB(float value) {
bw_chorus_set_coeff_fb(&coeffs, value);
}
}
#endif

View File

@ -25,69 +25,81 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Clip {
public:
Clip();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! api {{{
* ##### Brickworks::Clip
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Clip {
public:
Clip();
void setBias(float value);
void setGain(float value);
void setGainCompensation(bool value);
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
void setBias(float value);
void setGain(float value);
void setGainCompensation(bool value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_clip_coeffs coeffs;
bw_clip_state states[N_CHANNELS];
bw_clip_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void Clip<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_clip_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void Clip<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_clip_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Clip<N_CHANNELS>::setBias(float value) {
bw_clip_set_bias(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Clip<N_CHANNELS>::setGain(float value) {
bw_clip_set_gain(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Clip<N_CHANNELS>::setGainCompensation(bool value) {
bw_clip_set_gain_compensation(&coeffs, value);
}
private:
bw_clip_coeffs coeffs;
bw_clip_state states[N_CHANNELS];
bw_clip_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void Clip<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_clip_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void Clip<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_clip_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Clip<N_CHANNELS>::setBias(float value) {
bw_clip_set_bias(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Clip<N_CHANNELS>::setGain(float value) {
bw_clip_set_gain(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Clip<N_CHANNELS>::setGainCompensation(bool value) {
bw_clip_set_gain_compensation(&coeffs, value);
}
}
#endif

View File

@ -25,97 +25,109 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Comb {
public:
Comb(float maxDelay = 1.f);
~Comb();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! api {{{
* ##### Brickworks::Comb
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Comb {
public:
Comb(float maxDelay = 1.f);
~Comb();
void setDelayFF(float value);
void setDelayFB(float value);
void setCoeffBlend(float value);
void setCoeffFF(float value);
void setCoeffFB(float value);
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
void setDelayFF(float value);
void setDelayFB(float value);
void setCoeffBlend(float value);
void setCoeffFF(float value);
void setCoeffFB(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_comb_coeffs coeffs;
bw_comb_state states[N_CHANNELS];
bw_comb_state *statesP[N_CHANNELS];
void *mem;
};
template<BW_SIZE_T N_CHANNELS>
inline Comb<N_CHANNELS>::Comb(float maxDelay) {
bw_comb_init(&coeffs, maxDelay);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
mem = nullptr;
}
template<BW_SIZE_T N_CHANNELS>
inline Comb<N_CHANNELS>::~Comb() {
if (mem != nullptr)
operator delete(mem);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_comb_set_sample_rate(&coeffs, sampleRate);
BW_SIZE_T req = bw_comb_mem_req(&coeffs);
if (mem != nullptr)
operator delete(mem);
mem = operator new(req * N_CHANNELS);
void *m = mem;
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++, m = static_cast<char *>(m) + req)
bw_comb_mem_set(&coeffs, states + i, m);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::reset() {
bw_comb_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_comb_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_comb_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::setDelayFF(float value) {
bw_comb_set_delay_ff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::setDelayFB(float value) {
bw_comb_set_delay_fb(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::setCoeffBlend(float value) {
bw_comb_set_coeff_blend(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::setCoeffFF(float value) {
bw_comb_set_coeff_ff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::setCoeffFB(float value) {
bw_comb_set_coeff_fb(&coeffs, value);
}
private:
bw_comb_coeffs coeffs;
bw_comb_state states[N_CHANNELS];
bw_comb_state *statesP[N_CHANNELS];
void *mem;
};
template<BW_SIZE_T N_CHANNELS>
inline Comb<N_CHANNELS>::Comb(float maxDelay) {
bw_comb_init(&coeffs, maxDelay);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
mem = nullptr;
}
template<BW_SIZE_T N_CHANNELS>
inline Comb<N_CHANNELS>::~Comb() {
if (mem != nullptr)
operator delete(mem);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_comb_set_sample_rate(&coeffs, sampleRate);
BW_SIZE_T req = bw_comb_mem_req(&coeffs);
if (mem != nullptr)
operator delete(mem);
mem = operator new(req * N_CHANNELS);
void *m = mem;
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++, m = static_cast<char *>(m) + req)
bw_comb_mem_set(&coeffs, states + i, m);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::reset() {
bw_comb_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_comb_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_comb_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::setDelayFF(float value) {
bw_comb_set_delay_ff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::setDelayFB(float value) {
bw_comb_set_delay_fb(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::setCoeffBlend(float value) {
bw_comb_set_coeff_blend(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::setCoeffFF(float value) {
bw_comb_set_coeff_ff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::setCoeffFB(float value) {
bw_comb_set_coeff_fb(&coeffs, value);
}
}
#endif

View File

@ -25,95 +25,107 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Comp {
public:
Comp();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<const float *, N_CHANNELS> xSC,
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! api {{{
* ##### Brickworks::Comp
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Comp {
public:
Comp();
void setTreshLin(float value);
void setTreshDBFS(float value);
void setRatio(float value);
void setAttackTau(float value);
void setReleaseTau(float value);
void setGainLin(float value);
void setGainDB(float value);
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<const float *, N_CHANNELS> xSC,
std::array<float *, N_CHANNELS> y,
int nSamples);
void setTreshLin(float value);
void setTreshDBFS(float value);
void setRatio(float value);
void setAttackTau(float value);
void setReleaseTau(float value);
void setGainLin(float value);
void setGainDB(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_comp_coeffs coeffs;
bw_comp_state states[N_CHANNELS];
bw_comp_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void Comp<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_comp_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
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,
int nSamples) {
bw_comp_process_multi(&coeffs, statesP, x.data(), xSC.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::setTreshLin(float value) {
bw_comp_set_thresh_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::setTreshDBFS(float value) {
bw_comp_set_thresh_dBFS(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::setRatio(float value) {
bw_comp_set_ratio(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::setAttackTau(float value) {
bw_comp_set_attack_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::setReleaseTau(float value) {
bw_comp_set_release_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::setGainLin(float value) {
bw_comp_set_gain_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::setGainDB(float value) {
bw_comp_set_gain_dB(&coeffs, value);
}
private:
bw_comp_coeffs coeffs;
bw_comp_state states[N_CHANNELS];
bw_comp_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void Comp<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_comp_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
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,
int nSamples) {
bw_comp_process_multi(&coeffs, statesP, x.data(), xSC.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::setTreshLin(float value) {
bw_comp_set_thresh_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::setTreshDBFS(float value) {
bw_comp_set_thresh_dBFS(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::setRatio(float value) {
bw_comp_set_ratio(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::setAttackTau(float value) {
bw_comp_set_attack_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::setReleaseTau(float value) {
bw_comp_set_release_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::setGainLin(float value) {
bw_comp_set_gain_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::setGainDB(float value) {
bw_comp_set_gain_dB(&coeffs, value);
}
}
#endif

View File

@ -25,93 +25,105 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Delay {
public:
Delay(float maxDelay = 1.f);
~Delay();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
float read(BW_SIZE_T channel, BW_SIZE_T di, float df);
void write(BW_SIZE_T channel, float x);
/*! api {{{
* ##### Brickworks::Delay
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Delay {
public:
Delay(float maxDelay = 1.f);
~Delay();
void setDelay(float value);
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
BW_SIZE_T getLength();
float read(BW_SIZE_T channel, BW_SIZE_T di, float df);
void write(BW_SIZE_T channel, float x);
private:
bw_delay_coeffs coeffs;
bw_delay_state states[N_CHANNELS];
bw_delay_state *statesP[N_CHANNELS];
void *mem;
};
void setDelay(float value);
template<BW_SIZE_T N_CHANNELS>
inline Delay<N_CHANNELS>::Delay(float maxDelay) {
bw_delay_init(&coeffs, maxDelay);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
mem = nullptr;
}
template<BW_SIZE_T N_CHANNELS>
inline Delay<N_CHANNELS>::~Delay() {
if (mem != nullptr)
operator delete(mem);
}
template<BW_SIZE_T N_CHANNELS>
inline void Delay<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_delay_set_sample_rate(&coeffs, sampleRate);
BW_SIZE_T req = bw_delay_mem_req(&coeffs);
if (mem != nullptr)
operator delete(mem);
mem = operator new(req * N_CHANNELS);
void *m = mem;
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++, m = static_cast<char *>(m) + req)
bw_delay_mem_set(&coeffs, states + i, m);
}
template<BW_SIZE_T N_CHANNELS>
inline void Delay<N_CHANNELS>::reset() {
bw_delay_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_delay_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
inline void Delay<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_delay_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline float Delay<N_CHANNELS>::read(BW_SIZE_T channel, BW_SIZE_T di, float df) {
return bw_delay_read(&coeffs, states + channel, di, df);
}
template<BW_SIZE_T N_CHANNELS>
inline void Delay<N_CHANNELS>::write(BW_SIZE_T channel, float x) {
bw_delay_write(&coeffs, states + channel, x);
}
template<BW_SIZE_T N_CHANNELS>
inline void Delay<N_CHANNELS>::setDelay(float value) {
bw_delay_set_delay(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline BW_SIZE_T Delay<N_CHANNELS>::getLength() {
return bw_delay_get_length(&coeffs);
}
BW_SIZE_T getLength();
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_delay_coeffs coeffs;
bw_delay_state states[N_CHANNELS];
bw_delay_state *statesP[N_CHANNELS];
void *mem;
};
template<BW_SIZE_T N_CHANNELS>
inline Delay<N_CHANNELS>::Delay(float maxDelay) {
bw_delay_init(&coeffs, maxDelay);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
mem = nullptr;
}
template<BW_SIZE_T N_CHANNELS>
inline Delay<N_CHANNELS>::~Delay() {
if (mem != nullptr)
operator delete(mem);
}
template<BW_SIZE_T N_CHANNELS>
inline void Delay<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_delay_set_sample_rate(&coeffs, sampleRate);
BW_SIZE_T req = bw_delay_mem_req(&coeffs);
if (mem != nullptr)
operator delete(mem);
mem = operator new(req * N_CHANNELS);
void *m = mem;
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++, m = static_cast<char *>(m) + req)
bw_delay_mem_set(&coeffs, states + i, m);
}
template<BW_SIZE_T N_CHANNELS>
inline void Delay<N_CHANNELS>::reset() {
bw_delay_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_delay_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
inline void Delay<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_delay_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline float Delay<N_CHANNELS>::read(BW_SIZE_T channel, BW_SIZE_T di, float df) {
return bw_delay_read(&coeffs, states + channel, di, df);
}
template<BW_SIZE_T N_CHANNELS>
inline void Delay<N_CHANNELS>::write(BW_SIZE_T channel, float x) {
bw_delay_write(&coeffs, states + channel, x);
}
template<BW_SIZE_T N_CHANNELS>
inline void Delay<N_CHANNELS>::setDelay(float value) {
bw_delay_set_delay(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline BW_SIZE_T Delay<N_CHANNELS>::getLength() {
return bw_delay_get_length(&coeffs);
}
}
#endif

View File

@ -25,69 +25,81 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Dist {
public:
Dist();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! api {{{
* ##### Brickworks::Dist
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Dist {
public:
Dist();
void setDistortion(float value);
void setTone(float value);
void setVolume(float value);
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
void setDistortion(float value);
void setTone(float value);
void setVolume(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_dist_coeffs coeffs;
bw_dist_state states[N_CHANNELS];
bw_dist_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void Dist<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_dist_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void Dist<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_dist_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Dist<N_CHANNELS>::setDistortion(float value) {
bw_dist_set_distortion(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Dist<N_CHANNELS>::setTone(float value) {
bw_dist_set_tone(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Dist<N_CHANNELS>::setVolume(float value) {
bw_dist_set_volume(&coeffs, value);
}
private:
bw_dist_coeffs coeffs;
bw_dist_state states[N_CHANNELS];
bw_dist_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void Dist<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_dist_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void Dist<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_dist_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Dist<N_CHANNELS>::setDistortion(float value) {
bw_dist_set_distortion(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Dist<N_CHANNELS>::setTone(float value) {
bw_dist_set_tone(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Dist<N_CHANNELS>::setVolume(float value) {
bw_dist_set_volume(&coeffs, value);
}
}
#endif

View File

@ -25,69 +25,81 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Drive {
public:
Drive();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! api {{{
* ##### Brickworks::Drive
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Drive {
public:
Drive();
void setDrive(float value);
void setTone(float value);
void setVolume(float value);
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
void setDrive(float value);
void setTone(float value);
void setVolume(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_drive_coeffs coeffs;
bw_drive_state states[N_CHANNELS];
bw_drive_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void Drive<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_drive_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void Drive<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_drive_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Drive<N_CHANNELS>::setDrive(float value) {
bw_drive_set_drive(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Drive<N_CHANNELS>::setTone(float value) {
bw_drive_set_tone(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Drive<N_CHANNELS>::setVolume(float value) {
bw_drive_set_volume(&coeffs, value);
}
private:
bw_drive_coeffs coeffs;
bw_drive_state states[N_CHANNELS];
bw_drive_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void Drive<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_drive_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void Drive<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_drive_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Drive<N_CHANNELS>::setDrive(float value) {
bw_drive_set_drive(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Drive<N_CHANNELS>::setTone(float value) {
bw_drive_set_tone(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Drive<N_CHANNELS>::setVolume(float value) {
bw_drive_set_volume(&coeffs, value);
}
}
#endif

View File

@ -25,59 +25,71 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class DryWet {
public:
DryWet();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x_dry,
std::array<const float *, N_CHANNELS> x_wet,
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! api {{{
* ##### Brickworks::DryWet
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class DryWet {
public:
DryWet();
void setWet(float value);
void setSmoothTau(float value);
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x_dry,
std::array<const float *, N_CHANNELS> x_wet,
std::array<float *, N_CHANNELS> y,
int nSamples);
void setWet(float value);
void setSmoothTau(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_drywet_coeffs coeffs;
};
template<BW_SIZE_T N_CHANNELS>
inline DryWet<N_CHANNELS>::DryWet() {
bw_drywet_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
inline void DryWet<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_drywet_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
inline void DryWet<N_CHANNELS>::reset() {
bw_drywet_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
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,
int nSamples) {
bw_drywet_process_multi(&coeffs, x_dry.data(), x_wet.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void DryWet<N_CHANNELS>::setWet(float value) {
bw_drywet_set_wet(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void DryWet<N_CHANNELS>::setSmoothTau(float value) {
bw_drywet_set_smooth_tau(&coeffs, value);
}
private:
bw_drywet_coeffs coeffs;
};
template<BW_SIZE_T N_CHANNELS>
inline DryWet<N_CHANNELS>::DryWet() {
bw_drywet_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
inline void DryWet<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_drywet_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
inline void DryWet<N_CHANNELS>::reset() {
bw_drywet_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
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,
int nSamples) {
bw_drywet_process_multi(&coeffs, x_dry.data(), x_wet.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void DryWet<N_CHANNELS>::setWet(float value) {
bw_drywet_set_wet(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void DryWet<N_CHANNELS>::setSmoothTau(float value) {
bw_drywet_set_smooth_tau(&coeffs, value);
}
}
#endif

View File

@ -25,70 +25,82 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class EnvFollow {
public:
EnvFollow();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! api {{{
* ##### Brickworks::EnvFollow
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class EnvFollow {
public:
EnvFollow();
void setAttackTau(float value);
void setReleaseTau(float value);
float getYZ1(BW_SIZE_T channel);
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
private:
bw_env_follow_coeffs coeffs;
bw_env_follow_state states[N_CHANNELS];
bw_env_follow_state *statesP[N_CHANNELS];
};
void setAttackTau(float value);
void setReleaseTau(float value);
template<BW_SIZE_T N_CHANNELS>
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>
inline void EnvFollow<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_env_follow_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void EnvFollow<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_env_follow_process_multi(&coeffs, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void EnvFollow<N_CHANNELS>::setAttackTau(float value) {
bw_env_follow_set_attack_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void EnvFollow<N_CHANNELS>::setReleaseTau(float value) {
bw_env_follow_set_release_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline float EnvFollow<N_CHANNELS>::getYZ1(BW_SIZE_T channel) {
return bw_env_follow_get_y_z1(states + channel);
}
float getYZ1(BW_SIZE_T channel);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_env_follow_coeffs coeffs;
bw_env_follow_state states[N_CHANNELS];
bw_env_follow_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void EnvFollow<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_env_follow_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void EnvFollow<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_env_follow_process_multi(&coeffs, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void EnvFollow<N_CHANNELS>::setAttackTau(float value) {
bw_env_follow_set_attack_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void EnvFollow<N_CHANNELS>::setReleaseTau(float value) {
bw_env_follow_set_release_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline float EnvFollow<N_CHANNELS>::getYZ1(BW_SIZE_T channel) {
return bw_env_follow_get_y_z1(states + channel);
}
}
#endif

View File

@ -25,88 +25,100 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class EnvGen {
public:
EnvGen();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<char, N_CHANNELS> gate,
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! api {{{
* ##### Brickworks::EnvGen
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class EnvGen {
public:
EnvGen();
void setAttack(float value);
void setDecay(float value);
void setSustain(float value);
void setRelease(float value);
bw_env_gen_phase getPhase(BW_SIZE_T channel);
float getYZ1(BW_SIZE_T channel);
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<char, N_CHANNELS> gate,
std::array<float *, N_CHANNELS> y,
int nSamples);
private:
bw_env_gen_coeffs coeffs;
bw_env_gen_state states[N_CHANNELS];
bw_env_gen_state *statesP[N_CHANNELS];
};
void setAttack(float value);
void setDecay(float value);
void setSustain(float value);
void setRelease(float value);
template<BW_SIZE_T N_CHANNELS>
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>
inline void EnvGen<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_env_gen_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void EnvGen<N_CHANNELS>::process(
std::array<char, N_CHANNELS> gate,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_env_gen_process_multi(&coeffs, statesP, gate.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void EnvGen<N_CHANNELS>::setAttack(float value) {
bw_env_gen_set_attack(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void EnvGen<N_CHANNELS>::setDecay(float value) {
bw_env_gen_set_decay(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void EnvGen<N_CHANNELS>::setSustain(float value) {
bw_env_gen_set_sustain(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void EnvGen<N_CHANNELS>::setRelease(float value) {
bw_env_gen_set_release(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline float EnvGen<N_CHANNELS>::getYZ1(BW_SIZE_T channel) {
return bw_env_gen_get_y_z1(states + channel);
}
bw_env_gen_phase getPhase(BW_SIZE_T channel);
float getYZ1(BW_SIZE_T channel);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_env_gen_coeffs coeffs;
bw_env_gen_state states[N_CHANNELS];
bw_env_gen_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void EnvGen<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_env_gen_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void EnvGen<N_CHANNELS>::process(
std::array<char, N_CHANNELS> gate,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_env_gen_process_multi(&coeffs, statesP, gate.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void EnvGen<N_CHANNELS>::setAttack(float value) {
bw_env_gen_set_attack(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void EnvGen<N_CHANNELS>::setDecay(float value) {
bw_env_gen_set_decay(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void EnvGen<N_CHANNELS>::setSustain(float value) {
bw_env_gen_set_sustain(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void EnvGen<N_CHANNELS>::setRelease(float value) {
bw_env_gen_set_release(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline float EnvGen<N_CHANNELS>::getYZ1(BW_SIZE_T channel) {
return bw_env_gen_get_y_z1(states + channel);
}
}
#endif

View File

@ -25,63 +25,75 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Fuzz {
public:
Fuzz();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! api {{{
* ##### Brickworks::Fuzz
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Fuzz {
public:
Fuzz();
void setFuzz(float value);
void setVolume(float value);
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
void setFuzz(float value);
void setVolume(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_fuzz_coeffs coeffs;
bw_fuzz_state states[N_CHANNELS];
bw_fuzz_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void Fuzz<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_fuzz_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void Fuzz<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_fuzz_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Fuzz<N_CHANNELS>::setFuzz(float value) {
bw_fuzz_set_fuzz(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Fuzz<N_CHANNELS>::setVolume(float value) {
bw_fuzz_set_volume(&coeffs, value);
}
private:
bw_fuzz_coeffs coeffs;
bw_fuzz_state states[N_CHANNELS];
bw_fuzz_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void Fuzz<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_fuzz_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void Fuzz<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_fuzz_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Fuzz<N_CHANNELS>::setFuzz(float value) {
bw_fuzz_set_fuzz(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Fuzz<N_CHANNELS>::setVolume(float value) {
bw_fuzz_set_volume(&coeffs, value);
}
}
#endif

View File

@ -25,70 +25,82 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Gain {
public:
Gain();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! api {{{
* ##### Brickworks::Gain
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Gain {
public:
Gain();
void setGainLin(float value);
void setGainDB(float value);
void setSmoothTau(float value);
float getGain();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
private:
bw_gain_coeffs coeffs;
};
void setGainLin(float value);
void setGainDB(float value);
void setSmoothTau(float value);
template<BW_SIZE_T N_CHANNELS>
inline Gain<N_CHANNELS>::Gain() {
bw_gain_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
inline void Gain<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_gain_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
inline void Gain<N_CHANNELS>::reset() {
bw_gain_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
inline void Gain<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_gain_process_multi(&coeffs, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Gain<N_CHANNELS>::setGainLin(float value) {
bw_gain_set_gain_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Gain<N_CHANNELS>::setGainDB(float value) {
bw_gain_set_gain_dB(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Gain<N_CHANNELS>::setSmoothTau(float value) {
bw_gain_set_smooth_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline float Gain<N_CHANNELS>::getGain() {
return bw_gain_get_gain(&coeffs);
}
float getGain();
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_gain_coeffs coeffs;
};
template<BW_SIZE_T N_CHANNELS>
inline Gain<N_CHANNELS>::Gain() {
bw_gain_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
inline void Gain<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_gain_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
inline void Gain<N_CHANNELS>::reset() {
bw_gain_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
inline void Gain<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_gain_process_multi(&coeffs, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Gain<N_CHANNELS>::setGainLin(float value) {
bw_gain_set_gain_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Gain<N_CHANNELS>::setGainDB(float value) {
bw_gain_set_gain_dB(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Gain<N_CHANNELS>::setSmoothTau(float value) {
bw_gain_set_smooth_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline float Gain<N_CHANNELS>::getGain() {
return bw_gain_get_gain(&coeffs);
}
}
#endif

View File

@ -25,57 +25,69 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class HP1 {
public:
HP1();
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);
/*! api {{{
* ##### Brickworks::HP1
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class HP1 {
public:
HP1();
void setCutoff(float value);
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);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_hp1_coeffs coeffs;
bw_hp1_state states[N_CHANNELS];
bw_hp1_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void HP1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_hp1_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void HP1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_hp1_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void HP1<N_CHANNELS>::setCutoff(float value) {
bw_hp1_set_cutoff(&coeffs, value);
}
private:
bw_hp1_coeffs coeffs;
bw_hp1_state states[N_CHANNELS];
bw_hp1_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void HP1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_hp1_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void HP1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_hp1_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void HP1<N_CHANNELS>::setCutoff(float value) {
bw_hp1_set_cutoff(&coeffs, value);
}
}
#endif

View File

@ -25,69 +25,81 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class HS1 {
public:
HS1();
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);
/*! api {{{
* ##### Brickworks::HS1
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class HS1 {
public:
HS1();
void setCutoff(float value);
void setHighGainLin(float value);
void setHighGainDB(float value);
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 setHighGainLin(float value);
void setHighGainDB(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_hs1_coeffs coeffs;
bw_hs1_state states[N_CHANNELS];
bw_hs1_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void HS1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_hs1_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void HS1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_hs1_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void HS1<N_CHANNELS>::setCutoff(float value) {
bw_hs1_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void HS1<N_CHANNELS>::setHighGainLin(float value) {
bw_hs1_set_high_gain_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void HS1<N_CHANNELS>::setHighGainDB(float value) {
bw_hs1_set_high_gain_dB(&coeffs, value);
}
private:
bw_hs1_coeffs coeffs;
bw_hs1_state states[N_CHANNELS];
bw_hs1_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void HS1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_hs1_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void HS1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_hs1_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void HS1<N_CHANNELS>::setCutoff(float value) {
bw_hs1_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void HS1<N_CHANNELS>::setHighGainLin(float value) {
bw_hs1_set_high_gain_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void HS1<N_CHANNELS>::setHighGainDB(float value) {
bw_hs1_set_high_gain_dB(&coeffs, value);
}
}
#endif

View File

@ -25,75 +25,87 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class HS2 {
public:
HS2();
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);
/*! api {{{
* ##### Brickworks::HS2
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class HS2 {
public:
HS2();
void setCutoff(float value);
void setQ(float value);
void setHighGainLin(float value);
void setHighGainDB(float value);
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);
void setHighGainLin(float value);
void setHighGainDB(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_hs2_coeffs coeffs;
bw_hs2_state states[N_CHANNELS];
bw_hs2_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void HS2<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_hs2_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void HS2<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_hs2_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void HS2<N_CHANNELS>::setCutoff(float value) {
bw_hs2_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void HS2<N_CHANNELS>::setQ(float value) {
bw_hs2_set_Q(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void HS2<N_CHANNELS>::setHighGainLin(float value) {
bw_hs2_set_high_gain_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void HS2<N_CHANNELS>::setHighGainDB(float value) {
bw_hs2_set_high_gain_dB(&coeffs, value);
}
private:
bw_hs2_coeffs coeffs;
bw_hs2_state states[N_CHANNELS];
bw_hs2_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void HS2<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_hs2_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void HS2<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_hs2_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void HS2<N_CHANNELS>::setCutoff(float value) {
bw_hs2_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void HS2<N_CHANNELS>::setQ(float value) {
bw_hs2_set_Q(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void HS2<N_CHANNELS>::setHighGainLin(float value) {
bw_hs2_set_high_gain_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void HS2<N_CHANNELS>::setHighGainDB(float value) {
bw_hs2_set_high_gain_dB(&coeffs, value);
}
}
#endif

View File

@ -25,69 +25,81 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class LP1 {
public:
LP1();
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);
/*! api {{{
* ##### Brickworks::LP1
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class LP1 {
public:
LP1();
void setCutoff(float value);
void setPrewarpAtCutoff(bool value);
void setPrewarpFreq(float value);
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 setPrewarpAtCutoff(bool value);
void setPrewarpFreq(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_lp1_coeffs coeffs;
bw_lp1_state states[N_CHANNELS];
bw_lp1_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void LP1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_lp1_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void LP1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_lp1_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void LP1<N_CHANNELS>::setCutoff(float value) {
bw_lp1_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void LP1<N_CHANNELS>::setPrewarpAtCutoff(bool value) {
bw_lp1_set_prewarp_at_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void LP1<N_CHANNELS>::setPrewarpFreq(float value) {
bw_lp1_set_prewarp_freq(&coeffs, value);
}
private:
bw_lp1_coeffs coeffs;
bw_lp1_state states[N_CHANNELS];
bw_lp1_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void LP1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_lp1_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void LP1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_lp1_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void LP1<N_CHANNELS>::setCutoff(float value) {
bw_lp1_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void LP1<N_CHANNELS>::setPrewarpAtCutoff(bool value) {
bw_lp1_set_prewarp_at_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void LP1<N_CHANNELS>::setPrewarpFreq(float value) {
bw_lp1_set_prewarp_freq(&coeffs, value);
}
}
#endif

View File

@ -25,69 +25,81 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class LS1 {
public:
LS1();
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);
/*! api {{{
* ##### Brickworks::LS1
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class LS1 {
public:
LS1();
void setCutoff(float value);
void setDcGainLin(float value);
void setDcGainDB(float value);
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 setDcGainLin(float value);
void setDcGainDB(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_ls1_coeffs coeffs;
bw_ls1_state states[N_CHANNELS];
bw_ls1_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void LS1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ls1_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void LS1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_ls1_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void LS1<N_CHANNELS>::setCutoff(float value) {
bw_ls1_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void LS1<N_CHANNELS>::setDcGainLin(float value) {
bw_ls1_set_dc_gain_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void LS1<N_CHANNELS>::setDcGainDB(float value) {
bw_ls1_set_dc_gain_dB(&coeffs, value);
}
private:
bw_ls1_coeffs coeffs;
bw_ls1_state states[N_CHANNELS];
bw_ls1_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void LS1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ls1_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void LS1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_ls1_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void LS1<N_CHANNELS>::setCutoff(float value) {
bw_ls1_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void LS1<N_CHANNELS>::setDcGainLin(float value) {
bw_ls1_set_dc_gain_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void LS1<N_CHANNELS>::setDcGainDB(float value) {
bw_ls1_set_dc_gain_dB(&coeffs, value);
}
}
#endif

View File

@ -25,75 +25,87 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class LS2 {
public:
LS2();
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);
/*! api {{{
* ##### Brickworks::LS2
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class LS2 {
public:
LS2();
void setCutoff(float value);
void setQ(float value);
void setDcGainLin(float value);
void setDcGainDB(float value);
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);
void setDcGainLin(float value);
void setDcGainDB(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_ls2_coeffs coeffs;
bw_ls2_state states[N_CHANNELS];
bw_ls2_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void LS2<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ls2_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void LS2<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_ls2_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void LS2<N_CHANNELS>::setCutoff(float value) {
bw_ls2_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void LS2<N_CHANNELS>::setQ(float value) {
bw_ls2_set_Q(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void LS2<N_CHANNELS>::setDcGainLin(float value) {
bw_ls2_set_dc_gain_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void LS2<N_CHANNELS>::setDcGainDB(float value) {
bw_ls2_set_dc_gain_dB(&coeffs, value);
}
private:
bw_ls2_coeffs coeffs;
bw_ls2_state states[N_CHANNELS];
bw_ls2_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void LS2<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ls2_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void LS2<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_ls2_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void LS2<N_CHANNELS>::setCutoff(float value) {
bw_ls2_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void LS2<N_CHANNELS>::setQ(float value) {
bw_ls2_set_Q(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void LS2<N_CHANNELS>::setDcGainLin(float value) {
bw_ls2_set_dc_gain_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void LS2<N_CHANNELS>::setDcGainDB(float value) {
bw_ls2_set_dc_gain_dB(&coeffs, value);
}
}
#endif

View File

@ -25,81 +25,93 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class MM1 {
public:
MM1();
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);
/*! api {{{
* ##### Brickworks::MM1
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class MM1 {
public:
MM1();
void setCutoff(float value);
void setPrewarpAtCutoff(bool value);
void setPrewarpFreq(float value);
void setCoeffX(float value);
void setCoeffLp(float value);
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 setPrewarpAtCutoff(bool value);
void setPrewarpFreq(float value);
void setCoeffX(float value);
void setCoeffLp(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_mm1_coeffs coeffs;
bw_mm1_state states[N_CHANNELS];
bw_mm1_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void MM1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_mm1_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void MM1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_mm1_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM1<N_CHANNELS>::setCutoff(float value) {
bw_mm1_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM1<N_CHANNELS>::setPrewarpAtCutoff(bool value) {
bw_mm1_set_prewarp_at_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM1<N_CHANNELS>::setPrewarpFreq(float value) {
bw_mm1_set_prewarp_freq(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM1<N_CHANNELS>::setCoeffX(float value) {
bw_mm1_set_coeff_x(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM1<N_CHANNELS>::setCoeffLp(float value) {
bw_mm1_set_coeff_lp(&coeffs, value);
}
private:
bw_mm1_coeffs coeffs;
bw_mm1_state states[N_CHANNELS];
bw_mm1_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void MM1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_mm1_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void MM1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_mm1_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM1<N_CHANNELS>::setCutoff(float value) {
bw_mm1_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM1<N_CHANNELS>::setPrewarpAtCutoff(bool value) {
bw_mm1_set_prewarp_at_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM1<N_CHANNELS>::setPrewarpFreq(float value) {
bw_mm1_set_prewarp_freq(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM1<N_CHANNELS>::setCoeffX(float value) {
bw_mm1_set_coeff_x(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM1<N_CHANNELS>::setCoeffLp(float value) {
bw_mm1_set_coeff_lp(&coeffs, value);
}
}
#endif

View File

@ -25,99 +25,111 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class MM2 {
public:
MM2();
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);
/*! api {{{
* ##### Brickworks::MM2
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class MM2 {
public:
MM2();
void setCutoff(float value);
void setQ(float value);
void setPrewarpAtCutoff(bool value);
void setPrewarpFreq(float value);
void setCoeffX(float value);
void setCoeffLp(float value);
void setCoeffBp(float value);
void setCoeffHp(float value);
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);
void setPrewarpAtCutoff(bool value);
void setPrewarpFreq(float value);
void setCoeffX(float value);
void setCoeffLp(float value);
void setCoeffBp(float value);
void setCoeffHp(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_mm2_coeffs coeffs;
bw_mm2_state states[N_CHANNELS];
bw_mm2_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void MM2<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_mm2_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void MM2<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_mm2_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setCutoff(float value) {
bw_mm2_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setQ(float value) {
bw_mm2_set_Q(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setPrewarpAtCutoff(bool value) {
bw_mm2_set_prewarp_at_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setPrewarpFreq(float value) {
bw_mm2_set_prewarp_freq(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setCoeffX(float value) {
bw_mm2_set_coeff_x(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setCoeffLp(float value) {
bw_mm2_set_coeff_lp(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setCoeffBp(float value) {
bw_mm2_set_coeff_bp(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setCoeffHp(float value) {
bw_mm2_set_coeff_hp(&coeffs, value);
}
private:
bw_mm2_coeffs coeffs;
bw_mm2_state states[N_CHANNELS];
bw_mm2_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void MM2<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_mm2_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void MM2<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_mm2_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setCutoff(float value) {
bw_mm2_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setQ(float value) {
bw_mm2_set_Q(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setPrewarpAtCutoff(bool value) {
bw_mm2_set_prewarp_at_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setPrewarpFreq(float value) {
bw_mm2_set_prewarp_freq(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setCoeffX(float value) {
bw_mm2_set_coeff_x(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setCoeffLp(float value) {
bw_mm2_set_coeff_lp(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setCoeffBp(float value) {
bw_mm2_set_coeff_bp(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setCoeffHp(float value) {
bw_mm2_set_coeff_hp(&coeffs, value);
}
}
#endif

View File

@ -25,83 +25,95 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class NoiseGate {
public:
NoiseGate();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<const float *, N_CHANNELS> xSC,
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! api {{{
* ##### Brickworks::NoiseGate
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class NoiseGate {
public:
NoiseGate();
void setTreshLin(float value);
void setTreshDBFS(float value);
void setRatio(float value);
void setAttackTau(float value);
void setReleaseTau(float value);
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<const float *, N_CHANNELS> xSC,
std::array<float *, N_CHANNELS> y,
int nSamples);
void setTreshLin(float value);
void setTreshDBFS(float value);
void setRatio(float value);
void setAttackTau(float value);
void setReleaseTau(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_noise_gate_coeffs coeffs;
bw_noise_gate_state states[N_CHANNELS];
bw_noise_gate_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void NoiseGate<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_noise_gate_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
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,
int nSamples) {
bw_noise_gate_process_multi(&coeffs, statesP, x.data(), xSC.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void NoiseGate<N_CHANNELS>::setTreshLin(float value) {
bw_noise_gate_set_thresh_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void NoiseGate<N_CHANNELS>::setTreshDBFS(float value) {
bw_noise_gate_set_thresh_dBFS(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void NoiseGate<N_CHANNELS>::setRatio(float value) {
bw_noise_gate_set_ratio(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void NoiseGate<N_CHANNELS>::setAttackTau(float value) {
bw_noise_gate_set_attack_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void NoiseGate<N_CHANNELS>::setReleaseTau(float value) {
bw_noise_gate_set_release_tau(&coeffs, value);
}
private:
bw_noise_gate_coeffs coeffs;
bw_noise_gate_state states[N_CHANNELS];
bw_noise_gate_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void NoiseGate<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_noise_gate_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
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,
int nSamples) {
bw_noise_gate_process_multi(&coeffs, statesP, x.data(), xSC.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void NoiseGate<N_CHANNELS>::setTreshLin(float value) {
bw_noise_gate_set_thresh_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void NoiseGate<N_CHANNELS>::setTreshDBFS(float value) {
bw_noise_gate_set_thresh_dBFS(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void NoiseGate<N_CHANNELS>::setRatio(float value) {
bw_noise_gate_set_ratio(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void NoiseGate<N_CHANNELS>::setAttackTau(float value) {
bw_noise_gate_set_attack_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void NoiseGate<N_CHANNELS>::setReleaseTau(float value) {
bw_noise_gate_set_release_tau(&coeffs, value);
}
}
#endif

View File

@ -25,50 +25,62 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class NoiseGen {
public:
NoiseGen(uint64_t *BW_RESTRICT state);
void setSampleRate(float sampleRate);
void process(
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! api {{{
* ##### Brickworks::NoiseGen
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class NoiseGen {
public:
NoiseGen(uint64_t *BW_RESTRICT state);
void setSampleRateScaling(bool value);
float getScalingK();
void setSampleRate(float sampleRate);
void process(
std::array<float *, N_CHANNELS> y,
int nSamples);
private:
bw_noise_gen_coeffs coeffs;
};
void setSampleRateScaling(bool value);
template<BW_SIZE_T N_CHANNELS>
inline NoiseGen<N_CHANNELS>::NoiseGen(uint64_t *BW_RESTRICT state) {
bw_noise_gen_init(&coeffs, state);
}
template<BW_SIZE_T N_CHANNELS>
inline void NoiseGen<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_noise_gen_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
inline void NoiseGen<N_CHANNELS>::process(
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_noise_gen_process_multi(&coeffs, y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void NoiseGen<N_CHANNELS>::setSampleRateScaling(bool value) {
bw_noise_gen_set_sample_rate_scaling(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline float NoiseGen<N_CHANNELS>::getScalingK() {
return bw_noise_gen_get_scaling_k(&coeffs);
}
float getScalingK();
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_noise_gen_coeffs coeffs;
};
template<BW_SIZE_T N_CHANNELS>
inline NoiseGen<N_CHANNELS>::NoiseGen(uint64_t *BW_RESTRICT state) {
bw_noise_gen_init(&coeffs, state);
}
template<BW_SIZE_T N_CHANNELS>
inline void NoiseGen<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_noise_gen_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
inline void NoiseGen<N_CHANNELS>::process(
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_noise_gen_process_multi(&coeffs, y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void NoiseGen<N_CHANNELS>::setSampleRateScaling(bool value) {
bw_noise_gen_set_sample_rate_scaling(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline float NoiseGen<N_CHANNELS>::getScalingK() {
return bw_noise_gen_get_scaling_k(&coeffs);
}
}
#endif

View File

@ -25,63 +25,75 @@
#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);
/*! api {{{
* ##### Brickworks::Notch
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Notch {
public:
Notch();
void setCutoff(float value);
void setQ(float value);
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);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_notch_coeffs coeffs;
bw_notch_state states[N_CHANNELS];
bw_notch_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void Notch<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_notch_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline 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>
inline void Notch<N_CHANNELS>::setCutoff(float value) {
bw_notch_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Notch<N_CHANNELS>::setQ(float value) {
bw_notch_set_Q(&coeffs, value);
}
private:
bw_notch_coeffs coeffs;
bw_notch_state states[N_CHANNELS];
bw_notch_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void Notch<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_notch_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline 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>
inline void Notch<N_CHANNELS>::setCutoff(float value) {
bw_notch_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Notch<N_CHANNELS>::setQ(float value) {
bw_notch_set_Q(&coeffs, value);
}
}
#endif

View File

@ -24,27 +24,39 @@
#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;
};
/*! api {{{
* ##### Brickworks::NoteQueue
* ```>>> */
class NoteQueue {
public:
NoteQueue();
inline NoteQueue::NoteQueue() {
bw_note_queue_reset(&queue);
}
void clear();
void add(unsigned char note, bool pressed, float velocity, bool force_went_off);
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);
}
bw_note_queue queue;
};
/*! <<<```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
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

@ -25,106 +25,118 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class OnePole {
public:
OnePole();
void setSampleRate(float sampleRate);
void reset(float y_z1 = 0.f);
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! api {{{
* ##### Brickworks::OnePole
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class OnePole {
public:
OnePole();
void setCutoff(float value);
void setCutoffUp(float value);
void setCutoffDown(float value);
void setTau(float value);
void setTauUp(float value);
void setTauDown(float value);
void setStickyThresh(float value);
void setStickyMode(bw_one_pole_sticky_mode value);
float getYZ1(BW_SIZE_T channel);
void setSampleRate(float sampleRate);
void reset(float y_z1 = 0.f);
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
private:
bw_one_pole_coeffs coeffs;
bw_one_pole_state states[N_CHANNELS];
bw_one_pole_state *statesP[N_CHANNELS];
};
void setCutoff(float value);
void setCutoffUp(float value);
void setCutoffDown(float value);
void setTau(float value);
void setTauUp(float value);
void setTauDown(float value);
void setStickyThresh(float value);
void setStickyMode(bw_one_pole_sticky_mode value);
template<BW_SIZE_T N_CHANNELS>
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>
inline void OnePole<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_one_pole_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void OnePole<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_one_pole_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void OnePole<N_CHANNELS>::setCutoff(float value) {
bw_one_pole_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void OnePole<N_CHANNELS>::setCutoffUp(float value) {
bw_one_pole_set_cutoff_up(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void OnePole<N_CHANNELS>::setCutoffDown(float value) {
bw_one_pole_set_cutoff_down(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void OnePole<N_CHANNELS>::setTau(float value) {
bw_one_pole_set_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void OnePole<N_CHANNELS>::setTauUp(float value) {
bw_one_pole_set_tau_up(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void OnePole<N_CHANNELS>::setTauDown(float value) {
bw_one_pole_set_tau_down(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void OnePole<N_CHANNELS>::setStickyThresh(float value) {
bw_one_pole_set_sticky_thresh(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline float OnePole<N_CHANNELS>::getYZ1(BW_SIZE_T channel) {
return bw_one_pole_get_y_z1(states + channel);
}
float getYZ1(BW_SIZE_T channel);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_one_pole_coeffs coeffs;
bw_one_pole_state states[N_CHANNELS];
bw_one_pole_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void OnePole<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_one_pole_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void OnePole<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_one_pole_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void OnePole<N_CHANNELS>::setCutoff(float value) {
bw_one_pole_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void OnePole<N_CHANNELS>::setCutoffUp(float value) {
bw_one_pole_set_cutoff_up(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void OnePole<N_CHANNELS>::setCutoffDown(float value) {
bw_one_pole_set_cutoff_down(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void OnePole<N_CHANNELS>::setTau(float value) {
bw_one_pole_set_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void OnePole<N_CHANNELS>::setTauUp(float value) {
bw_one_pole_set_tau_up(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void OnePole<N_CHANNELS>::setTauDown(float value) {
bw_one_pole_set_tau_down(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void OnePole<N_CHANNELS>::setStickyThresh(float value) {
bw_one_pole_set_sticky_thresh(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline float OnePole<N_CHANNELS>::getYZ1(BW_SIZE_T channel) {
return bw_one_pole_get_y_z1(states + channel);
}
}
#endif

View File

@ -25,41 +25,53 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class OscFilt {
public:
OscFilt();
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
private:
bw_osc_filt_state states[N_CHANNELS];
bw_osc_filt_state *statesP[N_CHANNELS];
};
/*! api {{{
* ##### Brickworks::OscFilt
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class OscFilt {
public:
OscFilt();
template<BW_SIZE_T N_CHANNELS>
inline OscFilt<N_CHANNELS>::OscFilt() {
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void OscFilt<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_osc_filt_process_multi(statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_osc_filt_state states[N_CHANNELS];
bw_osc_filt_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
inline OscFilt<N_CHANNELS>::OscFilt() {
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void OscFilt<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_osc_filt_process_multi(statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
}
#endif

View File

@ -25,59 +25,71 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class OscPulse {
public:
OscPulse();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<const float *, N_CHANNELS> x_phase_inc,
std::array<float *, N_CHANNELS> y,
int nSamples);
void setAntialiasing(bool value);
void setPulseWidth(float value);
private:
bw_osc_pulse_coeffs coeffs;
};
/*! api {{{
* ##### Brickworks::OscPulse
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class OscPulse {
public:
OscPulse();
template<BW_SIZE_T N_CHANNELS>
inline OscPulse<N_CHANNELS>::OscPulse() {
bw_osc_pulse_init(&coeffs);
}
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<const float *, N_CHANNELS> x_phase_inc,
std::array<float *, N_CHANNELS> y,
int nSamples);
template<BW_SIZE_T N_CHANNELS>
inline void OscPulse<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_osc_pulse_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
inline void OscPulse<N_CHANNELS>::reset() {
bw_osc_pulse_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
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,
int nSamples) {
bw_osc_pulse_process_multi(&coeffs, x.data(), x_phase_inc.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void OscPulse<N_CHANNELS>::setAntialiasing(bool value) {
bw_osc_pulse_set_antialiasing(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void OscPulse<N_CHANNELS>::setPulseWidth(float value) {
bw_osc_pulse_set_pulse_width(&coeffs, value);
}
void setAntialiasing(bool value);
void setPulseWidth(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_osc_pulse_coeffs coeffs;
};
template<BW_SIZE_T N_CHANNELS>
inline OscPulse<N_CHANNELS>::OscPulse() {
bw_osc_pulse_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
inline void OscPulse<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_osc_pulse_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
inline void OscPulse<N_CHANNELS>::reset() {
bw_osc_pulse_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
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,
int nSamples) {
bw_osc_pulse_process_multi(&coeffs, x.data(), x_phase_inc.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void OscPulse<N_CHANNELS>::setAntialiasing(bool value) {
bw_osc_pulse_set_antialiasing(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void OscPulse<N_CHANNELS>::setPulseWidth(float value) {
bw_osc_pulse_set_pulse_width(&coeffs, value);
}
}
#endif

View File

@ -25,41 +25,53 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class OscSaw {
public:
OscSaw();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<const float *, N_CHANNELS> x_phase_inc,
std::array<float *, N_CHANNELS> y,
int nSamples);
void setAntialiasing(bool value);
private:
bw_osc_saw_coeffs coeffs;
};
/*! api {{{
* ##### Brickworks::OscSaw
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class OscSaw {
public:
OscSaw();
template<BW_SIZE_T N_CHANNELS>
inline OscSaw<N_CHANNELS>::OscSaw() {
bw_osc_saw_init(&coeffs);
}
void process(
std::array<const float *, N_CHANNELS> x,
std::array<const float *, N_CHANNELS> x_phase_inc,
std::array<float *, N_CHANNELS> y,
int nSamples);
template<BW_SIZE_T N_CHANNELS>
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,
int nSamples) {
bw_osc_saw_process_multi(&coeffs, x.data(), x_phase_inc.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void OscSaw<N_CHANNELS>::setAntialiasing(bool value) {
bw_osc_saw_set_antialiasing(&coeffs, value);
}
void setAntialiasing(bool value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_osc_saw_coeffs coeffs;
};
template<BW_SIZE_T N_CHANNELS>
inline OscSaw<N_CHANNELS>::OscSaw() {
bw_osc_saw_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
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,
int nSamples) {
bw_osc_saw_process_multi(&coeffs, x.data(), x_phase_inc.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void OscSaw<N_CHANNELS>::setAntialiasing(bool value) {
bw_osc_saw_set_antialiasing(&coeffs, value);
}
}
#endif

View File

@ -25,19 +25,31 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
void oscSinProcess(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
template<BW_SIZE_T N_CHANNELS>
inline void oscSinProcess(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_osc_sin_process_multi(x.data(), y.data(), N_CHANNELS, nSamples);
}
/*! api {{{
* ##### Brickworks::oscSinProcess
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
void oscSinProcess(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! <<<```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
template<BW_SIZE_T N_CHANNELS>
inline void oscSinProcess(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_osc_sin_process_multi(x.data(), y.data(), N_CHANNELS, nSamples);
}
}
#endif

View File

@ -25,59 +25,71 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class OscTri {
public:
OscTri();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<const float *, N_CHANNELS> x_phase_inc,
std::array<float *, N_CHANNELS> y,
int nSamples);
void setAntialiasing(bool value);
void setSlope(float value);
private:
bw_osc_tri_coeffs coeffs;
};
/*! api {{{
* ##### Brickworks::OscTri
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class OscTri {
public:
OscTri();
template<BW_SIZE_T N_CHANNELS>
inline OscTri<N_CHANNELS>::OscTri() {
bw_osc_tri_init(&coeffs);
}
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<const float *, N_CHANNELS> x_phase_inc,
std::array<float *, N_CHANNELS> y,
int nSamples);
template<BW_SIZE_T N_CHANNELS>
inline void OscTri<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_osc_tri_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
inline void OscTri<N_CHANNELS>::reset() {
bw_osc_tri_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
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,
int nSamples) {
bw_osc_tri_process_multi(&coeffs, x.data(), x_phase_inc.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void OscTri<N_CHANNELS>::setAntialiasing(bool value) {
bw_osc_tri_set_antialiasing(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void OscTri<N_CHANNELS>::setSlope(float value) {
bw_osc_tri_set_slope(&coeffs, value);
}
void setAntialiasing(bool value);
void setSlope(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_osc_tri_coeffs coeffs;
};
template<BW_SIZE_T N_CHANNELS>
inline OscTri<N_CHANNELS>::OscTri() {
bw_osc_tri_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
inline void OscTri<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_osc_tri_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
inline void OscTri<N_CHANNELS>::reset() {
bw_osc_tri_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
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,
int nSamples) {
bw_osc_tri_process_multi(&coeffs, x.data(), x_phase_inc.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void OscTri<N_CHANNELS>::setAntialiasing(bool value) {
bw_osc_tri_set_antialiasing(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void OscTri<N_CHANNELS>::setSlope(float value) {
bw_osc_tri_set_slope(&coeffs, value);
}
}
#endif

View File

@ -25,53 +25,65 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Pan {
public:
Pan();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y_l,
std::array<float *, N_CHANNELS> y_r,
int nSamples);
/*! api {{{
* ##### Brickworks::Pan
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Pan {
public:
Pan();
void setPan(float value);
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y_l,
std::array<float *, N_CHANNELS> y_r,
int nSamples);
void setPan(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_pan_coeffs coeffs;
};
template<BW_SIZE_T N_CHANNELS>
inline Pan<N_CHANNELS>::Pan() {
bw_pan_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
inline void Pan<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_pan_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
inline void Pan<N_CHANNELS>::reset() {
bw_pan_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
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,
int nSamples) {
bw_pan_process_multi(&coeffs, x.data(), y_l.data(), y_r.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Pan<N_CHANNELS>::setPan(float value) {
bw_pan_set_pan(&coeffs, value);
}
private:
bw_pan_coeffs coeffs;
};
template<BW_SIZE_T N_CHANNELS>
inline Pan<N_CHANNELS>::Pan() {
bw_pan_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
inline void Pan<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_pan_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
inline void Pan<N_CHANNELS>::reset() {
bw_pan_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
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,
int nSamples) {
bw_pan_process_multi(&coeffs, x.data(), y_l.data(), y_r.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Pan<N_CHANNELS>::setPan(float value) {
bw_pan_set_pan(&coeffs, value);
}
}
#endif

View File

@ -25,87 +25,99 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Peak {
public:
Peak();
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);
/*! api {{{
* ##### Brickworks::Peak
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Peak {
public:
Peak();
void setCutoff(float value);
void setQ(float value);
void setPeakGainLin(float value);
void setPeakGainDB(float value);
void setBandwidth(float value);
void setUseBandwidth(bool value);
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);
void setPeakGainLin(float value);
void setPeakGainDB(float value);
void setBandwidth(float value);
void setUseBandwidth(bool value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_peak_coeffs coeffs;
bw_peak_state states[N_CHANNELS];
bw_peak_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void Peak<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_peak_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void Peak<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_peak_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Peak<N_CHANNELS>::setCutoff(float value) {
bw_peak_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Peak<N_CHANNELS>::setQ(float value) {
bw_peak_set_Q(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Peak<N_CHANNELS>::setPeakGainLin(float value) {
bw_peak_set_peak_gain_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Peak<N_CHANNELS>::setPeakGainDB(float value) {
bw_peak_set_peak_gain_dB(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Peak<N_CHANNELS>::setBandwidth(float value) {
bw_peak_set_bandwidth(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Peak<N_CHANNELS>::setUseBandwidth(bool value) {
bw_peak_set_use_bandwidth(&coeffs, value);
}
private:
bw_peak_coeffs coeffs;
bw_peak_state states[N_CHANNELS];
bw_peak_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void Peak<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_peak_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void Peak<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_peak_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Peak<N_CHANNELS>::setCutoff(float value) {
bw_peak_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Peak<N_CHANNELS>::setQ(float value) {
bw_peak_set_Q(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Peak<N_CHANNELS>::setPeakGainLin(float value) {
bw_peak_set_peak_gain_lin(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Peak<N_CHANNELS>::setPeakGainDB(float value) {
bw_peak_set_peak_gain_dB(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Peak<N_CHANNELS>::setBandwidth(float value) {
bw_peak_set_bandwidth(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Peak<N_CHANNELS>::setUseBandwidth(bool value) {
bw_peak_set_use_bandwidth(&coeffs, value);
}
}
#endif

View File

@ -25,65 +25,77 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class PhaseGen {
public:
PhaseGen();
void setSampleRate(float sampleRate);
void reset(float phase_0 = 0.f);
void process(
std::array<const float *, N_CHANNELS> x_mod,
std::array<float *, N_CHANNELS> y,
std::array<float *, N_CHANNELS> y_phase_inc,
int nSamples);
/*! api {{{
* ##### Brickworks::PhaseGen
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class PhaseGen {
public:
PhaseGen();
void setFrequency(float value);
void setPortamentoTau(float value);
void setSampleRate(float sampleRate);
void reset(float phase_0 = 0.f);
void process(
std::array<const float *, N_CHANNELS> x_mod,
std::array<float *, N_CHANNELS> y,
std::array<float *, N_CHANNELS> y_phase_inc,
int nSamples);
void setFrequency(float value);
void setPortamentoTau(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_phase_gen_coeffs coeffs;
bw_phase_gen_state states[N_CHANNELS];
bw_phase_gen_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void PhaseGen<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_phase_gen_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
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,
int nSamples) {
bw_phase_gen_process_multi(&coeffs, statesP, x_mod.data(), y.data(), y_phase_inc.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void PhaseGen<N_CHANNELS>::setFrequency(float value) {
bw_phase_gen_set_frequency(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void PhaseGen<N_CHANNELS>::setPortamentoTau(float value) {
bw_phase_gen_set_portamento_tau(&coeffs, value);
}
private:
bw_phase_gen_coeffs coeffs;
bw_phase_gen_state states[N_CHANNELS];
bw_phase_gen_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void PhaseGen<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_phase_gen_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
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,
int nSamples) {
bw_phase_gen_process_multi(&coeffs, statesP, x_mod.data(), y.data(), y_phase_inc.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void PhaseGen<N_CHANNELS>::setFrequency(float value) {
bw_phase_gen_set_frequency(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void PhaseGen<N_CHANNELS>::setPortamentoTau(float value) {
bw_phase_gen_set_portamento_tau(&coeffs, value);
}
}
#endif

View File

@ -25,69 +25,81 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Phaser {
public:
Phaser();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! api {{{
* ##### Brickworks::Phaser
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Phaser {
public:
Phaser();
void setRate(float value);
void setCenter(float value);
void setAmount(float value);
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
void setRate(float value);
void setCenter(float value);
void setAmount(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_phaser_coeffs coeffs;
bw_phaser_state states[N_CHANNELS];
bw_phaser_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void Phaser<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_phaser_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void Phaser<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_phaser_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Phaser<N_CHANNELS>::setRate(float value) {
bw_phaser_set_rate(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Phaser<N_CHANNELS>::setCenter(float value) {
bw_phaser_set_center(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Phaser<N_CHANNELS>::setAmount(float value) {
bw_phaser_set_amount(&coeffs, value);
}
private:
bw_phaser_coeffs coeffs;
bw_phaser_state states[N_CHANNELS];
bw_phaser_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void Phaser<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_phaser_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void Phaser<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_phaser_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Phaser<N_CHANNELS>::setRate(float value) {
bw_phaser_set_rate(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Phaser<N_CHANNELS>::setCenter(float value) {
bw_phaser_set_center(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Phaser<N_CHANNELS>::setAmount(float value) {
bw_phaser_set_amount(&coeffs, value);
}
}
#endif

View File

@ -25,63 +25,75 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class PinkFilt {
public:
PinkFilt();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! api {{{
* ##### Brickworks::PinkFilt
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class PinkFilt {
public:
PinkFilt();
void setSampleRateScaling(bool value);
float getScalingK();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
private:
bw_pink_filt_coeffs coeffs;
bw_pink_filt_state states[N_CHANNELS];
bw_pink_filt_state *statesP[N_CHANNELS];
};
void setSampleRateScaling(bool value);
template<BW_SIZE_T N_CHANNELS>
inline PinkFilt<N_CHANNELS>::PinkFilt() {
bw_pink_filt_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
inline void PinkFilt<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_pink_filt_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void PinkFilt<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_pink_filt_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void PinkFilt<N_CHANNELS>::setSampleRateScaling(bool value) {
bw_pink_filt_set_sample_rate_scaling(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline float PinkFilt<N_CHANNELS>::getScalingK() {
return bw_pink_filt_get_scaling_k(&coeffs);
}
float getScalingK();
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_pink_filt_coeffs coeffs;
bw_pink_filt_state states[N_CHANNELS];
bw_pink_filt_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
inline PinkFilt<N_CHANNELS>::PinkFilt() {
bw_pink_filt_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
inline void PinkFilt<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_pink_filt_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void PinkFilt<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_pink_filt_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void PinkFilt<N_CHANNELS>::setSampleRateScaling(bool value) {
bw_pink_filt_set_sample_rate_scaling(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline float PinkFilt<N_CHANNELS>::getScalingK() {
return bw_pink_filt_get_scaling_k(&coeffs);
}
}
#endif

View File

@ -25,64 +25,76 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class PPM {
public:
PPM();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! api {{{
* ##### Brickworks::PPM
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class PPM {
public:
PPM();
void setIntegrationTau(float value);
float getYZ1(BW_SIZE_T channel);
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
private:
bw_ppm_coeffs coeffs;
bw_ppm_state states[N_CHANNELS];
bw_ppm_state *statesP[N_CHANNELS];
};
void setIntegrationTau(float value);
template<BW_SIZE_T N_CHANNELS>
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>
inline void PPM<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ppm_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void PPM<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_ppm_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void PPM<N_CHANNELS>::setIntegrationTau(float value) {
bw_ppm_set_integration_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline float PPM<N_CHANNELS>::getYZ1(BW_SIZE_T channel) {
return bw_ppm_get_y_z1(states + channel);
}
float getYZ1(BW_SIZE_T channel);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_ppm_coeffs coeffs;
bw_ppm_state states[N_CHANNELS];
bw_ppm_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void PPM<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ppm_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void PPM<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_ppm_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void PPM<N_CHANNELS>::setIntegrationTau(float value) {
bw_ppm_set_integration_tau(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline float PPM<N_CHANNELS>::getYZ1(BW_SIZE_T channel) {
return bw_ppm_get_y_z1(states + channel);
}
}
#endif

View File

@ -25,101 +25,113 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Reverb {
public:
Reverb();
~Reverb();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> xl,
std::array<const float *, N_CHANNELS> xr,
std::array<float *, N_CHANNELS> yl,
std::array<float *, N_CHANNELS> yr,
int nSamples);
/*! api {{{
* ##### Brickworks::Reverb
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Reverb {
public:
Reverb();
~Reverb();
void setPredelay(float value);
void setBandwidth(float value);
void setDamping(float value);
void setDecay(float value);
void setWet(float value);
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> xl,
std::array<const float *, N_CHANNELS> xr,
std::array<float *, N_CHANNELS> yl,
std::array<float *, N_CHANNELS> yr,
int nSamples);
void setPredelay(float value);
void setBandwidth(float value);
void setDamping(float value);
void setDecay(float value);
void setWet(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_reverb_coeffs coeffs;
bw_reverb_state states[N_CHANNELS];
bw_reverb_state *statesP[N_CHANNELS];
void *mem;
};
template<BW_SIZE_T N_CHANNELS>
inline Reverb<N_CHANNELS>::Reverb() {
bw_reverb_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
mem = nullptr;
}
template<BW_SIZE_T N_CHANNELS>
inline Reverb<N_CHANNELS>::~Reverb() {
if (mem != nullptr)
operator delete(mem);
}
template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_reverb_set_sample_rate(&coeffs, sampleRate);
BW_SIZE_T req = bw_reverb_mem_req(&coeffs);
if (mem != nullptr)
operator delete(mem);
mem = operator new(req * N_CHANNELS);
void *m = mem;
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++, m = static_cast<char *>(m) + req)
bw_reverb_mem_set(&coeffs, states + i, m);
}
template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::reset() {
bw_reverb_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_reverb_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> xl,
std::array<const float *, N_CHANNELS> xr,
std::array<float *, N_CHANNELS> yl,
std::array<float *, N_CHANNELS> yr,
int nSamples) {
bw_reverb_process_multi(&coeffs, statesP, xl.data(), xr.data(), yl.data(), yr.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::setPredelay(float value) {
bw_reverb_set_predelay(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::setBandwidth(float value) {
bw_reverb_set_bandwidth(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::setDamping(float value) {
bw_reverb_set_damping(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::setDecay(float value) {
bw_reverb_set_decay(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::setWet(float value) {
bw_reverb_set_wet(&coeffs, value);
}
private:
bw_reverb_coeffs coeffs;
bw_reverb_state states[N_CHANNELS];
bw_reverb_state *statesP[N_CHANNELS];
void *mem;
};
template<BW_SIZE_T N_CHANNELS>
inline Reverb<N_CHANNELS>::Reverb() {
bw_reverb_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
mem = nullptr;
}
template<BW_SIZE_T N_CHANNELS>
inline Reverb<N_CHANNELS>::~Reverb() {
if (mem != nullptr)
operator delete(mem);
}
template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_reverb_set_sample_rate(&coeffs, sampleRate);
BW_SIZE_T req = bw_reverb_mem_req(&coeffs);
if (mem != nullptr)
operator delete(mem);
mem = operator new(req * N_CHANNELS);
void *m = mem;
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++, m = static_cast<char *>(m) + req)
bw_reverb_mem_set(&coeffs, states + i, m);
}
template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::reset() {
bw_reverb_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_reverb_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> xl,
std::array<const float *, N_CHANNELS> xr,
std::array<float *, N_CHANNELS> yl,
std::array<float *, N_CHANNELS> yr,
int nSamples) {
bw_reverb_process_multi(&coeffs, statesP, xl.data(), xr.data(), yl.data(), yr.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::setPredelay(float value) {
bw_reverb_set_predelay(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::setBandwidth(float value) {
bw_reverb_set_bandwidth(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::setDamping(float value) {
bw_reverb_set_damping(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::setDecay(float value) {
bw_reverb_set_decay(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::setWet(float value) {
bw_reverb_set_wet(&coeffs, value);
}
}
#endif

View File

@ -25,53 +25,65 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class RingMod {
public:
RingMod();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x_mod,
std::array<const float *, N_CHANNELS> x_car,
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! api {{{
* ##### Brickworks::RingMod
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class RingMod {
public:
RingMod();
void setAmount(float value);
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x_mod,
std::array<const float *, N_CHANNELS> x_car,
std::array<float *, N_CHANNELS> y,
int nSamples);
void setAmount(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_ringmod_coeffs coeffs;
};
template<BW_SIZE_T N_CHANNELS>
inline RingMod<N_CHANNELS>::RingMod() {
bw_ringmod_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
inline void RingMod<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ringmod_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
inline void RingMod<N_CHANNELS>::reset() {
bw_ringmod_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
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,
int nSamples) {
bw_ringmod_process_multi(&coeffs, statesP, x_mod.data(), x_car.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void RingMod<N_CHANNELS>::setAmount(float value) {
bw_ringmod_set_amount(&coeffs, value);
}
private:
bw_ringmod_coeffs coeffs;
};
template<BW_SIZE_T N_CHANNELS>
inline RingMod<N_CHANNELS>::RingMod() {
bw_ringmod_init(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
inline void RingMod<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ringmod_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
inline void RingMod<N_CHANNELS>::reset() {
bw_ringmod_reset_coeffs(&coeffs);
}
template<BW_SIZE_T N_CHANNELS>
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,
int nSamples) {
bw_ringmod_process_multi(&coeffs, statesP, x_mod.data(), x_car.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void RingMod<N_CHANNELS>::setAmount(float value) {
bw_ringmod_set_amount(&coeffs, value);
}
}
#endif

View File

@ -25,69 +25,81 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Satur {
public:
Satur();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! api {{{
* ##### Brickworks::Satur
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Satur {
public:
Satur();
void setBias(float value);
void setGain(float value);
void setGainCompensation(bool value);
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
void setBias(float value);
void setGain(float value);
void setGainCompensation(bool value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_satur_coeffs coeffs;
bw_satur_state states[N_CHANNELS];
bw_satur_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void Satur<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_satur_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void Satur<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_satur_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Satur<N_CHANNELS>::setBias(float value) {
bw_satur_set_bias(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Satur<N_CHANNELS>::setGain(float value) {
bw_satur_set_gain(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Satur<N_CHANNELS>::setGainCompensation(bool value) {
bw_satur_set_gain_compensation(&coeffs, value);
}
private:
bw_satur_coeffs coeffs;
bw_satur_state states[N_CHANNELS];
bw_satur_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void Satur<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_satur_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void Satur<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_satur_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Satur<N_CHANNELS>::setBias(float value) {
bw_satur_set_bias(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Satur<N_CHANNELS>::setGain(float value) {
bw_satur_set_gain(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Satur<N_CHANNELS>::setGainCompensation(bool value) {
bw_satur_set_gain_compensation(&coeffs, value);
}
}
#endif

View File

@ -25,76 +25,88 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class SlewLim {
public:
SlewLim();
void setSampleRate(float sampleRate);
void reset(float y_z1 = 0.f);
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! api {{{
* ##### Brickworks::SlewLim
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class SlewLim {
public:
SlewLim();
void setMaxRate(float value);
void setMaxRateUp(float value);
void setMaxRateDown(float value);
float getYZ1(BW_SIZE_T channel);
void setSampleRate(float sampleRate);
void reset(float y_z1 = 0.f);
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
private:
bw_slew_lim_coeffs coeffs;
bw_slew_lim_state states[N_CHANNELS];
bw_slew_lim_state *statesP[N_CHANNELS];
};
void setMaxRate(float value);
void setMaxRateUp(float value);
void setMaxRateDown(float value);
template<BW_SIZE_T N_CHANNELS>
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>
inline void SlewLim<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_slew_lim_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void SlewLim<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_slew_lim_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void SlewLim<N_CHANNELS>::setMaxRate(float value) {
bw_slew_lim_set_max_rate(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void SlewLim<N_CHANNELS>::setMaxRateUp(float value) {
bw_slew_lim_set_max_rate_up(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void SlewLim<N_CHANNELS>::setMaxRateDown(float value) {
bw_slew_lim_set_max_rate_down(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline float SlewLim<N_CHANNELS>::getYZ1(BW_SIZE_T channel) {
return bw_slew_lim_get_y_z1(states + channel);
}
float getYZ1(BW_SIZE_T channel);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_slew_lim_coeffs coeffs;
bw_slew_lim_state states[N_CHANNELS];
bw_slew_lim_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void SlewLim<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_slew_lim_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void SlewLim<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_slew_lim_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void SlewLim<N_CHANNELS>::setMaxRate(float value) {
bw_slew_lim_set_max_rate(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void SlewLim<N_CHANNELS>::setMaxRateUp(float value) {
bw_slew_lim_set_max_rate_up(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void SlewLim<N_CHANNELS>::setMaxRateDown(float value) {
bw_slew_lim_set_max_rate_down(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline float SlewLim<N_CHANNELS>::getYZ1(BW_SIZE_T channel) {
return bw_slew_lim_get_y_z1(states + channel);
}
}
#endif

View File

@ -25,50 +25,62 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class SRReduce {
public:
SRReduce();
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
void setRatio(float value);
/*! api {{{
* ##### Brickworks::SRReduce
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class SRReduce {
public:
SRReduce();
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
void setRatio(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_sr_reduce_coeffs coeffs;
bw_sr_reduce_state states[N_CHANNELS];
bw_sr_reduce_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
inline SRReduce<N_CHANNELS>::SRReduce() {
bw_sr_reduce_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void SRReduce<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_sr_reduce_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void SRReduce<N_CHANNELS>::setRatio(float value) {
bw_sr_reduce_set_ratio(&coeffs, value);
}
private:
bw_sr_reduce_coeffs coeffs;
bw_sr_reduce_state states[N_CHANNELS];
bw_sr_reduce_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
inline SRReduce<N_CHANNELS>::SRReduce() {
bw_sr_reduce_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void SRReduce<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_sr_reduce_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void SRReduce<N_CHANNELS>::setRatio(float value) {
bw_sr_reduce_set_ratio(&coeffs, value);
}
}
#endif

View File

@ -25,45 +25,57 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class SRC {
public:
SRC(float ratio);
void reset(float x0 = 0.f);
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
std::array<int *, N_CHANNELS> nInSamples,
std::array<int *, N_CHANNELS> nOutSamples);
private:
bw_src_coeffs coeffs;
bw_src_state states[N_CHANNELS];
bw_src_state *statesP[N_CHANNELS];
};
/*! api {{{
* ##### Brickworks::SRC
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class SRC {
public:
SRC(float ratio);
template<BW_SIZE_T N_CHANNELS>
inline SRC<N_CHANNELS>::SRC(float ratio) {
bw_src_init(&coeffs, ratio);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
inline void SRC<N_CHANNELS>::reset(float x0) {
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_src_reset_state(&coeffs, states + i, x0);
}
template<BW_SIZE_T N_CHANNELS>
inline void SRC<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
std::array<int *, N_CHANNELS> nInSamples,
std::array<int *, N_CHANNELS> nOutSamples) {
bw_src_process_multi(coeffs, statesP, x.data(), y.data(), N_CHANNELS, nInSamples.data(), nOutSamples.data());
}
void reset(float x0 = 0.f);
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
std::array<int *, N_CHANNELS> nInSamples,
std::array<int *, N_CHANNELS> nOutSamples);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_src_coeffs coeffs;
bw_src_state states[N_CHANNELS];
bw_src_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
inline SRC<N_CHANNELS>::SRC(float ratio) {
bw_src_init(&coeffs, ratio);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
inline void SRC<N_CHANNELS>::reset(float x0) {
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_src_reset_state(&coeffs, states + i, x0);
}
template<BW_SIZE_T N_CHANNELS>
inline void SRC<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
std::array<int *, N_CHANNELS> nInSamples,
std::array<int *, N_CHANNELS> nOutSamples) {
bw_src_process_multi(coeffs, statesP, x.data(), y.data(), N_CHANNELS, nInSamples.data(), nOutSamples.data());
}
}
#endif

View File

@ -25,45 +25,57 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class SRCInt {
public:
SRCInt(int ratio);
void reset(float x0 = 0.f);
std::array<int, N_CHANNELS> process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nInSamples);
private:
bw_src_int_coeffs coeffs;
bw_src_int_state states[N_CHANNELS];
bw_src_int_state *statesP[N_CHANNELS];
};
/*! api {{{
* ##### Brickworks::SRCInt
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class SRCInt {
public:
SRCInt(int ratio);
template<BW_SIZE_T N_CHANNELS>
inline SRCInt<N_CHANNELS>::SRCInt(int ratio) {
bw_src_int_init(&coeffs, ratio);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
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>
inline std::array<int, N_CHANNELS> SRCInt<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nInSamples) {
std::array<int, N_CHANNELS> ret;
bw_src_int_process_multi(&coeffs, statesP, x.data(), y.data(), ret.data(), N_CHANNELS, nInSamples);
return ret;
}
void reset(float x0 = 0.f);
std::array<int, N_CHANNELS> process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nInSamples);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_src_int_coeffs coeffs;
bw_src_int_state states[N_CHANNELS];
bw_src_int_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
inline SRCInt<N_CHANNELS>::SRCInt(int ratio) {
bw_src_int_init(&coeffs, ratio);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS>
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>
inline std::array<int, N_CHANNELS> SRCInt<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nInSamples) {
std::array<int, N_CHANNELS> ret;
bw_src_int_process_multi(&coeffs, statesP, x.data(), y.data(), ret.data(), N_CHANNELS, nInSamples);
return ret;
}
}
#endif

View File

@ -25,79 +25,91 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class SVF {
public:
SVF();
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_lp,
std::array<float *, N_CHANNELS> y_bp,
std::array<float *, N_CHANNELS> y_hp,
int nSamples);
/*! api {{{
* ##### Brickworks::SVF
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class SVF {
public:
SVF();
void setCutoff(float value);
void setQ(float value);
void setPrewarpAtCutoff(bool value);
void setPrewarpFreq(float value);
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_lp,
std::array<float *, N_CHANNELS> y_bp,
std::array<float *, N_CHANNELS> y_hp,
int nSamples);
void setCutoff(float value);
void setQ(float value);
void setPrewarpAtCutoff(bool value);
void setPrewarpFreq(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_svf_coeffs coeffs;
bw_svf_state states[N_CHANNELS];
bw_svf_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void SVF<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_svf_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
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,
std::array<float *, N_CHANNELS> y_hp,
int nSamples) {
bw_svf_process_multi(&coeffs, statesP, x.data(), y_lp.data(), y_bp.data(), y_hp.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void SVF<N_CHANNELS>::setCutoff(float value) {
bw_svf_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void SVF<N_CHANNELS>::setQ(float value) {
bw_svf_set_Q(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void SVF<N_CHANNELS>::setPrewarpAtCutoff(bool value) {
bw_svf_set_prewarp_at_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void SVF<N_CHANNELS>::setPrewarpFreq(float value) {
bw_svf_set_prewarp_freq(&coeffs, value);
}
private:
bw_svf_coeffs coeffs;
bw_svf_state states[N_CHANNELS];
bw_svf_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void SVF<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_svf_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
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,
std::array<float *, N_CHANNELS> y_hp,
int nSamples) {
bw_svf_process_multi(&coeffs, statesP, x.data(), y_lp.data(), y_bp.data(), y_hp.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void SVF<N_CHANNELS>::setCutoff(float value) {
bw_svf_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void SVF<N_CHANNELS>::setQ(float value) {
bw_svf_set_Q(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void SVF<N_CHANNELS>::setPrewarpAtCutoff(bool value) {
bw_svf_set_prewarp_at_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void SVF<N_CHANNELS>::setPrewarpFreq(float value) {
bw_svf_set_prewarp_freq(&coeffs, value);
}
}
#endif

View File

@ -25,63 +25,75 @@
#include <array>
namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Trem {
public:
Trem();
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
/*! api {{{
* ##### Brickworks::Trem
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Trem {
public:
Trem();
void setRate(float value);
void setAmount(float value);
void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
void setRate(float value);
void setAmount(float value);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_trem_coeffs coeffs;
bw_trem_state states[N_CHANNELS];
bw_trem_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void Trem<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_trem_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void Trem<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_trem_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Trem<N_CHANNELS>::setRate(float value) {
bw_trem_set_rate(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Trem<N_CHANNELS>::setAmount(float value) {
bw_trem_set_amount(&coeffs, value);
}
private:
bw_trem_coeffs coeffs;
bw_trem_state states[N_CHANNELS];
bw_trem_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void Trem<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_trem_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline void Trem<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_trem_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Trem<N_CHANNELS>::setRate(float value) {
bw_trem_set_rate(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Trem<N_CHANNELS>::setAmount(float value) {
bw_trem_set_amount(&coeffs, value);
}
}
#endif

View File

@ -25,57 +25,69 @@
#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);
/*! api {{{
* ##### Brickworks::Wah
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Wah {
public:
Wah();
void setWah(float value);
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);
/*! <<<... }```
* }}} */
/*** Implementation ***/
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
private:
bw_wah_coeffs coeffs;
bw_wah_state states[N_CHANNELS];
bw_wah_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void Wah<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_wah_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline 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>
inline void Wah<N_CHANNELS>::setWah(float value) {
bw_wah_set_wah(&coeffs, value);
}
private:
bw_wah_coeffs coeffs;
bw_wah_state states[N_CHANNELS];
bw_wah_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS>
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>
inline void Wah<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_wah_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
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>
inline 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>
inline void Wah<N_CHANNELS>::setWah(float value) {
bw_wah_set_wah(&coeffs, value);
}
}
#endif