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,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class AP1 { /*! api {{{
public: * ##### Brickworks::AP1
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class AP1 {
public:
AP1(); AP1();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -38,44 +42,52 @@ namespace Brickworks {
int nSamples); int nSamples);
void setCutoff(float value); void setCutoff(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_ap1_state states[N_CHANNELS]; bw_ap1_state states[N_CHANNELS];
bw_ap1_state *statesP[N_CHANNELS]; bw_ap1_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline AP1<N_CHANNELS>::AP1() { inline AP1<N_CHANNELS>::AP1() {
bw_ap1_init(&coeffs); bw_ap1_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void AP1<N_CHANNELS>::setSampleRate(float sampleRate) { inline void AP1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ap1_set_sample_rate(&coeffs, sampleRate); bw_ap1_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void AP1<N_CHANNELS>::reset(float x0) { inline void AP1<N_CHANNELS>::reset(float x0) {
bw_ap1_reset_coeffs(&coeffs); bw_ap1_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_ap1_reset_state(&coeffs, states + i, x0); bw_ap1_reset_state(&coeffs, states + i, x0);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void AP1<N_CHANNELS>::process( inline void AP1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_ap1_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_ap1_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 AP1<N_CHANNELS>::setCutoff(float value) { inline void AP1<N_CHANNELS>::setCutoff(float value) {
bw_ap1_set_cutoff(&coeffs, value); bw_ap1_set_cutoff(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class AP2 { /*! api {{{
public: * ##### Brickworks::AP2
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class AP2 {
public:
AP2(); AP2();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -39,49 +43,57 @@ namespace Brickworks {
void setCutoff(float value); void setCutoff(float value);
void setQ(float value); void setQ(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_ap2_state states[N_CHANNELS]; bw_ap2_state states[N_CHANNELS];
bw_ap2_state *statesP[N_CHANNELS]; bw_ap2_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline AP2<N_CHANNELS>::AP2() { inline AP2<N_CHANNELS>::AP2() {
bw_ap2_init(&coeffs); bw_ap2_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void AP2<N_CHANNELS>::setSampleRate(float sampleRate) { inline void AP2<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ap2_set_sample_rate(&coeffs, sampleRate); bw_ap2_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void AP2<N_CHANNELS>::reset(float x0) { inline void AP2<N_CHANNELS>::reset(float x0) {
bw_ap2_reset_coeffs(&coeffs); bw_ap2_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_ap2_reset_state(&coeffs, states + i, x0); bw_ap2_reset_state(&coeffs, states + i, x0);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void AP2<N_CHANNELS>::process( inline void AP2<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_ap2_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_ap2_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 AP2<N_CHANNELS>::setCutoff(float value) { inline void AP2<N_CHANNELS>::setCutoff(float value) {
bw_ap2_set_cutoff(&coeffs, value); bw_ap2_set_cutoff(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void AP2<N_CHANNELS>::setQ(float value) { inline void AP2<N_CHANNELS>::setQ(float value) {
bw_ap2_set_Q(&coeffs, value); bw_ap2_set_Q(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Balance { /*! api {{{
public: * ##### Brickworks::Balance
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Balance {
public:
Balance(); Balance();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -40,40 +44,48 @@ namespace Brickworks {
int nSamples); int nSamples);
void setBalance(float value); void setBalance(float value);
/*! <<<... }```
* }}} */
private: /*** 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; bw_balance_coeffs coeffs;
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline Balance<N_CHANNELS>::Balance() { inline Balance<N_CHANNELS>::Balance() {
bw_balance_init(&coeffs); bw_balance_init(&coeffs);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Balance<N_CHANNELS>::setSampleRate(float sampleRate) { inline void Balance<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_balance_set_sample_rate(&coeffs, sampleRate); bw_balance_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Balance<N_CHANNELS>::reset() { inline void Balance<N_CHANNELS>::reset() {
bw_balance_reset_coeffs(&coeffs); bw_balance_reset_coeffs(&coeffs);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Balance<N_CHANNELS>::process( inline void Balance<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x_l, std::array<const float *, N_CHANNELS> x_l,
std::array<const float *, N_CHANNELS> x_r, std::array<const float *, N_CHANNELS> x_r,
std::array<float *, N_CHANNELS> y_l, std::array<float *, N_CHANNELS> y_l,
std::array<float *, N_CHANNELS> y_r, std::array<float *, N_CHANNELS> y_r,
int nSamples) { int nSamples) {
bw_balance_process_multi(&coeffs, x_l.data(), x_r.data(), y_l.data(), y_r.data(), N_CHANNELS, 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> template<BW_SIZE_T N_CHANNELS>
inline void Balance<N_CHANNELS>::setBalance(float value) { inline void Balance<N_CHANNELS>::setBalance(float value) {
bw_balance_set_balance(&coeffs, value); bw_balance_set_balance(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class BDReduce { /*! api {{{
public: * ##### Brickworks::BDReduce
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class BDReduce {
public:
BDReduce(); BDReduce();
void reset(); void reset();
@ -37,33 +41,41 @@ namespace Brickworks {
int nSamples); int nSamples);
void setBitDepth(char value); void setBitDepth(char value);
/*! <<<... }```
* }}} */
private: /*** 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; bw_bd_reduce_coeffs coeffs;
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline BDReduce<N_CHANNELS>::BDReduce() { inline BDReduce<N_CHANNELS>::BDReduce() {
bw_bd_reduce_init(&coeffs); bw_bd_reduce_init(&coeffs);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void BDReduce<N_CHANNELS>::reset() { inline void BDReduce<N_CHANNELS>::reset() {
bw_bd_reduce_reset_coeffs(&coeffs); bw_bd_reduce_reset_coeffs(&coeffs);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void BDReduce<N_CHANNELS>::process( inline void BDReduce<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_bd_reduce_process_multi(&coeffs, x.data(), y.data(), N_CHANNELS, nSamples); bw_bd_reduce_process_multi(&coeffs, x.data(), y.data(), N_CHANNELS, nSamples);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void BDReduce<N_CHANNELS>::setBitDepth(char value) { inline void BDReduce<N_CHANNELS>::setBitDepth(char value) {
bw_bd_reduce_set_bit_depth(&coeffs, 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( /*! api {{{
* ##### Brickworks::bufFill
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
void bufFill(
std::array<float *, N_CHANNELS> dest, std::array<float *, N_CHANNELS> dest,
float k, float k,
int nSamples); int nSamples);
/*! <<<```
template<BW_SIZE_T N_CHANNELS> *
void bufNeg( * ##### Brickworks::bufNeg
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
void bufNeg(
std::array<float *, N_CHANNELS> dest, std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src, std::array<const float *, N_CHANNELS> src,
int nSamples); int nSamples);
/*! <<<```
template<BW_SIZE_T N_CHANNELS> *
void bufAdd( * ##### Brickworks::bufAdd
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
void bufAdd(
std::array<float *, N_CHANNELS> dest, std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src, std::array<const float *, N_CHANNELS> src,
float k, float k,
int nSamples); int nSamples);
/*! <<<```
template<BW_SIZE_T N_CHANNELS> *
void bufScale( * ##### Brickworks::bufScale
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
void bufScale(
std::array<float *, N_CHANNELS> dest, std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src, std::array<const float *, N_CHANNELS> src,
float k, float k,
int nSamples); int nSamples);
/*! <<<```
template<BW_SIZE_T N_CHANNELS> *
void bufMix( * ##### Brickworks::bufMix
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
void bufMix(
std::array<float *, N_CHANNELS> dest, std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src1, std::array<const float *, N_CHANNELS> src1,
std::array<const float *, N_CHANNELS> src2, std::array<const float *, N_CHANNELS> src2,
int nSamples); int nSamples);
/*! <<<```
template<BW_SIZE_T N_CHANNELS> *
void bufMul( * ##### Brickworks::bufMul
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
void bufMul(
std::array<float *, N_CHANNELS> dest, std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src1, std::array<const float *, N_CHANNELS> src1,
std::array<const float *, N_CHANNELS> src2, std::array<const float *, N_CHANNELS> src2,
int nSamples); int nSamples);
/*! <<<```
* }}} */
template<BW_SIZE_T N_CHANNELS> /*** Implementation ***/
inline void bufFill(
/* WARNING: This part of the file is not part of the public API. Its content may
* change at any time in future versions. Please, do not use it directly. */
template<BW_SIZE_T N_CHANNELS>
inline void bufFill(
std::array<float *, N_CHANNELS> dest, std::array<float *, N_CHANNELS> dest,
float k, float k,
int nSamples) { int nSamples) {
bw_buf_fill_multi(dest.data(), k, N_CHANNELS, nSamples); bw_buf_fill_multi(dest.data(), k, N_CHANNELS, nSamples);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void bufNeg( inline void bufNeg(
std::array<float *, N_CHANNELS> dest, std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src, std::array<const float *, N_CHANNELS> src,
int nSamples) { int nSamples) {
bw_buf_neg_multi(dest.data(), src.data(), N_CHANNELS, nSamples); bw_buf_neg_multi(dest.data(), src.data(), N_CHANNELS, nSamples);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void bufAdd( inline void bufAdd(
std::array<float *, N_CHANNELS> dest, std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src, std::array<const float *, N_CHANNELS> src,
float k, float k,
int nSamples) { int nSamples) {
bw_buf_add_multi(dest.data(), src.data(), k, N_CHANNELS, nSamples); bw_buf_add_multi(dest.data(), src.data(), k, N_CHANNELS, nSamples);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void bufScale( inline void bufScale(
std::array<float *, N_CHANNELS> dest, std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src, std::array<const float *, N_CHANNELS> src,
float k, float k,
int nSamples) { int nSamples) {
bw_buf_scale_multi(dest.data(), src.data(), k, N_CHANNELS, nSamples); bw_buf_scale_multi(dest.data(), src.data(), k, N_CHANNELS, nSamples);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void bufMix( inline void bufMix(
std::array<float *, N_CHANNELS> dest, std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src1, std::array<const float *, N_CHANNELS> src1,
std::array<const float *, N_CHANNELS> src2, std::array<const float *, N_CHANNELS> src2,
int nSamples) { int nSamples) {
bw_buf_mix_multi(dest.data(), src1.data(), src2.data(), N_CHANNELS, nSamples); bw_buf_mix_multi(dest.data(), src1.data(), src2.data(), N_CHANNELS, nSamples);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void bufMul( inline void bufMul(
std::array<float *, N_CHANNELS> dest, std::array<float *, N_CHANNELS> dest,
std::array<const float *, N_CHANNELS> src1, std::array<const float *, N_CHANNELS> src1,
std::array<const float *, N_CHANNELS> src2, std::array<const float *, N_CHANNELS> src2,
int nSamples) { int nSamples) {
bw_buf_mul_multi(dest.data(), src1.data(), src2.data(), N_CHANNELS, nSamples); bw_buf_mul_multi(dest.data(), src1.data(), src2.data(), N_CHANNELS, nSamples);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Chorus { /*! api {{{
public: * ##### Brickworks::Chorus
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Chorus {
public:
Chorus(float maxDelay = 0.01f); Chorus(float maxDelay = 0.01f);
~Chorus(); ~Chorus();
@ -44,30 +48,37 @@ namespace Brickworks {
void setCoeffX(float value); void setCoeffX(float value);
void setCoeffMod(float value); void setCoeffMod(float value);
void setCoeffFB(float value); void setCoeffFB(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_chorus_state states[N_CHANNELS]; bw_chorus_state states[N_CHANNELS];
bw_chorus_state *statesP[N_CHANNELS]; bw_chorus_state *statesP[N_CHANNELS];
void *mem; void *mem;
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline Chorus<N_CHANNELS>::Chorus(float maxDelay) { inline Chorus<N_CHANNELS>::Chorus(float maxDelay) {
bw_chorus_init(&coeffs, maxDelay); bw_chorus_init(&coeffs, maxDelay);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
mem = nullptr; mem = nullptr;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline Chorus<N_CHANNELS>::~Chorus() { inline Chorus<N_CHANNELS>::~Chorus() {
if (mem != nullptr) if (mem != nullptr)
operator delete(mem); operator delete(mem);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::setSampleRate(float sampleRate) { inline void Chorus<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_chorus_set_sample_rate(&coeffs, sampleRate); bw_chorus_set_sample_rate(&coeffs, sampleRate);
BW_SIZE_T req = bw_chorus_mem_req(&coeffs); BW_SIZE_T req = bw_chorus_mem_req(&coeffs);
if (mem != nullptr) if (mem != nullptr)
@ -76,52 +87,53 @@ namespace Brickworks {
void *m = mem; void *m = mem;
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++, m = static_cast<char *>(m) + req) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++, m = static_cast<char *>(m) + req)
bw_chorus_mem_set(&coeffs, states + i, m); bw_chorus_mem_set(&coeffs, states + i, m);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::reset() { inline void Chorus<N_CHANNELS>::reset() {
bw_chorus_reset_coeffs(&coeffs); bw_chorus_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_chorus_reset_state(&coeffs, states + i); bw_chorus_reset_state(&coeffs, states + i);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::process( inline void Chorus<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_chorus_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_chorus_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 Chorus<N_CHANNELS>::setRate(float value) { inline void Chorus<N_CHANNELS>::setRate(float value) {
bw_chorus_set_rate(&coeffs, value); bw_chorus_set_rate(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::setDelay(float value) { inline void Chorus<N_CHANNELS>::setDelay(float value) {
bw_chorus_set_delay(&coeffs, value); bw_chorus_set_delay(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::setAmount(float value) { inline void Chorus<N_CHANNELS>::setAmount(float value) {
bw_chorus_set_amount(&coeffs, value); bw_chorus_set_amount(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::setCoeffX(float value) { inline void Chorus<N_CHANNELS>::setCoeffX(float value) {
bw_chorus_set_coeff_x(&coeffs, value); bw_chorus_set_coeff_x(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::setCoeffMod(float value) { inline void Chorus<N_CHANNELS>::setCoeffMod(float value) {
bw_chorus_set_coeff_mod(&coeffs, value); bw_chorus_set_coeff_mod(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Chorus<N_CHANNELS>::setCoeffFB(float value) { inline void Chorus<N_CHANNELS>::setCoeffFB(float value) {
bw_chorus_set_coeff_fb(&coeffs, value); bw_chorus_set_coeff_fb(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Clip { /*! api {{{
public: * ##### Brickworks::Clip
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Clip {
public:
Clip(); Clip();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -40,54 +44,62 @@ namespace Brickworks {
void setBias(float value); void setBias(float value);
void setGain(float value); void setGain(float value);
void setGainCompensation(bool value); void setGainCompensation(bool value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_clip_state states[N_CHANNELS]; bw_clip_state states[N_CHANNELS];
bw_clip_state *statesP[N_CHANNELS]; bw_clip_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline Clip<N_CHANNELS>::Clip() { inline Clip<N_CHANNELS>::Clip() {
bw_clip_init(&coeffs); bw_clip_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Clip<N_CHANNELS>::setSampleRate(float sampleRate) { inline void Clip<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_clip_set_sample_rate(&coeffs, sampleRate); bw_clip_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Clip<N_CHANNELS>::reset() { inline void Clip<N_CHANNELS>::reset() {
bw_clip_reset_coeffs(&coeffs); bw_clip_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_clip_reset_state(&coeffs, states + i); bw_clip_reset_state(&coeffs, states + i);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Clip<N_CHANNELS>::process( inline void Clip<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_clip_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_clip_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 Clip<N_CHANNELS>::setBias(float value) { inline void Clip<N_CHANNELS>::setBias(float value) {
bw_clip_set_bias(&coeffs, value); bw_clip_set_bias(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Clip<N_CHANNELS>::setGain(float value) { inline void Clip<N_CHANNELS>::setGain(float value) {
bw_clip_set_gain(&coeffs, value); bw_clip_set_gain(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Clip<N_CHANNELS>::setGainCompensation(bool value) { inline void Clip<N_CHANNELS>::setGainCompensation(bool value) {
bw_clip_set_gain_compensation(&coeffs, value); bw_clip_set_gain_compensation(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Comb { /*! api {{{
public: * ##### Brickworks::Comb
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Comb {
public:
Comb(float maxDelay = 1.f); Comb(float maxDelay = 1.f);
~Comb(); ~Comb();
@ -43,30 +47,37 @@ namespace Brickworks {
void setCoeffBlend(float value); void setCoeffBlend(float value);
void setCoeffFF(float value); void setCoeffFF(float value);
void setCoeffFB(float value); void setCoeffFB(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_comb_state states[N_CHANNELS]; bw_comb_state states[N_CHANNELS];
bw_comb_state *statesP[N_CHANNELS]; bw_comb_state *statesP[N_CHANNELS];
void *mem; void *mem;
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline Comb<N_CHANNELS>::Comb(float maxDelay) { inline Comb<N_CHANNELS>::Comb(float maxDelay) {
bw_comb_init(&coeffs, maxDelay); bw_comb_init(&coeffs, maxDelay);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
mem = nullptr; mem = nullptr;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline Comb<N_CHANNELS>::~Comb() { inline Comb<N_CHANNELS>::~Comb() {
if (mem != nullptr) if (mem != nullptr)
operator delete(mem); operator delete(mem);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::setSampleRate(float sampleRate) { inline void Comb<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_comb_set_sample_rate(&coeffs, sampleRate); bw_comb_set_sample_rate(&coeffs, sampleRate);
BW_SIZE_T req = bw_comb_mem_req(&coeffs); BW_SIZE_T req = bw_comb_mem_req(&coeffs);
if (mem != nullptr) if (mem != nullptr)
@ -75,47 +86,48 @@ namespace Brickworks {
void *m = mem; void *m = mem;
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++, m = static_cast<char *>(m) + req) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++, m = static_cast<char *>(m) + req)
bw_comb_mem_set(&coeffs, states + i, m); bw_comb_mem_set(&coeffs, states + i, m);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::reset() { inline void Comb<N_CHANNELS>::reset() {
bw_comb_reset_coeffs(&coeffs); bw_comb_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_comb_reset_state(&coeffs, states + i); bw_comb_reset_state(&coeffs, states + i);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::process( inline void Comb<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_comb_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_comb_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 Comb<N_CHANNELS>::setDelayFF(float value) { inline void Comb<N_CHANNELS>::setDelayFF(float value) {
bw_comb_set_delay_ff(&coeffs, value); bw_comb_set_delay_ff(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::setDelayFB(float value) { inline void Comb<N_CHANNELS>::setDelayFB(float value) {
bw_comb_set_delay_fb(&coeffs, value); bw_comb_set_delay_fb(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::setCoeffBlend(float value) { inline void Comb<N_CHANNELS>::setCoeffBlend(float value) {
bw_comb_set_coeff_blend(&coeffs, value); bw_comb_set_coeff_blend(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::setCoeffFF(float value) { inline void Comb<N_CHANNELS>::setCoeffFF(float value) {
bw_comb_set_coeff_ff(&coeffs, value); bw_comb_set_coeff_ff(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Comb<N_CHANNELS>::setCoeffFB(float value) { inline void Comb<N_CHANNELS>::setCoeffFB(float value) {
bw_comb_set_coeff_fb(&coeffs, value); bw_comb_set_coeff_fb(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Comp { /*! api {{{
public: * ##### Brickworks::Comp
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Comp {
public:
Comp(); Comp();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -45,75 +49,83 @@ namespace Brickworks {
void setReleaseTau(float value); void setReleaseTau(float value);
void setGainLin(float value); void setGainLin(float value);
void setGainDB(float value); void setGainDB(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_comp_state states[N_CHANNELS]; bw_comp_state states[N_CHANNELS];
bw_comp_state *statesP[N_CHANNELS]; bw_comp_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline Comp<N_CHANNELS>::Comp() { inline Comp<N_CHANNELS>::Comp() {
bw_comp_init(&coeffs); bw_comp_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::setSampleRate(float sampleRate) { inline void Comp<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_comp_set_sample_rate(&coeffs, sampleRate); bw_comp_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::reset() { inline void Comp<N_CHANNELS>::reset() {
bw_comp_reset_coeffs(&coeffs); bw_comp_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_comp_reset_state(&coeffs, states + i); bw_comp_reset_state(&coeffs, states + i);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::process( inline void Comp<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<const float *, N_CHANNELS> xSC, std::array<const float *, N_CHANNELS> xSC,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_comp_process_multi(&coeffs, statesP, x.data(), xSC.data(), y.data(), N_CHANNELS, nSamples); bw_comp_process_multi(&coeffs, statesP, x.data(), xSC.data(), y.data(), N_CHANNELS, nSamples);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::setTreshLin(float value) { inline void Comp<N_CHANNELS>::setTreshLin(float value) {
bw_comp_set_thresh_lin(&coeffs, value); bw_comp_set_thresh_lin(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::setTreshDBFS(float value) { inline void Comp<N_CHANNELS>::setTreshDBFS(float value) {
bw_comp_set_thresh_dBFS(&coeffs, value); bw_comp_set_thresh_dBFS(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::setRatio(float value) { inline void Comp<N_CHANNELS>::setRatio(float value) {
bw_comp_set_ratio(&coeffs, value); bw_comp_set_ratio(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::setAttackTau(float value) { inline void Comp<N_CHANNELS>::setAttackTau(float value) {
bw_comp_set_attack_tau(&coeffs, value); bw_comp_set_attack_tau(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::setReleaseTau(float value) { inline void Comp<N_CHANNELS>::setReleaseTau(float value) {
bw_comp_set_release_tau(&coeffs, value); bw_comp_set_release_tau(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::setGainLin(float value) { inline void Comp<N_CHANNELS>::setGainLin(float value) {
bw_comp_set_gain_lin(&coeffs, value); bw_comp_set_gain_lin(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Comp<N_CHANNELS>::setGainDB(float value) { inline void Comp<N_CHANNELS>::setGainDB(float value) {
bw_comp_set_gain_dB(&coeffs, value); bw_comp_set_gain_dB(&coeffs, value);
} }
} }
#endif #endif

View File

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

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Dist { /*! api {{{
public: * ##### Brickworks::Dist
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Dist {
public:
Dist(); Dist();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -40,54 +44,62 @@ namespace Brickworks {
void setDistortion(float value); void setDistortion(float value);
void setTone(float value); void setTone(float value);
void setVolume(float value); void setVolume(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_dist_state states[N_CHANNELS]; bw_dist_state states[N_CHANNELS];
bw_dist_state *statesP[N_CHANNELS]; bw_dist_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline Dist<N_CHANNELS>::Dist() { inline Dist<N_CHANNELS>::Dist() {
bw_dist_init(&coeffs); bw_dist_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Dist<N_CHANNELS>::setSampleRate(float sampleRate) { inline void Dist<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_dist_set_sample_rate(&coeffs, sampleRate); bw_dist_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Dist<N_CHANNELS>::reset() { inline void Dist<N_CHANNELS>::reset() {
bw_dist_reset_coeffs(&coeffs); bw_dist_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_dist_reset_state(&coeffs, states + i); bw_dist_reset_state(&coeffs, states + i);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Dist<N_CHANNELS>::process( inline void Dist<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_dist_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_dist_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 Dist<N_CHANNELS>::setDistortion(float value) { inline void Dist<N_CHANNELS>::setDistortion(float value) {
bw_dist_set_distortion(&coeffs, value); bw_dist_set_distortion(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Dist<N_CHANNELS>::setTone(float value) { inline void Dist<N_CHANNELS>::setTone(float value) {
bw_dist_set_tone(&coeffs, value); bw_dist_set_tone(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Dist<N_CHANNELS>::setVolume(float value) { inline void Dist<N_CHANNELS>::setVolume(float value) {
bw_dist_set_volume(&coeffs, value); bw_dist_set_volume(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Drive { /*! api {{{
public: * ##### Brickworks::Drive
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Drive {
public:
Drive(); Drive();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -40,54 +44,62 @@ namespace Brickworks {
void setDrive(float value); void setDrive(float value);
void setTone(float value); void setTone(float value);
void setVolume(float value); void setVolume(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_drive_state states[N_CHANNELS]; bw_drive_state states[N_CHANNELS];
bw_drive_state *statesP[N_CHANNELS]; bw_drive_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline Drive<N_CHANNELS>::Drive() { inline Drive<N_CHANNELS>::Drive() {
bw_drive_init(&coeffs); bw_drive_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Drive<N_CHANNELS>::setSampleRate(float sampleRate) { inline void Drive<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_drive_set_sample_rate(&coeffs, sampleRate); bw_drive_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Drive<N_CHANNELS>::reset() { inline void Drive<N_CHANNELS>::reset() {
bw_drive_reset_coeffs(&coeffs); bw_drive_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_drive_reset_state(&coeffs, states + i); bw_drive_reset_state(&coeffs, states + i);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Drive<N_CHANNELS>::process( inline void Drive<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_drive_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_drive_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 Drive<N_CHANNELS>::setDrive(float value) { inline void Drive<N_CHANNELS>::setDrive(float value) {
bw_drive_set_drive(&coeffs, value); bw_drive_set_drive(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Drive<N_CHANNELS>::setTone(float value) { inline void Drive<N_CHANNELS>::setTone(float value) {
bw_drive_set_tone(&coeffs, value); bw_drive_set_tone(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Drive<N_CHANNELS>::setVolume(float value) { inline void Drive<N_CHANNELS>::setVolume(float value) {
bw_drive_set_volume(&coeffs, value); bw_drive_set_volume(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class DryWet { /*! api {{{
public: * ##### Brickworks::DryWet
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class DryWet {
public:
DryWet(); DryWet();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -40,44 +44,52 @@ namespace Brickworks {
void setWet(float value); void setWet(float value);
void setSmoothTau(float value); void setSmoothTau(float value);
/*! <<<... }```
* }}} */
private: /*** 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; bw_drywet_coeffs coeffs;
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline DryWet<N_CHANNELS>::DryWet() { inline DryWet<N_CHANNELS>::DryWet() {
bw_drywet_init(&coeffs); bw_drywet_init(&coeffs);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void DryWet<N_CHANNELS>::setSampleRate(float sampleRate) { inline void DryWet<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_drywet_set_sample_rate(&coeffs, sampleRate); bw_drywet_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void DryWet<N_CHANNELS>::reset() { inline void DryWet<N_CHANNELS>::reset() {
bw_drywet_reset_coeffs(&coeffs); bw_drywet_reset_coeffs(&coeffs);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void DryWet<N_CHANNELS>::process( inline void DryWet<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x_dry, std::array<const float *, N_CHANNELS> x_dry,
std::array<const float *, N_CHANNELS> x_wet, std::array<const float *, N_CHANNELS> x_wet,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_drywet_process_multi(&coeffs, x_dry.data(), x_wet.data(), y.data(), N_CHANNELS, nSamples); bw_drywet_process_multi(&coeffs, x_dry.data(), x_wet.data(), y.data(), N_CHANNELS, nSamples);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void DryWet<N_CHANNELS>::setWet(float value) { inline void DryWet<N_CHANNELS>::setWet(float value) {
bw_drywet_set_wet(&coeffs, value); bw_drywet_set_wet(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void DryWet<N_CHANNELS>::setSmoothTau(float value) { inline void DryWet<N_CHANNELS>::setSmoothTau(float value) {
bw_drywet_set_smooth_tau(&coeffs, value); bw_drywet_set_smooth_tau(&coeffs, value);
} }
} }
#endif #endif

View File

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

View File

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

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Fuzz { /*! api {{{
public: * ##### Brickworks::Fuzz
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Fuzz {
public:
Fuzz(); Fuzz();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -39,49 +43,57 @@ namespace Brickworks {
void setFuzz(float value); void setFuzz(float value);
void setVolume(float value); void setVolume(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_fuzz_state states[N_CHANNELS]; bw_fuzz_state states[N_CHANNELS];
bw_fuzz_state *statesP[N_CHANNELS]; bw_fuzz_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline Fuzz<N_CHANNELS>::Fuzz() { inline Fuzz<N_CHANNELS>::Fuzz() {
bw_fuzz_init(&coeffs); bw_fuzz_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Fuzz<N_CHANNELS>::setSampleRate(float sampleRate) { inline void Fuzz<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_fuzz_set_sample_rate(&coeffs, sampleRate); bw_fuzz_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Fuzz<N_CHANNELS>::reset() { inline void Fuzz<N_CHANNELS>::reset() {
bw_fuzz_reset_coeffs(&coeffs); bw_fuzz_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_fuzz_reset_state(&coeffs, states + i); bw_fuzz_reset_state(&coeffs, states + i);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Fuzz<N_CHANNELS>::process( inline void Fuzz<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_fuzz_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_fuzz_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 Fuzz<N_CHANNELS>::setFuzz(float value) { inline void Fuzz<N_CHANNELS>::setFuzz(float value) {
bw_fuzz_set_fuzz(&coeffs, value); bw_fuzz_set_fuzz(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Fuzz<N_CHANNELS>::setVolume(float value) { inline void Fuzz<N_CHANNELS>::setVolume(float value) {
bw_fuzz_set_volume(&coeffs, value); bw_fuzz_set_volume(&coeffs, value);
} }
} }
#endif #endif

View File

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

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class HP1 { /*! api {{{
public: * ##### Brickworks::HP1
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class HP1 {
public:
HP1(); HP1();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -38,44 +42,52 @@ namespace Brickworks {
int nSamples); int nSamples);
void setCutoff(float value); void setCutoff(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_hp1_state states[N_CHANNELS]; bw_hp1_state states[N_CHANNELS];
bw_hp1_state *statesP[N_CHANNELS]; bw_hp1_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline HP1<N_CHANNELS>::HP1() { inline HP1<N_CHANNELS>::HP1() {
bw_hp1_init(&coeffs); bw_hp1_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void HP1<N_CHANNELS>::setSampleRate(float sampleRate) { inline void HP1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_hp1_set_sample_rate(&coeffs, sampleRate); bw_hp1_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void HP1<N_CHANNELS>::reset(float x0) { inline void HP1<N_CHANNELS>::reset(float x0) {
bw_hp1_reset_coeffs(&coeffs); bw_hp1_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_hp1_reset_state(&coeffs, states + i, x0); bw_hp1_reset_state(&coeffs, states + i, x0);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void HP1<N_CHANNELS>::process( inline void HP1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_hp1_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_hp1_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 HP1<N_CHANNELS>::setCutoff(float value) { inline void HP1<N_CHANNELS>::setCutoff(float value) {
bw_hp1_set_cutoff(&coeffs, value); bw_hp1_set_cutoff(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class HS1 { /*! api {{{
public: * ##### Brickworks::HS1
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class HS1 {
public:
HS1(); HS1();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -40,54 +44,62 @@ namespace Brickworks {
void setCutoff(float value); void setCutoff(float value);
void setHighGainLin(float value); void setHighGainLin(float value);
void setHighGainDB(float value); void setHighGainDB(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_hs1_state states[N_CHANNELS]; bw_hs1_state states[N_CHANNELS];
bw_hs1_state *statesP[N_CHANNELS]; bw_hs1_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline HS1<N_CHANNELS>::HS1() { inline HS1<N_CHANNELS>::HS1() {
bw_hs1_init(&coeffs); bw_hs1_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void HS1<N_CHANNELS>::setSampleRate(float sampleRate) { inline void HS1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_hs1_set_sample_rate(&coeffs, sampleRate); bw_hs1_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void HS1<N_CHANNELS>::reset(float x0) { inline void HS1<N_CHANNELS>::reset(float x0) {
bw_hs1_reset_coeffs(&coeffs); bw_hs1_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_hs1_reset_state(&coeffs, states + i, x0); bw_hs1_reset_state(&coeffs, states + i, x0);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void HS1<N_CHANNELS>::process( inline void HS1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_hs1_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_hs1_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 HS1<N_CHANNELS>::setCutoff(float value) { inline void HS1<N_CHANNELS>::setCutoff(float value) {
bw_hs1_set_cutoff(&coeffs, value); bw_hs1_set_cutoff(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void HS1<N_CHANNELS>::setHighGainLin(float value) { inline void HS1<N_CHANNELS>::setHighGainLin(float value) {
bw_hs1_set_high_gain_lin(&coeffs, value); bw_hs1_set_high_gain_lin(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void HS1<N_CHANNELS>::setHighGainDB(float value) { inline void HS1<N_CHANNELS>::setHighGainDB(float value) {
bw_hs1_set_high_gain_dB(&coeffs, value); bw_hs1_set_high_gain_dB(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class HS2 { /*! api {{{
public: * ##### Brickworks::HS2
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class HS2 {
public:
HS2(); HS2();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -41,59 +45,67 @@ namespace Brickworks {
void setQ(float value); void setQ(float value);
void setHighGainLin(float value); void setHighGainLin(float value);
void setHighGainDB(float value); void setHighGainDB(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_hs2_state states[N_CHANNELS]; bw_hs2_state states[N_CHANNELS];
bw_hs2_state *statesP[N_CHANNELS]; bw_hs2_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline HS2<N_CHANNELS>::HS2() { inline HS2<N_CHANNELS>::HS2() {
bw_hs2_init(&coeffs); bw_hs2_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void HS2<N_CHANNELS>::setSampleRate(float sampleRate) { inline void HS2<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_hs2_set_sample_rate(&coeffs, sampleRate); bw_hs2_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void HS2<N_CHANNELS>::reset(float x0) { inline void HS2<N_CHANNELS>::reset(float x0) {
bw_hs2_reset_coeffs(&coeffs); bw_hs2_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_hs2_reset_state(&coeffs, states + i, x0); bw_hs2_reset_state(&coeffs, states + i, x0);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void HS2<N_CHANNELS>::process( inline void HS2<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_hs2_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_hs2_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 HS2<N_CHANNELS>::setCutoff(float value) { inline void HS2<N_CHANNELS>::setCutoff(float value) {
bw_hs2_set_cutoff(&coeffs, value); bw_hs2_set_cutoff(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void HS2<N_CHANNELS>::setQ(float value) { inline void HS2<N_CHANNELS>::setQ(float value) {
bw_hs2_set_Q(&coeffs, value); bw_hs2_set_Q(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void HS2<N_CHANNELS>::setHighGainLin(float value) { inline void HS2<N_CHANNELS>::setHighGainLin(float value) {
bw_hs2_set_high_gain_lin(&coeffs, value); bw_hs2_set_high_gain_lin(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void HS2<N_CHANNELS>::setHighGainDB(float value) { inline void HS2<N_CHANNELS>::setHighGainDB(float value) {
bw_hs2_set_high_gain_dB(&coeffs, value); bw_hs2_set_high_gain_dB(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class LP1 { /*! api {{{
public: * ##### Brickworks::LP1
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class LP1 {
public:
LP1(); LP1();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -40,54 +44,62 @@ namespace Brickworks {
void setCutoff(float value); void setCutoff(float value);
void setPrewarpAtCutoff(bool value); void setPrewarpAtCutoff(bool value);
void setPrewarpFreq(float value); void setPrewarpFreq(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_lp1_state states[N_CHANNELS]; bw_lp1_state states[N_CHANNELS];
bw_lp1_state *statesP[N_CHANNELS]; bw_lp1_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline LP1<N_CHANNELS>::LP1() { inline LP1<N_CHANNELS>::LP1() {
bw_lp1_init(&coeffs); bw_lp1_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void LP1<N_CHANNELS>::setSampleRate(float sampleRate) { inline void LP1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_lp1_set_sample_rate(&coeffs, sampleRate); bw_lp1_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void LP1<N_CHANNELS>::reset(float x0) { inline void LP1<N_CHANNELS>::reset(float x0) {
bw_lp1_reset_coeffs(&coeffs); bw_lp1_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_lp1_reset_state(&coeffs, states + i, x0); bw_lp1_reset_state(&coeffs, states + i, x0);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void LP1<N_CHANNELS>::process( inline void LP1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_lp1_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_lp1_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 LP1<N_CHANNELS>::setCutoff(float value) { inline void LP1<N_CHANNELS>::setCutoff(float value) {
bw_lp1_set_cutoff(&coeffs, value); bw_lp1_set_cutoff(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void LP1<N_CHANNELS>::setPrewarpAtCutoff(bool value) { inline void LP1<N_CHANNELS>::setPrewarpAtCutoff(bool value) {
bw_lp1_set_prewarp_at_cutoff(&coeffs, value); bw_lp1_set_prewarp_at_cutoff(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void LP1<N_CHANNELS>::setPrewarpFreq(float value) { inline void LP1<N_CHANNELS>::setPrewarpFreq(float value) {
bw_lp1_set_prewarp_freq(&coeffs, value); bw_lp1_set_prewarp_freq(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class LS1 { /*! api {{{
public: * ##### Brickworks::LS1
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class LS1 {
public:
LS1(); LS1();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -40,54 +44,62 @@ namespace Brickworks {
void setCutoff(float value); void setCutoff(float value);
void setDcGainLin(float value); void setDcGainLin(float value);
void setDcGainDB(float value); void setDcGainDB(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_ls1_state states[N_CHANNELS]; bw_ls1_state states[N_CHANNELS];
bw_ls1_state *statesP[N_CHANNELS]; bw_ls1_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline LS1<N_CHANNELS>::LS1() { inline LS1<N_CHANNELS>::LS1() {
bw_ls1_init(&coeffs); bw_ls1_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void LS1<N_CHANNELS>::setSampleRate(float sampleRate) { inline void LS1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ls1_set_sample_rate(&coeffs, sampleRate); bw_ls1_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void LS1<N_CHANNELS>::reset(float x0) { inline void LS1<N_CHANNELS>::reset(float x0) {
bw_ls1_reset_coeffs(&coeffs); bw_ls1_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_ls1_reset_state(&coeffs, states + i, x0); bw_ls1_reset_state(&coeffs, states + i, x0);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void LS1<N_CHANNELS>::process( inline void LS1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_ls1_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_ls1_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 LS1<N_CHANNELS>::setCutoff(float value) { inline void LS1<N_CHANNELS>::setCutoff(float value) {
bw_ls1_set_cutoff(&coeffs, value); bw_ls1_set_cutoff(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void LS1<N_CHANNELS>::setDcGainLin(float value) { inline void LS1<N_CHANNELS>::setDcGainLin(float value) {
bw_ls1_set_dc_gain_lin(&coeffs, value); bw_ls1_set_dc_gain_lin(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void LS1<N_CHANNELS>::setDcGainDB(float value) { inline void LS1<N_CHANNELS>::setDcGainDB(float value) {
bw_ls1_set_dc_gain_dB(&coeffs, value); bw_ls1_set_dc_gain_dB(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class LS2 { /*! api {{{
public: * ##### Brickworks::LS2
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class LS2 {
public:
LS2(); LS2();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -41,59 +45,67 @@ namespace Brickworks {
void setQ(float value); void setQ(float value);
void setDcGainLin(float value); void setDcGainLin(float value);
void setDcGainDB(float value); void setDcGainDB(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_ls2_state states[N_CHANNELS]; bw_ls2_state states[N_CHANNELS];
bw_ls2_state *statesP[N_CHANNELS]; bw_ls2_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline LS2<N_CHANNELS>::LS2() { inline LS2<N_CHANNELS>::LS2() {
bw_ls2_init(&coeffs); bw_ls2_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void LS2<N_CHANNELS>::setSampleRate(float sampleRate) { inline void LS2<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ls2_set_sample_rate(&coeffs, sampleRate); bw_ls2_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void LS2<N_CHANNELS>::reset(float x0) { inline void LS2<N_CHANNELS>::reset(float x0) {
bw_ls2_reset_coeffs(&coeffs); bw_ls2_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_ls2_reset_state(&coeffs, states + i, x0); bw_ls2_reset_state(&coeffs, states + i, x0);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void LS2<N_CHANNELS>::process( inline void LS2<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_ls2_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_ls2_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 LS2<N_CHANNELS>::setCutoff(float value) { inline void LS2<N_CHANNELS>::setCutoff(float value) {
bw_ls2_set_cutoff(&coeffs, value); bw_ls2_set_cutoff(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void LS2<N_CHANNELS>::setQ(float value) { inline void LS2<N_CHANNELS>::setQ(float value) {
bw_ls2_set_Q(&coeffs, value); bw_ls2_set_Q(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void LS2<N_CHANNELS>::setDcGainLin(float value) { inline void LS2<N_CHANNELS>::setDcGainLin(float value) {
bw_ls2_set_dc_gain_lin(&coeffs, value); bw_ls2_set_dc_gain_lin(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void LS2<N_CHANNELS>::setDcGainDB(float value) { inline void LS2<N_CHANNELS>::setDcGainDB(float value) {
bw_ls2_set_dc_gain_dB(&coeffs, value); bw_ls2_set_dc_gain_dB(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class MM1 { /*! api {{{
public: * ##### Brickworks::MM1
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class MM1 {
public:
MM1(); MM1();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -42,64 +46,72 @@ namespace Brickworks {
void setPrewarpFreq(float value); void setPrewarpFreq(float value);
void setCoeffX(float value); void setCoeffX(float value);
void setCoeffLp(float value); void setCoeffLp(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_mm1_state states[N_CHANNELS]; bw_mm1_state states[N_CHANNELS];
bw_mm1_state *statesP[N_CHANNELS]; bw_mm1_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline MM1<N_CHANNELS>::MM1() { inline MM1<N_CHANNELS>::MM1() {
bw_mm1_init(&coeffs); bw_mm1_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void MM1<N_CHANNELS>::setSampleRate(float sampleRate) { inline void MM1<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_mm1_set_sample_rate(&coeffs, sampleRate); bw_mm1_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void MM1<N_CHANNELS>::reset(float x0) { inline void MM1<N_CHANNELS>::reset(float x0) {
bw_mm1_reset_coeffs(&coeffs); bw_mm1_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_mm1_reset_state(&coeffs, states + i, x0); bw_mm1_reset_state(&coeffs, states + i, x0);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void MM1<N_CHANNELS>::process( inline void MM1<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_mm1_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_mm1_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 MM1<N_CHANNELS>::setCutoff(float value) { inline void MM1<N_CHANNELS>::setCutoff(float value) {
bw_mm1_set_cutoff(&coeffs, value); bw_mm1_set_cutoff(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void MM1<N_CHANNELS>::setPrewarpAtCutoff(bool value) { inline void MM1<N_CHANNELS>::setPrewarpAtCutoff(bool value) {
bw_mm1_set_prewarp_at_cutoff(&coeffs, value); bw_mm1_set_prewarp_at_cutoff(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void MM1<N_CHANNELS>::setPrewarpFreq(float value) { inline void MM1<N_CHANNELS>::setPrewarpFreq(float value) {
bw_mm1_set_prewarp_freq(&coeffs, value); bw_mm1_set_prewarp_freq(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void MM1<N_CHANNELS>::setCoeffX(float value) { inline void MM1<N_CHANNELS>::setCoeffX(float value) {
bw_mm1_set_coeff_x(&coeffs, value); bw_mm1_set_coeff_x(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void MM1<N_CHANNELS>::setCoeffLp(float value) { inline void MM1<N_CHANNELS>::setCoeffLp(float value) {
bw_mm1_set_coeff_lp(&coeffs, value); bw_mm1_set_coeff_lp(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class MM2 { /*! api {{{
public: * ##### Brickworks::MM2
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class MM2 {
public:
MM2(); MM2();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -45,79 +49,87 @@ namespace Brickworks {
void setCoeffLp(float value); void setCoeffLp(float value);
void setCoeffBp(float value); void setCoeffBp(float value);
void setCoeffHp(float value); void setCoeffHp(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_mm2_state states[N_CHANNELS]; bw_mm2_state states[N_CHANNELS];
bw_mm2_state *statesP[N_CHANNELS]; bw_mm2_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline MM2<N_CHANNELS>::MM2() { inline MM2<N_CHANNELS>::MM2() {
bw_mm2_init(&coeffs); bw_mm2_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setSampleRate(float sampleRate) { inline void MM2<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_mm2_set_sample_rate(&coeffs, sampleRate); bw_mm2_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::reset(float x0) { inline void MM2<N_CHANNELS>::reset(float x0) {
bw_mm2_reset_coeffs(&coeffs); bw_mm2_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_mm2_reset_state(&coeffs, states + i, x0); bw_mm2_reset_state(&coeffs, states + i, x0);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::process( inline void MM2<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_mm2_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_mm2_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 MM2<N_CHANNELS>::setCutoff(float value) { inline void MM2<N_CHANNELS>::setCutoff(float value) {
bw_mm2_set_cutoff(&coeffs, value); bw_mm2_set_cutoff(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setQ(float value) { inline void MM2<N_CHANNELS>::setQ(float value) {
bw_mm2_set_Q(&coeffs, value); bw_mm2_set_Q(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setPrewarpAtCutoff(bool value) { inline void MM2<N_CHANNELS>::setPrewarpAtCutoff(bool value) {
bw_mm2_set_prewarp_at_cutoff(&coeffs, value); bw_mm2_set_prewarp_at_cutoff(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setPrewarpFreq(float value) { inline void MM2<N_CHANNELS>::setPrewarpFreq(float value) {
bw_mm2_set_prewarp_freq(&coeffs, value); bw_mm2_set_prewarp_freq(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setCoeffX(float value) { inline void MM2<N_CHANNELS>::setCoeffX(float value) {
bw_mm2_set_coeff_x(&coeffs, value); bw_mm2_set_coeff_x(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setCoeffLp(float value) { inline void MM2<N_CHANNELS>::setCoeffLp(float value) {
bw_mm2_set_coeff_lp(&coeffs, value); bw_mm2_set_coeff_lp(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setCoeffBp(float value) { inline void MM2<N_CHANNELS>::setCoeffBp(float value) {
bw_mm2_set_coeff_bp(&coeffs, value); bw_mm2_set_coeff_bp(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void MM2<N_CHANNELS>::setCoeffHp(float value) { inline void MM2<N_CHANNELS>::setCoeffHp(float value) {
bw_mm2_set_coeff_hp(&coeffs, value); bw_mm2_set_coeff_hp(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class NoiseGate { /*! api {{{
public: * ##### Brickworks::NoiseGate
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class NoiseGate {
public:
NoiseGate(); NoiseGate();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -43,65 +47,73 @@ namespace Brickworks {
void setRatio(float value); void setRatio(float value);
void setAttackTau(float value); void setAttackTau(float value);
void setReleaseTau(float value); void setReleaseTau(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_noise_gate_state states[N_CHANNELS]; bw_noise_gate_state states[N_CHANNELS];
bw_noise_gate_state *statesP[N_CHANNELS]; bw_noise_gate_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline NoiseGate<N_CHANNELS>::NoiseGate() { inline NoiseGate<N_CHANNELS>::NoiseGate() {
bw_noise_gate_init(&coeffs); bw_noise_gate_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void NoiseGate<N_CHANNELS>::setSampleRate(float sampleRate) { inline void NoiseGate<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_noise_gate_set_sample_rate(&coeffs, sampleRate); bw_noise_gate_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void NoiseGate<N_CHANNELS>::reset() { inline void NoiseGate<N_CHANNELS>::reset() {
bw_noise_gate_reset_coeffs(&coeffs); bw_noise_gate_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_noise_gate_reset_state(&coeffs, states + i); bw_noise_gate_reset_state(&coeffs, states + i);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void NoiseGate<N_CHANNELS>::process( inline void NoiseGate<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<const float *, N_CHANNELS> xSC, std::array<const float *, N_CHANNELS> xSC,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_noise_gate_process_multi(&coeffs, statesP, x.data(), xSC.data(), y.data(), N_CHANNELS, nSamples); bw_noise_gate_process_multi(&coeffs, statesP, x.data(), xSC.data(), y.data(), N_CHANNELS, nSamples);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void NoiseGate<N_CHANNELS>::setTreshLin(float value) { inline void NoiseGate<N_CHANNELS>::setTreshLin(float value) {
bw_noise_gate_set_thresh_lin(&coeffs, value); bw_noise_gate_set_thresh_lin(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void NoiseGate<N_CHANNELS>::setTreshDBFS(float value) { inline void NoiseGate<N_CHANNELS>::setTreshDBFS(float value) {
bw_noise_gate_set_thresh_dBFS(&coeffs, value); bw_noise_gate_set_thresh_dBFS(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void NoiseGate<N_CHANNELS>::setRatio(float value) { inline void NoiseGate<N_CHANNELS>::setRatio(float value) {
bw_noise_gate_set_ratio(&coeffs, value); bw_noise_gate_set_ratio(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void NoiseGate<N_CHANNELS>::setAttackTau(float value) { inline void NoiseGate<N_CHANNELS>::setAttackTau(float value) {
bw_noise_gate_set_attack_tau(&coeffs, value); bw_noise_gate_set_attack_tau(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void NoiseGate<N_CHANNELS>::setReleaseTau(float value) { inline void NoiseGate<N_CHANNELS>::setReleaseTau(float value) {
bw_noise_gate_set_release_tau(&coeffs, value); bw_noise_gate_set_release_tau(&coeffs, value);
} }
} }
#endif #endif

View File

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

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Notch { /*! api {{{
public: * ##### Brickworks::Notch
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Notch {
public:
Notch(); Notch();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -39,49 +43,57 @@ namespace Brickworks {
void setCutoff(float value); void setCutoff(float value);
void setQ(float value); void setQ(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_notch_state states[N_CHANNELS]; bw_notch_state states[N_CHANNELS];
bw_notch_state *statesP[N_CHANNELS]; bw_notch_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline Notch<N_CHANNELS>::Notch() { inline Notch<N_CHANNELS>::Notch() {
bw_notch_init(&coeffs); bw_notch_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Notch<N_CHANNELS>::setSampleRate(float sampleRate) { inline void Notch<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_notch_set_sample_rate(&coeffs, sampleRate); bw_notch_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Notch<N_CHANNELS>::reset(float x0) { inline void Notch<N_CHANNELS>::reset(float x0) {
bw_notch_reset_coeffs(&coeffs); bw_notch_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_notch_reset_state(&coeffs, states + i, x0); bw_notch_reset_state(&coeffs, states + i, x0);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Notch<N_CHANNELS>::process( inline void Notch<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_notch_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_notch_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 Notch<N_CHANNELS>::setCutoff(float value) { inline void Notch<N_CHANNELS>::setCutoff(float value) {
bw_notch_set_cutoff(&coeffs, value); bw_notch_set_cutoff(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Notch<N_CHANNELS>::setQ(float value) { inline void Notch<N_CHANNELS>::setQ(float value) {
bw_notch_set_Q(&coeffs, 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 {{{
* ##### Brickworks::NoteQueue
* ```>>> */
class NoteQueue {
public:
NoteQueue(); NoteQueue();
void clear(); void clear();
void add(unsigned char note, bool pressed, float velocity, bool force_went_off); void add(unsigned char note, bool pressed, float velocity, bool force_went_off);
bw_note_queue queue; bw_note_queue queue;
}; };
/*! <<<```
* }}} */
inline NoteQueue::NoteQueue() { /*** 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); bw_note_queue_reset(&queue);
} }
inline void NoteQueue::clear() { inline void NoteQueue::clear() {
bw_note_queue_clear(&queue); bw_note_queue_clear(&queue);
} }
inline void NoteQueue::add(unsigned char note, bool pressed, float velocity, bool force_went_off) { inline void NoteQueue::add(unsigned char note, bool pressed, float velocity, bool force_went_off) {
bw_note_queue_add(&queue, note, pressed, velocity, force_went_off); bw_note_queue_add(&queue, note, pressed, velocity, force_went_off);
} }
} }
#endif #endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Pan { /*! api {{{
public: * ##### Brickworks::Pan
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Pan {
public:
Pan(); Pan();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -39,39 +43,47 @@ namespace Brickworks {
int nSamples); int nSamples);
void setPan(float value); void setPan(float value);
/*! <<<... }```
* }}} */
private: /*** 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; bw_pan_coeffs coeffs;
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline Pan<N_CHANNELS>::Pan() { inline Pan<N_CHANNELS>::Pan() {
bw_pan_init(&coeffs); bw_pan_init(&coeffs);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Pan<N_CHANNELS>::setSampleRate(float sampleRate) { inline void Pan<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_pan_set_sample_rate(&coeffs, sampleRate); bw_pan_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Pan<N_CHANNELS>::reset() { inline void Pan<N_CHANNELS>::reset() {
bw_pan_reset_coeffs(&coeffs); bw_pan_reset_coeffs(&coeffs);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Pan<N_CHANNELS>::process( inline void Pan<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y_l, std::array<float *, N_CHANNELS> y_l,
std::array<float *, N_CHANNELS> y_r, std::array<float *, N_CHANNELS> y_r,
int nSamples) { int nSamples) {
bw_pan_process_multi(&coeffs, x.data(), y_l.data(), y_r.data(), N_CHANNELS, nSamples); bw_pan_process_multi(&coeffs, x.data(), y_l.data(), y_r.data(), N_CHANNELS, nSamples);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Pan<N_CHANNELS>::setPan(float value) { inline void Pan<N_CHANNELS>::setPan(float value) {
bw_pan_set_pan(&coeffs, value); bw_pan_set_pan(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Peak { /*! api {{{
public: * ##### Brickworks::Peak
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Peak {
public:
Peak(); Peak();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -43,69 +47,77 @@ namespace Brickworks {
void setPeakGainDB(float value); void setPeakGainDB(float value);
void setBandwidth(float value); void setBandwidth(float value);
void setUseBandwidth(bool value); void setUseBandwidth(bool value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_peak_state states[N_CHANNELS]; bw_peak_state states[N_CHANNELS];
bw_peak_state *statesP[N_CHANNELS]; bw_peak_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline Peak<N_CHANNELS>::Peak() { inline Peak<N_CHANNELS>::Peak() {
bw_peak_init(&coeffs); bw_peak_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Peak<N_CHANNELS>::setSampleRate(float sampleRate) { inline void Peak<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_peak_set_sample_rate(&coeffs, sampleRate); bw_peak_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Peak<N_CHANNELS>::reset(float x0) { inline void Peak<N_CHANNELS>::reset(float x0) {
bw_peak_reset_coeffs(&coeffs); bw_peak_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_peak_reset_state(&coeffs, states + i, x0); bw_peak_reset_state(&coeffs, states + i, x0);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Peak<N_CHANNELS>::process( inline void Peak<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_peak_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_peak_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 Peak<N_CHANNELS>::setCutoff(float value) { inline void Peak<N_CHANNELS>::setCutoff(float value) {
bw_peak_set_cutoff(&coeffs, value); bw_peak_set_cutoff(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Peak<N_CHANNELS>::setQ(float value) { inline void Peak<N_CHANNELS>::setQ(float value) {
bw_peak_set_Q(&coeffs, value); bw_peak_set_Q(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Peak<N_CHANNELS>::setPeakGainLin(float value) { inline void Peak<N_CHANNELS>::setPeakGainLin(float value) {
bw_peak_set_peak_gain_lin(&coeffs, value); bw_peak_set_peak_gain_lin(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Peak<N_CHANNELS>::setPeakGainDB(float value) { inline void Peak<N_CHANNELS>::setPeakGainDB(float value) {
bw_peak_set_peak_gain_dB(&coeffs, value); bw_peak_set_peak_gain_dB(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Peak<N_CHANNELS>::setBandwidth(float value) { inline void Peak<N_CHANNELS>::setBandwidth(float value) {
bw_peak_set_bandwidth(&coeffs, value); bw_peak_set_bandwidth(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Peak<N_CHANNELS>::setUseBandwidth(bool value) { inline void Peak<N_CHANNELS>::setUseBandwidth(bool value) {
bw_peak_set_use_bandwidth(&coeffs, value); bw_peak_set_use_bandwidth(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class PhaseGen { /*! api {{{
public: * ##### Brickworks::PhaseGen
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class PhaseGen {
public:
PhaseGen(); PhaseGen();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -40,50 +44,58 @@ namespace Brickworks {
void setFrequency(float value); void setFrequency(float value);
void setPortamentoTau(float value); void setPortamentoTau(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_phase_gen_state states[N_CHANNELS]; bw_phase_gen_state states[N_CHANNELS];
bw_phase_gen_state *statesP[N_CHANNELS]; bw_phase_gen_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline PhaseGen<N_CHANNELS>::PhaseGen() { inline PhaseGen<N_CHANNELS>::PhaseGen() {
bw_phase_gen_init(&coeffs); bw_phase_gen_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void PhaseGen<N_CHANNELS>::setSampleRate(float sampleRate) { inline void PhaseGen<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_phase_gen_set_sample_rate(&coeffs, sampleRate); bw_phase_gen_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void PhaseGen<N_CHANNELS>::reset(float phase_0) { inline void PhaseGen<N_CHANNELS>::reset(float phase_0) {
bw_phase_gen_reset_coeffs(&coeffs); bw_phase_gen_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_phase_gen_reset_state(&coeffs, states + i, phase_0); bw_phase_gen_reset_state(&coeffs, states + i, phase_0);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void PhaseGen<N_CHANNELS>::process( inline void PhaseGen<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x_mod, std::array<const float *, N_CHANNELS> x_mod,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
std::array<float *, N_CHANNELS> y_phase_inc, std::array<float *, N_CHANNELS> y_phase_inc,
int nSamples) { int nSamples) {
bw_phase_gen_process_multi(&coeffs, statesP, x_mod.data(), y.data(), y_phase_inc.data(), N_CHANNELS, 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> template<BW_SIZE_T N_CHANNELS>
inline void PhaseGen<N_CHANNELS>::setFrequency(float value) { inline void PhaseGen<N_CHANNELS>::setFrequency(float value) {
bw_phase_gen_set_frequency(&coeffs, value); bw_phase_gen_set_frequency(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void PhaseGen<N_CHANNELS>::setPortamentoTau(float value) { inline void PhaseGen<N_CHANNELS>::setPortamentoTau(float value) {
bw_phase_gen_set_portamento_tau(&coeffs, value); bw_phase_gen_set_portamento_tau(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Phaser { /*! api {{{
public: * ##### Brickworks::Phaser
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Phaser {
public:
Phaser(); Phaser();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -40,54 +44,62 @@ namespace Brickworks {
void setRate(float value); void setRate(float value);
void setCenter(float value); void setCenter(float value);
void setAmount(float value); void setAmount(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_phaser_state states[N_CHANNELS]; bw_phaser_state states[N_CHANNELS];
bw_phaser_state *statesP[N_CHANNELS]; bw_phaser_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline Phaser<N_CHANNELS>::Phaser() { inline Phaser<N_CHANNELS>::Phaser() {
bw_phaser_init(&coeffs); bw_phaser_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Phaser<N_CHANNELS>::setSampleRate(float sampleRate) { inline void Phaser<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_phaser_set_sample_rate(&coeffs, sampleRate); bw_phaser_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Phaser<N_CHANNELS>::reset() { inline void Phaser<N_CHANNELS>::reset() {
bw_phaser_reset_coeffs(&coeffs); bw_phaser_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_phaser_reset_state(&coeffs, states + i); bw_phaser_reset_state(&coeffs, states + i);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Phaser<N_CHANNELS>::process( inline void Phaser<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_phaser_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_phaser_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 Phaser<N_CHANNELS>::setRate(float value) { inline void Phaser<N_CHANNELS>::setRate(float value) {
bw_phaser_set_rate(&coeffs, value); bw_phaser_set_rate(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Phaser<N_CHANNELS>::setCenter(float value) { inline void Phaser<N_CHANNELS>::setCenter(float value) {
bw_phaser_set_center(&coeffs, value); bw_phaser_set_center(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Phaser<N_CHANNELS>::setAmount(float value) { inline void Phaser<N_CHANNELS>::setAmount(float value) {
bw_phaser_set_amount(&coeffs, value); bw_phaser_set_amount(&coeffs, value);
} }
} }
#endif #endif

View File

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

View File

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

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Reverb { /*! api {{{
public: * ##### Brickworks::Reverb
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Reverb {
public:
Reverb(); Reverb();
~Reverb(); ~Reverb();
@ -45,30 +49,37 @@ namespace Brickworks {
void setDamping(float value); void setDamping(float value);
void setDecay(float value); void setDecay(float value);
void setWet(float value); void setWet(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_reverb_state states[N_CHANNELS]; bw_reverb_state states[N_CHANNELS];
bw_reverb_state *statesP[N_CHANNELS]; bw_reverb_state *statesP[N_CHANNELS];
void *mem; void *mem;
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline Reverb<N_CHANNELS>::Reverb() { inline Reverb<N_CHANNELS>::Reverb() {
bw_reverb_init(&coeffs); bw_reverb_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
mem = nullptr; mem = nullptr;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline Reverb<N_CHANNELS>::~Reverb() { inline Reverb<N_CHANNELS>::~Reverb() {
if (mem != nullptr) if (mem != nullptr)
operator delete(mem); operator delete(mem);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::setSampleRate(float sampleRate) { inline void Reverb<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_reverb_set_sample_rate(&coeffs, sampleRate); bw_reverb_set_sample_rate(&coeffs, sampleRate);
BW_SIZE_T req = bw_reverb_mem_req(&coeffs); BW_SIZE_T req = bw_reverb_mem_req(&coeffs);
if (mem != nullptr) if (mem != nullptr)
@ -77,49 +88,50 @@ namespace Brickworks {
void *m = mem; void *m = mem;
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++, m = static_cast<char *>(m) + req) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++, m = static_cast<char *>(m) + req)
bw_reverb_mem_set(&coeffs, states + i, m); bw_reverb_mem_set(&coeffs, states + i, m);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::reset() { inline void Reverb<N_CHANNELS>::reset() {
bw_reverb_reset_coeffs(&coeffs); bw_reverb_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_reverb_reset_state(&coeffs, states + i); bw_reverb_reset_state(&coeffs, states + i);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::process( inline void Reverb<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> xl, std::array<const float *, N_CHANNELS> xl,
std::array<const float *, N_CHANNELS> xr, std::array<const float *, N_CHANNELS> xr,
std::array<float *, N_CHANNELS> yl, std::array<float *, N_CHANNELS> yl,
std::array<float *, N_CHANNELS> yr, std::array<float *, N_CHANNELS> yr,
int nSamples) { int nSamples) {
bw_reverb_process_multi(&coeffs, statesP, xl.data(), xr.data(), yl.data(), yr.data(), N_CHANNELS, nSamples); bw_reverb_process_multi(&coeffs, statesP, xl.data(), xr.data(), yl.data(), yr.data(), N_CHANNELS, nSamples);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::setPredelay(float value) { inline void Reverb<N_CHANNELS>::setPredelay(float value) {
bw_reverb_set_predelay(&coeffs, value); bw_reverb_set_predelay(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::setBandwidth(float value) { inline void Reverb<N_CHANNELS>::setBandwidth(float value) {
bw_reverb_set_bandwidth(&coeffs, value); bw_reverb_set_bandwidth(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::setDamping(float value) { inline void Reverb<N_CHANNELS>::setDamping(float value) {
bw_reverb_set_damping(&coeffs, value); bw_reverb_set_damping(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::setDecay(float value) { inline void Reverb<N_CHANNELS>::setDecay(float value) {
bw_reverb_set_decay(&coeffs, value); bw_reverb_set_decay(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Reverb<N_CHANNELS>::setWet(float value) { inline void Reverb<N_CHANNELS>::setWet(float value) {
bw_reverb_set_wet(&coeffs, value); bw_reverb_set_wet(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class RingMod { /*! api {{{
public: * ##### Brickworks::RingMod
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class RingMod {
public:
RingMod(); RingMod();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -39,39 +43,47 @@ namespace Brickworks {
int nSamples); int nSamples);
void setAmount(float value); void setAmount(float value);
/*! <<<... }```
* }}} */
private: /*** 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; bw_ringmod_coeffs coeffs;
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline RingMod<N_CHANNELS>::RingMod() { inline RingMod<N_CHANNELS>::RingMod() {
bw_ringmod_init(&coeffs); bw_ringmod_init(&coeffs);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void RingMod<N_CHANNELS>::setSampleRate(float sampleRate) { inline void RingMod<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_ringmod_set_sample_rate(&coeffs, sampleRate); bw_ringmod_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void RingMod<N_CHANNELS>::reset() { inline void RingMod<N_CHANNELS>::reset() {
bw_ringmod_reset_coeffs(&coeffs); bw_ringmod_reset_coeffs(&coeffs);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void RingMod<N_CHANNELS>::process( inline void RingMod<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x_mod, std::array<const float *, N_CHANNELS> x_mod,
std::array<const float *, N_CHANNELS> x_car, std::array<const float *, N_CHANNELS> x_car,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_ringmod_process_multi(&coeffs, statesP, x_mod.data(), x_car.data(), y.data(), N_CHANNELS, nSamples); bw_ringmod_process_multi(&coeffs, statesP, x_mod.data(), x_car.data(), y.data(), N_CHANNELS, nSamples);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void RingMod<N_CHANNELS>::setAmount(float value) { inline void RingMod<N_CHANNELS>::setAmount(float value) {
bw_ringmod_set_amount(&coeffs, value); bw_ringmod_set_amount(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Satur { /*! api {{{
public: * ##### Brickworks::Satur
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Satur {
public:
Satur(); Satur();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -40,54 +44,62 @@ namespace Brickworks {
void setBias(float value); void setBias(float value);
void setGain(float value); void setGain(float value);
void setGainCompensation(bool value); void setGainCompensation(bool value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_satur_state states[N_CHANNELS]; bw_satur_state states[N_CHANNELS];
bw_satur_state *statesP[N_CHANNELS]; bw_satur_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline Satur<N_CHANNELS>::Satur() { inline Satur<N_CHANNELS>::Satur() {
bw_satur_init(&coeffs); bw_satur_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Satur<N_CHANNELS>::setSampleRate(float sampleRate) { inline void Satur<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_satur_set_sample_rate(&coeffs, sampleRate); bw_satur_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Satur<N_CHANNELS>::reset() { inline void Satur<N_CHANNELS>::reset() {
bw_satur_reset_coeffs(&coeffs); bw_satur_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_satur_reset_state(&coeffs, states + i); bw_satur_reset_state(&coeffs, states + i);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Satur<N_CHANNELS>::process( inline void Satur<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_satur_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_satur_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 Satur<N_CHANNELS>::setBias(float value) { inline void Satur<N_CHANNELS>::setBias(float value) {
bw_satur_set_bias(&coeffs, value); bw_satur_set_bias(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Satur<N_CHANNELS>::setGain(float value) { inline void Satur<N_CHANNELS>::setGain(float value) {
bw_satur_set_gain(&coeffs, value); bw_satur_set_gain(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Satur<N_CHANNELS>::setGainCompensation(bool value) { inline void Satur<N_CHANNELS>::setGainCompensation(bool value) {
bw_satur_set_gain_compensation(&coeffs, value); bw_satur_set_gain_compensation(&coeffs, value);
} }
} }
#endif #endif

View File

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

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class SRReduce { /*! api {{{
public: * ##### Brickworks::SRReduce
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class SRReduce {
public:
SRReduce(); SRReduce();
void reset(); void reset();
@ -37,38 +41,46 @@ namespace Brickworks {
int nSamples); int nSamples);
void setRatio(float value); void setRatio(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_sr_reduce_state states[N_CHANNELS]; bw_sr_reduce_state states[N_CHANNELS];
bw_sr_reduce_state *statesP[N_CHANNELS]; bw_sr_reduce_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline SRReduce<N_CHANNELS>::SRReduce() { inline SRReduce<N_CHANNELS>::SRReduce() {
bw_sr_reduce_init(&coeffs); bw_sr_reduce_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void SRReduce<N_CHANNELS>::reset() { inline void SRReduce<N_CHANNELS>::reset() {
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_sr_reduce_reset_state(&coeffs, states + i); bw_sr_reduce_reset_state(&coeffs, states + i);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void SRReduce<N_CHANNELS>::process( inline void SRReduce<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_sr_reduce_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_sr_reduce_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 SRReduce<N_CHANNELS>::setRatio(float value) { inline void SRReduce<N_CHANNELS>::setRatio(float value) {
bw_sr_reduce_set_ratio(&coeffs, value); bw_sr_reduce_set_ratio(&coeffs, value);
} }
} }
#endif #endif

View File

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

View File

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

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class SVF { /*! api {{{
public: * ##### Brickworks::SVF
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class SVF {
public:
SVF(); SVF();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -43,61 +47,69 @@ namespace Brickworks {
void setQ(float value); void setQ(float value);
void setPrewarpAtCutoff(bool value); void setPrewarpAtCutoff(bool value);
void setPrewarpFreq(float value); void setPrewarpFreq(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_svf_state states[N_CHANNELS]; bw_svf_state states[N_CHANNELS];
bw_svf_state *statesP[N_CHANNELS]; bw_svf_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline SVF<N_CHANNELS>::SVF() { inline SVF<N_CHANNELS>::SVF() {
bw_svf_init(&coeffs); bw_svf_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void SVF<N_CHANNELS>::setSampleRate(float sampleRate) { inline void SVF<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_svf_set_sample_rate(&coeffs, sampleRate); bw_svf_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void SVF<N_CHANNELS>::reset(float x0) { inline void SVF<N_CHANNELS>::reset(float x0) {
bw_svf_reset_coeffs(&coeffs); bw_svf_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_svf_reset_state(&coeffs, states + i, x0); bw_svf_reset_state(&coeffs, states + i, x0);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void SVF<N_CHANNELS>::process( inline void SVF<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y_lp, std::array<float *, N_CHANNELS> y_lp,
std::array<float *, N_CHANNELS> y_bp, std::array<float *, N_CHANNELS> y_bp,
std::array<float *, N_CHANNELS> y_hp, std::array<float *, N_CHANNELS> y_hp,
int nSamples) { int nSamples) {
bw_svf_process_multi(&coeffs, statesP, x.data(), y_lp.data(), y_bp.data(), y_hp.data(), N_CHANNELS, 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> template<BW_SIZE_T N_CHANNELS>
inline void SVF<N_CHANNELS>::setCutoff(float value) { inline void SVF<N_CHANNELS>::setCutoff(float value) {
bw_svf_set_cutoff(&coeffs, value); bw_svf_set_cutoff(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void SVF<N_CHANNELS>::setQ(float value) { inline void SVF<N_CHANNELS>::setQ(float value) {
bw_svf_set_Q(&coeffs, value); bw_svf_set_Q(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void SVF<N_CHANNELS>::setPrewarpAtCutoff(bool value) { inline void SVF<N_CHANNELS>::setPrewarpAtCutoff(bool value) {
bw_svf_set_prewarp_at_cutoff(&coeffs, value); bw_svf_set_prewarp_at_cutoff(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void SVF<N_CHANNELS>::setPrewarpFreq(float value) { inline void SVF<N_CHANNELS>::setPrewarpFreq(float value) {
bw_svf_set_prewarp_freq(&coeffs, value); bw_svf_set_prewarp_freq(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Trem { /*! api {{{
public: * ##### Brickworks::Trem
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Trem {
public:
Trem(); Trem();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -39,49 +43,57 @@ namespace Brickworks {
void setRate(float value); void setRate(float value);
void setAmount(float value); void setAmount(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_trem_state states[N_CHANNELS]; bw_trem_state states[N_CHANNELS];
bw_trem_state *statesP[N_CHANNELS]; bw_trem_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline Trem<N_CHANNELS>::Trem() { inline Trem<N_CHANNELS>::Trem() {
bw_trem_init(&coeffs); bw_trem_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Trem<N_CHANNELS>::setSampleRate(float sampleRate) { inline void Trem<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_trem_set_sample_rate(&coeffs, sampleRate); bw_trem_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Trem<N_CHANNELS>::reset() { inline void Trem<N_CHANNELS>::reset() {
bw_trem_reset_coeffs(&coeffs); bw_trem_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_trem_reset_state(&coeffs, states + i); bw_trem_reset_state(&coeffs, states + i);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Trem<N_CHANNELS>::process( inline void Trem<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_trem_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_trem_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 Trem<N_CHANNELS>::setRate(float value) { inline void Trem<N_CHANNELS>::setRate(float value) {
bw_trem_set_rate(&coeffs, value); bw_trem_set_rate(&coeffs, value);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Trem<N_CHANNELS>::setAmount(float value) { inline void Trem<N_CHANNELS>::setAmount(float value) {
bw_trem_set_amount(&coeffs, value); bw_trem_set_amount(&coeffs, value);
} }
} }
#endif #endif

View File

@ -25,9 +25,13 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Wah { /*! api {{{
public: * ##### Brickworks::Wah
* ```>>> */
template<BW_SIZE_T N_CHANNELS>
class Wah {
public:
Wah(); Wah();
void setSampleRate(float sampleRate); void setSampleRate(float sampleRate);
@ -38,44 +42,52 @@ namespace Brickworks {
int nSamples); int nSamples);
void setWah(float value); void setWah(float value);
/*! <<<... }```
* }}} */
private: /*** 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_coeffs coeffs;
bw_wah_state states[N_CHANNELS]; bw_wah_state states[N_CHANNELS];
bw_wah_state *statesP[N_CHANNELS]; bw_wah_state *statesP[N_CHANNELS];
}; };
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline Wah<N_CHANNELS>::Wah() { inline Wah<N_CHANNELS>::Wah() {
bw_wah_init(&coeffs); bw_wah_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i; statesP[i] = states + i;
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Wah<N_CHANNELS>::setSampleRate(float sampleRate) { inline void Wah<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_wah_set_sample_rate(&coeffs, sampleRate); bw_wah_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Wah<N_CHANNELS>::reset() { inline void Wah<N_CHANNELS>::reset() {
bw_wah_reset_coeffs(&coeffs); bw_wah_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_wah_reset_state(&coeffs, states + i); bw_wah_reset_state(&coeffs, states + i);
} }
template<BW_SIZE_T N_CHANNELS> template<BW_SIZE_T N_CHANNELS>
inline void Wah<N_CHANNELS>::process( inline void Wah<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x, std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y, std::array<float *, N_CHANNELS> y,
int nSamples) { int nSamples) {
bw_wah_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); bw_wah_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 Wah<N_CHANNELS>::setWah(float value) { inline void Wah<N_CHANNELS>::setWah(float value) {
bw_wah_set_wah(&coeffs, value); bw_wah_set_wah(&coeffs, value);
} }
} }
#endif #endif