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> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class AP1 {
public:
AP1();
void setSampleRate(float sampleRate); /*! api {{{
void reset(float x0 = 0.f); * ##### Brickworks::AP1
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class AP1 {
int nSamples); 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 #endif

View File

@ -25,63 +25,75 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class AP2 {
public:
AP2();
void setSampleRate(float sampleRate); /*! api {{{
void reset(float x0 = 0.f); * ##### Brickworks::AP2
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class AP2 {
int nSamples); public:
AP2();
void setCutoff(float value); void setSampleRate(float sampleRate);
void setQ(float value); 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 #endif

View File

@ -25,55 +25,67 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Balance {
public:
Balance();
void setSampleRate(float sampleRate); /*! api {{{
void reset(); * ##### Brickworks::Balance
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x_l, template<BW_SIZE_T N_CHANNELS>
std::array<const float *, N_CHANNELS> x_r, class Balance {
std::array<float *, N_CHANNELS> y_l, public:
std::array<float *, N_CHANNELS> y_r, Balance();
int nSamples);
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 #endif

View File

@ -25,45 +25,57 @@
#include <array> #include <array>
namespace Brickworks { 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 #endif

View File

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

View File

@ -25,103 +25,115 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Chorus {
public:
Chorus(float maxDelay = 0.01f);
~Chorus();
void setSampleRate(float sampleRate); /*! api {{{
void reset(); * ##### Brickworks::Chorus
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class Chorus {
int nSamples); public:
Chorus(float maxDelay = 0.01f);
~Chorus();
void setRate(float value); void setSampleRate(float sampleRate);
void setDelay(float value); void reset();
void setAmount(float value); void process(
void setCoeffX(float value); std::array<const float *, N_CHANNELS> x,
void setCoeffMod(float value); std::array<float *, N_CHANNELS> y,
void setCoeffFB(float value); 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 #endif

View File

@ -25,69 +25,81 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Clip {
public:
Clip();
void setSampleRate(float sampleRate); /*! api {{{
void reset(); * ##### Brickworks::Clip
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class Clip {
int nSamples); public:
Clip();
void setBias(float value); void setSampleRate(float sampleRate);
void setGain(float value); void reset();
void setGainCompensation(bool value); 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 #endif

View File

@ -25,97 +25,109 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Comb {
public:
Comb(float maxDelay = 1.f);
~Comb();
void setSampleRate(float sampleRate); /*! api {{{
void reset(); * ##### Brickworks::Comb
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class Comb {
int nSamples); public:
Comb(float maxDelay = 1.f);
~Comb();
void setDelayFF(float value); void setSampleRate(float sampleRate);
void setDelayFB(float value); void reset();
void setCoeffBlend(float value); void process(
void setCoeffFF(float value); std::array<const float *, N_CHANNELS> x,
void setCoeffFB(float value); 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 #endif

View File

@ -25,95 +25,107 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Comp {
public:
Comp();
void setSampleRate(float sampleRate); /*! api {{{
void reset(); * ##### Brickworks::Comp
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<const float *, N_CHANNELS> xSC, class Comp {
std::array<float *, N_CHANNELS> y, public:
int nSamples); Comp();
void setTreshLin(float value); void setSampleRate(float sampleRate);
void setTreshDBFS(float value); void reset();
void setRatio(float value); void process(
void setAttackTau(float value); std::array<const float *, N_CHANNELS> x,
void setReleaseTau(float value); std::array<const float *, N_CHANNELS> xSC,
void setGainLin(float value); std::array<float *, N_CHANNELS> y,
void setGainDB(float value); 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 #endif

View File

@ -25,93 +25,105 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Delay {
public:
Delay(float maxDelay = 1.f);
~Delay();
void setSampleRate(float sampleRate); /*! api {{{
void reset(); * ##### Brickworks::Delay
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class Delay {
int nSamples); public:
Delay(float maxDelay = 1.f);
float read(BW_SIZE_T channel, BW_SIZE_T di, float df); ~Delay();
void write(BW_SIZE_T channel, float x);
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: void setDelay(float value);
bw_delay_coeffs coeffs;
bw_delay_state states[N_CHANNELS];
bw_delay_state *statesP[N_CHANNELS];
void *mem;
};
template<BW_SIZE_T N_CHANNELS> BW_SIZE_T getLength();
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; /*** Implementation ***/
mem = nullptr;
} /* 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 Delay<N_CHANNELS>::~Delay() { private:
if (mem != nullptr) bw_delay_coeffs coeffs;
operator delete(mem); bw_delay_state states[N_CHANNELS];
} bw_delay_state *statesP[N_CHANNELS];
void *mem;
template<BW_SIZE_T N_CHANNELS> };
inline void Delay<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_delay_set_sample_rate(&coeffs, sampleRate); template<BW_SIZE_T N_CHANNELS>
BW_SIZE_T req = bw_delay_mem_req(&coeffs); inline Delay<N_CHANNELS>::Delay(float maxDelay) {
if (mem != nullptr) bw_delay_init(&coeffs, maxDelay);
operator delete(mem); for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
mem = operator new(req * N_CHANNELS); statesP[i] = states + i;
void *m = mem; mem = nullptr;
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 Delay<N_CHANNELS>::~Delay() {
template<BW_SIZE_T N_CHANNELS> if (mem != nullptr)
inline void Delay<N_CHANNELS>::reset() { operator delete(mem);
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>::setSampleRate(float sampleRate) {
bw_delay_set_sample_rate(&coeffs, sampleRate);
template<BW_SIZE_T N_CHANNELS> BW_SIZE_T req = bw_delay_mem_req(&coeffs);
inline void Delay<N_CHANNELS>::process( if (mem != nullptr)
std::array<const float *, N_CHANNELS> x, operator delete(mem);
std::array<float *, N_CHANNELS> y, mem = operator new(req * N_CHANNELS);
int nSamples) { void *m = mem;
bw_delay_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); 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 float Delay<N_CHANNELS>::read(BW_SIZE_T channel, BW_SIZE_T di, float df) { template<BW_SIZE_T N_CHANNELS>
return bw_delay_read(&coeffs, states + channel, di, df); inline void Delay<N_CHANNELS>::reset() {
} bw_delay_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
template<BW_SIZE_T N_CHANNELS> bw_delay_reset_state(&coeffs, states + i);
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>::process(
template<BW_SIZE_T N_CHANNELS> std::array<const float *, N_CHANNELS> x,
inline void Delay<N_CHANNELS>::setDelay(float value) { std::array<float *, N_CHANNELS> y,
bw_delay_set_delay(&coeffs, value); int nSamples) {
} bw_delay_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline BW_SIZE_T Delay<N_CHANNELS>::getLength() { template<BW_SIZE_T N_CHANNELS>
return bw_delay_get_length(&coeffs); 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 #endif

View File

@ -25,69 +25,81 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Dist {
public:
Dist();
void setSampleRate(float sampleRate); /*! api {{{
void reset(); * ##### Brickworks::Dist
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class Dist {
int nSamples); public:
Dist();
void setDistortion(float value); void setSampleRate(float sampleRate);
void setTone(float value); void reset();
void setVolume(float value); 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 #endif

View File

@ -25,69 +25,81 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Drive {
public:
Drive();
void setSampleRate(float sampleRate); /*! api {{{
void reset(); * ##### Brickworks::Drive
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class Drive {
int nSamples); public:
Drive();
void setDrive(float value); void setSampleRate(float sampleRate);
void setTone(float value); void reset();
void setVolume(float value); 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 #endif

View File

@ -25,59 +25,71 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class DryWet {
public:
DryWet();
void setSampleRate(float sampleRate); /*! api {{{
void reset(); * ##### Brickworks::DryWet
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x_dry, template<BW_SIZE_T N_CHANNELS>
std::array<const float *, N_CHANNELS> x_wet, class DryWet {
std::array<float *, N_CHANNELS> y, public:
int nSamples); DryWet();
void setWet(float value); void setSampleRate(float sampleRate);
void setSmoothTau(float value); 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 #endif

View File

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

View File

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

View File

@ -25,63 +25,75 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Fuzz {
public:
Fuzz();
void setSampleRate(float sampleRate); /*! api {{{
void reset(); * ##### Brickworks::Fuzz
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class Fuzz {
int nSamples); public:
Fuzz();
void setFuzz(float value); void setSampleRate(float sampleRate);
void setVolume(float value); 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 #endif

View File

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

View File

@ -25,57 +25,69 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class HP1 {
public:
HP1();
void setSampleRate(float sampleRate); /*! api {{{
void reset(float x0 = 0.f); * ##### Brickworks::HP1
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class HP1 {
int nSamples); 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 #endif

View File

@ -25,69 +25,81 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class HS1 {
public:
HS1();
void setSampleRate(float sampleRate); /*! api {{{
void reset(float x0 = 0.f); * ##### Brickworks::HS1
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class HS1 {
int nSamples); public:
HS1();
void setCutoff(float value); void setSampleRate(float sampleRate);
void setHighGainLin(float value); void reset(float x0 = 0.f);
void setHighGainDB(float value); 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 #endif

View File

@ -25,75 +25,87 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class HS2 {
public:
HS2();
void setSampleRate(float sampleRate); /*! api {{{
void reset(float x0 = 0.f); * ##### Brickworks::HS2
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class HS2 {
int nSamples); public:
HS2();
void setCutoff(float value); void setSampleRate(float sampleRate);
void setQ(float value); void reset(float x0 = 0.f);
void setHighGainLin(float value); void process(
void setHighGainDB(float value); 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 #endif

View File

@ -25,69 +25,81 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class LP1 {
public:
LP1();
void setSampleRate(float sampleRate); /*! api {{{
void reset(float x0 = 0.f); * ##### Brickworks::LP1
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class LP1 {
int nSamples); public:
LP1();
void setCutoff(float value); void setSampleRate(float sampleRate);
void setPrewarpAtCutoff(bool value); void reset(float x0 = 0.f);
void setPrewarpFreq(float value); 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 #endif

View File

@ -25,69 +25,81 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class LS1 {
public:
LS1();
void setSampleRate(float sampleRate); /*! api {{{
void reset(float x0 = 0.f); * ##### Brickworks::LS1
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class LS1 {
int nSamples); public:
LS1();
void setCutoff(float value); void setSampleRate(float sampleRate);
void setDcGainLin(float value); void reset(float x0 = 0.f);
void setDcGainDB(float value); 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 #endif

View File

@ -25,75 +25,87 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class LS2 {
public:
LS2();
void setSampleRate(float sampleRate); /*! api {{{
void reset(float x0 = 0.f); * ##### Brickworks::LS2
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class LS2 {
int nSamples); public:
LS2();
void setCutoff(float value); void setSampleRate(float sampleRate);
void setQ(float value); void reset(float x0 = 0.f);
void setDcGainLin(float value); void process(
void setDcGainDB(float value); 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 #endif

View File

@ -25,81 +25,93 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class MM1 {
public:
MM1();
void setSampleRate(float sampleRate); /*! api {{{
void reset(float x0 = 0.f); * ##### Brickworks::MM1
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class MM1 {
int nSamples); public:
MM1();
void setCutoff(float value); void setSampleRate(float sampleRate);
void setPrewarpAtCutoff(bool value); void reset(float x0 = 0.f);
void setPrewarpFreq(float value); void process(
void setCoeffX(float value); std::array<const float *, N_CHANNELS> x,
void setCoeffLp(float value); 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 #endif

View File

@ -25,99 +25,111 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class MM2 {
public:
MM2();
void setSampleRate(float sampleRate); /*! api {{{
void reset(float x0 = 0.f); * ##### Brickworks::MM2
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class MM2 {
int nSamples); public:
MM2();
void setCutoff(float value); void setSampleRate(float sampleRate);
void setQ(float value); void reset(float x0 = 0.f);
void setPrewarpAtCutoff(bool value); void process(
void setPrewarpFreq(float value); std::array<const float *, N_CHANNELS> x,
void setCoeffX(float value); std::array<float *, N_CHANNELS> y,
void setCoeffLp(float value); int nSamples);
void setCoeffBp(float value);
void setCoeffHp(float value); 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 #endif

View File

@ -25,83 +25,95 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class NoiseGate {
public:
NoiseGate();
void setSampleRate(float sampleRate); /*! api {{{
void reset(); * ##### Brickworks::NoiseGate
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<const float *, N_CHANNELS> xSC, class NoiseGate {
std::array<float *, N_CHANNELS> y, public:
int nSamples); NoiseGate();
void setTreshLin(float value); void setSampleRate(float sampleRate);
void setTreshDBFS(float value); void reset();
void setRatio(float value); void process(
void setAttackTau(float value); std::array<const float *, N_CHANNELS> x,
void setReleaseTau(float value); 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 #endif

View File

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

View File

@ -25,63 +25,75 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Notch {
public:
Notch();
void setSampleRate(float sampleRate); /*! api {{{
void reset(float x0 = 0.f); * ##### Brickworks::Notch
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class Notch {
int nSamples); public:
Notch();
void setCutoff(float value); void setSampleRate(float sampleRate);
void setQ(float value); 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 #endif

View File

@ -24,27 +24,39 @@
#include <bw_note_queue.h> #include <bw_note_queue.h>
namespace Brickworks { namespace Brickworks {
class NoteQueue {
public: /*! api {{{
NoteQueue(); * ##### Brickworks::NoteQueue
* ```>>> */
void clear(); class NoteQueue {
void add(unsigned char note, bool pressed, float velocity, bool force_went_off); public:
NoteQueue();
bw_note_queue queue;
};
inline NoteQueue::NoteQueue() { void clear();
bw_note_queue_reset(&queue); void add(unsigned char note, bool pressed, float velocity, bool force_went_off);
}
inline void NoteQueue::clear() { bw_note_queue queue;
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); /*** 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 #endif

View File

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

View File

@ -25,41 +25,53 @@
#include <array> #include <array>
namespace Brickworks { 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: /*! api {{{
bw_osc_filt_state states[N_CHANNELS]; * ##### Brickworks::OscFilt
bw_osc_filt_state *statesP[N_CHANNELS]; * ```>>> */
}; template<BW_SIZE_T N_CHANNELS>
class OscFilt {
public:
OscFilt();
template<BW_SIZE_T N_CHANNELS> void reset();
inline OscFilt<N_CHANNELS>::OscFilt() { void process(
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) std::array<const float *, N_CHANNELS> x,
statesP[i] = states + i; std::array<float *, N_CHANNELS> y,
} int nSamples);
/*! <<<... }```
template<BW_SIZE_T N_CHANNELS> * }}} */
inline void OscFilt<N_CHANNELS>::reset() {
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) /*** Implementation ***/
bw_osc_filt_reset_state(states + i);
} /* 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 OscFilt<N_CHANNELS>::process( private:
std::array<const float *, N_CHANNELS> x, bw_osc_filt_state states[N_CHANNELS];
std::array<float *, N_CHANNELS> y, bw_osc_filt_state *statesP[N_CHANNELS];
int nSamples) { };
bw_osc_filt_process_multi(statesP, x.data(), y.data(), N_CHANNELS, nSamples);
} 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 #endif

View File

@ -25,59 +25,71 @@
#include <array> #include <array>
namespace Brickworks { 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: /*! api {{{
bw_osc_pulse_coeffs coeffs; * ##### Brickworks::OscPulse
}; * ```>>> */
template<BW_SIZE_T N_CHANNELS>
class OscPulse {
public:
OscPulse();
template<BW_SIZE_T N_CHANNELS> void setSampleRate(float sampleRate);
inline OscPulse<N_CHANNELS>::OscPulse() { void reset();
bw_osc_pulse_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> void setAntialiasing(bool value);
inline void OscPulse<N_CHANNELS>::setSampleRate(float sampleRate) { void setPulseWidth(float value);
bw_osc_pulse_set_sample_rate(&coeffs, sampleRate); /*! <<<... }```
} * }}} */
template<BW_SIZE_T N_CHANNELS> /*** Implementation ***/
inline void OscPulse<N_CHANNELS>::reset() {
bw_osc_pulse_reset_coeffs(&coeffs); /* 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> private:
inline void OscPulse<N_CHANNELS>::process( bw_osc_pulse_coeffs coeffs;
std::array<const float *, N_CHANNELS> x, };
std::array<const float *, N_CHANNELS> x_phase_inc,
std::array<float *, N_CHANNELS> y, template<BW_SIZE_T N_CHANNELS>
int nSamples) { inline OscPulse<N_CHANNELS>::OscPulse() {
bw_osc_pulse_process_multi(&coeffs, x.data(), x_phase_inc.data(), y.data(), N_CHANNELS, nSamples); bw_osc_pulse_init(&coeffs);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void OscPulse<N_CHANNELS>::setAntialiasing(bool value) { inline void OscPulse<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_osc_pulse_set_antialiasing(&coeffs, value); bw_osc_pulse_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void OscPulse<N_CHANNELS>::setPulseWidth(float value) { inline void OscPulse<N_CHANNELS>::reset() {
bw_osc_pulse_set_pulse_width(&coeffs, value); 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 #endif

View File

@ -25,41 +25,53 @@
#include <array> #include <array>
namespace Brickworks { 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: /*! api {{{
bw_osc_saw_coeffs coeffs; * ##### Brickworks::OscSaw
}; * ```>>> */
template<BW_SIZE_T N_CHANNELS>
class OscSaw {
public:
OscSaw();
template<BW_SIZE_T N_CHANNELS> void process(
inline OscSaw<N_CHANNELS>::OscSaw() { std::array<const float *, N_CHANNELS> x,
bw_osc_saw_init(&coeffs); std::array<const float *, N_CHANNELS> x_phase_inc,
} std::array<float *, N_CHANNELS> y,
int nSamples);
template<BW_SIZE_T N_CHANNELS> void setAntialiasing(bool value);
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, /*** Implementation ***/
int nSamples) {
bw_osc_saw_process_multi(&coeffs, x.data(), x_phase_inc.data(), y.data(), N_CHANNELS, nSamples); /* 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> private:
inline void OscSaw<N_CHANNELS>::setAntialiasing(bool value) { bw_osc_saw_coeffs coeffs;
bw_osc_saw_set_antialiasing(&coeffs, value); };
}
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 #endif

View File

@ -25,19 +25,31 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
void oscSinProcess( /*! api {{{
std::array<const float *, N_CHANNELS> x, * ##### Brickworks::oscSinProcess
std::array<float *, N_CHANNELS> y, * ```>>> */
int nSamples); template<BW_SIZE_T N_CHANNELS>
void oscSinProcess(
template<BW_SIZE_T N_CHANNELS> std::array<const float *, N_CHANNELS> x,
inline void oscSinProcess( std::array<float *, N_CHANNELS> y,
std::array<const float *, N_CHANNELS> x, int nSamples);
std::array<float *, N_CHANNELS> y, /*! <<<```
int nSamples) { * }}} */
bw_osc_sin_process_multi(x.data(), y.data(), N_CHANNELS, 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 #endif

View File

@ -25,59 +25,71 @@
#include <array> #include <array>
namespace Brickworks { 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: /*! api {{{
bw_osc_tri_coeffs coeffs; * ##### Brickworks::OscTri
}; * ```>>> */
template<BW_SIZE_T N_CHANNELS>
class OscTri {
public:
OscTri();
template<BW_SIZE_T N_CHANNELS> void setSampleRate(float sampleRate);
inline OscTri<N_CHANNELS>::OscTri() { void reset();
bw_osc_tri_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> void setAntialiasing(bool value);
inline void OscTri<N_CHANNELS>::setSampleRate(float sampleRate) { void setSlope(float value);
bw_osc_tri_set_sample_rate(&coeffs, sampleRate); /*! <<<... }```
} * }}} */
template<BW_SIZE_T N_CHANNELS> /*** Implementation ***/
inline void OscTri<N_CHANNELS>::reset() {
bw_osc_tri_reset_coeffs(&coeffs); /* 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> private:
inline void OscTri<N_CHANNELS>::process( bw_osc_tri_coeffs coeffs;
std::array<const float *, N_CHANNELS> x, };
std::array<const float *, N_CHANNELS> x_phase_inc,
std::array<float *, N_CHANNELS> y, template<BW_SIZE_T N_CHANNELS>
int nSamples) { inline OscTri<N_CHANNELS>::OscTri() {
bw_osc_tri_process_multi(&coeffs, x.data(), x_phase_inc.data(), y.data(), N_CHANNELS, nSamples); bw_osc_tri_init(&coeffs);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void OscTri<N_CHANNELS>::setAntialiasing(bool value) { inline void OscTri<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_osc_tri_set_antialiasing(&coeffs, value); bw_osc_tri_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void OscTri<N_CHANNELS>::setSlope(float value) { inline void OscTri<N_CHANNELS>::reset() {
bw_osc_tri_set_slope(&coeffs, value); 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 #endif

View File

@ -25,53 +25,65 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Pan {
public:
Pan();
void setSampleRate(float sampleRate); /*! api {{{
void reset(); * ##### Brickworks::Pan
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y_l, class Pan {
std::array<float *, N_CHANNELS> y_r, public:
int nSamples); 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 #endif

View File

@ -25,87 +25,99 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Peak {
public:
Peak();
void setSampleRate(float sampleRate); /*! api {{{
void reset(float x0 = 0.f); * ##### Brickworks::Peak
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class Peak {
int nSamples); public:
Peak();
void setCutoff(float value); void setSampleRate(float sampleRate);
void setQ(float value); void reset(float x0 = 0.f);
void setPeakGainLin(float value); void process(
void setPeakGainDB(float value); std::array<const float *, N_CHANNELS> x,
void setBandwidth(float value); std::array<float *, N_CHANNELS> y,
void setUseBandwidth(bool value); 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 #endif

View File

@ -25,65 +25,77 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class PhaseGen {
public:
PhaseGen();
void setSampleRate(float sampleRate); /*! api {{{
void reset(float phase_0 = 0.f); * ##### Brickworks::PhaseGen
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x_mod, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class PhaseGen {
std::array<float *, N_CHANNELS> y_phase_inc, public:
int nSamples); PhaseGen();
void setFrequency(float value); void setSampleRate(float sampleRate);
void setPortamentoTau(float value); 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 #endif

View File

@ -25,69 +25,81 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Phaser {
public:
Phaser();
void setSampleRate(float sampleRate); /*! api {{{
void reset(); * ##### Brickworks::Phaser
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class Phaser {
int nSamples); public:
Phaser();
void setRate(float value); void setSampleRate(float sampleRate);
void setCenter(float value); void reset();
void setAmount(float value); 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 #endif

View File

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

View File

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

View File

@ -25,101 +25,113 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Reverb {
public:
Reverb();
~Reverb();
void setSampleRate(float sampleRate); /*! api {{{
void reset(); * ##### Brickworks::Reverb
void process( * ```>>> */
std::array<const float *, N_CHANNELS> xl, template<BW_SIZE_T N_CHANNELS>
std::array<const float *, N_CHANNELS> xr, class Reverb {
std::array<float *, N_CHANNELS> yl, public:
std::array<float *, N_CHANNELS> yr, Reverb();
int nSamples); ~Reverb();
void setPredelay(float value); void setSampleRate(float sampleRate);
void setBandwidth(float value); void reset();
void setDamping(float value); void process(
void setDecay(float value); std::array<const float *, N_CHANNELS> xl,
void setWet(float value); 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 #endif

View File

@ -25,53 +25,65 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class RingMod {
public:
RingMod();
void setSampleRate(float sampleRate); /*! api {{{
void reset(); * ##### Brickworks::RingMod
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x_mod, template<BW_SIZE_T N_CHANNELS>
std::array<const float *, N_CHANNELS> x_car, class RingMod {
std::array<float *, N_CHANNELS> y, public:
int nSamples); 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 #endif

View File

@ -25,69 +25,81 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Satur {
public:
Satur();
void setSampleRate(float sampleRate); /*! api {{{
void reset(); * ##### Brickworks::Satur
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class Satur {
int nSamples); public:
Satur();
void setBias(float value); void setSampleRate(float sampleRate);
void setGain(float value); void reset();
void setGainCompensation(bool value); 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 #endif

View File

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

View File

@ -25,50 +25,62 @@
#include <array> #include <array>
namespace Brickworks { 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 #endif

View File

@ -25,45 +25,57 @@
#include <array> #include <array>
namespace Brickworks { 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: /*! api {{{
bw_src_coeffs coeffs; * ##### Brickworks::SRC
bw_src_state states[N_CHANNELS]; * ```>>> */
bw_src_state *statesP[N_CHANNELS]; template<BW_SIZE_T N_CHANNELS>
}; class SRC {
public:
SRC(float ratio);
template<BW_SIZE_T N_CHANNELS> void reset(float x0 = 0.f);
inline SRC<N_CHANNELS>::SRC(float ratio) { void process(
bw_src_init(&coeffs, ratio); std::array<const float *, N_CHANNELS> x,
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) std::array<float *, N_CHANNELS> y,
statesP[i] = states + i; std::array<int *, N_CHANNELS> nInSamples,
} std::array<int *, N_CHANNELS> nOutSamples);
/*! <<<... }```
template<BW_SIZE_T N_CHANNELS> * }}} */
inline void SRC<N_CHANNELS>::reset(float x0) {
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) /*** Implementation ***/
bw_src_reset_state(&coeffs, states + i, x0);
} /* 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 SRC<N_CHANNELS>::process( private:
std::array<const float *, N_CHANNELS> x, bw_src_coeffs coeffs;
std::array<float *, N_CHANNELS> y, bw_src_state states[N_CHANNELS];
std::array<int *, N_CHANNELS> nInSamples, bw_src_state *statesP[N_CHANNELS];
std::array<int *, N_CHANNELS> nOutSamples) { };
bw_src_process_multi(coeffs, statesP, x.data(), y.data(), N_CHANNELS, nInSamples.data(), nOutSamples.data());
} 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 #endif

View File

@ -25,45 +25,57 @@
#include <array> #include <array>
namespace Brickworks { 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: /*! api {{{
bw_src_int_coeffs coeffs; * ##### Brickworks::SRCInt
bw_src_int_state states[N_CHANNELS]; * ```>>> */
bw_src_int_state *statesP[N_CHANNELS]; template<BW_SIZE_T N_CHANNELS>
}; class SRCInt {
public:
SRCInt(int ratio);
template<BW_SIZE_T N_CHANNELS> void reset(float x0 = 0.f);
inline SRCInt<N_CHANNELS>::SRCInt(int ratio) { std::array<int, N_CHANNELS> process(
bw_src_int_init(&coeffs, ratio); std::array<const float *, N_CHANNELS> x,
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) std::array<float *, N_CHANNELS> y,
statesP[i] = states + i; int nInSamples);
} /*! <<<... }```
* }}} */
template<BW_SIZE_T N_CHANNELS>
inline void SRCInt<N_CHANNELS>::reset(float x0) { /*** Implementation ***/
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_src_int_reset_state(&coeffs, states + i, x0); /* 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> private:
inline std::array<int, N_CHANNELS> SRCInt<N_CHANNELS>::process( bw_src_int_coeffs coeffs;
std::array<const float *, N_CHANNELS> x, bw_src_int_state states[N_CHANNELS];
std::array<float *, N_CHANNELS> y, bw_src_int_state *statesP[N_CHANNELS];
int nInSamples) { };
std::array<int, N_CHANNELS> ret;
bw_src_int_process_multi(&coeffs, statesP, x.data(), y.data(), ret.data(), N_CHANNELS, nInSamples); template<BW_SIZE_T N_CHANNELS>
return ret; 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 #endif

View File

@ -25,79 +25,91 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class SVF {
public:
SVF();
void setSampleRate(float sampleRate); /*! api {{{
void reset(float x0 = 0.f); * ##### Brickworks::SVF
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y_lp, class SVF {
std::array<float *, N_CHANNELS> y_bp, public:
std::array<float *, N_CHANNELS> y_hp, SVF();
int nSamples);
void setCutoff(float value); void setSampleRate(float sampleRate);
void setQ(float value); void reset(float x0 = 0.f);
void setPrewarpAtCutoff(bool value); void process(
void setPrewarpFreq(float value); 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 #endif

View File

@ -25,63 +25,75 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Trem {
public:
Trem();
void setSampleRate(float sampleRate); /*! api {{{
void reset(); * ##### Brickworks::Trem
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class Trem {
int nSamples); public:
Trem();
void setRate(float value); void setSampleRate(float sampleRate);
void setAmount(float value); 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 #endif

View File

@ -25,57 +25,69 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Wah {
public:
Wah();
void setSampleRate(float sampleRate); /*! api {{{
void reset(); * ##### Brickworks::Wah
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class Wah {
int nSamples); 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 #endif