bwpp_{drywet,env_follow,gain,pink_filt,ringmod} + using BW_SIZE_T to index channels
This commit is contained in:
parent
768aa6d81e
commit
7a0c76652f
1
TODO
1
TODO
@ -59,6 +59,7 @@ code:
|
|||||||
* sr_reduce reset_coeffs? update_coeffs? process_multi?
|
* sr_reduce reset_coeffs? update_coeffs? process_multi?
|
||||||
* src(_int) process_multi?
|
* src(_int) process_multi?
|
||||||
* fix definitions leading to X ** -> const X ** error https://isocpp.org/wiki/faq/const-correctness#constptrptr-conversion, fix fx_balance, fx_pan, synth_poly
|
* fix definitions leading to X ** -> const X ** error https://isocpp.org/wiki/faq/const-correctness#constptrptr-conversion, fix fx_balance, fx_pan, synth_poly
|
||||||
|
* drywet -> dry_wet, ringmod -> ring_mod, etc?
|
||||||
|
|
||||||
build system:
|
build system:
|
||||||
* make makefiles handle paths with spaces etc
|
* make makefiles handle paths with spaces etc
|
||||||
|
@ -48,7 +48,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
AP1<N_CHANNELS>::AP1() {
|
AP1<N_CHANNELS>::AP1() {
|
||||||
bw_ap1_init(&coeffs);
|
bw_ap1_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void AP1<N_CHANNELS>::reset(float x0) {
|
void AP1<N_CHANNELS>::reset(float x0) {
|
||||||
bw_ap1_reset_coeffs(&coeffs);
|
bw_ap1_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_ap1_reset_state(&coeffs, states + i, x0);
|
bw_ap1_reset_state(&coeffs, states + i, x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
AP2<N_CHANNELS>::AP2() {
|
AP2<N_CHANNELS>::AP2() {
|
||||||
bw_ap2_init(&coeffs);
|
bw_ap2_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void AP2<N_CHANNELS>::reset(float x0) {
|
void AP2<N_CHANNELS>::reset(float x0) {
|
||||||
bw_ap2_reset_coeffs(&coeffs);
|
bw_ap2_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_ap2_reset_state(&coeffs, states + i, x0);
|
bw_ap2_reset_state(&coeffs, states + i, x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
Clip<N_CHANNELS>::Clip() {
|
Clip<N_CHANNELS>::Clip() {
|
||||||
bw_clip_init(&coeffs);
|
bw_clip_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void Clip<N_CHANNELS>::reset() {
|
void Clip<N_CHANNELS>::reset() {
|
||||||
bw_clip_reset_coeffs(&coeffs);
|
bw_clip_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_clip_reset_state(&coeffs, states + i);
|
bw_clip_reset_state(&coeffs, states + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
Comp<N_CHANNELS>::Comp() {
|
Comp<N_CHANNELS>::Comp() {
|
||||||
bw_comp_init(&coeffs);
|
bw_comp_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void Comp<N_CHANNELS>::reset() {
|
void Comp<N_CHANNELS>::reset() {
|
||||||
bw_comp_reset_coeffs(&coeffs);
|
bw_comp_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_comp_reset_state(&coeffs, states + i);
|
bw_comp_reset_state(&coeffs, states + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
Dist<N_CHANNELS>::Dist() {
|
Dist<N_CHANNELS>::Dist() {
|
||||||
bw_dist_init(&coeffs);
|
bw_dist_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void Dist<N_CHANNELS>::reset() {
|
void Dist<N_CHANNELS>::reset() {
|
||||||
bw_dist_reset_coeffs(&coeffs);
|
bw_dist_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_dist_reset_state(&coeffs, states + i);
|
bw_dist_reset_state(&coeffs, states + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
Drive<N_CHANNELS>::Drive() {
|
Drive<N_CHANNELS>::Drive() {
|
||||||
bw_drive_init(&coeffs);
|
bw_drive_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void Drive<N_CHANNELS>::reset() {
|
void Drive<N_CHANNELS>::reset() {
|
||||||
bw_drive_reset_coeffs(&coeffs);
|
bw_drive_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_drive_reset_state(&coeffs, states + i);
|
bw_drive_reset_state(&coeffs, states + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
83
include/bwpp_drywet.h
Normal file
83
include/bwpp_drywet.h
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* Brickworks
|
||||||
|
*
|
||||||
|
* Copyright (C) 2023 Orastron Srl unipersonale
|
||||||
|
*
|
||||||
|
* Brickworks is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, version 3 of the License.
|
||||||
|
*
|
||||||
|
* Brickworks is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Brickworks. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* File author: Stefano D'Angelo
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BWPP_DRYWET_H
|
||||||
|
#define BWPP_DRYWET_H
|
||||||
|
|
||||||
|
#include <bw_drywet.h>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
|
namespace Brickworks {
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
class DryWet {
|
||||||
|
public:
|
||||||
|
DryWet();
|
||||||
|
|
||||||
|
void setSampleRate(float sampleRate);
|
||||||
|
void reset();
|
||||||
|
void process(
|
||||||
|
std::array<const float *, N_CHANNELS> x_dry,
|
||||||
|
std::array<const float *, N_CHANNELS> x_wet,
|
||||||
|
std::array<float *, N_CHANNELS> y,
|
||||||
|
int nSamples);
|
||||||
|
|
||||||
|
void setWet(float value);
|
||||||
|
void setSmoothTau(float value);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bw_drywet_coeffs coeffs;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
DryWet<N_CHANNELS>::DryWet() {
|
||||||
|
bw_drywet_init(&coeffs);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
void DryWet<N_CHANNELS>::setSampleRate(float sampleRate) {
|
||||||
|
bw_drywet_set_sample_rate(&coeffs, sampleRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
void DryWet<N_CHANNELS>::reset() {
|
||||||
|
bw_drywet_reset_coeffs(&coeffs);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
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>
|
||||||
|
void DryWet<N_CHANNELS>::setWet(float value) {
|
||||||
|
bw_drywet_set_wet(&coeffs, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
void DryWet<N_CHANNELS>::setSmoothTau(float value) {
|
||||||
|
bw_drywet_set_smooth_tau(&coeffs, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
94
include/bwpp_env_follow.h
Normal file
94
include/bwpp_env_follow.h
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* Brickworks
|
||||||
|
*
|
||||||
|
* Copyright (C) 2023 Orastron Srl unipersonale
|
||||||
|
*
|
||||||
|
* Brickworks is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, version 3 of the License.
|
||||||
|
*
|
||||||
|
* Brickworks is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Brickworks. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* File author: Stefano D'Angelo
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BWPP_ENV_FOLLOW_H
|
||||||
|
#define BWPP_ENV_FOLLOW_H
|
||||||
|
|
||||||
|
#include <bw_env_follow.h>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
|
namespace Brickworks {
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
class EnvFollow {
|
||||||
|
public:
|
||||||
|
EnvFollow();
|
||||||
|
|
||||||
|
void setSampleRate(float sampleRate);
|
||||||
|
void reset();
|
||||||
|
void process(
|
||||||
|
std::array<const float *, N_CHANNELS> x,
|
||||||
|
std::array<float *, N_CHANNELS> y,
|
||||||
|
int nSamples);
|
||||||
|
|
||||||
|
void setAttackTau(float value);
|
||||||
|
void setReleaseTau(float value);
|
||||||
|
|
||||||
|
float getYZ1(BW_SIZE_T channel);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bw_env_follow_coeffs coeffs;
|
||||||
|
bw_env_follow_state states[N_CHANNELS];
|
||||||
|
bw_env_follow_state *statesP[N_CHANNELS];
|
||||||
|
};
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
EnvFollow<N_CHANNELS>::EnvFollow() {
|
||||||
|
bw_env_follow_init(&coeffs);
|
||||||
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
|
statesP[i] = states + i;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
void EnvFollow<N_CHANNELS>::setSampleRate(float sampleRate) {
|
||||||
|
bw_env_follow_set_sample_rate(&coeffs, sampleRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
void EnvFollow<N_CHANNELS>::reset() {
|
||||||
|
bw_env_follow_reset_coeffs(&coeffs);
|
||||||
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
|
bw_env_follow_reset_state(&coeffs, states + i);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
void EnvFollow<N_CHANNELS>::process(
|
||||||
|
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>
|
||||||
|
void EnvFollow<N_CHANNELS>::setAttackTau(float value) {
|
||||||
|
bw_env_follow_set_attack_tau(&coeffs, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
void EnvFollow<N_CHANNELS>::setReleaseTau(float value) {
|
||||||
|
bw_env_follow_set_release_tau(&coeffs, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
float EnvFollow<N_CHANNELS>::getYZ1(BW_SIZE_T channel) {
|
||||||
|
return bw_env_follow_get_y_z1(states + channel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -49,7 +49,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
Fuzz<N_CHANNELS>::Fuzz() {
|
Fuzz<N_CHANNELS>::Fuzz() {
|
||||||
bw_fuzz_init(&coeffs);
|
bw_fuzz_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void Fuzz<N_CHANNELS>::reset() {
|
void Fuzz<N_CHANNELS>::reset() {
|
||||||
bw_fuzz_reset_coeffs(&coeffs);
|
bw_fuzz_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_fuzz_reset_state(&coeffs, states + i);
|
bw_fuzz_reset_state(&coeffs, states + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
94
include/bwpp_gain.h
Normal file
94
include/bwpp_gain.h
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* Brickworks
|
||||||
|
*
|
||||||
|
* Copyright (C) 2023 Orastron Srl unipersonale
|
||||||
|
*
|
||||||
|
* Brickworks is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, version 3 of the License.
|
||||||
|
*
|
||||||
|
* Brickworks is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Brickworks. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* File author: Stefano D'Angelo
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BWPP_GAIN_H
|
||||||
|
#define BWPP_GAIN_H
|
||||||
|
|
||||||
|
#include <bw_gain.h>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
|
namespace Brickworks {
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
class Gain {
|
||||||
|
public:
|
||||||
|
Gain();
|
||||||
|
|
||||||
|
void setSampleRate(float sampleRate);
|
||||||
|
void reset();
|
||||||
|
void process(
|
||||||
|
std::array<const float *, N_CHANNELS> x,
|
||||||
|
std::array<float *, N_CHANNELS> y,
|
||||||
|
int nSamples);
|
||||||
|
|
||||||
|
void setGainLin(float value);
|
||||||
|
void setGainDB(float value);
|
||||||
|
void setSmoothTau(float value);
|
||||||
|
|
||||||
|
float getGain();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bw_gain_coeffs coeffs;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
Gain<N_CHANNELS>::Gain() {
|
||||||
|
bw_gain_init(&coeffs);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
void Gain<N_CHANNELS>::setSampleRate(float sampleRate) {
|
||||||
|
bw_gain_set_sample_rate(&coeffs, sampleRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
void Gain<N_CHANNELS>::reset() {
|
||||||
|
bw_gain_reset_coeffs(&coeffs);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
void Gain<N_CHANNELS>::process(
|
||||||
|
std::array<const float *, N_CHANNELS> x,
|
||||||
|
std::array<float *, N_CHANNELS> y,
|
||||||
|
int nSamples) {
|
||||||
|
bw_gain_process_multi(&coeffs, x.data(), y.data(), N_CHANNELS, nSamples);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
void Gain<N_CHANNELS>::setGainLin(float value) {
|
||||||
|
bw_gain_set_gain_lin(&coeffs, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
void Gain<N_CHANNELS>::setGainDB(float value) {
|
||||||
|
bw_gain_set_gain_dB(&coeffs, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
void Gain<N_CHANNELS>::setSmoothTau(float value) {
|
||||||
|
bw_gain_set_smooth_tau(&coeffs, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
float Gain<N_CHANNELS>::getGain() {
|
||||||
|
return bw_gain_get_gain(&coeffs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -48,7 +48,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
HP1<N_CHANNELS>::HP1() {
|
HP1<N_CHANNELS>::HP1() {
|
||||||
bw_hp1_init(&coeffs);
|
bw_hp1_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void HP1<N_CHANNELS>::reset(float x0) {
|
void HP1<N_CHANNELS>::reset(float x0) {
|
||||||
bw_hp1_reset_coeffs(&coeffs);
|
bw_hp1_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_hp1_reset_state(&coeffs, states + i, x0);
|
bw_hp1_reset_state(&coeffs, states + i, x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
HS1<N_CHANNELS>::HS1() {
|
HS1<N_CHANNELS>::HS1() {
|
||||||
bw_hs1_init(&coeffs);
|
bw_hs1_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void HS1<N_CHANNELS>::reset(float x0) {
|
void HS1<N_CHANNELS>::reset(float x0) {
|
||||||
bw_hs1_reset_coeffs(&coeffs);
|
bw_hs1_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_hs1_reset_state(&coeffs, states + i, x0);
|
bw_hs1_reset_state(&coeffs, states + i, x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
HS2<N_CHANNELS>::HS2() {
|
HS2<N_CHANNELS>::HS2() {
|
||||||
bw_hs2_init(&coeffs);
|
bw_hs2_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void HS2<N_CHANNELS>::reset(float x0) {
|
void HS2<N_CHANNELS>::reset(float x0) {
|
||||||
bw_hs2_reset_coeffs(&coeffs);
|
bw_hs2_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_hs2_reset_state(&coeffs, states + i, x0);
|
bw_hs2_reset_state(&coeffs, states + i, x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
LP1<N_CHANNELS>::LP1() {
|
LP1<N_CHANNELS>::LP1() {
|
||||||
bw_lp1_init(&coeffs);
|
bw_lp1_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void LP1<N_CHANNELS>::reset(float x0) {
|
void LP1<N_CHANNELS>::reset(float x0) {
|
||||||
bw_lp1_reset_coeffs(&coeffs);
|
bw_lp1_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_lp1_reset_state(&coeffs, states + i, x0);
|
bw_lp1_reset_state(&coeffs, states + i, x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
LS1<N_CHANNELS>::LS1() {
|
LS1<N_CHANNELS>::LS1() {
|
||||||
bw_ls1_init(&coeffs);
|
bw_ls1_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void LS1<N_CHANNELS>::reset(float x0) {
|
void LS1<N_CHANNELS>::reset(float x0) {
|
||||||
bw_ls1_reset_coeffs(&coeffs);
|
bw_ls1_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_ls1_reset_state(&coeffs, states + i, x0);
|
bw_ls1_reset_state(&coeffs, states + i, x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
LS2<N_CHANNELS>::LS2() {
|
LS2<N_CHANNELS>::LS2() {
|
||||||
bw_ls2_init(&coeffs);
|
bw_ls2_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void LS2<N_CHANNELS>::reset(float x0) {
|
void LS2<N_CHANNELS>::reset(float x0) {
|
||||||
bw_ls2_reset_coeffs(&coeffs);
|
bw_ls2_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_ls2_reset_state(&coeffs, states + i, x0);
|
bw_ls2_reset_state(&coeffs, states + i, x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
MM1<N_CHANNELS>::MM1() {
|
MM1<N_CHANNELS>::MM1() {
|
||||||
bw_mm1_init(&coeffs);
|
bw_mm1_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void MM1<N_CHANNELS>::reset(float x0) {
|
void MM1<N_CHANNELS>::reset(float x0) {
|
||||||
bw_mm1_reset_coeffs(&coeffs);
|
bw_mm1_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_mm1_reset_state(&coeffs, states + i, x0);
|
bw_mm1_reset_state(&coeffs, states + i, x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
MM2<N_CHANNELS>::MM2() {
|
MM2<N_CHANNELS>::MM2() {
|
||||||
bw_mm2_init(&coeffs);
|
bw_mm2_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void MM2<N_CHANNELS>::reset(float x0) {
|
void MM2<N_CHANNELS>::reset(float x0) {
|
||||||
bw_mm2_reset_coeffs(&coeffs);
|
bw_mm2_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_mm2_reset_state(&coeffs, states + i, x0);
|
bw_mm2_reset_state(&coeffs, states + i, x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
NoiseGate<N_CHANNELS>::NoiseGate() {
|
NoiseGate<N_CHANNELS>::NoiseGate() {
|
||||||
bw_noise_gate_init(&coeffs);
|
bw_noise_gate_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void NoiseGate<N_CHANNELS>::reset() {
|
void NoiseGate<N_CHANNELS>::reset() {
|
||||||
bw_noise_gate_reset_coeffs(&coeffs);
|
bw_noise_gate_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_noise_gate_reset_state(&coeffs, states + i);
|
bw_noise_gate_reset_state(&coeffs, states + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ namespace Brickworks {
|
|||||||
void NoiseGen<N_CHANNELS>::process(
|
void NoiseGen<N_CHANNELS>::process(
|
||||||
std::array<float *, N_CHANNELS> y,
|
std::array<float *, N_CHANNELS> y,
|
||||||
int nSamples) {
|
int nSamples) {
|
||||||
for (int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_noise_gen_process(&coeffs, y.data()[i], nSamples);
|
bw_noise_gen_process(&coeffs, y.data()[i], nSamples);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
Notch<N_CHANNELS>::Notch() {
|
Notch<N_CHANNELS>::Notch() {
|
||||||
bw_notch_init(&coeffs);
|
bw_notch_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void Notch<N_CHANNELS>::reset(float x0) {
|
void Notch<N_CHANNELS>::reset(float x0) {
|
||||||
bw_notch_reset_coeffs(&coeffs);
|
bw_notch_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_notch_reset_state(&coeffs, states + i, x0);
|
bw_notch_reset_state(&coeffs, states + i, x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
OnePole<N_CHANNELS>::OnePole() {
|
OnePole<N_CHANNELS>::OnePole() {
|
||||||
bw_one_pole_init(&coeffs);
|
bw_one_pole_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void OnePole<N_CHANNELS>::reset(float y_z1) {
|
void OnePole<N_CHANNELS>::reset(float y_z1) {
|
||||||
bw_one_pole_reset_coeffs(&coeffs);
|
bw_one_pole_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_one_pole_reset_state(&coeffs, states + i, y_z1);
|
bw_one_pole_reset_state(&coeffs, states + i, y_z1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
Peak<N_CHANNELS>::Peak() {
|
Peak<N_CHANNELS>::Peak() {
|
||||||
bw_peak_init(&coeffs);
|
bw_peak_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void Peak<N_CHANNELS>::reset(float x0) {
|
void Peak<N_CHANNELS>::reset(float x0) {
|
||||||
bw_peak_reset_coeffs(&coeffs);
|
bw_peak_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_peak_reset_state(&coeffs, states + i, x0);
|
bw_peak_reset_state(&coeffs, states + i, x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
Phaser<N_CHANNELS>::Phaser() {
|
Phaser<N_CHANNELS>::Phaser() {
|
||||||
bw_phaser_init(&coeffs);
|
bw_phaser_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void Phaser<N_CHANNELS>::reset() {
|
void Phaser<N_CHANNELS>::reset() {
|
||||||
bw_phaser_reset_coeffs(&coeffs);
|
bw_phaser_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_phaser_reset_state(&coeffs, states + i);
|
bw_phaser_reset_state(&coeffs, states + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
86
include/bwpp_pink_filt.h
Normal file
86
include/bwpp_pink_filt.h
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
* Brickworks
|
||||||
|
*
|
||||||
|
* Copyright (C) 2023 Orastron Srl unipersonale
|
||||||
|
*
|
||||||
|
* Brickworks is free software: you can repink_filtribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, version 3 of the License.
|
||||||
|
*
|
||||||
|
* Brickworks is pink_filtributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Brickworks. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* File author: Stefano D'Angelo
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BWPP_PINK_FILT_H
|
||||||
|
#define BWPP_PINK_FILT_H
|
||||||
|
|
||||||
|
#include <bw_pink_filt.h>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
|
namespace Brickworks {
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
class PinkFilt {
|
||||||
|
public:
|
||||||
|
PinkFilt();
|
||||||
|
|
||||||
|
void setSampleRate(float sampleRate);
|
||||||
|
void reset();
|
||||||
|
void process(
|
||||||
|
std::array<const float *, N_CHANNELS> x,
|
||||||
|
std::array<float *, N_CHANNELS> y,
|
||||||
|
int nSamples);
|
||||||
|
|
||||||
|
void setSampleRateScaling(bool value);
|
||||||
|
|
||||||
|
float getScalingK();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bw_pink_filt_coeffs coeffs;
|
||||||
|
bw_pink_filt_state states[N_CHANNELS];
|
||||||
|
};
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
PinkFilt<N_CHANNELS>::PinkFilt() {
|
||||||
|
bw_pink_filt_init(&coeffs);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
void PinkFilt<N_CHANNELS>::setSampleRate(float sampleRate) {
|
||||||
|
bw_pink_filt_set_sample_rate(&coeffs, sampleRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
void PinkFilt<N_CHANNELS>::reset() {
|
||||||
|
bw_pink_filt_reset_coeffs(&coeffs);
|
||||||
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
|
bw_pink_filt_reset_state(&coeffs, states + i);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
void PinkFilt<N_CHANNELS>::process(
|
||||||
|
std::array<const float *, N_CHANNELS> x,
|
||||||
|
std::array<float *, N_CHANNELS> y,
|
||||||
|
int nSamples) {
|
||||||
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
|
bw_pink_filt_process(&coeffs, x.data()[i], y.data()[i], nSamples);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
void PinkFilt<N_CHANNELS>::setSampleRateScaling(bool value) {
|
||||||
|
bw_pink_filt_set_sample_rate_scaling(&coeffs, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
float PinkFilt<N_CHANNELS>::getScalingK(float value) {
|
||||||
|
return bw_pink_filt_get_scaling_k(&coeffs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -50,7 +50,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
PPM<N_CHANNELS>::PPM() {
|
PPM<N_CHANNELS>::PPM() {
|
||||||
bw_ppm_init(&coeffs);
|
bw_ppm_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void PPM<N_CHANNELS>::reset() {
|
void PPM<N_CHANNELS>::reset() {
|
||||||
bw_ppm_reset_coeffs(&coeffs);
|
bw_ppm_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_ppm_reset_state(&coeffs, states + i);
|
bw_ppm_reset_state(&coeffs, states + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
77
include/bwpp_ringmod.h
Normal file
77
include/bwpp_ringmod.h
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
/*
|
||||||
|
* Brickworks
|
||||||
|
*
|
||||||
|
* Copyright (C) 2023 Orastron Srl unipersonale
|
||||||
|
*
|
||||||
|
* Brickworks is free software: you can reringmodribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, version 3 of the License.
|
||||||
|
*
|
||||||
|
* Brickworks is ringmodributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Brickworks. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* File author: Stefano D'Angelo
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BWPP_RINGMOD_H
|
||||||
|
#define BWPP_RINGMOD_H
|
||||||
|
|
||||||
|
#include <bw_ringmod.h>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
|
namespace Brickworks {
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
class RingMod {
|
||||||
|
public:
|
||||||
|
RingMod();
|
||||||
|
|
||||||
|
void setSampleRate(float sampleRate);
|
||||||
|
void reset();
|
||||||
|
void process(
|
||||||
|
std::array<const float *, N_CHANNELS> x_mod,
|
||||||
|
std::array<const float *, N_CHANNELS> x_car,
|
||||||
|
std::array<float *, N_CHANNELS> y,
|
||||||
|
int nSamples);
|
||||||
|
|
||||||
|
void setAmount(float value);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bw_ringmod_coeffs coeffs;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
RingMod<N_CHANNELS>::RingMod() {
|
||||||
|
bw_ringmod_init(&coeffs);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
void RingMod<N_CHANNELS>::setSampleRate(float sampleRate) {
|
||||||
|
bw_ringmod_set_sample_rate(&coeffs, sampleRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
void RingMod<N_CHANNELS>::reset() {
|
||||||
|
bw_ringmod_reset_coeffs(&coeffs);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
|
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>
|
||||||
|
void RingMod<N_CHANNELS>::setAmount(float value) {
|
||||||
|
bw_ringmod_set_amount(&coeffs, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -50,7 +50,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
Satur<N_CHANNELS>::Satur() {
|
Satur<N_CHANNELS>::Satur() {
|
||||||
bw_satur_init(&coeffs);
|
bw_satur_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void Satur<N_CHANNELS>::reset() {
|
void Satur<N_CHANNELS>::reset() {
|
||||||
bw_satur_reset_coeffs(&coeffs);
|
bw_satur_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_satur_reset_state(&coeffs, states + i);
|
bw_satur_reset_state(&coeffs, states + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
SlewLim<N_CHANNELS>::SlewLim() {
|
SlewLim<N_CHANNELS>::SlewLim() {
|
||||||
bw_slew_lim_init(&coeffs);
|
bw_slew_lim_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void SlewLim<N_CHANNELS>::reset(float y_z1) {
|
void SlewLim<N_CHANNELS>::reset(float y_z1) {
|
||||||
bw_slew_lim_reset_coeffs(&coeffs);
|
bw_slew_lim_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_slew_lim_reset_state(&coeffs, states + i, y_z1);
|
bw_slew_lim_reset_state(&coeffs, states + i, y_z1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ namespace Brickworks {
|
|||||||
|
|
||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void SRReduce<N_CHANNELS>::reset() {
|
void SRReduce<N_CHANNELS>::reset() {
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_sr_reduce_reset_state(&coeffs, states + i);
|
bw_sr_reduce_reset_state(&coeffs, states + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ namespace Brickworks {
|
|||||||
std::array<const float *, N_CHANNELS> x,
|
std::array<const float *, N_CHANNELS> x,
|
||||||
std::array<float *, N_CHANNELS> y,
|
std::array<float *, N_CHANNELS> y,
|
||||||
int nSamples) {
|
int nSamples) {
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_sr_reduce_process(&coeffs, states + i, x.data()[i], y.data()[i], nSamples);
|
bw_sr_reduce_process(&coeffs, states + i, x.data()[i], y.data()[i], nSamples);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ namespace Brickworks {
|
|||||||
|
|
||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void SRCInt<N_CHANNELS>::reset(float x0) {
|
void SRCInt<N_CHANNELS>::reset(float x0) {
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_src_int_reset_state(&coeffs, states + i, x0);
|
bw_src_int_reset_state(&coeffs, states + i, x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ namespace Brickworks {
|
|||||||
std::array<const float *, N_CHANNELS> x,
|
std::array<const float *, N_CHANNELS> x,
|
||||||
std::array<float *, N_CHANNELS> y,
|
std::array<float *, N_CHANNELS> y,
|
||||||
int nInSamples) {
|
int nInSamples) {
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_src_int_process(&coeffs, states + i, x.data()[i], y.data()[i], nInSamples);
|
bw_src_int_process(&coeffs, states + i, x.data()[i], y.data()[i], nInSamples);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
SVF<N_CHANNELS>::SVF() {
|
SVF<N_CHANNELS>::SVF() {
|
||||||
bw_svf_init(&coeffs);
|
bw_svf_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void SVF<N_CHANNELS>::reset(float x0) {
|
void SVF<N_CHANNELS>::reset(float x0) {
|
||||||
bw_svf_reset_coeffs(&coeffs);
|
bw_svf_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_svf_reset_state(&coeffs, states + i, x0);
|
bw_svf_reset_state(&coeffs, states + i, x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
Trem<N_CHANNELS>::Trem() {
|
Trem<N_CHANNELS>::Trem() {
|
||||||
bw_trem_init(&coeffs);
|
bw_trem_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void Trem<N_CHANNELS>::reset() {
|
void Trem<N_CHANNELS>::reset() {
|
||||||
bw_trem_reset_coeffs(&coeffs);
|
bw_trem_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_trem_reset_state(&coeffs, states + i);
|
bw_trem_reset_state(&coeffs, states + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
Wah<N_CHANNELS>::Wah() {
|
Wah<N_CHANNELS>::Wah() {
|
||||||
bw_wah_init(&coeffs);
|
bw_wah_init(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
statesP[i] = states + i;
|
statesP[i] = states + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ namespace Brickworks {
|
|||||||
template<BW_SIZE_T N_CHANNELS>
|
template<BW_SIZE_T N_CHANNELS>
|
||||||
void Wah<N_CHANNELS>::reset() {
|
void Wah<N_CHANNELS>::reset() {
|
||||||
bw_wah_reset_coeffs(&coeffs);
|
bw_wah_reset_coeffs(&coeffs);
|
||||||
for (unsigned int i = 0; i < N_CHANNELS; i++)
|
for (BW_SIZE_T i = 0; i < N_CHANNELS; i++)
|
||||||
bw_wah_reset_state(&coeffs, states + i);
|
bw_wah_reset_state(&coeffs, states + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user