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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,63 +25,75 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Notch {
public:
Notch();
void setSampleRate(float sampleRate); /*! api {{{
void reset(float x0 = 0.f); * ##### Brickworks::Notch
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class Notch {
int nSamples); public:
Notch();
void setCutoff(float value); void setSampleRate(float sampleRate);
void setQ(float value); void reset(float x0 = 0.f);
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
private: void setCutoff(float value);
bw_notch_coeffs coeffs; void setQ(float value);
bw_notch_state states[N_CHANNELS]; /*! <<<... }```
bw_notch_state *statesP[N_CHANNELS]; * }}} */
};
template<BW_SIZE_T N_CHANNELS> /*** Implementation ***/
inline Notch<N_CHANNELS>::Notch() {
bw_notch_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS> /* WARNING: This part of the file is not part of the public API. Its content may
inline void Notch<N_CHANNELS>::setSampleRate(float sampleRate) { * change at any time in future versions. Please, do not use it directly. */
bw_notch_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS> private:
inline void Notch<N_CHANNELS>::reset(float x0) { bw_notch_coeffs coeffs;
bw_notch_reset_coeffs(&coeffs); bw_notch_state states[N_CHANNELS];
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) bw_notch_state *statesP[N_CHANNELS];
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 Notch<N_CHANNELS>::Notch() {
std::array<const float *, N_CHANNELS> x, bw_notch_init(&coeffs);
std::array<float *, N_CHANNELS> y, for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
int nSamples) { statesP[i] = states + i;
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>::setSampleRate(float sampleRate) {
bw_notch_set_cutoff(&coeffs, value); bw_notch_set_sample_rate(&coeffs, sampleRate);
} }
template<BW_SIZE_T N_CHANNELS>
inline void Notch<N_CHANNELS>::reset(float x0) {
bw_notch_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_notch_reset_state(&coeffs, states + i, x0);
}
template<BW_SIZE_T N_CHANNELS>
inline void Notch<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_notch_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Notch<N_CHANNELS>::setCutoff(float value) {
bw_notch_set_cutoff(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Notch<N_CHANNELS>::setQ(float value) {
bw_notch_set_Q(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Notch<N_CHANNELS>::setQ(float value) {
bw_notch_set_Q(&coeffs, value);
}
} }
#endif #endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,57 +25,69 @@
#include <array> #include <array>
namespace Brickworks { namespace Brickworks {
template<BW_SIZE_T N_CHANNELS>
class Wah {
public:
Wah();
void setSampleRate(float sampleRate); /*! api {{{
void reset(); * ##### Brickworks::Wah
void process( * ```>>> */
std::array<const float *, N_CHANNELS> x, template<BW_SIZE_T N_CHANNELS>
std::array<float *, N_CHANNELS> y, class Wah {
int nSamples); public:
Wah();
void setWah(float value); void setSampleRate(float sampleRate);
void reset();
void process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples);
private: void setWah(float value);
bw_wah_coeffs coeffs; /*! <<<... }```
bw_wah_state states[N_CHANNELS]; * }}} */
bw_wah_state *statesP[N_CHANNELS];
};
template<BW_SIZE_T N_CHANNELS> /*** Implementation ***/
inline Wah<N_CHANNELS>::Wah() {
bw_wah_init(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
statesP[i] = states + i;
}
template<BW_SIZE_T N_CHANNELS> /* WARNING: This part of the file is not part of the public API. Its content may
inline void Wah<N_CHANNELS>::setSampleRate(float sampleRate) { * change at any time in future versions. Please, do not use it directly. */
bw_wah_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS> private:
inline void Wah<N_CHANNELS>::reset() { bw_wah_coeffs coeffs;
bw_wah_reset_coeffs(&coeffs); bw_wah_state states[N_CHANNELS];
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++) bw_wah_state *statesP[N_CHANNELS];
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 Wah<N_CHANNELS>::Wah() {
std::array<const float *, N_CHANNELS> x, bw_wah_init(&coeffs);
std::array<float *, N_CHANNELS> y, for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
int nSamples) { statesP[i] = states + i;
bw_wah_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); }
}
template<BW_SIZE_T N_CHANNELS>
inline void Wah<N_CHANNELS>::setSampleRate(float sampleRate) {
bw_wah_set_sample_rate(&coeffs, sampleRate);
}
template<BW_SIZE_T N_CHANNELS>
inline void Wah<N_CHANNELS>::reset() {
bw_wah_reset_coeffs(&coeffs);
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
bw_wah_reset_state(&coeffs, states + i);
}
template<BW_SIZE_T N_CHANNELS>
inline void Wah<N_CHANNELS>::process(
std::array<const float *, N_CHANNELS> x,
std::array<float *, N_CHANNELS> y,
int nSamples) {
bw_wah_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
}
template<BW_SIZE_T N_CHANNELS>
inline void Wah<N_CHANNELS>::setWah(float value) {
bw_wah_set_wah(&coeffs, value);
}
template<BW_SIZE_T N_CHANNELS>
inline void Wah<N_CHANNELS>::setWah(float value) {
bw_wah_set_wah(&coeffs, value);
}
} }
#endif #endif