polished bw_{ap1,ap2,one_pole} + removed bwpp_{ap1,ap2} + fixed examples
This commit is contained in:
parent
48275d077d
commit
5ec809bc4f
3
TODO
3
TODO
@ -28,7 +28,7 @@ code:
|
||||
* make gain of distortions homogeneous?
|
||||
* max_delay -> set sample rate? see reverb
|
||||
* revise typedef style (see https://stackoverflow.com/questions/54752861/using-an-anonymous-struct-vs-a-named-struct-with-typedef)
|
||||
* x_y vs xy var names
|
||||
* var names xy -> x_y
|
||||
* don't use reserved identifiers (https://devblogs.microsoft.com/oldnewthing/20230109-00/?p=107685)
|
||||
* update state ctrl -> process ctrl?
|
||||
* mem req -> return value of set sample rate?
|
||||
@ -44,6 +44,7 @@ code:
|
||||
* clearly specify that state is tied to a particular set of coeffs (1:N)
|
||||
* modulation vs process (multi) no update (post 1.0.0)???
|
||||
* check assumptions w.r.t. usage of math functions
|
||||
* extern "C" in a macro to be individually applied (easier #include)
|
||||
|
||||
build system:
|
||||
* single header generation (vs modules in bwp... to think about)
|
||||
|
@ -21,14 +21,14 @@
|
||||
#ifndef _BW_EXAMPLE_FX_AP1_H
|
||||
#define _BW_EXAMPLE_FX_AP1_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_ap1.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_cutoff,
|
||||
p_n
|
||||
|
@ -21,14 +21,14 @@
|
||||
#ifndef _BW_EXAMPLE_FX_AP2_H
|
||||
#define _BW_EXAMPLE_FX_AP2_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_ap2.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_cutoff,
|
||||
p_Q,
|
||||
|
@ -21,16 +21,16 @@
|
||||
#ifndef _BW_EXAMPLE_FX_BALANCE_H
|
||||
#define _BW_EXAMPLE_FX_BALANCE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_balance.h>
|
||||
#include <bw_ppm.h>
|
||||
#include <bw_math.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_balance,
|
||||
p_n
|
||||
|
@ -21,13 +21,15 @@
|
||||
#ifndef _BW_EXAMPLE_FX_BITCRUSH_H
|
||||
#define _BW_EXAMPLE_FX_BITCRUSH_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_sr_reduce.h>
|
||||
#include <bw_bd_reduce.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_sr_ratio,
|
||||
p_bit_depth,
|
||||
|
@ -21,14 +21,14 @@
|
||||
#ifndef _BW_EXAMPLE_FX_CHORUS_H
|
||||
#define _BW_EXAMPLE_FX_CHORUS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_chorus.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_rate,
|
||||
p_depth,
|
||||
|
@ -21,15 +21,15 @@
|
||||
#ifndef _BW_EXAMPLE_FX_CLIP_H
|
||||
#define _BW_EXAMPLE_FX_CLIP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_clip.h>
|
||||
#include <bw_src_int.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_bias,
|
||||
p_gain,
|
||||
|
@ -21,14 +21,14 @@
|
||||
#ifndef _BW_EXAMPLE_FX_COMB_H
|
||||
#define _BW_EXAMPLE_FX_COMB_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_comb.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_ff_delay,
|
||||
p_fb_delay,
|
||||
|
@ -21,14 +21,14 @@
|
||||
#ifndef _BW_EXAMPLE_FX_COMP_H
|
||||
#define _BW_EXAMPLE_FX_COMP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_comp.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_thresh,
|
||||
p_ratio,
|
||||
|
@ -21,14 +21,14 @@
|
||||
#ifndef _BW_EXAMPLE_FX_DELAY_H
|
||||
#define _BW_EXAMPLE_FX_DELAY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_delay.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_delay,
|
||||
p_n
|
||||
|
@ -21,15 +21,15 @@
|
||||
#ifndef _BW_EXAMPLE_FX_DIST_H
|
||||
#define _BW_EXAMPLE_FX_DIST_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_dist.h>
|
||||
#include <bw_src_int.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_dist,
|
||||
p_tone,
|
||||
|
@ -21,15 +21,15 @@
|
||||
#ifndef _BW_EXAMPLE_FX_DRIVE_H
|
||||
#define _BW_EXAMPLE_FX_DRIVE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_drive.h>
|
||||
#include <bw_src_int.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_drive,
|
||||
p_tone,
|
||||
|
@ -21,16 +21,16 @@
|
||||
#ifndef _BW_EXAMPLE_FX_EQ_3BAND_H
|
||||
#define _BW_EXAMPLE_FX_EQ_3BAND_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_ls2.h>
|
||||
#include <bw_hs2.h>
|
||||
#include <bw_peak.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_ls_cutoff,
|
||||
p_ls_gain,
|
||||
|
@ -21,14 +21,14 @@
|
||||
#ifndef _BW_EXAMPLE_FX_FLANGER_H
|
||||
#define _BW_EXAMPLE_FX_FLANGER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_chorus.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_rate,
|
||||
p_amount,
|
||||
|
@ -21,15 +21,15 @@
|
||||
#ifndef _BW_EXAMPLE_FX_FUZZ_H
|
||||
#define _BW_EXAMPLE_FX_FUZZ_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_fuzz.h>
|
||||
#include <bw_src_int.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_fuzz,
|
||||
p_volume,
|
||||
|
@ -21,14 +21,14 @@
|
||||
#ifndef _BW_EXAMPLE_FX_HP1_H
|
||||
#define _BW_EXAMPLE_FX_HP1_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_hp1.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_cutoff,
|
||||
p_n
|
||||
|
@ -21,14 +21,14 @@
|
||||
#ifndef _BW_EXAMPLE_FX_HS1_H
|
||||
#define _BW_EXAMPLE_FX_HS1_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_hs1.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_cutoff,
|
||||
p_gain,
|
||||
|
@ -21,14 +21,14 @@
|
||||
#ifndef _BW_EXAMPLE_FX_LP1_H
|
||||
#define _BW_EXAMPLE_FX_LP1_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_lp1.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_cutoff,
|
||||
p_n
|
||||
|
@ -21,14 +21,14 @@
|
||||
#ifndef _BW_EXAMPLE_FX_LS1_H
|
||||
#define _BW_EXAMPLE_FX_LS1_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_ls1.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_cutoff,
|
||||
p_gain,
|
||||
|
@ -21,14 +21,14 @@
|
||||
#ifndef _BW_EXAMPLE_FX_MM1_H
|
||||
#define _BW_EXAMPLE_FX_MM1_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_mm1.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_cutoff,
|
||||
p_input_coeff,
|
||||
|
@ -21,14 +21,14 @@
|
||||
#ifndef _BW_EXAMPLE_FX_MM2_H
|
||||
#define _BW_EXAMPLE_FX_MM2_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_mm2.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_cutoff,
|
||||
p_Q,
|
||||
|
@ -21,14 +21,14 @@
|
||||
#ifndef _BW_EXAMPLE_FX_NOISE_GATE_H
|
||||
#define _BW_EXAMPLE_FX_NOISE_GATE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_noise_gate.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_thresh,
|
||||
p_attenuation,
|
||||
|
@ -21,14 +21,14 @@
|
||||
#ifndef _BW_EXAMPLE_FX_NOTCH_H
|
||||
#define _BW_EXAMPLE_FX_NOTCH_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_notch.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_cutoff,
|
||||
p_Q,
|
||||
|
@ -21,14 +21,14 @@
|
||||
#ifndef _BW_EXAMPLE_FX_ONE_POLE_H
|
||||
#define _BW_EXAMPLE_FX_ONE_POLE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_one_pole.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_cutoff,
|
||||
p_n
|
||||
|
@ -21,16 +21,16 @@
|
||||
#ifndef _BW_EXAMPLE_FX_PAN_H
|
||||
#define _BW_EXAMPLE_FX_PAN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_pan.h>
|
||||
#include <bw_ppm.h>
|
||||
#include <bw_math.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_pan,
|
||||
p_n
|
||||
|
@ -21,14 +21,14 @@
|
||||
#ifndef _BW_EXAMPLE_FX_PHASER_H
|
||||
#define _BW_EXAMPLE_FX_PHASER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_phaser.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_rate,
|
||||
p_center,
|
||||
|
@ -21,12 +21,12 @@
|
||||
#ifndef _BW_EXAMPLE_FX_REVERB_H
|
||||
#define _BW_EXAMPLE_FX_REVERB_H
|
||||
|
||||
#include <bw_reverb.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_reverb.h>
|
||||
|
||||
enum {
|
||||
p_predelay,
|
||||
p_bandwidth,
|
||||
|
@ -21,13 +21,15 @@
|
||||
#ifndef _BW_EXAMPLE_FX_SATUR_H
|
||||
#define _BW_EXAMPLE_FX_SATUR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_satur.h>
|
||||
#include <bw_src_int.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_bias,
|
||||
p_gain,
|
||||
|
@ -21,12 +21,14 @@
|
||||
#ifndef _BW_EXAMPLE_FX_SLEW_LIM_H
|
||||
#define _BW_EXAMPLE_FX_SLEW_LIM_H
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_slew_lim.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_slew_lim.h>
|
||||
|
||||
enum {
|
||||
p_max_rate,
|
||||
p_n
|
||||
|
@ -21,12 +21,14 @@
|
||||
#ifndef _BW_EXAMPLE_FX_SVF_H
|
||||
#define _BW_EXAMPLE_FX_SVF_H
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_svf.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_svf.h>
|
||||
|
||||
enum {
|
||||
p_cutoff,
|
||||
p_Q,
|
||||
|
@ -21,12 +21,14 @@
|
||||
#ifndef _BW_EXAMPLE_FX_TREM_H
|
||||
#define _BW_EXAMPLE_FX_TREM_H
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_trem.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_trem.h>
|
||||
|
||||
enum {
|
||||
p_rate,
|
||||
p_amount,
|
||||
|
@ -21,12 +21,14 @@
|
||||
#ifndef _BW_EXAMPLE_FX_VIBRATO_H
|
||||
#define _BW_EXAMPLE_FX_VIBRATO_H
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_chorus.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_chorus.h>
|
||||
|
||||
enum {
|
||||
p_rate,
|
||||
p_amount,
|
||||
|
@ -21,12 +21,14 @@
|
||||
#ifndef _BW_EXAMPLE_FX_WAH_H
|
||||
#define _BW_EXAMPLE_FX_WAH_H
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_wah.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bw_wah.h>
|
||||
|
||||
enum {
|
||||
p_wah,
|
||||
p_n
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bwpp_ap1.h>
|
||||
#include <bw_ap1.h>
|
||||
|
||||
using namespace Brickworks;
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bwpp_ap2.h>
|
||||
#include <bw_ap2.h>
|
||||
|
||||
using namespace Brickworks;
|
||||
|
||||
|
@ -21,10 +21,6 @@
|
||||
#ifndef _BW_EXAMPLE_SYNTH_MONO_H
|
||||
#define _BW_EXAMPLE_SYNTH_MONO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_math.h>
|
||||
@ -41,6 +37,10 @@ extern "C" {
|
||||
#include <bw_gain.h>
|
||||
#include <bw_ppm.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_volume,
|
||||
p_master_tune,
|
||||
|
@ -21,10 +21,6 @@
|
||||
#ifndef _BW_EXAMPLE_SYNTH_POLY_H
|
||||
#define _BW_EXAMPLE_SYNTH_POLY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_note_queue.h>
|
||||
@ -41,6 +37,10 @@ extern "C" {
|
||||
#include <bw_gain.h>
|
||||
#include <bw_ppm.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_volume,
|
||||
p_master_tune,
|
||||
|
@ -21,10 +21,6 @@
|
||||
#ifndef _BW_EXAMPLE_SYNTH_SIMPLE_H
|
||||
#define _BW_EXAMPLE_SYNTH_SIMPLE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <bw_math.h>
|
||||
@ -36,6 +32,10 @@ extern "C" {
|
||||
#include <bw_gain.h>
|
||||
#include <bw_ppm.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
p_volume,
|
||||
p_master_tune,
|
||||
|
131
include/bw_ap1.h
131
include/bw_ap1.h
@ -30,8 +30,15 @@
|
||||
* <ul>
|
||||
* <li>Version <strong>1.0.0</strong>:
|
||||
* <ul>
|
||||
* <li>Now using <code>size_t</code> instead of
|
||||
* <code>BW_SIZE_T</code>.</li>
|
||||
* <li><code>bw_ap1_process()</code> and
|
||||
* <code>bw_ap1_process_multi()</code> now use <code>size_t</code>
|
||||
* to count samples and channels.</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>:
|
||||
@ -60,8 +67,8 @@
|
||||
* }}}
|
||||
*/
|
||||
|
||||
#ifndef _BW_AP1_H
|
||||
#define _BW_AP1_H
|
||||
#ifndef BW_AP1_H
|
||||
#define BW_AP1_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
@ -69,16 +76,18 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*** Public API ***/
|
||||
|
||||
/*! api {{{
|
||||
* #### bw_ap1_coeffs
|
||||
* ```>>> */
|
||||
typedef struct _bw_ap1_coeffs bw_ap1_coeffs;
|
||||
typedef struct bw_ap1_coeffs bw_ap1_coeffs;
|
||||
/*! <<<```
|
||||
* Coefficients and related.
|
||||
*
|
||||
* #### bw_ap1_state
|
||||
* ```>>> */
|
||||
typedef struct _bw_ap1_state bw_ap1_state;
|
||||
typedef struct bw_ap1_state bw_ap1_state;
|
||||
/*! <<<```
|
||||
* Internal state and related.
|
||||
*
|
||||
@ -102,10 +111,10 @@ static inline void bw_ap1_reset_coeffs(bw_ap1_coeffs *BW_RESTRICT coeffs);
|
||||
*
|
||||
* #### bw_ap1_reset_state()
|
||||
* ```>>> */
|
||||
static inline void bw_ap1_reset_state(const bw_ap1_coeffs *BW_RESTRICT coeffs, bw_ap1_state *BW_RESTRICT state, float x0);
|
||||
static inline void bw_ap1_reset_state(const bw_ap1_coeffs *BW_RESTRICT coeffs, bw_ap1_state *BW_RESTRICT state, float x_0);
|
||||
/*! <<<```
|
||||
* Resets the given `state` to its initial values using the given `coeffs`
|
||||
* and the quiescent/initial input value `x0`.
|
||||
* and the quiescent/initial input value `x_0`.
|
||||
*
|
||||
* #### bw_ap1_update_coeffs_ctrl()
|
||||
* ```>>> */
|
||||
@ -128,7 +137,7 @@ static inline float bw_ap1_process1(const bw_ap1_coeffs *BW_RESTRICT coeffs, bw_
|
||||
*
|
||||
* #### bw_ap1_process()
|
||||
* ```>>> */
|
||||
static inline void bw_ap1_process(bw_ap1_coeffs *BW_RESTRICT coeffs, bw_ap1_state *BW_RESTRICT state, const float *x, float *y, int n_samples);
|
||||
static inline void bw_ap1_process(bw_ap1_coeffs *BW_RESTRICT coeffs, bw_ap1_state *BW_RESTRICT state, const float *x, float *y, size_t n_samples);
|
||||
/*! <<<```
|
||||
* Processes the first `n_samples` of the input buffer `x` and fills the
|
||||
* first `n_samples` of the output buffer `y`, while using and updating both
|
||||
@ -136,7 +145,7 @@ static inline void bw_ap1_process(bw_ap1_coeffs *BW_RESTRICT coeffs, bw_ap1_stat
|
||||
*
|
||||
* #### bw_ap1_process_multi()
|
||||
* ```>>> */
|
||||
static inline void bw_ap1_process_multi(bw_ap1_coeffs *BW_RESTRICT coeffs, bw_ap1_state **BW_RESTRICT state, const float **x, float **y, int n_channels, int n_samples);
|
||||
static inline void bw_ap1_process_multi(bw_ap1_coeffs *BW_RESTRICT coeffs, bw_ap1_state * const *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
|
||||
@ -167,12 +176,12 @@ static inline void bw_ap1_set_cutoff(bw_ap1_coeffs *BW_RESTRICT coeffs, float va
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_ap1_coeffs {
|
||||
struct bw_ap1_coeffs {
|
||||
// Sub-components
|
||||
bw_lp1_coeffs lp1_coeffs;
|
||||
};
|
||||
|
||||
struct _bw_ap1_state {
|
||||
struct bw_ap1_state {
|
||||
bw_lp1_state lp1_state;
|
||||
};
|
||||
|
||||
@ -188,8 +197,8 @@ static inline void bw_ap1_reset_coeffs(bw_ap1_coeffs *BW_RESTRICT coeffs) {
|
||||
bw_lp1_reset_coeffs(&coeffs->lp1_coeffs);
|
||||
}
|
||||
|
||||
static inline void bw_ap1_reset_state(const bw_ap1_coeffs *BW_RESTRICT coeffs, bw_ap1_state *BW_RESTRICT state, float x0) {
|
||||
bw_lp1_reset_state(&coeffs->lp1_coeffs, &state->lp1_state, x0);
|
||||
static inline void bw_ap1_reset_state(const bw_ap1_coeffs *BW_RESTRICT coeffs, bw_ap1_state *BW_RESTRICT state, float x_0) {
|
||||
bw_lp1_reset_state(&coeffs->lp1_coeffs, &state->lp1_state, x_0);
|
||||
}
|
||||
|
||||
static inline void bw_ap1_update_coeffs_ctrl(bw_ap1_coeffs *BW_RESTRICT coeffs) {
|
||||
@ -205,19 +214,19 @@ static inline float bw_ap1_process1(const bw_ap1_coeffs *BW_RESTRICT coeffs, bw_
|
||||
return x - lp - lp;
|
||||
}
|
||||
|
||||
static inline void bw_ap1_process(bw_ap1_coeffs *BW_RESTRICT coeffs, bw_ap1_state *BW_RESTRICT state, const float *x, float *y, int n_samples) {
|
||||
static inline void bw_ap1_process(bw_ap1_coeffs *BW_RESTRICT coeffs, bw_ap1_state *BW_RESTRICT state, const float *x, float *y, size_t n_samples) {
|
||||
bw_ap1_update_coeffs_ctrl(coeffs);
|
||||
for (int i = 0; i < n_samples; i++) {
|
||||
for (size_t i = 0; i < n_samples; i++) {
|
||||
bw_ap1_update_coeffs_audio(coeffs);
|
||||
y[i] = bw_ap1_process1(coeffs, state, x[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void bw_ap1_process_multi(bw_ap1_coeffs *BW_RESTRICT coeffs, bw_ap1_state **BW_RESTRICT state, const float **x, float **y, int n_channels, int n_samples) {
|
||||
static inline void bw_ap1_process_multi(bw_ap1_coeffs *BW_RESTRICT coeffs, bw_ap1_state * const *BW_RESTRICT state, const float * const *x, float **y, size_t n_channels, size_t n_samples) {
|
||||
bw_ap1_update_coeffs_ctrl(coeffs);
|
||||
for (int i = 0; i < n_samples; i++) {
|
||||
for (size_t i = 0; i < n_samples; i++) {
|
||||
bw_ap1_update_coeffs_audio(coeffs);
|
||||
for (int j = 0; j < n_channels; j++)
|
||||
for (size_t j = 0; j < n_channels; j++)
|
||||
y[j][i] = bw_ap1_process1(coeffs, state[j], x[j][i]);
|
||||
}
|
||||
}
|
||||
@ -227,6 +236,90 @@ static inline void bw_ap1_set_cutoff(bw_ap1_coeffs *BW_RESTRICT coeffs, float va
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace Brickworks {
|
||||
|
||||
/*** Public C++ API ***/
|
||||
|
||||
/*! api_cpp {{{
|
||||
* ##### Brickworks::AP1
|
||||
* ```>>> */
|
||||
template<size_t N_CHANNELS>
|
||||
class AP1 {
|
||||
public:
|
||||
AP1();
|
||||
|
||||
void setSampleRate(float sampleRate);
|
||||
void reset(float x_0 = 0.f);
|
||||
void process(
|
||||
const float * const *x,
|
||||
float **y,
|
||||
size_t nSamples);
|
||||
void process(
|
||||
std::array<const float *, N_CHANNELS> x,
|
||||
std::array<float *, N_CHANNELS> y,
|
||||
size_t nSamples);
|
||||
|
||||
void setCutoff(float value);
|
||||
/*! <<<...
|
||||
* }
|
||||
* ```
|
||||
* }}} */
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
* change at any time in future versions. Please, do not use it directly. */
|
||||
|
||||
private:
|
||||
bw_ap1_coeffs coeffs;
|
||||
bw_ap1_state states[N_CHANNELS];
|
||||
bw_ap1_state *statesP[N_CHANNELS];
|
||||
};
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline AP1<N_CHANNELS>::AP1() {
|
||||
bw_ap1_init(&coeffs);
|
||||
for (size_t i = 0; i < N_CHANNELS; i++)
|
||||
statesP[i] = states + i;
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void AP1<N_CHANNELS>::setSampleRate(float sampleRate) {
|
||||
bw_ap1_set_sample_rate(&coeffs, sampleRate);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void AP1<N_CHANNELS>::reset(float x_0) {
|
||||
bw_ap1_reset_coeffs(&coeffs);
|
||||
for (size_t i = 0; i < N_CHANNELS; i++)
|
||||
bw_ap1_reset_state(&coeffs, states + i, x_0);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void AP1<N_CHANNELS>::process(
|
||||
const float * const *x,
|
||||
float **y,
|
||||
size_t nSamples) {
|
||||
bw_ap1_process_multi(&coeffs, statesP, x, y, N_CHANNELS, nSamples);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void AP1<N_CHANNELS>::process(
|
||||
std::array<const float *, N_CHANNELS> x,
|
||||
std::array<float *, N_CHANNELS> y,
|
||||
size_t nSamples) {
|
||||
process(x.data(), y.data(), nSamples);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void AP1<N_CHANNELS>::setCutoff(float value) {
|
||||
bw_ap1_set_cutoff(&coeffs, value);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
135
include/bw_ap2.h
135
include/bw_ap2.h
@ -30,8 +30,15 @@
|
||||
* <ul>
|
||||
* <li>Version <strong>1.0.0</strong>:
|
||||
* <ul>
|
||||
* <li>Now using <code>size_t</code> instead of
|
||||
* <code>BW_SIZE_T</code>.</li>
|
||||
* <li><code>bw_ap2_process()</code> and
|
||||
* <code>bw_ap2_process_multi()</code> now use <code>size_t</code>
|
||||
* to count samples and channels.</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>:
|
||||
@ -60,8 +67,8 @@
|
||||
* }}}
|
||||
*/
|
||||
|
||||
#ifndef _BW_AP2_H
|
||||
#define _BW_AP2_H
|
||||
#ifndef BW_AP2_H
|
||||
#define BW_AP2_H
|
||||
|
||||
#include <bw_common.h>
|
||||
|
||||
@ -72,13 +79,13 @@ extern "C" {
|
||||
/*! api {{{
|
||||
* #### bw_ap2_coeffs
|
||||
* ```>>> */
|
||||
typedef struct _bw_ap2_coeffs bw_ap2_coeffs;
|
||||
typedef struct bw_ap2_coeffs bw_ap2_coeffs;
|
||||
/*! <<<```
|
||||
* Coefficients and related.
|
||||
*
|
||||
* #### bw_ap2_state
|
||||
* ```>>> */
|
||||
typedef struct _bw_ap2_state bw_ap2_state;
|
||||
typedef struct bw_ap2_state bw_ap2_state;
|
||||
/*! <<<```
|
||||
* Internal state and related.
|
||||
*
|
||||
@ -102,10 +109,10 @@ static inline void bw_ap2_reset_coeffs(bw_ap2_coeffs *BW_RESTRICT coeffs);
|
||||
*
|
||||
* #### bw_ap2_reset_state()
|
||||
* ```>>> */
|
||||
static inline void bw_ap2_reset_state(const bw_ap2_coeffs *BW_RESTRICT coeffs, bw_ap2_state *BW_RESTRICT state, float x0);
|
||||
static inline void bw_ap2_reset_state(const bw_ap2_coeffs *BW_RESTRICT coeffs, bw_ap2_state *BW_RESTRICT state, float x_0);
|
||||
/*! <<<```
|
||||
* Resets the given `state` to its initial values using the given `coeffs`
|
||||
* and the quiescent/initial input value `x0`.
|
||||
* and the quiescent/initial input value `x_0`.
|
||||
*
|
||||
* #### bw_ap2_update_coeffs_ctrl()
|
||||
* ```>>> */
|
||||
@ -128,7 +135,7 @@ static inline float bw_ap2_process1(const bw_ap2_coeffs *BW_RESTRICT coeffs, bw_
|
||||
*
|
||||
* #### bw_ap2_process()
|
||||
* ```>>> */
|
||||
static inline void bw_ap2_process(bw_ap2_coeffs *BW_RESTRICT coeffs, bw_ap2_state *BW_RESTRICT state, const float *x, float *y, int n_samples);
|
||||
static inline void bw_ap2_process(bw_ap2_coeffs *BW_RESTRICT coeffs, bw_ap2_state *BW_RESTRICT state, const float *x, float *y, size_t n_samples);
|
||||
/*! <<<```
|
||||
* Processes the first `n_samples` of the input buffer `x` and fills the
|
||||
* first `n_samples` of the output buffer `y`, while using and updating both
|
||||
@ -136,7 +143,7 @@ static inline void bw_ap2_process(bw_ap2_coeffs *BW_RESTRICT coeffs, bw_ap2_stat
|
||||
*
|
||||
* #### bw_ap2_process_multi()
|
||||
* ```>>> */
|
||||
static inline void bw_ap2_process_multi(bw_ap2_coeffs *BW_RESTRICT coeffs, bw_ap2_state **BW_RESTRICT state, const float **x, float **y, int n_channels, int n_samples);
|
||||
static inline void bw_ap2_process_multi(bw_ap2_coeffs *BW_RESTRICT coeffs, bw_ap2_state * const *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
|
||||
@ -177,12 +184,12 @@ static inline void bw_ap2_set_Q(bw_ap2_coeffs *BW_RESTRICT coeffs, float value);
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _bw_ap2_coeffs {
|
||||
struct bw_ap2_coeffs {
|
||||
// Sub-components
|
||||
bw_svf_coeffs svf_coeffs;
|
||||
};
|
||||
|
||||
struct _bw_ap2_state {
|
||||
struct bw_ap2_state {
|
||||
bw_svf_state svf_state;
|
||||
};
|
||||
|
||||
@ -198,8 +205,8 @@ static inline void bw_ap2_reset_coeffs(bw_ap2_coeffs *BW_RESTRICT coeffs) {
|
||||
bw_svf_reset_coeffs(&coeffs->svf_coeffs);
|
||||
}
|
||||
|
||||
static inline void bw_ap2_reset_state(const bw_ap2_coeffs *BW_RESTRICT coeffs, bw_ap2_state *BW_RESTRICT state, float x0) {
|
||||
bw_svf_reset_state(&coeffs->svf_coeffs, &state->svf_state, x0);
|
||||
static inline void bw_ap2_reset_state(const bw_ap2_coeffs *BW_RESTRICT coeffs, bw_ap2_state *BW_RESTRICT state, float x_0) {
|
||||
bw_svf_reset_state(&coeffs->svf_coeffs, &state->svf_state, x_0);
|
||||
}
|
||||
|
||||
static inline void bw_ap2_update_coeffs_ctrl(bw_ap2_coeffs *BW_RESTRICT coeffs) {
|
||||
@ -217,19 +224,19 @@ static inline float bw_ap2_process1(const bw_ap2_coeffs *BW_RESTRICT coeffs, bw_
|
||||
return lh + lh - x;
|
||||
}
|
||||
|
||||
static inline void bw_ap2_process(bw_ap2_coeffs *BW_RESTRICT coeffs, bw_ap2_state *BW_RESTRICT state, const float *x, float *y, int n_samples) {
|
||||
static inline void bw_ap2_process(bw_ap2_coeffs *BW_RESTRICT coeffs, bw_ap2_state *BW_RESTRICT state, const float *x, float *y, size_t n_samples) {
|
||||
bw_ap2_update_coeffs_ctrl(coeffs);
|
||||
for (int i = 0; i < n_samples; i++) {
|
||||
for (size_t i = 0; i < n_samples; i++) {
|
||||
bw_ap2_update_coeffs_audio(coeffs);
|
||||
y[i] = bw_ap2_process1(coeffs, state, x[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void bw_ap2_process_multi(bw_ap2_coeffs *BW_RESTRICT coeffs, bw_ap2_state **BW_RESTRICT state, const float **x, float **y, int n_channels, int n_samples) {
|
||||
static inline void bw_ap2_process_multi(bw_ap2_coeffs *BW_RESTRICT coeffs, bw_ap2_state * const *BW_RESTRICT state, const float * const *x, float **y, size_t n_channels, size_t n_samples) {
|
||||
bw_ap2_update_coeffs_ctrl(coeffs);
|
||||
for (int i = 0; i < n_samples; i++) {
|
||||
for (size_t i = 0; i < n_samples; i++) {
|
||||
bw_ap2_update_coeffs_audio(coeffs);
|
||||
for (int j = 0; j < n_channels; j++)
|
||||
for (size_t j = 0; j < n_channels; j++)
|
||||
y[j][i] = bw_ap2_process1(coeffs, state[j], x[j][i]);
|
||||
}
|
||||
}
|
||||
@ -243,6 +250,96 @@ static inline void bw_ap2_set_Q(bw_ap2_coeffs *BW_RESTRICT coeffs, float value)
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace Brickworks {
|
||||
|
||||
/*** Public C++ API ***/
|
||||
|
||||
/*! api_cpp {{{
|
||||
* ##### Brickworks::AP2
|
||||
* ```>>> */
|
||||
template<size_t N_CHANNELS>
|
||||
class AP2 {
|
||||
public:
|
||||
AP2();
|
||||
|
||||
void setSampleRate(float sampleRate);
|
||||
void reset(float x_0 = 0.f);
|
||||
void process(
|
||||
const float * const *x,
|
||||
float **y,
|
||||
size_t nSamples);
|
||||
void process(
|
||||
std::array<const float *, N_CHANNELS> x,
|
||||
std::array<float *, N_CHANNELS> y,
|
||||
size_t nSamples);
|
||||
|
||||
void setCutoff(float value);
|
||||
void setQ(float value);
|
||||
/*! <<<...
|
||||
* }
|
||||
* ```
|
||||
* }}} */
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
* change at any time in future versions. Please, do not use it directly. */
|
||||
|
||||
private:
|
||||
bw_ap2_coeffs coeffs;
|
||||
bw_ap2_state states[N_CHANNELS];
|
||||
bw_ap2_state *statesP[N_CHANNELS];
|
||||
};
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline AP2<N_CHANNELS>::AP2() {
|
||||
bw_ap2_init(&coeffs);
|
||||
for (size_t i = 0; i < N_CHANNELS; i++)
|
||||
statesP[i] = states + i;
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void AP2<N_CHANNELS>::setSampleRate(float sampleRate) {
|
||||
bw_ap2_set_sample_rate(&coeffs, sampleRate);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void AP2<N_CHANNELS>::reset(float x_0) {
|
||||
bw_ap2_reset_coeffs(&coeffs);
|
||||
for (size_t i = 0; i < N_CHANNELS; i++)
|
||||
bw_ap2_reset_state(&coeffs, states + i, x_0);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void AP2<N_CHANNELS>::process(
|
||||
const float * const *x,
|
||||
float **y,
|
||||
size_t nSamples) {
|
||||
bw_ap2_process_multi(&coeffs, statesP, x, y, N_CHANNELS, nSamples);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void AP2<N_CHANNELS>::process(
|
||||
std::array<const float *, N_CHANNELS> x,
|
||||
std::array<float *, N_CHANNELS> y,
|
||||
size_t nSamples) {
|
||||
process(x.data(), y.data(), nSamples);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void AP2<N_CHANNELS>::setCutoff(float value) {
|
||||
bw_ap2_set_cutoff(&coeffs, value);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void AP2<N_CHANNELS>::setQ(float value) {
|
||||
bw_ap2_set_Q(&coeffs, value);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -196,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 * const *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 * const *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
|
||||
@ -706,7 +706,7 @@ static inline void bw_one_pole_process(bw_one_pole_coeffs *BW_RESTRICT coeffs, b
|
||||
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 * const *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 * const *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);
|
||||
@ -985,11 +985,11 @@ public:
|
||||
void process(
|
||||
const float * const *x,
|
||||
float **y,
|
||||
int nSamples);
|
||||
size_t nSamples);
|
||||
void process(
|
||||
std::array<const float *, N_CHANNELS> x,
|
||||
std::array<float *, N_CHANNELS> y,
|
||||
int nSamples);
|
||||
size_t nSamples);
|
||||
|
||||
void setCutoff(float value);
|
||||
void setCutoffUp(float value);
|
||||
@ -1040,7 +1040,7 @@ template<size_t N_CHANNELS>
|
||||
inline void OnePole<N_CHANNELS>::process(
|
||||
const float * const *x,
|
||||
float **y,
|
||||
int nSamples) {
|
||||
size_t nSamples) {
|
||||
bw_one_pole_process_multi(&coeffs, statesP, x, y, N_CHANNELS, nSamples);
|
||||
}
|
||||
|
||||
@ -1048,7 +1048,7 @@ 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) {
|
||||
size_t nSamples) {
|
||||
process(x.data(), y.data(), nSamples);
|
||||
}
|
||||
|
||||
|
@ -1,95 +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_AP1_H
|
||||
#define BWPP_AP1_H
|
||||
|
||||
#include <bw_ap1.h>
|
||||
#include <array>
|
||||
|
||||
namespace Brickworks {
|
||||
|
||||
/*! api {{{
|
||||
* ##### Brickworks::AP1
|
||||
* ```>>> */
|
||||
template<size_t N_CHANNELS>
|
||||
class AP1 {
|
||||
public:
|
||||
AP1();
|
||||
|
||||
void setSampleRate(float sampleRate);
|
||||
void reset(float x0 = 0.f);
|
||||
void process(
|
||||
std::array<const float *, N_CHANNELS> x,
|
||||
std::array<float *, N_CHANNELS> y,
|
||||
int nSamples);
|
||||
|
||||
void setCutoff(float value);
|
||||
/*! <<<...
|
||||
* }
|
||||
* ```
|
||||
* }}} */
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
* change at any time in future versions. Please, do not use it directly. */
|
||||
|
||||
private:
|
||||
bw_ap1_coeffs coeffs;
|
||||
bw_ap1_state states[N_CHANNELS];
|
||||
bw_ap1_state *statesP[N_CHANNELS];
|
||||
};
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline AP1<N_CHANNELS>::AP1() {
|
||||
bw_ap1_init(&coeffs);
|
||||
for (size_t i = 0; i < N_CHANNELS; i++)
|
||||
statesP[i] = states + i;
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void AP1<N_CHANNELS>::setSampleRate(float sampleRate) {
|
||||
bw_ap1_set_sample_rate(&coeffs, sampleRate);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void AP1<N_CHANNELS>::reset(float x0) {
|
||||
bw_ap1_reset_coeffs(&coeffs);
|
||||
for (size_t i = 0; i < N_CHANNELS; i++)
|
||||
bw_ap1_reset_state(&coeffs, states + i, x0);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void AP1<N_CHANNELS>::process(
|
||||
std::array<const float *, N_CHANNELS> x,
|
||||
std::array<float *, N_CHANNELS> y,
|
||||
int nSamples) {
|
||||
bw_ap1_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void AP1<N_CHANNELS>::setCutoff(float value) {
|
||||
bw_ap1_set_cutoff(&coeffs, value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -1,101 +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_AP2_H
|
||||
#define BWPP_AP2_H
|
||||
|
||||
#include <bw_ap2.h>
|
||||
#include <array>
|
||||
|
||||
namespace Brickworks {
|
||||
|
||||
/*! api {{{
|
||||
* ##### Brickworks::AP2
|
||||
* ```>>> */
|
||||
template<size_t N_CHANNELS>
|
||||
class AP2 {
|
||||
public:
|
||||
AP2();
|
||||
|
||||
void setSampleRate(float sampleRate);
|
||||
void reset(float x0 = 0.f);
|
||||
void process(
|
||||
std::array<const float *, N_CHANNELS> x,
|
||||
std::array<float *, N_CHANNELS> y,
|
||||
int nSamples);
|
||||
|
||||
void setCutoff(float value);
|
||||
void setQ(float value);
|
||||
/*! <<<...
|
||||
* }
|
||||
* ```
|
||||
* }}} */
|
||||
|
||||
/*** Implementation ***/
|
||||
|
||||
/* WARNING: This part of the file is not part of the public API. Its content may
|
||||
* change at any time in future versions. Please, do not use it directly. */
|
||||
|
||||
private:
|
||||
bw_ap2_coeffs coeffs;
|
||||
bw_ap2_state states[N_CHANNELS];
|
||||
bw_ap2_state *statesP[N_CHANNELS];
|
||||
};
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline AP2<N_CHANNELS>::AP2() {
|
||||
bw_ap2_init(&coeffs);
|
||||
for (size_t i = 0; i < N_CHANNELS; i++)
|
||||
statesP[i] = states + i;
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void AP2<N_CHANNELS>::setSampleRate(float sampleRate) {
|
||||
bw_ap2_set_sample_rate(&coeffs, sampleRate);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void AP2<N_CHANNELS>::reset(float x0) {
|
||||
bw_ap2_reset_coeffs(&coeffs);
|
||||
for (size_t i = 0; i < N_CHANNELS; i++)
|
||||
bw_ap2_reset_state(&coeffs, states + i, x0);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void AP2<N_CHANNELS>::process(
|
||||
std::array<const float *, N_CHANNELS> x,
|
||||
std::array<float *, N_CHANNELS> y,
|
||||
int nSamples) {
|
||||
bw_ap2_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void AP2<N_CHANNELS>::setCutoff(float value) {
|
||||
bw_ap2_set_cutoff(&coeffs, value);
|
||||
}
|
||||
|
||||
template<size_t N_CHANNELS>
|
||||
inline void AP2<N_CHANNELS>::setQ(float value) {
|
||||
bw_ap2_set_Q(&coeffs, value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user