improved bw_one_pole + removed bwpp_one_pole + c++ reshuffling
This commit is contained in:
parent
225ef9108c
commit
48275d077d
@ -23,7 +23,7 @@
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bwpp_one_pole.h>
|
||||
#include <bw_one_pole.h>
|
||||
|
||||
using namespace Brickworks;
|
||||
|
||||
|
@ -63,12 +63,12 @@
|
||||
#ifndef _BW_AP1_H
|
||||
#define _BW_AP1_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_ap1_coeffs
|
||||
* ```>>> */
|
||||
@ -152,6 +152,10 @@ static inline void bw_ap1_set_cutoff(bw_ap1_coeffs *BW_RESTRICT coeffs, float va
|
||||
* Default value: `1e3f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -159,6 +163,10 @@ static inline void bw_ap1_set_cutoff(bw_ap1_coeffs *BW_RESTRICT coeffs, float va
|
||||
|
||||
#include <bw_lp1.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_ap1_coeffs {
|
||||
// Sub-components
|
||||
bw_lp1_coeffs lp1_coeffs;
|
||||
|
@ -63,12 +63,12 @@
|
||||
#ifndef _BW_AP2_H
|
||||
#define _BW_AP2_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_ap2_coeffs
|
||||
* ```>>> */
|
||||
@ -162,6 +162,10 @@ static inline void bw_ap2_set_Q(bw_ap2_coeffs *BW_RESTRICT coeffs, float value);
|
||||
* Default value: `0.5f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -169,6 +173,10 @@ static inline void bw_ap2_set_Q(bw_ap2_coeffs *BW_RESTRICT coeffs, float value);
|
||||
|
||||
#include <bw_svf.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_ap2_coeffs {
|
||||
// Sub-components
|
||||
bw_svf_coeffs svf_coeffs;
|
||||
|
@ -59,12 +59,12 @@
|
||||
#ifndef _BW_BALANCE_H
|
||||
#define _BW_BALANCE_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_balance_coeffs
|
||||
* ```>>> */
|
||||
@ -138,6 +138,10 @@ static inline void bw_balance_set_balance(bw_balance_coeffs *BW_RESTRICT coeffs,
|
||||
* Default value: `0.f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -146,6 +150,10 @@ static inline void bw_balance_set_balance(bw_balance_coeffs *BW_RESTRICT coeffs,
|
||||
#include <bw_math.h>
|
||||
#include <bw_gain.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_balance_coeffs {
|
||||
// Sub-components
|
||||
bw_gain_coeffs l_coeffs;
|
||||
|
@ -65,12 +65,12 @@
|
||||
#ifndef _BW_BD_REDUCE_H
|
||||
#define _BW_BD_REDUCE_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_bd_reduce_coeffs
|
||||
* ```>>> */
|
||||
@ -134,6 +134,10 @@ static inline void bw_bd_reduce_set_bit_depth(bw_bd_reduce_coeffs *BW_RESTRICT c
|
||||
* Default value: `16`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -141,6 +145,10 @@ static inline void bw_bd_reduce_set_bit_depth(bw_bd_reduce_coeffs *BW_RESTRICT c
|
||||
|
||||
#include <bw_math.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_bd_reduce_coeffs {
|
||||
// Coefficients
|
||||
float ki;
|
||||
|
217
include/bw_buf.h
217
include/bw_buf.h
@ -77,6 +77,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*** Public API ***/
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_buf_fill()
|
||||
* ```>>> */
|
||||
@ -169,112 +171,6 @@ static inline void bw_buf_mul_multi(const float * const *src1, const float * con
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace Brickworks {
|
||||
|
||||
/*! api_cpp {{{
|
||||
* ##### Brickworks::bufFill
|
||||
* ```>>> */
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufFill(
|
||||
float k,
|
||||
float ** dest,
|
||||
int nSamples);
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufFill(
|
||||
float k,
|
||||
std::array<float *, N_CHANNELS> dest,
|
||||
int nSamples);
|
||||
/*! <<<```
|
||||
*
|
||||
* ##### Brickworks::bufNeg
|
||||
* ```>>> */
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufNeg(
|
||||
const float * const *src,
|
||||
float **dest,
|
||||
int nSamples);
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufNeg(
|
||||
std::array<const float *, N_CHANNELS> src,
|
||||
std::array<float *, N_CHANNELS> dest,
|
||||
int nSamples);
|
||||
/*! <<<```
|
||||
*
|
||||
* ##### Brickworks::bufAdd
|
||||
* ```>>> */
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufAdd(
|
||||
const float * const *src,
|
||||
float **dest,
|
||||
float k,
|
||||
int nSamples);
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufAdd(
|
||||
std::array<const float *, N_CHANNELS> src,
|
||||
std::array<float *, N_CHANNELS> dest,
|
||||
float k,
|
||||
int nSamples);
|
||||
/*! <<<```
|
||||
*
|
||||
* ##### Brickworks::bufScale
|
||||
* ```>>> */
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufScale(
|
||||
const float * const *src,
|
||||
float k,
|
||||
float **dest,
|
||||
int nSamples);
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufScale(
|
||||
std::array<const float *, N_CHANNELS> src,
|
||||
std::array<float *, N_CHANNELS> dest,
|
||||
float k,
|
||||
int nSamples);
|
||||
/*! <<<```
|
||||
*
|
||||
* ##### Brickworks::bufMix
|
||||
* ```>>> */
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufMix(
|
||||
const float * const *src1,
|
||||
const float * const *src2,
|
||||
float **dest,
|
||||
int nSamples);
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufMix(
|
||||
std::array<const float *, N_CHANNELS> src1,
|
||||
std::array<const float *, N_CHANNELS> src2,
|
||||
std::array<float *, N_CHANNELS> dest,
|
||||
int nSamples);
|
||||
/*! <<<```
|
||||
*
|
||||
* ##### Brickworks::bufMul
|
||||
* ```>>> */
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufMul(
|
||||
const float * const *src1,
|
||||
const float * const *src2,
|
||||
float **dest,
|
||||
int nSamples);
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufMul(
|
||||
std::array<const float *, N_CHANNELS> src1,
|
||||
std::array<const float *, N_CHANNELS> src2,
|
||||
std::array<float *, N_CHANNELS> dest,
|
||||
int nSamples);
|
||||
/*! <<<```
|
||||
* }}} */
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
@ -395,8 +291,117 @@ static inline void bw_buf_mul_multi(const float * const *src1, const float * con
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace Brickworks {
|
||||
|
||||
/*** Public C++ API ***/
|
||||
|
||||
/*! api_cpp {{{
|
||||
* ##### Brickworks::bufFill
|
||||
* ```>>> */
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufFill(
|
||||
float k,
|
||||
float ** dest,
|
||||
int nSamples);
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufFill(
|
||||
float k,
|
||||
std::array<float *, N_CHANNELS> dest,
|
||||
int nSamples);
|
||||
/*! <<<```
|
||||
*
|
||||
* ##### Brickworks::bufNeg
|
||||
* ```>>> */
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufNeg(
|
||||
const float * const *src,
|
||||
float **dest,
|
||||
int nSamples);
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufNeg(
|
||||
std::array<const float *, N_CHANNELS> src,
|
||||
std::array<float *, N_CHANNELS> dest,
|
||||
int nSamples);
|
||||
/*! <<<```
|
||||
*
|
||||
* ##### Brickworks::bufAdd
|
||||
* ```>>> */
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufAdd(
|
||||
const float * const *src,
|
||||
float **dest,
|
||||
float k,
|
||||
int nSamples);
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufAdd(
|
||||
std::array<const float *, N_CHANNELS> src,
|
||||
std::array<float *, N_CHANNELS> dest,
|
||||
float k,
|
||||
int nSamples);
|
||||
/*! <<<```
|
||||
*
|
||||
* ##### Brickworks::bufScale
|
||||
* ```>>> */
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufScale(
|
||||
const float * const *src,
|
||||
float k,
|
||||
float **dest,
|
||||
int nSamples);
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufScale(
|
||||
std::array<const float *, N_CHANNELS> src,
|
||||
std::array<float *, N_CHANNELS> dest,
|
||||
float k,
|
||||
int nSamples);
|
||||
/*! <<<```
|
||||
*
|
||||
* ##### Brickworks::bufMix
|
||||
* ```>>> */
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufMix(
|
||||
const float * const *src1,
|
||||
const float * const *src2,
|
||||
float **dest,
|
||||
int nSamples);
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufMix(
|
||||
std::array<const float *, N_CHANNELS> src1,
|
||||
std::array<const float *, N_CHANNELS> src2,
|
||||
std::array<float *, N_CHANNELS> dest,
|
||||
int nSamples);
|
||||
/*! <<<```
|
||||
*
|
||||
* ##### Brickworks::bufMul
|
||||
* ```>>> */
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufMul(
|
||||
const float * const *src1,
|
||||
const float * const *src2,
|
||||
float **dest,
|
||||
int nSamples);
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void bufMul(
|
||||
std::array<const float *, N_CHANNELS> src1,
|
||||
std::array<const float *, N_CHANNELS> src2,
|
||||
std::array<float *, N_CHANNELS> dest,
|
||||
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<size_t N_CHANNELS>
|
||||
inline void bufFill(
|
||||
float k,
|
||||
|
@ -67,12 +67,12 @@
|
||||
#ifndef _BW_CHORUS_H
|
||||
#define _BW_CHORUS_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_chorus_coeffs
|
||||
* ```>>> */
|
||||
@ -209,6 +209,10 @@ static inline void bw_chorus_set_coeff_fb(bw_chorus_coeffs *BW_RESTRICT coeffs,
|
||||
* Default value: `0.f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -218,6 +222,10 @@ static inline void bw_chorus_set_coeff_fb(bw_chorus_coeffs *BW_RESTRICT coeffs,
|
||||
#include <bw_osc_sin.h>
|
||||
#include <bw_comb.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_chorus_coeffs {
|
||||
// Sub-components
|
||||
bw_phase_gen_coeffs phase_gen_coeffs;
|
||||
|
@ -61,12 +61,12 @@
|
||||
#ifndef _BW_CLIP_H
|
||||
#define _BW_CLIP_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_clip_coeffs
|
||||
* ```>>> */
|
||||
@ -173,6 +173,10 @@ static inline void bw_clip_set_gain_compensation(bw_clip_coeffs *BW_RESTRICT coe
|
||||
* Default value: `1` (on).
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -181,6 +185,10 @@ static inline void bw_clip_set_gain_compensation(bw_clip_coeffs *BW_RESTRICT coe
|
||||
#include <bw_math.h>
|
||||
#include <bw_one_pole.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_clip_coeffs {
|
||||
// Sub-components
|
||||
bw_one_pole_coeffs smooth_coeffs;
|
||||
|
@ -68,12 +68,12 @@
|
||||
#ifndef _BW_COMB_H
|
||||
#define _BW_COMB_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_comb_coeffs
|
||||
* ```>>> */
|
||||
@ -202,6 +202,10 @@ static inline void bw_comb_set_coeff_fb(bw_comb_coeffs *BW_RESTRICT coeffs, floa
|
||||
* Default value: `0.f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -212,6 +216,10 @@ static inline void bw_comb_set_coeff_fb(bw_comb_coeffs *BW_RESTRICT coeffs, floa
|
||||
#include <bw_one_pole.h>
|
||||
#include <bw_math.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_comb_coeffs {
|
||||
// Sub-components
|
||||
bw_delay_coeffs delay_coeffs;
|
||||
|
@ -81,6 +81,8 @@
|
||||
#ifndef BW_COMMON_H
|
||||
#define BW_COMMON_H
|
||||
|
||||
/*** Public API ***/
|
||||
|
||||
/*! api {{{
|
||||
*
|
||||
* #### Basic definitions
|
||||
|
@ -60,12 +60,12 @@
|
||||
#ifndef _BW_COMP_H
|
||||
#define _BW_COMP_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_comp_coeffs
|
||||
* ```>>> */
|
||||
@ -204,6 +204,10 @@ static inline void bw_comp_set_gain_dB(bw_comp_coeffs *BW_RESTRICT coeffs, float
|
||||
* Default value: `0.f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -214,6 +218,10 @@ static inline void bw_comp_set_gain_dB(bw_comp_coeffs *BW_RESTRICT coeffs, float
|
||||
#include <bw_gain.h>
|
||||
#include <bw_one_pole.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_comp_coeffs {
|
||||
// Sub-components
|
||||
bw_env_follow_coeffs env_follow_coeffs;
|
||||
|
@ -61,12 +61,12 @@
|
||||
#ifndef _BW_DELAY_H
|
||||
#define _BW_DELAY_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_delay_coeffs
|
||||
* ```>>> */
|
||||
@ -186,6 +186,10 @@ static inline size_t bw_delay_get_length(const bw_delay_coeffs *BW_RESTRICT coef
|
||||
* Returns the length of the delay line in samples.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -194,6 +198,10 @@ static inline size_t bw_delay_get_length(const bw_delay_coeffs *BW_RESTRICT coef
|
||||
#include <bw_buf.h>
|
||||
#include <bw_math.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_delay_coeffs {
|
||||
// Coefficients
|
||||
float fs;
|
||||
|
@ -55,12 +55,12 @@
|
||||
#ifndef _BW_DIST_H
|
||||
#define _BW_DIST_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_dist_coeffs
|
||||
* ```>>> */
|
||||
@ -161,6 +161,10 @@ static inline void bw_dist_set_volume(bw_dist_coeffs *BW_RESTRICT coeffs, float
|
||||
* Default value: `1.f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -173,6 +177,10 @@ static inline void bw_dist_set_volume(bw_dist_coeffs *BW_RESTRICT coeffs, float
|
||||
#include <bw_lp1.h>
|
||||
#include <bw_gain.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_dist_coeffs {
|
||||
// Sub-components
|
||||
bw_hp1_coeffs hp1_coeffs;
|
||||
|
@ -54,12 +54,12 @@
|
||||
#ifndef _BW_DRIVE_H
|
||||
#define _BW_DRIVE_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_drive_coeffs
|
||||
* ```>>> */
|
||||
@ -160,6 +160,10 @@ static inline void bw_drive_set_volume(bw_drive_coeffs *BW_RESTRICT coeffs, floa
|
||||
* Default value: `1.f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -170,6 +174,10 @@ static inline void bw_drive_set_volume(bw_drive_coeffs *BW_RESTRICT coeffs, floa
|
||||
#include <bw_satur.h>
|
||||
#include <bw_gain.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_drive_coeffs {
|
||||
// Sub-components
|
||||
bw_svf_coeffs hp2_coeffs;
|
||||
|
@ -50,12 +50,12 @@
|
||||
#ifndef _BW_DRYWET_H
|
||||
#define _BW_DRYWET_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_drywet_coeffs
|
||||
* ```>>> */
|
||||
@ -134,6 +134,10 @@ static inline void bw_drywet_set_smooth_tau(bw_drywet_coeffs *BW_RESTRICT coeffs
|
||||
* Default value: `0.05f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -141,6 +145,10 @@ static inline void bw_drywet_set_smooth_tau(bw_drywet_coeffs *BW_RESTRICT coeffs
|
||||
|
||||
#include <bw_gain.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_drywet_coeffs {
|
||||
// Sub-components
|
||||
bw_gain_coeffs gain_coeffs;
|
||||
|
@ -67,12 +67,12 @@
|
||||
#ifndef _BW_ENV_FOLLOW_H
|
||||
#define _BW_ENV_FOLLOW_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_env_follow_coeffs
|
||||
* ```>>> */
|
||||
@ -174,6 +174,10 @@ static inline float bw_env_follow_get_y_z1(const bw_env_follow_state *BW_RESTRIC
|
||||
/*! <<<```
|
||||
* Returns the last output sample as stored in `state`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
@ -183,6 +187,10 @@ static inline float bw_env_follow_get_y_z1(const bw_env_follow_state *BW_RESTRIC
|
||||
#include <bw_math.h>
|
||||
#include <bw_one_pole.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_env_follow_coeffs {
|
||||
// Sub-components
|
||||
bw_one_pole_coeffs one_pole_coeffs;
|
||||
|
@ -89,12 +89,12 @@
|
||||
#ifndef _BW_ENV_GEN_H
|
||||
#define _BW_ENV_GEN_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_env_gen_coeffs
|
||||
* ```>>> */
|
||||
@ -247,6 +247,10 @@ static inline float bw_env_gen_get_y_z1(const bw_env_gen_state *state);
|
||||
* Returns the last output sample as stored in `state`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -255,6 +259,10 @@ static inline float bw_env_gen_get_y_z1(const bw_env_gen_state *state);
|
||||
#include <bw_math.h>
|
||||
#include <bw_one_pole.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_env_gen_coeffs {
|
||||
// Sub-components
|
||||
bw_one_pole_coeffs smooth_coeffs;
|
||||
|
@ -55,12 +55,12 @@
|
||||
#ifndef _BW_FUZZ_H
|
||||
#define _BW_FUZZ_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_fuzz_coeffs
|
||||
* ```>>> */
|
||||
@ -153,6 +153,10 @@ static inline void bw_fuzz_set_volume(bw_fuzz_coeffs *BW_RESTRICT coeffs, float
|
||||
* Default value: `1.f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -164,6 +168,10 @@ static inline void bw_fuzz_set_volume(bw_fuzz_coeffs *BW_RESTRICT coeffs, float
|
||||
#include <bw_hp1.h>
|
||||
#include <bw_gain.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_fuzz_coeffs {
|
||||
// Sub-components
|
||||
bw_svf_coeffs svf_coeffs;
|
||||
|
@ -70,12 +70,12 @@
|
||||
#ifndef _BW_GAIN_H
|
||||
#define _BW_GAIN_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_gain_coeffs
|
||||
* ```>>> */
|
||||
@ -167,6 +167,10 @@ static inline float bw_gain_get_gain(const bw_gain_coeffs *BW_RESTRICT coeffs);
|
||||
* Returns the actual current gain coefficient (linear gain) in `coeffs`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -175,6 +179,10 @@ static inline float bw_gain_get_gain(const bw_gain_coeffs *BW_RESTRICT coeffs);
|
||||
#include <bw_math.h>
|
||||
#include <bw_one_pole.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_gain_coeffs {
|
||||
// Sub-components
|
||||
bw_one_pole_coeffs smooth_coeffs;
|
||||
|
@ -63,12 +63,12 @@
|
||||
#ifndef _BW_HP1_H
|
||||
#define _BW_HP1_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_hp1_coeffs
|
||||
* ```>>> */
|
||||
@ -152,6 +152,10 @@ static inline void bw_hp1_set_cutoff(bw_hp1_coeffs *BW_RESTRICT coeffs, float va
|
||||
* Default value: `1e3f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -159,6 +163,10 @@ static inline void bw_hp1_set_cutoff(bw_hp1_coeffs *BW_RESTRICT coeffs, float va
|
||||
|
||||
#include <bw_lp1.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_hp1_coeffs {
|
||||
// Sub-components
|
||||
bw_lp1_coeffs lp1_coeffs;
|
||||
|
@ -62,12 +62,12 @@
|
||||
#ifndef _BW_HS1_H
|
||||
#define _BW_HS1_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_hs1_coeffs
|
||||
* ```>>> */
|
||||
@ -170,6 +170,10 @@ static inline void bw_hs1_set_high_gain_dB(bw_hs1_coeffs *BW_RESTRICT coeffs, fl
|
||||
*
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -178,6 +182,10 @@ static inline void bw_hs1_set_high_gain_dB(bw_hs1_coeffs *BW_RESTRICT coeffs, fl
|
||||
#include <bw_mm1.h>
|
||||
#include <bw_math.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_hs1_coeffs {
|
||||
// Sub-components
|
||||
bw_mm1_coeffs mm1_coeffs;
|
||||
|
@ -62,12 +62,12 @@
|
||||
#ifndef _BW_HS2_H
|
||||
#define _BW_HS2_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_hs2_coeffs
|
||||
* ```>>> */
|
||||
@ -179,6 +179,10 @@ static inline void bw_hs2_set_high_gain_dB(bw_hs2_coeffs *BW_RESTRICT coeffs, fl
|
||||
* Default value: `-INFINITY`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -187,6 +191,10 @@ static inline void bw_hs2_set_high_gain_dB(bw_hs2_coeffs *BW_RESTRICT coeffs, fl
|
||||
#include <bw_mm2.h>
|
||||
#include <bw_math.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_hs2_coeffs {
|
||||
// Sub-components
|
||||
bw_mm2_coeffs mm2_coeffs;
|
||||
|
@ -66,12 +66,12 @@
|
||||
#ifndef _BW_LP1_H
|
||||
#define _BW_LP1_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_lp1_coeffs
|
||||
* ```>>> */
|
||||
@ -174,6 +174,10 @@ static inline void bw_lp1_set_prewarp_freq(bw_lp1_coeffs *BW_RESTRICT coeffs, fl
|
||||
* Default value: `1e3f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -182,6 +186,10 @@ static inline void bw_lp1_set_prewarp_freq(bw_lp1_coeffs *BW_RESTRICT coeffs, fl
|
||||
#include <bw_math.h>
|
||||
#include <bw_one_pole.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_lp1_coeffs {
|
||||
// Sub-components
|
||||
bw_one_pole_coeffs smooth_coeffs;
|
||||
|
@ -63,12 +63,12 @@
|
||||
#ifndef _BW_LS1_H
|
||||
#define _BW_LS1_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_ls1_coeffs
|
||||
* ```>>> */
|
||||
@ -168,6 +168,10 @@ static inline void bw_ls1_set_dc_gain_dB(bw_ls1_coeffs *BW_RESTRICT coeffs, floa
|
||||
* Default value: `-INFINITY`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -176,6 +180,10 @@ static inline void bw_ls1_set_dc_gain_dB(bw_ls1_coeffs *BW_RESTRICT coeffs, floa
|
||||
#include <bw_mm1.h>
|
||||
#include <bw_math.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_ls1_coeffs {
|
||||
// Sub-components
|
||||
bw_mm1_coeffs mm1_coeffs;
|
||||
|
@ -63,12 +63,12 @@
|
||||
#ifndef _BW_LS2_H
|
||||
#define _BW_LS2_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_ls2_coeffs
|
||||
* ```>>> */
|
||||
@ -178,6 +178,10 @@ static inline void bw_ls2_set_dc_gain_dB(bw_ls2_coeffs *BW_RESTRICT coeffs, floa
|
||||
* Default value: `-INFINITY`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -186,6 +190,10 @@ static inline void bw_ls2_set_dc_gain_dB(bw_ls2_coeffs *BW_RESTRICT coeffs, floa
|
||||
#include <bw_mm2.h>
|
||||
#include <bw_math.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_ls2_coeffs {
|
||||
// Sub-components
|
||||
bw_mm2_coeffs mm2_coeffs;
|
||||
|
@ -117,6 +117,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*** Public API ***/
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_signfilli32()
|
||||
* ```>>> */
|
||||
|
@ -62,12 +62,12 @@
|
||||
#ifndef _BW_MM1_H
|
||||
#define _BW_MM1_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_mm1_coeffs
|
||||
* ```>>> */
|
||||
@ -186,6 +186,10 @@ static inline void bw_mm1_set_coeff_lp(bw_mm1_coeffs *BW_RESTRICT coeffs, float
|
||||
* Default value: `0.f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -194,6 +198,10 @@ static inline void bw_mm1_set_coeff_lp(bw_mm1_coeffs *BW_RESTRICT coeffs, float
|
||||
#include <bw_lp1.h>
|
||||
#include <bw_gain.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_mm1_coeffs {
|
||||
// Sub-components
|
||||
bw_lp1_coeffs lp1_coeffs;
|
||||
|
@ -62,12 +62,12 @@
|
||||
#ifndef _BW_MM2_H
|
||||
#define _BW_MM2_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_mm2_coeffs
|
||||
* ```>>> */
|
||||
@ -212,6 +212,10 @@ static inline void bw_mm2_set_coeff_hp(bw_mm2_coeffs *BW_RESTRICT coeffs, float
|
||||
* Default value: `0.f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -220,6 +224,10 @@ static inline void bw_mm2_set_coeff_hp(bw_mm2_coeffs *BW_RESTRICT coeffs, float
|
||||
#include <bw_svf.h>
|
||||
#include <bw_gain.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_mm2_coeffs {
|
||||
// Sub-components
|
||||
bw_svf_coeffs svf_coeffs;
|
||||
|
@ -56,12 +56,12 @@
|
||||
#ifndef _BW_NOISE_GATE_H
|
||||
#define _BW_NOISE_GATE_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_noise_gate_coeffs
|
||||
* ```>>> */
|
||||
@ -184,6 +184,10 @@ static inline void bw_noise_gate_set_release_tau(bw_noise_gate_coeffs *BW_RESTRI
|
||||
* Default value: `0.f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -193,6 +197,10 @@ static inline void bw_noise_gate_set_release_tau(bw_noise_gate_coeffs *BW_RESTRI
|
||||
#include <bw_env_follow.h>
|
||||
#include <bw_one_pole.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_noise_gate_coeffs {
|
||||
// Sub-noise_gateonents
|
||||
bw_env_follow_coeffs env_follow_coeffs;
|
||||
|
@ -137,6 +137,10 @@ static inline float bw_noise_gen_get_scaling_k(const bw_noise_gen_coeffs *BW_RES
|
||||
* if sample rate scaling were enabled, as stored in `coeffs`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -144,7 +148,11 @@ static inline float bw_noise_gen_get_scaling_k(const bw_noise_gen_coeffs *BW_RES
|
||||
|
||||
#include <bw_math.h>
|
||||
#include <bw_rand.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_noise_gen_coeffs {
|
||||
// Coefficients
|
||||
float scaling_k;
|
||||
|
@ -63,12 +63,12 @@
|
||||
#ifndef _BW_NOTCH_H
|
||||
#define _BW_NOTCH_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_notch_coeffs
|
||||
* ```>>> */
|
||||
@ -162,6 +162,10 @@ static inline void bw_notch_set_Q(bw_notch_coeffs *BW_RESTRICT coeffs, float val
|
||||
* Default value: `0.5f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -169,6 +173,10 @@ static inline void bw_notch_set_Q(bw_notch_coeffs *BW_RESTRICT coeffs, float val
|
||||
|
||||
#include <bw_svf.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_notch_coeffs {
|
||||
// Sub-components
|
||||
bw_svf_coeffs svf_coeffs;
|
||||
|
@ -67,6 +67,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*** Public API ***/
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_note_queue_status
|
||||
* ```>>> */
|
||||
@ -149,25 +151,6 @@ static inline char bw_note_queue_is_valid(const bw_note_queue *BW_RESTRICT queue
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
namespace Brickworks {
|
||||
|
||||
/*! api_cpp {{{
|
||||
* ##### Brickworks::NoteQueue
|
||||
* ```>>> */
|
||||
class NoteQueue {
|
||||
public:
|
||||
NoteQueue();
|
||||
|
||||
void clear();
|
||||
void add(unsigned char note, bool pressed, float velocity, bool force_went_off);
|
||||
|
||||
bw_note_queue queue;
|
||||
};
|
||||
/*! <<<```
|
||||
* }}} */
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
@ -259,8 +242,30 @@ static inline char bw_note_queue_is_valid(const bw_note_queue *BW_RESTRICT queue
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
/*** Public C++ API ***/
|
||||
|
||||
namespace Brickworks {
|
||||
|
||||
/*! api_cpp {{{
|
||||
* ##### Brickworks::NoteQueue
|
||||
* ```>>> */
|
||||
class NoteQueue {
|
||||
public:
|
||||
NoteQueue();
|
||||
|
||||
void clear();
|
||||
void add(unsigned char note, bool pressed, float velocity, bool force_went_off);
|
||||
|
||||
bw_note_queue queue;
|
||||
};
|
||||
/*! <<<```
|
||||
* }}} */
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
* change at any time in future versions. Please, do not use it directly. */
|
||||
|
||||
inline NoteQueue::NoteQueue() {
|
||||
bw_note_queue_reset(&queue);
|
||||
}
|
||||
|
@ -34,6 +34,12 @@
|
||||
* <ul>
|
||||
* <li>Now using <code>size_t</code> instead of
|
||||
* <code>BW_SIZE_T</code>.</li>
|
||||
* <li>Added more <code>const</code> specifiers to input
|
||||
* arguments.</li>
|
||||
* <li>Moved C++ code to C header.</li>
|
||||
* <li>Added overladed C++ <code>process()</code> function taking
|
||||
* C-style arrays as arguments.</li>
|
||||
* <li>Removed usage of reserved identifiers.</li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* <li>Version <strong>0.6.0</strong>:
|
||||
@ -71,25 +77,27 @@
|
||||
* }}}
|
||||
*/
|
||||
|
||||
#ifndef _BW_ONE_POLE_H
|
||||
#define _BW_ONE_POLE_H
|
||||
#ifndef BW_ONE_POLE_H
|
||||
#define BW_ONE_POLE_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
/*** Public API ***/
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_one_pole_coeffs
|
||||
* ```>>> */
|
||||
typedef struct _bw_one_pole_coeffs bw_one_pole_coeffs;
|
||||
typedef struct bw_one_pole_coeffs bw_one_pole_coeffs;
|
||||
/*! <<<```
|
||||
* Coefficients and related.
|
||||
*
|
||||
* #### bw_one_pole_state
|
||||
* ```>>> */
|
||||
typedef struct _bw_one_pole_state bw_one_pole_state;
|
||||
typedef struct bw_one_pole_state bw_one_pole_state;
|
||||
/*! <<<```
|
||||
* Internal state and related.
|
||||
*
|
||||
@ -188,7 +196,7 @@ static inline void bw_one_pole_process(bw_one_pole_coeffs *BW_RESTRICT coeffs, b
|
||||
*
|
||||
* #### bw_one_pole_process_multi()
|
||||
* ```>>> */
|
||||
static inline void bw_one_pole_process_multi(bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state **BW_RESTRICT state, const float **x, float **y, size_t n_channels, size_t n_samples);
|
||||
static inline void bw_one_pole_process_multi(bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state **BW_RESTRICT state, const float * const *x, float **y, size_t n_channels, size_t n_samples);
|
||||
/*! <<<```
|
||||
* Processes the first `n_samples` of the `n_channels` input buffers `x` and
|
||||
* fills the first `n_samples` of the `n_channels` output buffers `y`, while
|
||||
@ -324,6 +332,10 @@ static inline char bw_one_pole_state_is_valid(const bw_one_pole_state *BW_RESTRI
|
||||
* than or equal to that of `bw_one_pole_state`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -331,16 +343,20 @@ static inline char bw_one_pole_state_is_valid(const bw_one_pole_state *BW_RESTRI
|
||||
|
||||
#include <bw_math.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef BW_DEBUG_DEEP
|
||||
enum _bw_one_pole_coeffs_state {
|
||||
_bw_one_pole_coeffs_state_invalid,
|
||||
_bw_one_pole_coeffs_state_init,
|
||||
_bw_one_pole_coeffs_state_set_sample_rate,
|
||||
_bw_one_pole_coeffs_state_reset_coeffs,
|
||||
enum bw_one_pole_coeffs_state {
|
||||
bw_one_pole_coeffs_state_invalid,
|
||||
bw_one_pole_coeffs_state_init,
|
||||
bw_one_pole_coeffs_state_set_sample_rate,
|
||||
bw_one_pole_coeffs_state_reset_coeffs,
|
||||
};
|
||||
#endif
|
||||
|
||||
struct _bw_one_pole_coeffs {
|
||||
struct bw_one_pole_coeffs {
|
||||
#ifdef BW_DEBUG_DEEP
|
||||
uint32_t hash;
|
||||
enum _bw_one_pole_coeffs_state state;
|
||||
@ -362,7 +378,7 @@ struct _bw_one_pole_coeffs {
|
||||
int param_changed;
|
||||
};
|
||||
|
||||
struct _bw_one_pole_state {
|
||||
struct bw_one_pole_state {
|
||||
#ifdef BW_DEBUG_DEEP
|
||||
uint32_t hash;
|
||||
uint32_t coeffs_reset_id;
|
||||
@ -371,9 +387,9 @@ struct _bw_one_pole_state {
|
||||
float y_z1;
|
||||
};
|
||||
|
||||
#define _BW_ONE_POLE_PARAM_CUTOFF_UP 1
|
||||
#define _BW_ONE_POLE_PARAM_CUTOFF_DOWN (1<<1)
|
||||
#define _BW_ONE_POLE_PARAM_STICKY_THRESH (1<<2)
|
||||
#define BW_ONE_POLE_PARAM_CUTOFF_UP 1
|
||||
#define BW_ONE_POLE_PARAM_CUTOFF_DOWN (1<<1)
|
||||
#define BW_ONE_POLE_PARAM_STICKY_THRESH (1<<2)
|
||||
|
||||
static inline void bw_one_pole_init(bw_one_pole_coeffs *BW_RESTRICT coeffs) {
|
||||
BW_ASSERT(coeffs != NULL);
|
||||
@ -394,26 +410,26 @@ static inline void bw_one_pole_init(bw_one_pole_coeffs *BW_RESTRICT coeffs) {
|
||||
static inline void bw_one_pole_set_sample_rate(bw_one_pole_coeffs *BW_RESTRICT coeffs, float sample_rate) {
|
||||
BW_ASSERT(coeffs != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
|
||||
|
||||
coeffs->Ttm2pi = -6.283185307179586f / sample_rate;
|
||||
|
||||
#ifdef BW_DEBUG_DEEP
|
||||
coeffs->state = _bw_one_pole_coeffs_state_set_sample_rate;
|
||||
coeffs->state = bw_one_pole_coeffs_state_set_sample_rate;
|
||||
#endif
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state == _bw_one_pole_coeffs_state_set_sample_rate);
|
||||
BW_ASSERT_DEEP(coeffs->state == bw_one_pole_coeffs_state_set_sample_rate);
|
||||
}
|
||||
|
||||
static inline void _bw_one_pole_do_update_coeffs_ctrl(bw_one_pole_coeffs *BW_RESTRICT coeffs) {
|
||||
if (coeffs->param_changed) {
|
||||
if (coeffs->param_changed & _BW_ONE_POLE_PARAM_CUTOFF_UP)
|
||||
if (coeffs->param_changed & BW_ONE_POLE_PARAM_CUTOFF_UP)
|
||||
coeffs->mA1u = coeffs->cutoff_up > 1.591549430918953e8f ? 0.f : bw_expf(coeffs->Ttm2pi * coeffs->cutoff_up);
|
||||
// tau < 1 ns is instantaneous for any practical purpose
|
||||
if (coeffs->param_changed & _BW_ONE_POLE_PARAM_CUTOFF_DOWN)
|
||||
if (coeffs->param_changed & BW_ONE_POLE_PARAM_CUTOFF_DOWN)
|
||||
coeffs->mA1d = coeffs->cutoff_down > 1.591549430918953e8f ? 0.f : bw_expf(coeffs->Ttm2pi * coeffs->cutoff_down);
|
||||
// as before
|
||||
if (coeffs->param_changed & _BW_ONE_POLE_PARAM_STICKY_THRESH)
|
||||
if (coeffs->param_changed & BW_ONE_POLE_PARAM_STICKY_THRESH)
|
||||
coeffs->st2 = coeffs->sticky_thresh * coeffs->sticky_thresh;
|
||||
coeffs->param_changed = 0;
|
||||
}
|
||||
@ -422,7 +438,7 @@ static inline void _bw_one_pole_do_update_coeffs_ctrl(bw_one_pole_coeffs *BW_RES
|
||||
static inline void bw_one_pole_reset_coeffs(bw_one_pole_coeffs *BW_RESTRICT coeffs) {
|
||||
BW_ASSERT(coeffs != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_set_sample_rate);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_set_sample_rate);
|
||||
|
||||
coeffs->param_changed = ~0;
|
||||
_bw_one_pole_do_update_coeffs_ctrl(coeffs);
|
||||
@ -432,13 +448,13 @@ static inline void bw_one_pole_reset_coeffs(bw_one_pole_coeffs *BW_RESTRICT coef
|
||||
coeffs->reset_id++;
|
||||
#endif
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state == _bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(coeffs->state == bw_one_pole_coeffs_state_reset_coeffs);
|
||||
}
|
||||
|
||||
static inline void bw_one_pole_reset_state(const bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state *BW_RESTRICT state, float y_z1) {
|
||||
BW_ASSERT(coeffs != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT(state != NULL);
|
||||
BW_ASSERT(bw_is_finite(y_z1));
|
||||
|
||||
@ -458,18 +474,18 @@ static inline void bw_one_pole_reset_state(const bw_one_pole_coeffs *BW_RESTRICT
|
||||
static inline void bw_one_pole_update_coeffs_ctrl(bw_one_pole_coeffs *BW_RESTRICT coeffs) {
|
||||
BW_ASSERT(coeffs != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||
|
||||
_bw_one_pole_do_update_coeffs_ctrl(coeffs);
|
||||
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||
}
|
||||
|
||||
static inline void bw_one_pole_update_coeffs_audio(bw_one_pole_coeffs *BW_RESTRICT coeffs) {
|
||||
BW_ASSERT(coeffs != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||
|
||||
(void)coeffs;
|
||||
}
|
||||
@ -477,7 +493,7 @@ static inline void bw_one_pole_update_coeffs_audio(bw_one_pole_coeffs *BW_RESTRI
|
||||
static inline float bw_one_pole_process1(const bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state *BW_RESTRICT state, float x) {
|
||||
BW_ASSERT(coeffs != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT(state != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
||||
@ -487,7 +503,7 @@ static inline float bw_one_pole_process1(const bw_one_pole_coeffs *BW_RESTRICT c
|
||||
state->y_z1 = y;
|
||||
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
||||
BW_ASSERT(bw_is_finite(y));
|
||||
@ -498,7 +514,7 @@ static inline float bw_one_pole_process1(const bw_one_pole_coeffs *BW_RESTRICT c
|
||||
static inline float bw_one_pole_process1_sticky_abs(const bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state *BW_RESTRICT state, float x) {
|
||||
BW_ASSERT(coeffs != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT(state != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
||||
@ -511,7 +527,7 @@ static inline float bw_one_pole_process1_sticky_abs(const bw_one_pole_coeffs *BW
|
||||
state->y_z1 = y;
|
||||
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
||||
BW_ASSERT(bw_is_finite(y));
|
||||
@ -522,7 +538,7 @@ static inline float bw_one_pole_process1_sticky_abs(const bw_one_pole_coeffs *BW
|
||||
static inline float bw_one_pole_process1_sticky_rel(const bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state *BW_RESTRICT state, float x) {
|
||||
BW_ASSERT(coeffs != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT(state != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
||||
@ -535,7 +551,7 @@ static inline float bw_one_pole_process1_sticky_rel(const bw_one_pole_coeffs *BW
|
||||
state->y_z1 = y;
|
||||
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
||||
BW_ASSERT(bw_is_finite(y));
|
||||
@ -546,7 +562,7 @@ static inline float bw_one_pole_process1_sticky_rel(const bw_one_pole_coeffs *BW
|
||||
static inline float bw_one_pole_process1_asym(const bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state *BW_RESTRICT state, float x) {
|
||||
BW_ASSERT(coeffs != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT(state != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
||||
@ -556,7 +572,7 @@ static inline float bw_one_pole_process1_asym(const bw_one_pole_coeffs *BW_RESTR
|
||||
state->y_z1 = y;
|
||||
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
||||
BW_ASSERT(bw_is_finite(y));
|
||||
@ -567,7 +583,7 @@ static inline float bw_one_pole_process1_asym(const bw_one_pole_coeffs *BW_RESTR
|
||||
static inline float bw_one_pole_process1_asym_sticky_abs(const bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state *BW_RESTRICT state, float x) {
|
||||
BW_ASSERT(coeffs != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT(state != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
||||
@ -580,7 +596,7 @@ static inline float bw_one_pole_process1_asym_sticky_abs(const bw_one_pole_coeff
|
||||
state->y_z1 = y;
|
||||
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
||||
BW_ASSERT(bw_is_finite(y));
|
||||
@ -591,7 +607,7 @@ static inline float bw_one_pole_process1_asym_sticky_abs(const bw_one_pole_coeff
|
||||
static inline float bw_one_pole_process1_asym_sticky_rel(const bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state *BW_RESTRICT state, float x) {
|
||||
BW_ASSERT(coeffs != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT(state != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
||||
@ -604,7 +620,7 @@ static inline float bw_one_pole_process1_asym_sticky_rel(const bw_one_pole_coeff
|
||||
state->y_z1 = y;
|
||||
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
||||
BW_ASSERT(bw_is_finite(y));
|
||||
@ -615,7 +631,7 @@ static inline float bw_one_pole_process1_asym_sticky_rel(const bw_one_pole_coeff
|
||||
static inline void bw_one_pole_process(bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state *BW_RESTRICT state, const float *x, float *y, size_t n_samples) {
|
||||
BW_ASSERT(coeffs != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT(state != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
||||
@ -684,16 +700,16 @@ static inline void bw_one_pole_process(bw_one_pole_coeffs *BW_RESTRICT coeffs, b
|
||||
}
|
||||
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
||||
BW_ASSERT_DEEP(!bw_has_nan(y, n_samples));
|
||||
}
|
||||
|
||||
static inline void bw_one_pole_process_multi(bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state **BW_RESTRICT state, const float **x, float **y, size_t n_channels, size_t n_samples) {
|
||||
static inline void bw_one_pole_process_multi(bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state **BW_RESTRICT state, const float * const *x, float **y, size_t n_channels, size_t n_samples) {
|
||||
BW_ASSERT(coeffs != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||
//...
|
||||
|
||||
bw_one_pole_update_coeffs_ctrl(coeffs);
|
||||
@ -800,7 +816,7 @@ static inline void bw_one_pole_process_multi(bw_one_pole_coeffs *BW_RESTRICT coe
|
||||
static inline void bw_one_pole_set_cutoff(bw_one_pole_coeffs *BW_RESTRICT coeffs, float value) {
|
||||
BW_ASSERT(coeffs != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT(!bw_is_nan(value));
|
||||
BW_ASSERT(value >= 0.f);
|
||||
|
||||
@ -808,45 +824,45 @@ static inline void bw_one_pole_set_cutoff(bw_one_pole_coeffs *BW_RESTRICT coeffs
|
||||
bw_one_pole_set_cutoff_down(coeffs, value);
|
||||
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
|
||||
}
|
||||
|
||||
static inline void bw_one_pole_set_cutoff_up(bw_one_pole_coeffs *BW_RESTRICT coeffs, float value) {
|
||||
BW_ASSERT(coeffs != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT(!bw_is_nan(value));
|
||||
BW_ASSERT(value >= 0.f);
|
||||
|
||||
if (coeffs->cutoff_up != value) {
|
||||
coeffs->cutoff_up = value;
|
||||
coeffs->param_changed |= _BW_ONE_POLE_PARAM_CUTOFF_UP;
|
||||
coeffs->param_changed |= BW_ONE_POLE_PARAM_CUTOFF_UP;
|
||||
}
|
||||
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
|
||||
}
|
||||
|
||||
static inline void bw_one_pole_set_cutoff_down(bw_one_pole_coeffs *BW_RESTRICT coeffs, float value) {
|
||||
BW_ASSERT(coeffs != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT(!bw_is_nan(value));
|
||||
BW_ASSERT(value >= 0.f);
|
||||
|
||||
if (coeffs->cutoff_down != value) {
|
||||
coeffs->cutoff_down = value;
|
||||
coeffs->param_changed |= _BW_ONE_POLE_PARAM_CUTOFF_DOWN;
|
||||
coeffs->param_changed |= BW_ONE_POLE_PARAM_CUTOFF_DOWN;
|
||||
}
|
||||
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
|
||||
}
|
||||
|
||||
static inline void bw_one_pole_set_tau(bw_one_pole_coeffs *BW_RESTRICT coeffs, float value) {
|
||||
BW_ASSERT(coeffs != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT(!bw_is_nan(value));
|
||||
BW_ASSERT(value >= 0.f);
|
||||
|
||||
@ -854,13 +870,13 @@ static inline void bw_one_pole_set_tau(bw_one_pole_coeffs *BW_RESTRICT coeffs, f
|
||||
bw_one_pole_set_tau_down(coeffs, value);
|
||||
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
|
||||
}
|
||||
|
||||
static inline void bw_one_pole_set_tau_up(bw_one_pole_coeffs *BW_RESTRICT coeffs, float value) {
|
||||
BW_ASSERT(coeffs != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT(!bw_is_nan(value));
|
||||
BW_ASSERT(value >= 0.f);
|
||||
|
||||
@ -868,13 +884,13 @@ static inline void bw_one_pole_set_tau_up(bw_one_pole_coeffs *BW_RESTRICT coeffs
|
||||
// tau < 1 ns is instantaneous for any practical purpose
|
||||
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
|
||||
}
|
||||
|
||||
static inline void bw_one_pole_set_tau_down(bw_one_pole_coeffs *BW_RESTRICT coeffs, float value) {
|
||||
BW_ASSERT(coeffs != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT(!bw_is_nan(value));
|
||||
BW_ASSERT(value >= 0.f);
|
||||
|
||||
@ -882,34 +898,34 @@ static inline void bw_one_pole_set_tau_down(bw_one_pole_coeffs *BW_RESTRICT coef
|
||||
// as before
|
||||
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
|
||||
}
|
||||
|
||||
static inline void bw_one_pole_set_sticky_thresh(bw_one_pole_coeffs *BW_RESTRICT coeffs, float value) {
|
||||
BW_ASSERT(coeffs != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
|
||||
//...
|
||||
|
||||
if (coeffs->sticky_thresh != value) {
|
||||
coeffs->sticky_thresh = value;
|
||||
coeffs->param_changed |= _BW_ONE_POLE_PARAM_STICKY_THRESH;
|
||||
coeffs->param_changed |= BW_ONE_POLE_PARAM_STICKY_THRESH;
|
||||
}
|
||||
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
|
||||
}
|
||||
|
||||
static inline void bw_one_pole_set_sticky_mode(bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_sticky_mode value) {
|
||||
BW_ASSERT(coeffs != NULL);
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
|
||||
//...
|
||||
|
||||
coeffs->sticky_mode = value;
|
||||
|
||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init);
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
|
||||
}
|
||||
|
||||
static inline float bw_one_pole_get_y_z1(const bw_one_pole_state *BW_RESTRICT state) {
|
||||
@ -943,11 +959,144 @@ static inline char bw_one_pole_state_is_valid(const bw_one_pole_state *BW_RESTRI
|
||||
return bw_is_finite(state->y_z1);
|
||||
}
|
||||
|
||||
#undef _BW_ONE_POLE_PARAM_CUTOFF_UP
|
||||
#undef _BW_ONE_POLE_PARAM_CUTOFF_DOWN
|
||||
#undef _BW_ONE_POLE_PARAM_STICKY_THRESH
|
||||
#undef BW_ONE_POLE_PARAM_CUTOFF_UP
|
||||
#undef BW_ONE_POLE_PARAM_CUTOFF_DOWN
|
||||
#undef BW_ONE_POLE_PARAM_STICKY_THRESH
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace Brickworks {
|
||||
|
||||
/*** Public C++ API ***/
|
||||
|
||||
/*! api_cpp {{{
|
||||
* ##### Brickworks::OnePole
|
||||
* ```>>> */
|
||||
template<size_t N_CHANNELS>
|
||||
class OnePole {
|
||||
public:
|
||||
OnePole();
|
||||
|
||||
void setSampleRate(float sampleRate);
|
||||
void reset(float y_z1 = 0.f);
|
||||
void process(
|
||||
const float * const *x,
|
||||
float **y,
|
||||
int nSamples);
|
||||
void process(
|
||||
std::array<const float *, N_CHANNELS> x,
|
||||
std::array<float *, N_CHANNELS> y,
|
||||
int nSamples);
|
||||
|
||||
void setCutoff(float value);
|
||||
void setCutoffUp(float value);
|
||||
void setCutoffDown(float value);
|
||||
void setTau(float value);
|
||||
void setTauUp(float value);
|
||||
void setTauDown(float value);
|
||||
void setStickyThresh(float value);
|
||||
void setStickyMode(bw_one_pole_sticky_mode value);
|
||||
|
||||
float getYZ1(size_t channel);
|
||||
/*! <<<...
|
||||
* }
|
||||
* ```
|
||||
* }}} */
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
* change at any time in future versions. Please, do not use it directly. */
|
||||
|
||||
private:
|
||||
bw_one_pole_coeffs coeffs;
|
||||
bw_one_pole_state states[N_CHANNELS];
|
||||
bw_one_pole_state *statesP[N_CHANNELS];
|
||||
};
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline OnePole<N_CHANNELS>::OnePole() {
|
||||
bw_one_pole_init(&coeffs);
|
||||
for (size_t i = 0; i < N_CHANNELS; i++)
|
||||
statesP[i] = states + i;
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void OnePole<N_CHANNELS>::setSampleRate(float sampleRate) {
|
||||
bw_one_pole_set_sample_rate(&coeffs, sampleRate);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void OnePole<N_CHANNELS>::reset(float y_z1) {
|
||||
bw_one_pole_reset_coeffs(&coeffs);
|
||||
for (size_t i = 0; i < N_CHANNELS; i++)
|
||||
bw_one_pole_reset_state(&coeffs, states + i, y_z1);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void OnePole<N_CHANNELS>::process(
|
||||
const float * const *x,
|
||||
float **y,
|
||||
int nSamples) {
|
||||
bw_one_pole_process_multi(&coeffs, statesP, x, y, N_CHANNELS, nSamples);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void OnePole<N_CHANNELS>::process(
|
||||
std::array<const float *, N_CHANNELS> x,
|
||||
std::array<float *, N_CHANNELS> y,
|
||||
int nSamples) {
|
||||
process(x.data(), y.data(), nSamples);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void OnePole<N_CHANNELS>::setCutoff(float value) {
|
||||
bw_one_pole_set_cutoff(&coeffs, value);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void OnePole<N_CHANNELS>::setCutoffUp(float value) {
|
||||
bw_one_pole_set_cutoff_up(&coeffs, value);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void OnePole<N_CHANNELS>::setCutoffDown(float value) {
|
||||
bw_one_pole_set_cutoff_down(&coeffs, value);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void OnePole<N_CHANNELS>::setTau(float value) {
|
||||
bw_one_pole_set_tau(&coeffs, value);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void OnePole<N_CHANNELS>::setTauUp(float value) {
|
||||
bw_one_pole_set_tau_up(&coeffs, value);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void OnePole<N_CHANNELS>::setTauDown(float value) {
|
||||
bw_one_pole_set_tau_down(&coeffs, value);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void OnePole<N_CHANNELS>::setStickyThresh(float value) {
|
||||
bw_one_pole_set_sticky_thresh(&coeffs, value);
|
||||
}
|
||||
|
||||
template<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<size_t N_CHANNELS>
|
||||
inline float OnePole<N_CHANNELS>::getYZ1(size_t channel) {
|
||||
return bw_one_pole_get_y_z1(states + channel);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -67,12 +67,12 @@
|
||||
#ifndef _BW_OSC_FILT_H
|
||||
#define _BW_OSC_FILT_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_osc_filt_state
|
||||
* ```>>> */
|
||||
@ -110,11 +110,19 @@ static inline void bw_osc_filt_process_multi(bw_osc_filt_state **BW_RESTRICT sta
|
||||
* using and updating each of the `n_channels` `state`s.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** 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. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_osc_filt_state {
|
||||
float x_z1;
|
||||
float y_z1;
|
||||
|
@ -70,12 +70,12 @@
|
||||
#ifndef _BW_OSC_PULSE_H
|
||||
#define _BW_OSC_PULSE_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_osc_pulse_coeffs
|
||||
* ```>>> */
|
||||
@ -170,6 +170,10 @@ static inline void bw_osc_pulse_set_pulse_width(bw_osc_pulse_coeffs *BW_RESTRICT
|
||||
* Default value: `0.5f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -178,6 +182,10 @@ static inline void bw_osc_pulse_set_pulse_width(bw_osc_pulse_coeffs *BW_RESTRICT
|
||||
#include <bw_math.h>
|
||||
#include <bw_one_pole.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_osc_pulse_coeffs {
|
||||
// Sub-components
|
||||
bw_one_pole_coeffs smooth_coeffs;
|
||||
|
@ -69,12 +69,12 @@
|
||||
#ifndef _BW_OSC_SAW_H
|
||||
#define _BW_OSC_SAW_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_osc_saw_coeffs
|
||||
* ```>>> */
|
||||
@ -135,6 +135,10 @@ static inline void bw_osc_saw_set_antialiasing(bw_osc_saw_coeffs *BW_RESTRICT co
|
||||
* Default value: `0` (off).
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -142,6 +146,10 @@ static inline void bw_osc_saw_set_antialiasing(bw_osc_saw_coeffs *BW_RESTRICT co
|
||||
|
||||
#include <bw_math.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_osc_saw_coeffs {
|
||||
// Parameters
|
||||
char antialiasing;
|
||||
|
@ -64,12 +64,12 @@
|
||||
#ifndef _BW_OSC_SIN_H
|
||||
#define _BW_OSC_SIN_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_osc_sin_process1()
|
||||
* ```>>> */
|
||||
@ -96,6 +96,10 @@ static inline void bw_osc_sin_process_multi(const float **x, float **y, int n_ch
|
||||
* of the `n_channels` output buffers `y`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -103,6 +107,10 @@ static inline void bw_osc_sin_process_multi(const float **x, float **y, int n_ch
|
||||
|
||||
#include <bw_math.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static inline float bw_osc_sin_process1(float x) {
|
||||
return bw_sin2pif(x);
|
||||
}
|
||||
|
@ -72,12 +72,12 @@
|
||||
#ifndef _BW_OSC_TRI_H
|
||||
#define _BW_OSC_TRI_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_osc_tri_coeffs
|
||||
* ```>>> */
|
||||
@ -172,6 +172,10 @@ static inline void bw_osc_tri_set_slope(bw_osc_tri_coeffs *BW_RESTRICT coeffs, f
|
||||
* Default value: `0.5f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -180,6 +184,10 @@ static inline void bw_osc_tri_set_slope(bw_osc_tri_coeffs *BW_RESTRICT coeffs, f
|
||||
#include <bw_math.h>
|
||||
#include <bw_one_pole.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_osc_tri_coeffs {
|
||||
// Sub-components
|
||||
bw_one_pole_coeffs smooth_coeffs;
|
||||
|
@ -58,12 +58,12 @@
|
||||
#ifndef _BW_PAN_H
|
||||
#define _BW_PAN_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_pan_coeffs
|
||||
* ```>>> */
|
||||
@ -136,6 +136,10 @@ static inline void bw_pan_set_pan(bw_pan_coeffs *BW_RESTRICT coeffs, float value
|
||||
* Default value: `0.f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -144,6 +148,10 @@ static inline void bw_pan_set_pan(bw_pan_coeffs *BW_RESTRICT coeffs, float value
|
||||
#include <bw_math.h>
|
||||
#include <bw_gain.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_pan_coeffs {
|
||||
// Sub-components
|
||||
bw_gain_coeffs l_coeffs;
|
||||
|
@ -72,12 +72,12 @@
|
||||
#ifndef _BW_PEAK_H
|
||||
#define _BW_PEAK_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_peak_coeffs
|
||||
* ```>>> */
|
||||
@ -205,6 +205,10 @@ static inline void bw_peak_set_use_bandwidth(bw_peak_coeffs *BW_RESTRICT coeffs,
|
||||
* Default value: non-`0` (use bandwidth parameter).
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -213,6 +217,10 @@ static inline void bw_peak_set_use_bandwidth(bw_peak_coeffs *BW_RESTRICT coeffs,
|
||||
#include <bw_mm2.h>
|
||||
#include <bw_math.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_peak_coeffs {
|
||||
// Sub-components
|
||||
bw_mm2_coeffs mm2_coeffs;
|
||||
|
@ -74,12 +74,12 @@
|
||||
#ifndef _BW_PHASE_GEN_H
|
||||
#define _BW_PHASE_GEN_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_phase_gen_coeffs
|
||||
* ```>>> */
|
||||
@ -188,6 +188,10 @@ static inline void bw_phase_gen_set_portamento_tau(bw_phase_gen_coeffs *BW_RESTR
|
||||
* Default value: `0.f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -196,6 +200,10 @@ static inline void bw_phase_gen_set_portamento_tau(bw_phase_gen_coeffs *BW_RESTR
|
||||
#include <bw_math.h>
|
||||
#include <bw_one_pole.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_phase_gen_coeffs {
|
||||
// Sub-components
|
||||
bw_one_pole_coeffs portamento_coeffs;
|
||||
|
@ -60,12 +60,12 @@
|
||||
#ifndef _BW_PHASER_H
|
||||
#define _BW_PHASER_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_phaser_coeffs
|
||||
* ```>>> */
|
||||
@ -164,6 +164,10 @@ static inline void bw_phaser_set_amount(bw_phaser_coeffs *BW_RESTRICT coeffs, fl
|
||||
* Default value: `1.f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -174,6 +178,10 @@ static inline void bw_phaser_set_amount(bw_phaser_coeffs *BW_RESTRICT coeffs, fl
|
||||
#include <bw_ap1.h>
|
||||
#include <bw_math.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_phaser_coeffs {
|
||||
// Sub-components
|
||||
bw_phase_gen_coeffs phase_gen_coeffs;
|
||||
|
@ -81,12 +81,12 @@
|
||||
#ifndef _BW_PINK_FILT_H
|
||||
#define _BW_PINK_FILT_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_pink_filt_coeffs
|
||||
* ```>>> */
|
||||
@ -170,11 +170,19 @@ static inline float bw_pink_filt_get_scaling_k(const bw_pink_filt_coeffs *BW_RES
|
||||
* if sample rate scaling were enabled, as stored in `coeffs`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** 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. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_pink_filt_coeffs {
|
||||
// Coefficients
|
||||
float scaling_k;
|
||||
|
@ -61,12 +61,12 @@
|
||||
#ifndef _BW_PPM_H
|
||||
#define _BW_PPM_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_ppm_coeffs
|
||||
* ```>>> */
|
||||
@ -163,6 +163,10 @@ static inline float bw_ppm_get_y_z1(const bw_ppm_state *BW_RESTRICT state);
|
||||
* Returns the last output sample as stored in `state`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -170,6 +174,10 @@ static inline float bw_ppm_get_y_z1(const bw_ppm_state *BW_RESTRICT state);
|
||||
|
||||
#include <bw_env_follow.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_ppm_coeffs {
|
||||
// Sub-components
|
||||
bw_env_follow_coeffs env_follow_coeffs;
|
||||
|
@ -70,6 +70,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*** Public API ***/
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_randu32()
|
||||
* ```>>> */
|
||||
|
@ -58,12 +58,12 @@
|
||||
#ifndef _BW_REVERB_H
|
||||
#define _BW_REVERB_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_reverb_coeffs
|
||||
* ```>>> */
|
||||
@ -198,6 +198,10 @@ static inline void bw_reverb_set_wet(bw_reverb_coeffs *BW_RESTRICT coeffs, float
|
||||
* Default value: `0.5f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -212,6 +216,10 @@ static inline void bw_reverb_set_wet(bw_reverb_coeffs *BW_RESTRICT coeffs, float
|
||||
#include <bw_one_pole.h>
|
||||
#include <bw_math.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_reverb_coeffs {
|
||||
// Sub-components
|
||||
bw_delay_coeffs predelay_coeffs;
|
||||
|
@ -58,12 +58,12 @@
|
||||
#ifndef _BW_RINGMOD_H
|
||||
#define _BW_RINGMOD_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_ringmod_coeffs
|
||||
* ```>>> */
|
||||
@ -137,6 +137,10 @@ static inline void bw_ringmod_set_amount(bw_ringmod_coeffs *BW_RESTRICT coeffs,
|
||||
* Default value: `1.f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -145,6 +149,10 @@ static inline void bw_ringmod_set_amount(bw_ringmod_coeffs *BW_RESTRICT coeffs,
|
||||
#include <bw_math.h>
|
||||
#include <bw_one_pole.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_ringmod_coeffs {
|
||||
// Sub-components
|
||||
bw_one_pole_coeffs smooth_coeffs;
|
||||
|
@ -74,12 +74,12 @@
|
||||
#ifndef _BW_SATUR_H
|
||||
#define _BW_SATUR_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_satur_coeffs
|
||||
* ```>>> */
|
||||
@ -186,6 +186,10 @@ static inline void bw_satur_set_gain_compensation(bw_satur_coeffs *BW_RESTRICT c
|
||||
* Default value: `1` (on).
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -194,6 +198,10 @@ static inline void bw_satur_set_gain_compensation(bw_satur_coeffs *BW_RESTRICT c
|
||||
#include <bw_math.h>
|
||||
#include <bw_one_pole.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_satur_coeffs {
|
||||
// Sub-components
|
||||
bw_one_pole_coeffs smooth_coeffs;
|
||||
|
@ -63,12 +63,12 @@
|
||||
#ifndef _BW_SLEW_LIM_H
|
||||
#define _BW_SLEW_LIM_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_slew_lim_coeffs
|
||||
* ```>>> */
|
||||
@ -205,6 +205,10 @@ static inline void bw_slew_lim_set_max_rate_down(bw_slew_lim_coeffs *BW_RESTRICT
|
||||
|
||||
static inline float bw_slew_lim_get_y_z1(const bw_slew_lim_state *BW_RESTRICT state);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -212,6 +216,10 @@ static inline float bw_slew_lim_get_y_z1(const bw_slew_lim_state *BW_RESTRICT st
|
||||
|
||||
#include <bw_math.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_slew_lim_coeffs {
|
||||
// Coefficients
|
||||
float T;
|
||||
|
@ -65,12 +65,12 @@
|
||||
#ifndef _BW_SR_REDUCE_H
|
||||
#define _BW_SR_REDUCE_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_sr_reduce_coeffs
|
||||
* ```>>> */
|
||||
@ -131,6 +131,10 @@ static inline void bw_sr_reduce_set_ratio(bw_sr_reduce_coeffs *BW_RESTRICT coeff
|
||||
* Default value: `1.f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -138,6 +142,10 @@ static inline void bw_sr_reduce_set_ratio(bw_sr_reduce_coeffs *BW_RESTRICT coeff
|
||||
|
||||
#include <bw_math.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_sr_reduce_coeffs {
|
||||
// Parameters
|
||||
float ratio;
|
||||
|
@ -56,12 +56,12 @@
|
||||
#ifndef _BW_SRC_H
|
||||
#define _BW_SRC_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_src_coeffs
|
||||
* ```>>> */
|
||||
@ -119,6 +119,10 @@ static inline void bw_src_process_multi(const bw_src_coeffs *BW_RESTRICT coeffs,
|
||||
* couples.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -126,6 +130,10 @@ static inline void bw_src_process_multi(const bw_src_coeffs *BW_RESTRICT coeffs,
|
||||
|
||||
#include <bw_math.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_src_coeffs {
|
||||
float k;
|
||||
float a1;
|
||||
|
@ -62,12 +62,12 @@
|
||||
#ifndef _BW_SRC_INT_H
|
||||
#define _BW_SRC_INT_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_src_int_coeffs
|
||||
* ```>>> */
|
||||
@ -130,6 +130,10 @@ static inline void bw_src_int_process_multi(const bw_src_int_coeffs *BW_RESTRICT
|
||||
* buffer, if not `NULL`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -137,6 +141,10 @@ static inline void bw_src_int_process_multi(const bw_src_int_coeffs *BW_RESTRICT
|
||||
|
||||
#include <bw_math.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_src_int_coeffs {
|
||||
int ratio;
|
||||
float a1;
|
||||
|
@ -82,12 +82,12 @@
|
||||
#ifndef _BW_SVF_H
|
||||
#define _BW_SVF_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_svf_coeffs
|
||||
* ```>>> */
|
||||
@ -208,6 +208,10 @@ static inline void bw_svf_set_prewarp_freq(bw_svf_coeffs *BW_RESTRICT coeffs, fl
|
||||
* Default value: `1e3f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -216,6 +220,10 @@ static inline void bw_svf_set_prewarp_freq(bw_svf_coeffs *BW_RESTRICT coeffs, fl
|
||||
#include <bw_math.h>
|
||||
#include <bw_one_pole.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_svf_coeffs {
|
||||
// Sub-components
|
||||
bw_one_pole_coeffs smooth_coeffs;
|
||||
|
@ -58,12 +58,12 @@
|
||||
#ifndef _BW_TREM_H
|
||||
#define _BW_TREM_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_trem_coeffs
|
||||
* ```>>> */
|
||||
@ -155,6 +155,10 @@ static inline void bw_trem_set_amount(bw_trem_coeffs *BW_RESTRICT coeffs, float
|
||||
* Default value: `1.f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -164,6 +168,10 @@ static inline void bw_trem_set_amount(bw_trem_coeffs *BW_RESTRICT coeffs, float
|
||||
#include <bw_osc_sin.h>
|
||||
#include <bw_ringmod.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_trem_coeffs {
|
||||
// Sub-components
|
||||
bw_phase_gen_coeffs phase_gen_coeffs;
|
||||
|
@ -57,12 +57,14 @@
|
||||
#ifndef BW_VOICE_ALLOC_H
|
||||
#define BW_VOICE_ALLOC_H
|
||||
|
||||
#include <bw_common.h>
|
||||
#include <bw_note_queue.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
#include <bw_note_queue.h>
|
||||
/*** Public API ***/
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_voice_alloc_priority
|
||||
@ -110,11 +112,19 @@ void bw_voice_alloc(const bw_voice_alloc_opts *BW_RESTRICT opts, bw_note_queue *
|
||||
* the number of elements in `voices`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** 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. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void bw_voice_alloc(const bw_voice_alloc_opts *BW_RESTRICT opts, bw_note_queue *BW_RESTRICT queue, void * const *BW_RESTRICT voices, size_t n_voices) {
|
||||
BW_ASSERT(opts != NULL);
|
||||
BW_ASSERT(opts->priority == bw_voice_alloc_priority_low || opts->priority == bw_voice_alloc_priority_high);
|
||||
|
@ -72,12 +72,12 @@
|
||||
#ifndef _BW_WAH_H
|
||||
#define _BW_WAH_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_wah_coeffs
|
||||
* ```>>> */
|
||||
@ -161,6 +161,10 @@ static inline void bw_wah_set_wah(bw_wah_coeffs *BW_RESTRICT coeffs, float value
|
||||
* Default value: `0.5f`.
|
||||
* }}} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
@ -168,6 +172,10 @@ static inline void bw_wah_set_wah(bw_wah_coeffs *BW_RESTRICT coeffs, float value
|
||||
|
||||
#include <bw_svf.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_wah_coeffs {
|
||||
// Sub-components
|
||||
bw_svf_coeffs svf_coeffs;
|
||||
|
@ -1,144 +0,0 @@
|
||||
/*
|
||||
* 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_ONE_POLE_H
|
||||
#define BWPP_ONE_POLE_H
|
||||
|
||||
#include <bw_one_pole.h>
|
||||
#include <array>
|
||||
|
||||
namespace Brickworks {
|
||||
|
||||
/*! api {{{
|
||||
* ##### Brickworks::OnePole
|
||||
* ```>>> */
|
||||
template<size_t N_CHANNELS>
|
||||
class OnePole {
|
||||
public:
|
||||
OnePole();
|
||||
|
||||
void setSampleRate(float sampleRate);
|
||||
void reset(float y_z1 = 0.f);
|
||||
void process(
|
||||
std::array<const float *, N_CHANNELS> x,
|
||||
std::array<float *, N_CHANNELS> y,
|
||||
int nSamples);
|
||||
|
||||
void setCutoff(float value);
|
||||
void setCutoffUp(float value);
|
||||
void setCutoffDown(float value);
|
||||
void setTau(float value);
|
||||
void setTauUp(float value);
|
||||
void setTauDown(float value);
|
||||
void setStickyThresh(float value);
|
||||
void setStickyMode(bw_one_pole_sticky_mode value);
|
||||
|
||||
float getYZ1(size_t channel);
|
||||
/*! <<<...
|
||||
* }
|
||||
* ```
|
||||
* }}} */
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
* change at any time in future versions. Please, do not use it directly. */
|
||||
|
||||
private:
|
||||
bw_one_pole_coeffs coeffs;
|
||||
bw_one_pole_state states[N_CHANNELS];
|
||||
bw_one_pole_state *statesP[N_CHANNELS];
|
||||
};
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline OnePole<N_CHANNELS>::OnePole() {
|
||||
bw_one_pole_init(&coeffs);
|
||||
for (size_t i = 0; i < N_CHANNELS; i++)
|
||||
statesP[i] = states + i;
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void OnePole<N_CHANNELS>::setSampleRate(float sampleRate) {
|
||||
bw_one_pole_set_sample_rate(&coeffs, sampleRate);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void OnePole<N_CHANNELS>::reset(float y_z1) {
|
||||
bw_one_pole_reset_coeffs(&coeffs);
|
||||
for (size_t i = 0; i < N_CHANNELS; i++)
|
||||
bw_one_pole_reset_state(&coeffs, states + i, y_z1);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void OnePole<N_CHANNELS>::process(
|
||||
std::array<const float *, N_CHANNELS> x,
|
||||
std::array<float *, N_CHANNELS> y,
|
||||
int nSamples) {
|
||||
bw_one_pole_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void OnePole<N_CHANNELS>::setCutoff(float value) {
|
||||
bw_one_pole_set_cutoff(&coeffs, value);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void OnePole<N_CHANNELS>::setCutoffUp(float value) {
|
||||
bw_one_pole_set_cutoff_up(&coeffs, value);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void OnePole<N_CHANNELS>::setCutoffDown(float value) {
|
||||
bw_one_pole_set_cutoff_down(&coeffs, value);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void OnePole<N_CHANNELS>::setTau(float value) {
|
||||
bw_one_pole_set_tau(&coeffs, value);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void OnePole<N_CHANNELS>::setTauUp(float value) {
|
||||
bw_one_pole_set_tau_up(&coeffs, value);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void OnePole<N_CHANNELS>::setTauDown(float value) {
|
||||
bw_one_pole_set_tau_down(&coeffs, value);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void OnePole<N_CHANNELS>::setStickyThresh(float value) {
|
||||
bw_one_pole_set_sticky_thresh(&coeffs, value);
|
||||
}
|
||||
|
||||
template<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<size_t N_CHANNELS>
|
||||
inline float OnePole<N_CHANNELS>::getYZ1(size_t channel) {
|
||||
return bw_one_pole_get_y_z1(states + channel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user