diff --git a/README.md b/README.md index ddd81af..571a881 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ You can find information and documentation [on the official web page](https://ww ## Legal -Copyright (C) 2021-2023 Orastron Srl unipersonale. +Copyright (C) 2021-2024 Orastron Srl unipersonale. Authors: Stefano D'Angelo, Paolo Marrone. diff --git a/THANKS.md b/THANKS.md index 517f199..9fcb4cb 100644 --- a/THANKS.md +++ b/THANKS.md @@ -1,5 +1,8 @@ We wish to thank and give credit to: -- the adopters of this software, of which at the moment we can only publicly mention our friends at [Elk Audio](https://www.elk.audio/); +- the adopters of this software, of which at the moment we can publicly mention, in alphabetical order: + - [Elk Audio](https://www.elk.audio/); + - [Faselunare](http://faselunare.com/); +- Kevin Molcard for finding compilation warnings that needed fixing in Brickworks 1.0.0; - users participating to [this thread on the KVR Audio forum](https://www.kvraudio.com/forum/viewtopic.php?f=33&t=589519) for providing useful feedback; - [Mads Kjeldgaard](https://madskjeldgaard.dk/) for publishing [instructions to build for the Daisy Seed and uploading the firmware](https://madskjeldgaard.dk/posts/daisy-setup/); - [Hereket](https://hereket.github.io/) for providing instructions on [how to build an Android app without Android Studio or Gradle](https://hereket.github.io/posts/android_from_command_line/); diff --git a/include/bw_ap1.h b/include/bw_ap1.h index 9fdf5e9..002a890 100644 --- a/include/bw_ap1.h +++ b/include/bw_ap1.h @@ -1,7 +1,7 @@ /* * Brickworks * - * Copyright (C) 2022, 2023 Orastron Srl unipersonale + * Copyright (C) 2022-2024 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 @@ -20,7 +20,7 @@ /*! * module_type {{{ dsp }}} - * version {{{ 1.0.0 }}} + * version {{{ 1.0.1 }}} * requires {{{ bw_common bw_lp1 bw_math bw_one_pole }}} * description {{{ * First-order allpass filter (90° shift at cutoff, approaching 180° shift @@ -28,6 +28,11 @@ * }}} * changelog {{{ *
BW_NULL
.bw_ap1_reset_state_multi()
and updated C++
@@ -149,7 +154,7 @@ static inline void bw_ap1_reset_state_multi(
* array.
*
* The corresponding initial output values are written into the `y_0` array,
- * if not `NULL`.
+ * if not `BW_NULL`.
*
* #### bw_ap1_update_coeffs_ctrl()
* ```>>> */
@@ -263,8 +268,8 @@ static inline char bw_ap1_state_is_valid(
* seems to be the case and `0` if it is certainly not. False positives are
* possible, false negatives are not.
*
- * If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
- * is supposed to be associated to `coeffs`).
+ * If `coeffs` is not `BW_NULL` extra cross-checks might be performed
+ * (`state` is supposed to be associated to `coeffs`).
*
* `state` must at least point to a readable memory block of size greater
* than or equal to that of `bw_ap1_state`.
@@ -317,7 +322,7 @@ struct bw_ap1_state {
static inline void bw_ap1_init(
bw_ap1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
bw_lp1_init(&coeffs->lp1_coeffs);
@@ -333,7 +338,7 @@ static inline void bw_ap1_init(
static inline void bw_ap1_set_sample_rate(
bw_ap1_coeffs * BW_RESTRICT coeffs,
float sample_rate) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap1_coeffs_state_init);
BW_ASSERT(bw_is_finite(sample_rate) && sample_rate > 0.f);
@@ -349,7 +354,7 @@ static inline void bw_ap1_set_sample_rate(
static inline void bw_ap1_reset_coeffs(
bw_ap1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap1_coeffs_state_set_sample_rate);
@@ -367,10 +372,10 @@ static inline float bw_ap1_reset_state(
const bw_ap1_coeffs * BW_RESTRICT coeffs,
bw_ap1_state * BW_RESTRICT state,
float x_0) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap1_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT(bw_is_finite(x_0));
const float lp = bw_lp1_reset_state(&coeffs->lp1_coeffs, &state->lp1_state, x_0);
@@ -394,18 +399,18 @@ static inline void bw_ap1_reset_state_multi(
const float * x_0,
float * y_0,
size_t n_channels) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap1_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x_0 != NULL);
+ BW_ASSERT(x_0 != BW_NULL);
- if (y_0 != NULL)
+ if (y_0 != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
y_0[i] = bw_ap1_reset_state(coeffs, state[i], x_0[i]);
else
@@ -414,12 +419,12 @@ static inline void bw_ap1_reset_state_multi(
BW_ASSERT_DEEP(bw_ap1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap1_coeffs_state_reset_coeffs);
- BW_ASSERT_DEEP(y_0 != NULL ? bw_has_only_finite(y_0, n_channels) : 1);
+ BW_ASSERT_DEEP(y_0 != BW_NULL ? bw_has_only_finite(y_0, n_channels) : 1);
}
static inline void bw_ap1_update_coeffs_ctrl(
bw_ap1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap1_coeffs_state_reset_coeffs);
@@ -431,7 +436,7 @@ static inline void bw_ap1_update_coeffs_ctrl(
static inline void bw_ap1_update_coeffs_audio(
bw_ap1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap1_coeffs_state_reset_coeffs);
@@ -445,10 +450,10 @@ static inline float bw_ap1_process1(
const bw_ap1_coeffs * BW_RESTRICT coeffs,
bw_ap1_state * BW_RESTRICT state,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap1_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_ap1_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
@@ -469,14 +474,14 @@ static inline void bw_ap1_process(
const float * x,
float * y,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap1_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_ap1_state_is_valid(coeffs, state));
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
bw_ap1_update_coeffs_ctrl(coeffs);
for (size_t i = 0; i < n_samples; i++) {
@@ -497,17 +502,17 @@ static inline void bw_ap1_process_multi(
float * const * y,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap1_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x != NULL);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(x != BW_NULL);
+ BW_ASSERT(y != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -528,7 +533,7 @@ static inline void bw_ap1_process_multi(
static inline void bw_ap1_set_cutoff(
bw_ap1_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap1_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -543,7 +548,7 @@ static inline void bw_ap1_set_cutoff(
static inline void bw_ap1_set_prewarp_at_cutoff(
bw_ap1_coeffs * BW_RESTRICT coeffs,
char value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap1_coeffs_state_init);
@@ -556,7 +561,7 @@ static inline void bw_ap1_set_prewarp_at_cutoff(
static inline void bw_ap1_set_prewarp_freq(
bw_ap1_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap1_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -570,7 +575,7 @@ static inline void bw_ap1_set_prewarp_freq(
static inline char bw_ap1_coeffs_is_valid(
const bw_ap1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_ap1_coeffs"))
@@ -585,17 +590,17 @@ static inline char bw_ap1_coeffs_is_valid(
static inline char bw_ap1_state_is_valid(
const bw_ap1_coeffs * BW_RESTRICT coeffs,
const bw_ap1_state * BW_RESTRICT state) {
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (state->hash != bw_hash_sdbm("bw_ap1_state"))
return 0;
- if (coeffs != NULL && coeffs->reset_id != state->coeffs_reset_id)
+ if (coeffs != BW_NULL && coeffs->reset_id != state->coeffs_reset_id)
return 0;
#endif
- return bw_lp1_state_is_valid(coeffs ? &coeffs->lp1_coeffs : NULL, &state->lp1_state);
+ return bw_lp1_state_is_valid(coeffs ? &coeffs->lp1_coeffs : BW_NULL, &state->lp1_state);
}
#ifdef __cplusplus
diff --git a/include/bw_ap2.h b/include/bw_ap2.h
index b9ed2db..2b257ad 100644
--- a/include/bw_ap2.h
+++ b/include/bw_ap2.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2022, 2023 Orastron Srl unipersonale
+ * Copyright (C) 2022-2024 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
@@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common bw_math bw_one_pole bw_svf }}}
* description {{{
* Second-order allpass filter (180° shift at cutoff, approaching 360° shift
@@ -28,6 +28,11 @@
* }}}
* changelog {{{
* BW_NULL
.bw_ap2_reset_state_multi()
and updated C++
@@ -146,7 +151,7 @@ static inline void bw_ap2_reset_state_multi(
* array.
*
* The corresponding initial output values are written into the `y_0` array,
- * if not `NULL`.
+ * if not `BW_NULL`.
*
* #### bw_ap2_update_coeffs_ctrl()
* ```>>> */
@@ -272,8 +277,8 @@ static inline char bw_ap2_state_is_valid(
* seems to be the case and `0` if it is certainly not. False positives are
* possible, false negatives are not.
*
- * If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
- * is supposed to be associated to `coeffs`).
+ * If `coeffs` is not `BW_NULL` extra cross-checks might be performed
+ * (`state` is supposed to be associated to `coeffs`).
*
* `state` must at least point to a readable memory block of size greater
* than or equal to that of `bw_ap2_state`.
@@ -326,7 +331,7 @@ struct bw_ap2_state {
static inline void bw_ap2_init(
bw_ap2_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
bw_svf_init(&coeffs->svf_coeffs);
@@ -342,7 +347,7 @@ static inline void bw_ap2_init(
static inline void bw_ap2_set_sample_rate(
bw_ap2_coeffs * BW_RESTRICT coeffs,
float sample_rate) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap2_coeffs_state_init);
BW_ASSERT(bw_is_finite(sample_rate) && sample_rate > 0.f);
@@ -358,7 +363,7 @@ static inline void bw_ap2_set_sample_rate(
static inline void bw_ap2_reset_coeffs(
bw_ap2_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap2_coeffs_state_set_sample_rate);
@@ -376,10 +381,10 @@ static inline float bw_ap2_reset_state(
const bw_ap2_coeffs * BW_RESTRICT coeffs,
bw_ap2_state * BW_RESTRICT state,
float x_0) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap2_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT(bw_is_finite(x_0));
float lp, bp, hp;
@@ -405,18 +410,18 @@ static inline void bw_ap2_reset_state_multi(
const float * x_0,
float * y_0,
size_t n_channels) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap2_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x_0 != NULL);
+ BW_ASSERT(x_0 != BW_NULL);
- if (y_0 != NULL)
+ if (y_0 != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
y_0[i] = bw_ap2_reset_state(coeffs, state[i], x_0[i]);
else
@@ -425,12 +430,12 @@ static inline void bw_ap2_reset_state_multi(
BW_ASSERT_DEEP(bw_ap2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap2_coeffs_state_reset_coeffs);
- BW_ASSERT_DEEP(y_0 != NULL ? bw_has_only_finite(y_0, n_channels) : 1);
+ BW_ASSERT_DEEP(y_0 != BW_NULL ? bw_has_only_finite(y_0, n_channels) : 1);
}
static inline void bw_ap2_update_coeffs_ctrl(
bw_ap2_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap2_coeffs_state_reset_coeffs);
@@ -442,7 +447,7 @@ static inline void bw_ap2_update_coeffs_ctrl(
static inline void bw_ap2_update_coeffs_audio(
bw_ap2_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap2_coeffs_state_reset_coeffs);
@@ -456,10 +461,10 @@ static inline float bw_ap2_process1(
const bw_ap2_coeffs * BW_RESTRICT coeffs,
bw_ap2_state * BW_RESTRICT state,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap2_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_ap2_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
@@ -482,14 +487,14 @@ static inline void bw_ap2_process(
const float * x,
float * y,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap2_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_ap2_state_is_valid(coeffs, state));
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
bw_ap2_update_coeffs_ctrl(coeffs);
for (size_t i = 0; i < n_samples; i++) {
@@ -510,17 +515,17 @@ static inline void bw_ap2_process_multi(
float * const * y,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap2_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x != NULL);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(x != BW_NULL);
+ BW_ASSERT(y != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -541,7 +546,7 @@ static inline void bw_ap2_process_multi(
static inline void bw_ap2_set_cutoff(
bw_ap2_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap2_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -556,7 +561,7 @@ static inline void bw_ap2_set_cutoff(
static inline void bw_ap2_set_Q(
bw_ap2_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap2_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -571,7 +576,7 @@ static inline void bw_ap2_set_Q(
static inline void bw_ap2_set_prewarp_at_cutoff(
bw_ap2_coeffs * BW_RESTRICT coeffs,
char value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap2_coeffs_state_init);
@@ -584,7 +589,7 @@ static inline void bw_ap2_set_prewarp_at_cutoff(
static inline void bw_ap2_set_prewarp_freq(
bw_ap2_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ap2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ap2_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -598,7 +603,7 @@ static inline void bw_ap2_set_prewarp_freq(
static inline char bw_ap2_coeffs_is_valid(
const bw_ap2_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_ap2_coeffs"))
@@ -613,17 +618,17 @@ static inline char bw_ap2_coeffs_is_valid(
static inline char bw_ap2_state_is_valid(
const bw_ap2_coeffs * BW_RESTRICT coeffs,
const bw_ap2_state * BW_RESTRICT state) {
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (state->hash != bw_hash_sdbm("bw_ap2_state"))
return 0;
- if (coeffs != NULL && coeffs->reset_id != state->coeffs_reset_id)
+ if (coeffs != BW_NULL && coeffs->reset_id != state->coeffs_reset_id)
return 0;
#endif
- return bw_svf_state_is_valid(coeffs ? &coeffs->svf_coeffs : NULL, &state->svf_state);
+ return bw_svf_state_is_valid(coeffs ? &coeffs->svf_coeffs : BW_NULL, &state->svf_state);
}
#ifdef __cplusplus
diff --git a/include/bw_balance.h b/include/bw_balance.h
index b742157..8f8d801 100644
--- a/include/bw_balance.h
+++ b/include/bw_balance.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2023 Orastron Srl unipersonale
+ * Copyright (C) 2023, 2024 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
@@ -20,13 +20,18 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common bw_gain bw_math bw_one_pole }}}
* description {{{
* Stereo balance.
* }}}
* changelog {{{
* BW_NULL
.bw_balance_process()
and
@@ -229,7 +234,7 @@ struct bw_balance_coeffs {
static inline void bw_balance_init(
bw_balance_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
bw_gain_init(&coeffs->l_coeffs);
bw_gain_init(&coeffs->r_coeffs);
@@ -246,7 +251,7 @@ static inline void bw_balance_init(
static inline void bw_balance_set_sample_rate(
bw_balance_coeffs * BW_RESTRICT coeffs,
float sample_rate) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_balance_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_balance_coeffs_state_init);
BW_ASSERT(bw_is_finite(sample_rate) && sample_rate > 0.f);
@@ -273,7 +278,7 @@ static inline void bw_balance_do_update_coeffs(
static inline void bw_balance_reset_coeffs(
bw_balance_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_balance_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_balance_coeffs_state_set_sample_rate);
@@ -290,7 +295,7 @@ static inline void bw_balance_reset_coeffs(
static inline void bw_balance_update_coeffs_ctrl(
bw_balance_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_balance_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_balance_coeffs_state_reset_coeffs);
@@ -304,7 +309,7 @@ static inline void bw_balance_update_coeffs_ctrl(
static inline void bw_balance_update_coeffs_audio(
bw_balance_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_balance_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_balance_coeffs_state_reset_coeffs);
@@ -321,7 +326,7 @@ static inline void bw_balance_process1(
float x_r,
float * BW_RESTRICT y_l,
float * BW_RESTRICT y_r) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_balance_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_balance_coeffs_state_reset_coeffs);
BW_ASSERT(bw_is_finite(x_l));
@@ -344,15 +349,15 @@ static inline void bw_balance_process(
float * y_l,
float * y_r,
size_t n_samples){
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_balance_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_balance_coeffs_state_reset_coeffs);
- BW_ASSERT(x_l != NULL);
+ BW_ASSERT(x_l != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x_l, n_samples));
- BW_ASSERT(x_r != NULL);
+ BW_ASSERT(x_r != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x_r, n_samples));
- BW_ASSERT(y_l != NULL);
- BW_ASSERT(y_r != NULL);
+ BW_ASSERT(y_l != BW_NULL);
+ BW_ASSERT(y_r != BW_NULL);
BW_ASSERT(y_l != y_r);
bw_balance_update_coeffs_ctrl(coeffs);
@@ -375,13 +380,13 @@ static inline void bw_balance_process_multi(
float * const * y_r,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_balance_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_balance_coeffs_state_reset_coeffs);
- BW_ASSERT(x_l != NULL);
- BW_ASSERT(x_r != NULL);
- BW_ASSERT(y_l != NULL);
- BW_ASSERT(y_r != NULL);
+ BW_ASSERT(x_l != BW_NULL);
+ BW_ASSERT(x_r != BW_NULL);
+ BW_ASSERT(y_l != BW_NULL);
+ BW_ASSERT(y_r != BW_NULL);
BW_ASSERT(y_l != y_r);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
@@ -408,7 +413,7 @@ static inline void bw_balance_process_multi(
static inline void bw_balance_set_balance(
bw_balance_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_balance_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_balance_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -422,7 +427,7 @@ static inline void bw_balance_set_balance(
static inline char bw_balance_coeffs_is_valid(
const bw_balance_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_balance_coeffs"))
diff --git a/include/bw_bd_reduce.h b/include/bw_bd_reduce.h
index 5d46607..95b0fef 100644
--- a/include/bw_bd_reduce.h
+++ b/include/bw_bd_reduce.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2022, 2023 Orastron Srl unipersonale
+ * Copyright (C) 2022-2024 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
@@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common bw_math }}}
* description {{{
* Bit depth reducer.
@@ -31,6 +31,11 @@
* }}}
* changelog {{{
* BW_NULL
.bw_bd_reduce_set_sample_rate()
.BW_NULL
.size_t
instead of
@@ -240,7 +245,7 @@ static inline void bw_buf_fill(
float * BW_RESTRICT dest,
size_t n_elems) {
BW_ASSERT(!bw_is_nan(k));
- BW_ASSERT(dest != NULL);
+ BW_ASSERT(dest != BW_NULL);
for (size_t i = 0; i < n_elems; i++)
dest[i] = k;
@@ -252,9 +257,9 @@ static inline void bw_buf_neg(
const float * src,
float * dest,
size_t n_elems) {
- BW_ASSERT(src != NULL);
+ BW_ASSERT(src != BW_NULL);
BW_ASSERT_DEEP(!bw_has_nan(src, n_elems));
- BW_ASSERT(dest != NULL);
+ BW_ASSERT(dest != BW_NULL);
for (size_t i = 0; i < n_elems; i++)
dest[i] = -src[i];
@@ -267,10 +272,10 @@ static inline void bw_buf_add(
float k,
float * dest,
size_t n_elems) {
- BW_ASSERT(src != NULL);
+ BW_ASSERT(src != BW_NULL);
BW_ASSERT_DEEP(!bw_has_nan(src, n_elems));
BW_ASSERT(!bw_is_nan(k));
- BW_ASSERT(dest != NULL);
+ BW_ASSERT(dest != BW_NULL);
for (size_t i = 0; i < n_elems; i++)
dest[i] = k + src[i];
@@ -283,10 +288,10 @@ static inline void bw_buf_scale(
float k,
float * dest,
size_t n_elems) {
- BW_ASSERT(src != NULL);
+ BW_ASSERT(src != BW_NULL);
BW_ASSERT_DEEP(!bw_has_nan(src, n_elems));
BW_ASSERT(!bw_is_nan(k));
- BW_ASSERT(dest != NULL);
+ BW_ASSERT(dest != BW_NULL);
for (size_t i = 0; i < n_elems; i++)
dest[i] = k * src[i];
@@ -299,11 +304,11 @@ static inline void bw_buf_mix(
const float * src2,
float * dest,
size_t n_elems) {
- BW_ASSERT(src1 != NULL);
+ BW_ASSERT(src1 != BW_NULL);
BW_ASSERT_DEEP(!bw_has_nan(src1, n_elems));
- BW_ASSERT(src2 != NULL);
+ BW_ASSERT(src2 != BW_NULL);
BW_ASSERT_DEEP(!bw_has_nan(src2, n_elems));
- BW_ASSERT(dest != NULL);
+ BW_ASSERT(dest != BW_NULL);
for (size_t i = 0; i < n_elems; i++)
dest[i] = src1[i] + src2[i];
@@ -316,11 +321,11 @@ static inline void bw_buf_mul(
const float * src2,
float * dest,
size_t n_elems) {
- BW_ASSERT(src1 != NULL);
+ BW_ASSERT(src1 != BW_NULL);
BW_ASSERT_DEEP(!bw_has_nan(src1, n_elems));
- BW_ASSERT(src2 != NULL);
+ BW_ASSERT(src2 != BW_NULL);
BW_ASSERT_DEEP(!bw_has_nan(src2, n_elems));
- BW_ASSERT(dest != NULL);
+ BW_ASSERT(dest != BW_NULL);
for (size_t i = 0; i < n_elems; i++)
dest[i] = src1[i] * src2[i];
@@ -334,7 +339,7 @@ static inline void bw_buf_fill_multi(
size_t n_channels,
size_t n_elems) {
BW_ASSERT(!bw_is_nan(k));
- BW_ASSERT(dest != NULL);
+ BW_ASSERT(dest != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -350,8 +355,8 @@ static inline void bw_buf_neg_multi(
float * const * dest,
size_t n_channels,
size_t n_elems) {
- BW_ASSERT(src != NULL);
- BW_ASSERT(dest != NULL);
+ BW_ASSERT(src != BW_NULL);
+ BW_ASSERT(dest != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -368,9 +373,9 @@ static inline void bw_buf_add_multi(
float * const * dest,
size_t n_channels,
size_t n_elems) {
- BW_ASSERT(src != NULL);
+ BW_ASSERT(src != BW_NULL);
BW_ASSERT(!bw_is_nan(k));
- BW_ASSERT(dest != NULL);
+ BW_ASSERT(dest != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -387,9 +392,9 @@ static inline void bw_buf_scale_multi(
float * const * dest,
size_t n_channels,
size_t n_elems) {
- BW_ASSERT(src != NULL);
+ BW_ASSERT(src != BW_NULL);
BW_ASSERT(!bw_is_nan(k));
- BW_ASSERT(dest != NULL);
+ BW_ASSERT(dest != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -406,9 +411,9 @@ static inline void bw_buf_mix_multi(
float * const * dest,
size_t n_channels,
size_t n_elems) {
- BW_ASSERT(src1 != NULL);
- BW_ASSERT(src2 != NULL);
- BW_ASSERT(dest != NULL);
+ BW_ASSERT(src1 != BW_NULL);
+ BW_ASSERT(src2 != BW_NULL);
+ BW_ASSERT(dest != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -425,9 +430,9 @@ static inline void bw_buf_mul_multi(
float * const * dest,
size_t n_channels,
size_t n_elems) {
- BW_ASSERT(src1 != NULL);
- BW_ASSERT(src2 != NULL);
- BW_ASSERT(dest != NULL);
+ BW_ASSERT(src1 != BW_NULL);
+ BW_ASSERT(src2 != BW_NULL);
+ BW_ASSERT(dest != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
diff --git a/include/bw_cab.h b/include/bw_cab.h
index fe6032c..ac39f42 100644
--- a/include/bw_cab.h
+++ b/include/bw_cab.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2023 Orastron Srl unipersonale
+ * Copyright (C) 2023, 2024 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
@@ -109,7 +109,7 @@ static inline void bw_cab_reset_state_multi(
* array.
*
* The corresponding initial output values are written into the `y_0` array,
- * if not `NULL`.
+ * if not `BW_NULL`.
*
* #### bw_cab_update_coeffs_ctrl()
* ```>>> */
@@ -222,7 +222,7 @@ static inline char bw_cab_state_is_valid(
* seems to be the case and `0` if it is certainly not. False positives are
* possible, false negatives are not.
*
- * If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
+ * If `coeffs` is not `BW_NULL` extra cross-checks might be performed (`state`
* is supposed to be associated to `coeffs`).
*
* `state` must at least point to a readable memory block of size greater
@@ -285,7 +285,7 @@ struct bw_cab_state {
static inline void bw_cab_init(
bw_cab_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
bw_svf_init(&coeffs->lp_coeffs);
bw_svf_init(&coeffs->hp_coeffs);
@@ -313,7 +313,7 @@ static inline void bw_cab_init(
static inline void bw_cab_set_sample_rate(
bw_cab_coeffs * BW_RESTRICT coeffs,
float sample_rate) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_cab_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_cab_coeffs_state_init);
BW_ASSERT(bw_is_finite(sample_rate) && sample_rate > 0.f);
@@ -334,7 +334,7 @@ static inline void bw_cab_set_sample_rate(
static inline void bw_cab_reset_coeffs(
bw_cab_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_cab_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_cab_coeffs_state_set_sample_rate);
@@ -357,10 +357,10 @@ static inline float bw_cab_reset_state(
const bw_cab_coeffs * BW_RESTRICT coeffs,
bw_cab_state * BW_RESTRICT state,
float x_0) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_cab_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_cab_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT(bw_is_finite(x_0));
float v_lp, v_hp, v_bp;
@@ -392,18 +392,18 @@ static inline void bw_cab_reset_state_multi(
const float * x_0,
float * y_0,
size_t n_channels) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_cab_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_cab_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x_0 != NULL);
+ BW_ASSERT(x_0 != BW_NULL);
- if (y_0 != NULL)
+ if (y_0 != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
y_0[i] = bw_cab_reset_state(coeffs, state[i], x_0[i]);
else
@@ -412,12 +412,12 @@ static inline void bw_cab_reset_state_multi(
BW_ASSERT_DEEP(bw_cab_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_cab_coeffs_state_reset_coeffs);
- BW_ASSERT_DEEP(y_0 != NULL ? bw_has_only_finite(y_0, n_channels) : 1);
+ BW_ASSERT_DEEP(y_0 != BW_NULL ? bw_has_only_finite(y_0, n_channels) : 1);
}
static inline void bw_cab_update_coeffs_ctrl(
bw_cab_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_cab_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_cab_coeffs_state_reset_coeffs);
@@ -434,7 +434,7 @@ static inline void bw_cab_update_coeffs_ctrl(
static inline void bw_cab_update_coeffs_audio(
bw_cab_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_cab_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_cab_coeffs_state_reset_coeffs);
@@ -453,10 +453,10 @@ static inline float bw_cab_process1(
const bw_cab_coeffs * BW_RESTRICT coeffs,
bw_cab_state * BW_RESTRICT state,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_cab_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_cab_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_cab_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
@@ -485,14 +485,14 @@ static inline void bw_cab_process(
const float * x,
float * y,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_cab_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_cab_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_cab_state_is_valid(coeffs, state));
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
bw_cab_update_coeffs_ctrl(coeffs);
for (size_t i = 0; i < n_samples; i++) {
@@ -513,17 +513,17 @@ static inline void bw_cab_process_multi(
float * const * y,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_cab_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_cab_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x != NULL);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(x != BW_NULL);
+ BW_ASSERT(y != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -544,7 +544,7 @@ static inline void bw_cab_process_multi(
static inline void bw_cab_set_cutoff_low(
bw_cab_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_cab_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_cab_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -561,7 +561,7 @@ static inline void bw_cab_set_cutoff_low(
static inline void bw_cab_set_cutoff_high(
bw_cab_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_cab_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_cab_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -578,7 +578,7 @@ static inline void bw_cab_set_cutoff_high(
static inline void bw_cab_set_tone(
bw_cab_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_cab_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_cab_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -593,7 +593,7 @@ static inline void bw_cab_set_tone(
static inline char bw_cab_coeffs_is_valid(
const bw_cab_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_cab_coeffs"))
@@ -613,20 +613,20 @@ static inline char bw_cab_coeffs_is_valid(
static inline char bw_cab_state_is_valid(
const bw_cab_coeffs * BW_RESTRICT coeffs,
const bw_cab_state * BW_RESTRICT state) {
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (state->hash != bw_hash_sdbm("bw_cab_state"))
return 0;
- if (coeffs != NULL && coeffs->reset_id != state->coeffs_reset_id)
+ if (coeffs != BW_NULL && coeffs->reset_id != state->coeffs_reset_id)
return 0;
#endif
- return bw_svf_state_is_valid(coeffs ? &coeffs->lp_coeffs : NULL, &state->lp_state)
- && bw_svf_state_is_valid(coeffs ? &coeffs->hp_coeffs : NULL, &state->hp_state)
- && bw_svf_state_is_valid(coeffs ? &coeffs->bpl_coeffs : NULL, &state->bpl_state)
- && bw_svf_state_is_valid(coeffs ? &coeffs->bph_coeffs : NULL, &state->bph_state);
+ return bw_svf_state_is_valid(coeffs ? &coeffs->lp_coeffs : BW_NULL, &state->lp_state)
+ && bw_svf_state_is_valid(coeffs ? &coeffs->hp_coeffs : BW_NULL, &state->hp_state)
+ && bw_svf_state_is_valid(coeffs ? &coeffs->bpl_coeffs : BW_NULL, &state->bpl_state)
+ && bw_svf_state_is_valid(coeffs ? &coeffs->bph_coeffs : BW_NULL, &state->bph_state);
}
#ifdef __cplusplus
diff --git a/include/bw_chorus.h b/include/bw_chorus.h
index b265c5e..dc229ec 100644
--- a/include/bw_chorus.h
+++ b/include/bw_chorus.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2023 Orastron Srl unipersonale
+ * Copyright (C) 2023, 2024 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
@@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{
* bw_buf bw_comb bw_common bw_delay bw_gain bw_math bw_one_pole bw_osc_sin
* bw_phase_gen
@@ -36,6 +36,11 @@
* }}}
* changelog {{{
* BW_NULL
.BW_NULL
.BW_NULL
.BW_NULL
and relaxed NULL
definition
+ * requirement in C++.BW_SIZE_T
and went for size_t
@@ -91,7 +97,7 @@
*
* Brickworks requires definitions of:
*
- * * `NULL` and `size_t`, normally supplied by `stddef.h`;
+ * * `NULL` (C only) and `size_t`, normally supplied by `stddef.h`;
* * `(u)int{8,16,32,64}_t`, `INT{8,16,32,64}_{MIN,MAX}`, and
* `UINT{8,16,32,64}_MAX`, normally supplied by `stdint.h`;
* * `INFINITY`, normally supplied by `math.h`.
@@ -106,13 +112,20 @@
* * if `BW_NO_STDLIB` or `BW_NO_MATH_H` is defined, then `math.h` is not
* `#include`d.
*
+ * A `BW_NULL` macro is defined whose value is either `NULL` (C) or `nullptr`
+ * (C++).
* >>> */
#if !defined(BW_NO_STDLIB) && !defined(BW_NO_STDDEF_H)
# include BW_NULL
.BW_NULL
.read()
and write()
from C++
@@ -171,7 +176,7 @@ static inline void bw_delay_reset_state_multi(
* array.
*
* The corresponding initial output values are written into the `y_0` array,
- * if not `NULL`.
+ * if not `BW_NULL`.
*
* #### bw_delay_read()
* ```>>> */
@@ -292,8 +297,8 @@ static inline char bw_delay_state_is_valid(
* seems to be the case and `0` if it is certainly not. False positives are
* possible, false negatives are not.
*
- * If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
- * is supposed to be associated to `coeffs`).
+ * If `coeffs` is not `BW_NULL` extra cross-checks might be performed
+ * (`state` is supposed to be associated to `coeffs`).
*
* `state` must at least point to a readable memory block of size greater
* than or equal to that of `bw_delay_state`.
@@ -367,7 +372,7 @@ struct bw_delay_state {
static inline void bw_delay_init(
bw_delay_coeffs * BW_RESTRICT coeffs,
float max_delay) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT(bw_is_finite(max_delay));
BW_ASSERT(max_delay >= 0.f);
@@ -386,7 +391,7 @@ static inline void bw_delay_init(
static inline void bw_delay_set_sample_rate(
bw_delay_coeffs * BW_RESTRICT coeffs,
float sample_rate) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_delay_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_delay_coeffs_state_init);
BW_ASSERT(bw_is_finite(sample_rate) && sample_rate > 0.f);
@@ -403,7 +408,7 @@ static inline void bw_delay_set_sample_rate(
static inline size_t bw_delay_mem_req(
const bw_delay_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_delay_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_delay_coeffs_state_set_sample_rate);
@@ -414,11 +419,11 @@ static inline void bw_delay_mem_set(
const bw_delay_coeffs * BW_RESTRICT coeffs,
bw_delay_state * BW_RESTRICT state,
void * BW_RESTRICT mem) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_delay_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_delay_coeffs_state_set_sample_rate);
- BW_ASSERT(state != NULL);
- BW_ASSERT(mem != NULL);
+ BW_ASSERT(state != BW_NULL);
+ BW_ASSERT(mem != BW_NULL);
(void)coeffs;
state->buf = (float *)mem;
@@ -444,7 +449,7 @@ static inline void bw_delay_do_update_coeffs_ctrl(bw_delay_coeffs *BW_RESTRICT c
static inline void bw_delay_reset_coeffs(
bw_delay_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_delay_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_delay_coeffs_state_set_sample_rate);
@@ -463,10 +468,10 @@ static inline float bw_delay_reset_state(
const bw_delay_coeffs * BW_RESTRICT coeffs,
bw_delay_state * BW_RESTRICT state,
float x_0) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_delay_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_delay_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_delay_state_is_valid(coeffs, state));
BW_ASSERT_DEEP(state->state >= bw_delay_state_state_mem_set);
BW_ASSERT(bw_is_finite(x_0));
@@ -494,18 +499,18 @@ static inline void bw_delay_reset_state_multi(
const float * x_0,
float * y_0,
size_t n_channels) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_delay_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_delay_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x_0 != NULL);
+ BW_ASSERT(x_0 != BW_NULL);
- if (y_0 != NULL)
+ if (y_0 != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
y_0[i] = bw_delay_reset_state(coeffs, state[i], x_0[i]);
else
@@ -514,7 +519,7 @@ static inline void bw_delay_reset_state_multi(
BW_ASSERT_DEEP(bw_delay_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_delay_coeffs_state_reset_coeffs);
- BW_ASSERT_DEEP(y_0 != NULL ? bw_has_only_finite(y_0, n_channels) : 1);
+ BW_ASSERT_DEEP(y_0 != BW_NULL ? bw_has_only_finite(y_0, n_channels) : 1);
}
static float bw_delay_read(
@@ -522,10 +527,10 @@ static float bw_delay_read(
const bw_delay_state * BW_RESTRICT state,
size_t di,
float df) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_delay_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_delay_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_delay_state_is_valid(coeffs, state));
BW_ASSERT_DEEP(state->state >= bw_delay_state_state_reset_state);
BW_ASSERT(bw_is_finite(df));
@@ -549,10 +554,10 @@ static void bw_delay_write(
const bw_delay_coeffs * BW_RESTRICT coeffs,
bw_delay_state * BW_RESTRICT state,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_delay_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_delay_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_delay_state_is_valid(coeffs, state));
BW_ASSERT_DEEP(state->state >= bw_delay_state_state_reset_state);
BW_ASSERT(bw_is_finite(x));
@@ -569,7 +574,7 @@ static void bw_delay_write(
static inline void bw_delay_update_coeffs_ctrl(
bw_delay_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_delay_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_delay_coeffs_state_reset_coeffs);
@@ -581,7 +586,7 @@ static inline void bw_delay_update_coeffs_ctrl(
static inline void bw_delay_update_coeffs_audio(
bw_delay_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_delay_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_delay_coeffs_state_reset_coeffs);
@@ -592,10 +597,10 @@ static inline float bw_delay_process1(
const bw_delay_coeffs * BW_RESTRICT coeffs,
bw_delay_state * BW_RESTRICT state,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_delay_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_delay_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_delay_state_is_valid(coeffs, state));
BW_ASSERT_DEEP(state->state >= bw_delay_state_state_reset_state);
BW_ASSERT(bw_is_finite(x));
@@ -618,15 +623,15 @@ static inline void bw_delay_process(
const float * x,
float * y,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_delay_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_delay_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_delay_state_is_valid(coeffs, state));
BW_ASSERT_DEEP(state->state >= bw_delay_state_state_reset_state);
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
bw_delay_update_coeffs_ctrl(coeffs);
for (size_t i = 0; i < n_samples; i++)
@@ -646,17 +651,17 @@ static inline void bw_delay_process_multi(
float * const * y,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_delay_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_delay_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x != NULL);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(x != BW_NULL);
+ BW_ASSERT(y != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -675,7 +680,7 @@ static inline void bw_delay_process_multi(
static inline void bw_delay_set_delay(
bw_delay_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_delay_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_delay_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -691,7 +696,7 @@ static inline void bw_delay_set_delay(
static inline size_t bw_delay_get_length(
const bw_delay_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_delay_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_delay_coeffs_state_set_sample_rate);
@@ -700,7 +705,7 @@ static inline size_t bw_delay_get_length(
static inline char bw_delay_coeffs_is_valid(
const bw_delay_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_delay_coeffs"))
@@ -736,7 +741,7 @@ static inline char bw_delay_coeffs_is_valid(
static inline char bw_delay_state_is_valid(
const bw_delay_coeffs * BW_RESTRICT coeffs,
const bw_delay_state * BW_RESTRICT state) {
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (state->hash != bw_hash_sdbm("bw_delay_state"))
@@ -747,11 +752,11 @@ static inline char bw_delay_state_is_valid(
(void)coeffs;
- if (state->buf == NULL)
+ if (state->buf == BW_NULL)
return 0;
#ifdef BW_DEBUG_DEEP
- if (state->state >= bw_delay_state_state_reset_state && coeffs != NULL) {
+ if (state->state >= bw_delay_state_state_reset_state && coeffs != BW_NULL) {
if (coeffs->reset_id != state->coeffs_reset_id)
return 0;
diff --git a/include/bw_dist.h b/include/bw_dist.h
index c4035cc..322a098 100644
--- a/include/bw_dist.h
+++ b/include/bw_dist.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2023 Orastron Srl unipersonale
+ * Copyright (C) 2023, 2024 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
@@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{
* bw_clip bw_common bw_gain bw_hp1 bw_lp1 bw_math bw_mm2 bw_one_pole bw_peak
* bw_satur bw_svf
@@ -32,6 +32,11 @@
* }}}
* changelog {{{
* BW_NULL
.BW_NULL
.BW_NULL
.BW_NULL
.BW_NULL
.BW_NULL
.BW_NULL
.bw_gain_get_gain_lin()
.BW_NULL
.bw_hp1_reset_state_multi()
and updated C++
@@ -146,7 +151,7 @@ static inline void bw_hp1_reset_state_multi(
* array.
*
* The corresponding initial output values are written into the `y_0` array,
- * if not `NULL`.
+ * if not `BW_NULL`.
*
* #### bw_hp1_update_coeffs_ctrl()
* ```>>> */
@@ -260,8 +265,8 @@ static inline char bw_hp1_state_is_valid(
* seems to be the case and `0` if it is certainly not. False positives are
* possible, false negatives are not.
*
- * If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
- * is supposed to be associated to `coeffs`).
+ * If `coeffs` is not `BW_NULL` extra cross-checks might be performed
+ * (`state` is supposed to be associated to `coeffs`).
*
* `state` must at least point to a readable memory block of size greater
* than or equal to that of `bw_hp1_state`.
@@ -314,7 +319,7 @@ struct bw_hp1_state {
static inline void bw_hp1_init(
bw_hp1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
bw_lp1_init(&coeffs->lp1_coeffs);
@@ -330,7 +335,7 @@ static inline void bw_hp1_init(
static inline void bw_hp1_set_sample_rate(
bw_hp1_coeffs * BW_RESTRICT coeffs,
float sample_rate) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_init);
BW_ASSERT(bw_is_finite(sample_rate) && sample_rate > 0.f);
@@ -346,7 +351,7 @@ static inline void bw_hp1_set_sample_rate(
static inline void bw_hp1_reset_coeffs(
bw_hp1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_set_sample_rate);
@@ -364,10 +369,10 @@ static inline float bw_hp1_reset_state(
const bw_hp1_coeffs * BW_RESTRICT coeffs,
bw_hp1_state * BW_RESTRICT state,
float x_0) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT(bw_is_finite(x_0));
const float lp = bw_lp1_reset_state(&coeffs->lp1_coeffs, &state->lp1_state, x_0);
@@ -391,31 +396,31 @@ static inline void bw_hp1_reset_state_multi(
const float * x_0,
float * y_0,
size_t n_channels) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x_0 != NULL);
+ BW_ASSERT(x_0 != BW_NULL);
for (size_t i = 0; i < n_channels; i++)
bw_hp1_reset_state(coeffs, state[i], x_0[i]);
- if (y_0 != NULL)
+ if (y_0 != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
y_0[i] = 0.f;
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_reset_coeffs);
- BW_ASSERT_DEEP(y_0 != NULL ? bw_has_only_finite(y_0, n_channels) : 1);
+ BW_ASSERT_DEEP(y_0 != BW_NULL ? bw_has_only_finite(y_0, n_channels) : 1);
}
static inline void bw_hp1_update_coeffs_ctrl(
bw_hp1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_reset_coeffs);
@@ -427,7 +432,7 @@ static inline void bw_hp1_update_coeffs_ctrl(
static inline void bw_hp1_update_coeffs_audio(
bw_hp1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_reset_coeffs);
@@ -441,10 +446,10 @@ static inline float bw_hp1_process1(
const bw_hp1_coeffs * BW_RESTRICT coeffs,
bw_hp1_state * BW_RESTRICT state,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_hp1_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
@@ -465,14 +470,14 @@ static inline void bw_hp1_process(
const float * x,
float * y,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_hp1_state_is_valid(coeffs, state));
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
bw_hp1_update_coeffs_ctrl(coeffs);
for (size_t i = 0; i < n_samples; i++) {
@@ -493,17 +498,17 @@ static inline void bw_hp1_process_multi(
float * const * y,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x != NULL);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(x != BW_NULL);
+ BW_ASSERT(y != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -524,7 +529,7 @@ static inline void bw_hp1_process_multi(
static inline void bw_hp1_set_cutoff(
bw_hp1_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -539,7 +544,7 @@ static inline void bw_hp1_set_cutoff(
static inline void bw_hp1_set_prewarp_at_cutoff(
bw_hp1_coeffs * BW_RESTRICT coeffs,
char value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_init);
@@ -552,7 +557,7 @@ static inline void bw_hp1_set_prewarp_at_cutoff(
static inline void bw_hp1_set_prewarp_freq(
bw_hp1_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -566,7 +571,7 @@ static inline void bw_hp1_set_prewarp_freq(
static inline char bw_hp1_coeffs_is_valid(
const bw_hp1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_hp1_coeffs"))
@@ -581,17 +586,17 @@ static inline char bw_hp1_coeffs_is_valid(
static inline char bw_hp1_state_is_valid(
const bw_hp1_coeffs * BW_RESTRICT coeffs,
const bw_hp1_state * BW_RESTRICT state) {
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (state->hash != bw_hash_sdbm("bw_hp1_state"))
return 0;
- if (coeffs != NULL && coeffs->reset_id != state->coeffs_reset_id)
+ if (coeffs != BW_NULL && coeffs->reset_id != state->coeffs_reset_id)
return 0;
#endif
- return bw_lp1_state_is_valid(coeffs ? &coeffs->lp1_coeffs : NULL, &state->lp1_state);
+ return bw_lp1_state_is_valid(coeffs ? &coeffs->lp1_coeffs : BW_NULL, &state->lp1_state);
}
#ifdef __cplusplus
diff --git a/include/bw_hs1.h b/include/bw_hs1.h
index 263faa7..846c756 100644
--- a/include/bw_hs1.h
+++ b/include/bw_hs1.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2022, 2023 Orastron Srl unipersonale
+ * Copyright (C) 2022-2024 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
@@ -20,13 +20,18 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common bw_gain bw_lp1 bw_math bw_mm1 bw_one_pole }}}
* description {{{
* First-order high shelf filter (6 dB/oct) with unitary DC gain.
* }}}
* changelog {{{
* BW_NULL
.bw_hs1_reset_state_multi()
and updated C++
@@ -147,7 +152,7 @@ static inline void bw_hs1_reset_state_multi(
* array.
*
* The corresponding initial output values are written into the `y_0` array,
- * if not `NULL`.
+ * if not `BW_NULL`.
*
* #### bw_hs1_update_coeffs_ctrl()
* ```>>> */
@@ -302,8 +307,8 @@ static inline char bw_hs1_state_is_valid(
* seems to be the case and `0` if it is certainly not. False positives are
* possible, false negatives are not.
*
- * If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
- * is supposed to be associated to `coeffs`).
+ * If `coeffs` is not `BW_NULL` extra cross-checks might be performed
+ * (`state` is supposed to be associated to `coeffs`).
*
* `state` must at least point to a readable memory block of size greater
* than or equal to that of `bw_hs1_state`.
@@ -364,7 +369,7 @@ struct bw_hs1_state {
static inline void bw_hs1_init(
bw_hs1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
bw_mm1_init(&coeffs->mm1_coeffs);
bw_mm1_set_prewarp_at_cutoff(&coeffs->mm1_coeffs, 0);
@@ -387,7 +392,7 @@ static inline void bw_hs1_init(
static inline void bw_hs1_set_sample_rate(
bw_hs1_coeffs * BW_RESTRICT coeffs,
float sample_rate) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs1_coeffs_state_init);
BW_ASSERT(bw_is_finite(sample_rate) && sample_rate > 0.f);
@@ -414,7 +419,7 @@ static inline void bw_hs1_update_mm1_params(
static inline void bw_hs1_reset_coeffs(
bw_hs1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs1_coeffs_state_set_sample_rate);
BW_ASSERT_DEEP(coeffs->cutoff * bw_sqrtf(coeffs->high_gain) >= 1e-6f && coeffs->cutoff * bw_sqrtf(coeffs->high_gain) <= 1e12f);
@@ -435,10 +440,10 @@ static inline float bw_hs1_reset_state(
const bw_hs1_coeffs * BW_RESTRICT coeffs,
bw_hs1_state * BW_RESTRICT state,
float x_0) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs1_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT(bw_is_finite(x_0));
const float y = bw_mm1_reset_state(&coeffs->mm1_coeffs, &state->mm1_state, x_0);
@@ -461,18 +466,18 @@ static inline void bw_hs1_reset_state_multi(
const float * x_0,
float * y_0,
size_t n_channels) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs1_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x_0 != NULL);
+ BW_ASSERT(x_0 != BW_NULL);
- if (y_0 != NULL)
+ if (y_0 != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
y_0[i] = bw_hs1_reset_state(coeffs, state[i], x_0[i]);
else
@@ -481,12 +486,12 @@ static inline void bw_hs1_reset_state_multi(
BW_ASSERT_DEEP(bw_hs1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs1_coeffs_state_reset_coeffs);
- BW_ASSERT_DEEP(y_0 != NULL ? bw_has_only_finite(y_0, n_channels) : 1);
+ BW_ASSERT_DEEP(y_0 != BW_NULL ? bw_has_only_finite(y_0, n_channels) : 1);
}
static inline void bw_hs1_update_coeffs_ctrl(
bw_hs1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs1_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->cutoff * bw_sqrtf(coeffs->high_gain) >= 1e-6f && coeffs->cutoff * bw_sqrtf(coeffs->high_gain) <= 1e12f);
@@ -500,7 +505,7 @@ static inline void bw_hs1_update_coeffs_ctrl(
static inline void bw_hs1_update_coeffs_audio(
bw_hs1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs1_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->cutoff * bw_sqrtf(coeffs->high_gain) >= 1e-6f && coeffs->cutoff * bw_sqrtf(coeffs->high_gain) <= 1e12f);
@@ -515,11 +520,11 @@ static inline float bw_hs1_process1(
const bw_hs1_coeffs * BW_RESTRICT coeffs,
bw_hs1_state * BW_RESTRICT state,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs1_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->cutoff * bw_sqrtf(coeffs->high_gain) >= 1e-6f && coeffs->cutoff * bw_sqrtf(coeffs->high_gain) <= 1e12f);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_hs1_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
@@ -539,15 +544,15 @@ static inline void bw_hs1_process(
const float * x,
float * y,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs1_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->cutoff * bw_sqrtf(coeffs->high_gain) >= 1e-6f && coeffs->cutoff * bw_sqrtf(coeffs->high_gain) <= 1e12f);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_hs1_state_is_valid(coeffs, state));
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
bw_hs1_update_coeffs_ctrl(coeffs);
for (size_t i = 0; i < n_samples; i++) {
@@ -568,18 +573,18 @@ static inline void bw_hs1_process_multi(
float * const * y,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs1_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->cutoff * bw_sqrtf(coeffs->high_gain) >= 1e-6f && coeffs->cutoff * bw_sqrtf(coeffs->high_gain) <= 1e12f);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x != NULL);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(x != BW_NULL);
+ BW_ASSERT(y != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -600,7 +605,7 @@ static inline void bw_hs1_process_multi(
static inline void bw_hs1_set_cutoff(
bw_hs1_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs1_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -618,7 +623,7 @@ static inline void bw_hs1_set_cutoff(
static inline void bw_hs1_set_prewarp_at_cutoff(
bw_hs1_coeffs * BW_RESTRICT coeffs,
char value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs1_coeffs_state_init);
@@ -631,7 +636,7 @@ static inline void bw_hs1_set_prewarp_at_cutoff(
static inline void bw_hs1_set_prewarp_freq(
bw_hs1_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs1_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -646,7 +651,7 @@ static inline void bw_hs1_set_prewarp_freq(
static inline void bw_hs1_set_high_gain_lin(
bw_hs1_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs1_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -664,7 +669,7 @@ static inline void bw_hs1_set_high_gain_lin(
static inline void bw_hs1_set_high_gain_dB(
bw_hs1_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs1_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -678,7 +683,7 @@ static inline void bw_hs1_set_high_gain_dB(
static inline char bw_hs1_coeffs_is_valid(
const bw_hs1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_hs1_coeffs"))
@@ -702,17 +707,17 @@ static inline char bw_hs1_coeffs_is_valid(
static inline char bw_hs1_state_is_valid(
const bw_hs1_coeffs * BW_RESTRICT coeffs,
const bw_hs1_state * BW_RESTRICT state) {
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (state->hash != bw_hash_sdbm("bw_hs1_state"))
return 0;
- if (coeffs != NULL && coeffs->reset_id != state->coeffs_reset_id)
+ if (coeffs != BW_NULL && coeffs->reset_id != state->coeffs_reset_id)
return 0;
#endif
- return bw_mm1_state_is_valid(coeffs ? &coeffs->mm1_coeffs : NULL, &state->mm1_state);
+ return bw_mm1_state_is_valid(coeffs ? &coeffs->mm1_coeffs : BW_NULL, &state->mm1_state);
}
#ifdef __cplusplus
diff --git a/include/bw_hs2.h b/include/bw_hs2.h
index 3ebdbd8..c166564 100644
--- a/include/bw_hs2.h
+++ b/include/bw_hs2.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2022, 2023 Orastron Srl unipersonale
+ * Copyright (C) 2022-2024 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
@@ -20,13 +20,18 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common bw_gain bw_math bw_mm2 bw_one_pole bw_svf }}}
* description {{{
* Second-order high shelf filter (12 dB/oct) with unitary DC gain.
* }}}
* changelog {{{
* BW_NULL
.bw_hs2_reset_state_multi()
and updated C++
@@ -149,7 +154,7 @@ static inline void bw_hs2_reset_state_multi(
* array.
*
* The corresponding initial output values are written into the `y_0` array,
- * if not `NULL`.
+ * if not `BW_NULL`.
*
* #### bw_hs2_update_coeffs_ctrl()
* ```>>> */
@@ -316,8 +321,8 @@ static inline char bw_hs2_state_is_valid(
* seems to be the case and `0` if it is certainly not. False positives are
* possible, false negatives are not.
*
- * If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
- * is supposed to be associated to `coeffs`).
+ * If `coeffs` is not `BW_NULL` extra cross-checks might be performed
+ * (`state` is supposed to be associated to `coeffs`).
*
* `state` must at least point to a readable memory block of size greater
* than or equal to that of `bw_hs2_state`.
@@ -385,7 +390,7 @@ struct bw_hs2_state {
static inline void bw_hs2_init(
bw_hs2_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
bw_mm2_init(&coeffs->mm2_coeffs);
bw_mm2_set_prewarp_at_cutoff(&coeffs->mm2_coeffs, 0);
@@ -406,7 +411,7 @@ static inline void bw_hs2_init(
static inline void bw_hs2_set_sample_rate(
bw_hs2_coeffs * BW_RESTRICT coeffs,
float sample_rate) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs2_coeffs_state_init);
BW_ASSERT(bw_is_finite(sample_rate) && sample_rate > 0.f);
@@ -438,7 +443,7 @@ static inline void bw_hs2_update_mm2_params(
static inline void bw_hs2_reset_coeffs(
bw_hs2_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs2_coeffs_state_set_sample_rate);
BW_ASSERT_DEEP(coeffs->cutoff * bw_sqrtf(bw_sqrtf(coeffs->high_gain)) >= 1e-6f && coeffs->cutoff * bw_sqrtf(bw_sqrtf(coeffs->high_gain)) <= 1e12f);
@@ -459,10 +464,10 @@ static inline float bw_hs2_reset_state(
const bw_hs2_coeffs * BW_RESTRICT coeffs,
bw_hs2_state * BW_RESTRICT state,
float x_0) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs2_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT(bw_is_finite(x_0));
const float y = bw_mm2_reset_state(&coeffs->mm2_coeffs, &state->mm2_state, x_0);
@@ -485,18 +490,18 @@ static inline void bw_hs2_reset_state_multi(
const float * x_0,
float * y_0,
size_t n_channels) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs2_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x_0 != NULL);
+ BW_ASSERT(x_0 != BW_NULL);
- if (y_0 != NULL)
+ if (y_0 != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
y_0[i] = bw_hs2_reset_state(coeffs, state[i], x_0[i]);
else
@@ -505,12 +510,12 @@ static inline void bw_hs2_reset_state_multi(
BW_ASSERT_DEEP(bw_hs2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs2_coeffs_state_reset_coeffs);
- BW_ASSERT_DEEP(y_0 != NULL ? bw_has_only_finite(y_0, n_channels) : 1);
+ BW_ASSERT_DEEP(y_0 != BW_NULL ? bw_has_only_finite(y_0, n_channels) : 1);
}
static inline void bw_hs2_update_coeffs_ctrl(
bw_hs2_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs2_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->cutoff * bw_sqrtf(bw_sqrtf(coeffs->high_gain)) >= 1e-6f && coeffs->cutoff * bw_sqrtf(bw_sqrtf(coeffs->high_gain)) <= 1e12f);
@@ -524,7 +529,7 @@ static inline void bw_hs2_update_coeffs_ctrl(
static inline void bw_hs2_update_coeffs_audio(
bw_hs2_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs2_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->cutoff * bw_sqrtf(bw_sqrtf(coeffs->high_gain)) >= 1e-6f && coeffs->cutoff * bw_sqrtf(bw_sqrtf(coeffs->high_gain)) <= 1e12f);
@@ -539,11 +544,11 @@ static inline float bw_hs2_process1(
const bw_hs2_coeffs * BW_RESTRICT coeffs,
bw_hs2_state * BW_RESTRICT state,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs2_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->cutoff * bw_sqrtf(bw_sqrtf(coeffs->high_gain)) >= 1e-6f && coeffs->cutoff * bw_sqrtf(bw_sqrtf(coeffs->high_gain)) <= 1e12f);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_hs2_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
@@ -563,15 +568,15 @@ static inline void bw_hs2_process(
const float * x,
float * y,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs2_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->cutoff * bw_sqrtf(bw_sqrtf(coeffs->high_gain)) >= 1e-6f && coeffs->cutoff * bw_sqrtf(bw_sqrtf(coeffs->high_gain)) <= 1e12f);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_hs2_state_is_valid(coeffs, state));
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
bw_hs2_update_coeffs_ctrl(coeffs);
for (size_t i = 0; i < n_samples; i++) {
@@ -592,18 +597,18 @@ static inline void bw_hs2_process_multi(
float * const * y,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs2_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->cutoff * bw_sqrtf(bw_sqrtf(coeffs->high_gain)) >= 1e-6f && coeffs->cutoff * bw_sqrtf(bw_sqrtf(coeffs->high_gain)) <= 1e12f);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x != NULL);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(x != BW_NULL);
+ BW_ASSERT(y != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -624,7 +629,7 @@ static inline void bw_hs2_process_multi(
static inline void bw_hs2_set_cutoff(
bw_hs2_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs2_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -645,7 +650,7 @@ static inline void bw_hs2_set_cutoff(
static inline void bw_hs2_set_Q(
bw_hs2_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs2_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -660,7 +665,7 @@ static inline void bw_hs2_set_Q(
static inline void bw_hs2_set_prewarp_at_cutoff(
bw_hs2_coeffs * BW_RESTRICT coeffs,
char value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs2_coeffs_state_init);
@@ -673,7 +678,7 @@ static inline void bw_hs2_set_prewarp_at_cutoff(
static inline void bw_hs2_set_prewarp_freq(
bw_hs2_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs2_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -688,7 +693,7 @@ static inline void bw_hs2_set_prewarp_freq(
static inline void bw_hs2_set_high_gain_lin(
bw_hs2_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs2_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -709,7 +714,7 @@ static inline void bw_hs2_set_high_gain_lin(
static inline void bw_hs2_set_high_gain_dB(
bw_hs2_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_hs2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_hs2_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -723,7 +728,7 @@ static inline void bw_hs2_set_high_gain_dB(
static inline char bw_hs2_coeffs_is_valid(
const bw_hs2_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_hs2_coeffs"))
@@ -756,17 +761,17 @@ static inline char bw_hs2_coeffs_is_valid(
static inline char bw_hs2_state_is_valid(
const bw_hs2_coeffs * BW_RESTRICT coeffs,
const bw_hs2_state * BW_RESTRICT state) {
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (state->hash != bw_hash_sdbm("bw_hs2_state"))
return 0;
- if (coeffs != NULL && coeffs->reset_id != state->coeffs_reset_id)
+ if (coeffs != BW_NULL && coeffs->reset_id != state->coeffs_reset_id)
return 0;
#endif
- return bw_mm2_state_is_valid(coeffs ? &coeffs->mm2_coeffs : NULL, &state->mm2_state);
+ return bw_mm2_state_is_valid(coeffs ? &coeffs->mm2_coeffs : BW_NULL, &state->mm2_state);
}
#undef BW_HS2_PARAM_CUTOFF
diff --git a/include/bw_lp1.h b/include/bw_lp1.h
index 8b5f3af..b254342 100644
--- a/include/bw_lp1.h
+++ b/include/bw_lp1.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2022, 2023 Orastron Srl unipersonale
+ * Copyright (C) 2022-2024 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
@@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common bw_math bw_one_pole }}}
* description {{{
* First-order lowpass filter (6 dB/oct) with unitary DC gain.
@@ -30,6 +30,11 @@
* }}}
* changelog {{{
* BW_NULL
.BW_NULL
.bw_ls1_reset_state_multi()
and updated C++
@@ -148,7 +153,7 @@ static inline void bw_ls1_reset_state_multi(
* array.
*
* The corresponding initial output values are written into the `y_0` array,
- * if not `NULL`.
+ * if not `BW_NULL`.
*
* #### bw_ls1_update_coeffs_ctrl()
* ```>>> */
@@ -301,8 +306,8 @@ static inline char bw_ls1_state_is_valid(
* seems to be the case and `0` if it is certainly not. False positives are
* possible, false negatives are not.
*
- * If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
- * is supposed to be associated to `coeffs`).
+ * If `coeffs` is not `BW_NULL` extra cross-checks might be performed
+ * (`state` is supposed to be associated to `coeffs`).
*
* `state` must at least point to a readable memory block of size greater
* than or equal to that of `bw_ls1_state`.
@@ -363,7 +368,7 @@ struct bw_ls1_state {
static inline void bw_ls1_init(
bw_ls1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
bw_mm1_init(&coeffs->mm1_coeffs);
bw_mm1_set_prewarp_at_cutoff(&coeffs->mm1_coeffs, 0);
@@ -386,7 +391,7 @@ static inline void bw_ls1_init(
static inline void bw_ls1_set_sample_rate(
bw_ls1_coeffs * BW_RESTRICT coeffs,
float sample_rate) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls1_coeffs_state_init);
BW_ASSERT(bw_is_finite(sample_rate) && sample_rate > 0.f);
@@ -412,7 +417,7 @@ static inline void bw_ls1_update_mm1_params(
static inline void bw_ls1_reset_coeffs(
bw_ls1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls1_coeffs_state_set_sample_rate);
BW_ASSERT_DEEP(coeffs->cutoff * bw_rcpf(bw_sqrtf(coeffs->dc_gain)) >= 1e-6f && coeffs->cutoff * bw_rcpf(bw_sqrtf(coeffs->dc_gain)) <= 1e12f);
@@ -433,10 +438,10 @@ static inline float bw_ls1_reset_state(
const bw_ls1_coeffs * BW_RESTRICT coeffs,
bw_ls1_state * BW_RESTRICT state,
float x_0) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls1_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT(bw_is_finite(x_0));
const float y = bw_mm1_reset_state(&coeffs->mm1_coeffs, &state->mm1_state, x_0);
@@ -459,18 +464,18 @@ static inline void bw_ls1_reset_state_multi(
const float * x_0,
float * y_0,
size_t n_channels) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls1_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x_0 != NULL);
+ BW_ASSERT(x_0 != BW_NULL);
- if (y_0 != NULL)
+ if (y_0 != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
y_0[i] = bw_ls1_reset_state(coeffs, state[i], x_0[i]);
else
@@ -479,12 +484,12 @@ static inline void bw_ls1_reset_state_multi(
BW_ASSERT_DEEP(bw_ls1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls1_coeffs_state_reset_coeffs);
- BW_ASSERT_DEEP(y_0 != NULL ? bw_has_only_finite(y_0, n_channels) : 1);
+ BW_ASSERT_DEEP(y_0 != BW_NULL ? bw_has_only_finite(y_0, n_channels) : 1);
}
static inline void bw_ls1_update_coeffs_ctrl(
bw_ls1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls1_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->cutoff * bw_rcpf(bw_sqrtf(coeffs->dc_gain)) >= 1e-6f && coeffs->cutoff * bw_rcpf(bw_sqrtf(coeffs->dc_gain)) <= 1e12f);
@@ -498,7 +503,7 @@ static inline void bw_ls1_update_coeffs_ctrl(
static inline void bw_ls1_update_coeffs_audio(
bw_ls1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls1_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->cutoff * bw_rcpf(bw_sqrtf(coeffs->dc_gain)) >= 1e-6f && coeffs->cutoff * bw_rcpf(bw_sqrtf(coeffs->dc_gain)) <= 1e12f);
@@ -513,11 +518,11 @@ static inline float bw_ls1_process1(
const bw_ls1_coeffs * BW_RESTRICT coeffs,
bw_ls1_state * BW_RESTRICT state,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls1_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->cutoff * bw_rcpf(bw_sqrtf(coeffs->dc_gain)) >= 1e-6f && coeffs->cutoff * bw_rcpf(bw_sqrtf(coeffs->dc_gain)) <= 1e12f);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_ls1_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
@@ -537,15 +542,15 @@ static inline void bw_ls1_process(
const float * x,
float * y,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls1_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->cutoff * bw_rcpf(bw_sqrtf(coeffs->dc_gain)) >= 1e-6f && coeffs->cutoff * bw_rcpf(bw_sqrtf(coeffs->dc_gain)) <= 1e12f);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_ls1_state_is_valid(coeffs, state));
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
bw_ls1_update_coeffs_ctrl(coeffs);
for (size_t i = 0; i < n_samples; i++) {
@@ -566,18 +571,18 @@ static inline void bw_ls1_process_multi(
float * const * y,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls1_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->cutoff * bw_rcpf(bw_sqrtf(coeffs->dc_gain)) >= 1e-6f && coeffs->cutoff * bw_rcpf(bw_sqrtf(coeffs->dc_gain)) <= 1e12f);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x != NULL);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(x != BW_NULL);
+ BW_ASSERT(y != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -598,7 +603,7 @@ static inline void bw_ls1_process_multi(
static inline void bw_ls1_set_cutoff(
bw_ls1_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls1_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -616,7 +621,7 @@ static inline void bw_ls1_set_cutoff(
static inline void bw_ls1_set_prewarp_at_cutoff(
bw_ls1_coeffs * BW_RESTRICT coeffs,
char value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls1_coeffs_state_init);
@@ -629,7 +634,7 @@ static inline void bw_ls1_set_prewarp_at_cutoff(
static inline void bw_ls1_set_prewarp_freq(
bw_ls1_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls1_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -644,7 +649,7 @@ static inline void bw_ls1_set_prewarp_freq(
static inline void bw_ls1_set_dc_gain_lin(
bw_ls1_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls1_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -662,7 +667,7 @@ static inline void bw_ls1_set_dc_gain_lin(
static inline void bw_ls1_set_dc_gain_dB(
bw_ls1_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls1_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -676,7 +681,7 @@ static inline void bw_ls1_set_dc_gain_dB(
static inline char bw_ls1_coeffs_is_valid(
const bw_ls1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_ls1_coeffs"))
@@ -700,17 +705,17 @@ static inline char bw_ls1_coeffs_is_valid(
static inline char bw_ls1_state_is_valid(
const bw_ls1_coeffs * BW_RESTRICT coeffs,
const bw_ls1_state * BW_RESTRICT state) {
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (state->hash != bw_hash_sdbm("bw_ls1_state"))
return 0;
- if (coeffs != NULL && coeffs->reset_id != state->coeffs_reset_id)
+ if (coeffs != BW_NULL && coeffs->reset_id != state->coeffs_reset_id)
return 0;
#endif
- return bw_mm1_state_is_valid(coeffs ? &coeffs->mm1_coeffs : NULL, &state->mm1_state);
+ return bw_mm1_state_is_valid(coeffs ? &coeffs->mm1_coeffs : BW_NULL, &state->mm1_state);
}
#ifdef __cplusplus
diff --git a/include/bw_ls2.h b/include/bw_ls2.h
index 4faa214..47ab313 100644
--- a/include/bw_ls2.h
+++ b/include/bw_ls2.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2022, 2023 Orastron Srl unipersonale
+ * Copyright (C) 2022-2024 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
@@ -30,6 +30,7 @@
* BW_NULL
.bw_ls2_set_cutoff()
,
* bw_ls2_set_dc_gain_lin()
, and
@@ -158,7 +159,7 @@ static inline void bw_ls2_reset_state_multi(
* array.
*
* The corresponding initial output values are written into the `y_0` array,
- * if not `NULL`.
+ * if not `BW_NULL`.
*
* #### bw_ls2_update_coeffs_ctrl()
* ```>>> */
@@ -326,8 +327,8 @@ static inline char bw_ls2_state_is_valid(
* seems to be the case and `0` if it is certainly not. False positives are
* possible, false negatives are not.
*
- * If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
- * is supposed to be associated to `coeffs`).
+ * If `coeffs` is not `BW_NULL` extra cross-checks might be performed
+ * (`state` is supposed to be associated to `coeffs`).
*
* `state` must at least point to a readable memory block of size greater
* than or equal to that of `bw_ls2_state`.
@@ -395,7 +396,7 @@ struct bw_ls2_state {
static inline void bw_ls2_init(
bw_ls2_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
bw_mm2_init(&coeffs->mm2_coeffs);
bw_mm2_set_prewarp_at_cutoff(&coeffs->mm2_coeffs, 0);
@@ -416,7 +417,7 @@ static inline void bw_ls2_init(
static inline void bw_ls2_set_sample_rate(
bw_ls2_coeffs * BW_RESTRICT coeffs,
float sample_rate) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls2_coeffs_state_init);
BW_ASSERT(bw_is_finite(sample_rate) && sample_rate > 0.f);
@@ -448,7 +449,7 @@ static inline void bw_ls2_update_mm2_params(
static inline void bw_ls2_reset_coeffs(
bw_ls2_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls2_coeffs_state_set_sample_rate);
BW_ASSERT_DEEP(coeffs->cutoff * bw_rcpf(bw_sqrtf(bw_sqrtf(coeffs->dc_gain))) >= 1e-6f && coeffs->cutoff * bw_rcpf(bw_sqrtf(bw_sqrtf(coeffs->dc_gain))) <= 1e12f);
@@ -469,10 +470,10 @@ static inline float bw_ls2_reset_state(
const bw_ls2_coeffs * BW_RESTRICT coeffs,
bw_ls2_state * BW_RESTRICT state,
float x_0) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls2_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT(bw_is_finite(x_0));
const float y = bw_mm2_reset_state(&coeffs->mm2_coeffs, &state->mm2_state, x_0);
@@ -495,18 +496,18 @@ static inline void bw_ls2_reset_state_multi(
const float * x_0,
float * y_0,
size_t n_channels) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls2_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x_0 != NULL);
+ BW_ASSERT(x_0 != BW_NULL);
- if (y_0 != NULL)
+ if (y_0 != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
y_0[i] = bw_ls2_reset_state(coeffs, state[i], x_0[i]);
else
@@ -515,12 +516,12 @@ static inline void bw_ls2_reset_state_multi(
BW_ASSERT_DEEP(bw_ls2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls2_coeffs_state_reset_coeffs);
- BW_ASSERT_DEEP(y_0 != NULL ? bw_has_only_finite(y_0, n_channels) : 1);
+ BW_ASSERT_DEEP(y_0 != BW_NULL ? bw_has_only_finite(y_0, n_channels) : 1);
}
static inline void bw_ls2_update_coeffs_ctrl(
bw_ls2_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls2_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->cutoff * bw_rcpf(bw_sqrtf(bw_sqrtf(coeffs->dc_gain))) >= 1e-6f && coeffs->cutoff * bw_rcpf(bw_sqrtf(bw_sqrtf(coeffs->dc_gain))) <= 1e12f);
@@ -534,7 +535,7 @@ static inline void bw_ls2_update_coeffs_ctrl(
static inline void bw_ls2_update_coeffs_audio(
bw_ls2_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls2_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->cutoff * bw_rcpf(bw_sqrtf(bw_sqrtf(coeffs->dc_gain))) >= 1e-6f && coeffs->cutoff * bw_rcpf(bw_sqrtf(bw_sqrtf(coeffs->dc_gain))) <= 1e12f);
@@ -549,11 +550,11 @@ static inline float bw_ls2_process1(
const bw_ls2_coeffs * BW_RESTRICT coeffs,
bw_ls2_state * BW_RESTRICT state,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls2_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->cutoff * bw_rcpf(bw_sqrtf(bw_sqrtf(coeffs->dc_gain))) >= 1e-6f && coeffs->cutoff * bw_rcpf(bw_sqrtf(bw_sqrtf(coeffs->dc_gain))) <= 1e12f);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_ls2_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
@@ -573,15 +574,15 @@ static inline void bw_ls2_process(
const float * x,
float * y,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls2_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->cutoff * bw_rcpf(bw_sqrtf(bw_sqrtf(coeffs->dc_gain))) >= 1e-6f && coeffs->cutoff * bw_rcpf(bw_sqrtf(bw_sqrtf(coeffs->dc_gain))) <= 1e12f);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_ls2_state_is_valid(coeffs, state));
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
bw_ls2_update_coeffs_ctrl(coeffs);
for (size_t i = 0; i < n_samples; i++) {
@@ -602,18 +603,18 @@ static inline void bw_ls2_process_multi(
float * const * y,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls2_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->cutoff * bw_rcpf(bw_sqrtf(bw_sqrtf(coeffs->dc_gain))) >= 1e-6f && coeffs->cutoff * bw_rcpf(bw_sqrtf(bw_sqrtf(coeffs->dc_gain))) <= 1e12f);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x != NULL);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(x != BW_NULL);
+ BW_ASSERT(y != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -634,7 +635,7 @@ static inline void bw_ls2_process_multi(
static inline void bw_ls2_set_cutoff(
bw_ls2_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls2_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -655,7 +656,7 @@ static inline void bw_ls2_set_cutoff(
static inline void bw_ls2_set_Q(
bw_ls2_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls2_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -670,7 +671,7 @@ static inline void bw_ls2_set_Q(
static inline void bw_ls2_set_prewarp_at_cutoff(
bw_ls2_coeffs * BW_RESTRICT coeffs,
char value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls2_coeffs_state_init);
@@ -683,7 +684,7 @@ static inline void bw_ls2_set_prewarp_at_cutoff(
static inline void bw_ls2_set_prewarp_freq(
bw_ls2_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls2_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -698,7 +699,7 @@ static inline void bw_ls2_set_prewarp_freq(
static inline void bw_ls2_set_dc_gain_lin(
bw_ls2_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls2_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -719,7 +720,7 @@ static inline void bw_ls2_set_dc_gain_lin(
static inline void bw_ls2_set_dc_gain_dB(
bw_ls2_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_ls2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_ls2_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -733,7 +734,7 @@ static inline void bw_ls2_set_dc_gain_dB(
static inline char bw_ls2_coeffs_is_valid(
const bw_ls2_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_ls2_coeffs"))
@@ -766,17 +767,17 @@ static inline char bw_ls2_coeffs_is_valid(
static inline char bw_ls2_state_is_valid(
const bw_ls2_coeffs * BW_RESTRICT coeffs,
const bw_ls2_state * BW_RESTRICT state) {
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (state->hash != bw_hash_sdbm("bw_ls2_state"))
return 0;
- if (coeffs != NULL && coeffs->reset_id != state->coeffs_reset_id)
+ if (coeffs != BW_NULL && coeffs->reset_id != state->coeffs_reset_id)
return 0;
#endif
- return bw_mm2_state_is_valid(coeffs ? &coeffs->mm2_coeffs : NULL, &state->mm2_state);
+ return bw_mm2_state_is_valid(coeffs ? &coeffs->mm2_coeffs : BW_NULL, &state->mm2_state);
}
#undef BW_LS2_PARAM_CUTOFF
diff --git a/include/bw_math.h b/include/bw_math.h
index 0f2b0e9..8280a21 100644
--- a/include/bw_math.h
+++ b/include/bw_math.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2021-2023 Orastron Srl unipersonale
+ * Copyright (C) 2021-2024 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
@@ -20,7 +20,7 @@
/*!
* module_type {{{ utility }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common }}}
* description {{{
* A collection of mathematical routines that strive to be better suited to
@@ -44,6 +44,11 @@
* }}}
* changelog {{{
* BW_NULL
.bw_min0xf()
as bw_min0f()
and
@@ -756,8 +761,8 @@ static inline void bw_intfracf(
float * BW_RESTRICT i,
float * BW_RESTRICT f) {
BW_ASSERT(bw_is_finite(x));
- BW_ASSERT(i != NULL);
- BW_ASSERT(f != NULL);
+ BW_ASSERT(i != BW_NULL);
+ BW_ASSERT(f != BW_NULL);
BW_ASSERT(i != f);
*i = bw_floorf(x);
*f = x - *i;
diff --git a/include/bw_mm1.h b/include/bw_mm1.h
index 93c3933..df21826 100644
--- a/include/bw_mm1.h
+++ b/include/bw_mm1.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2022, 2023 Orastron Srl unipersonale
+ * Copyright (C) 2022-2024 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
@@ -20,13 +20,18 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common bw_gain bw_lp1 bw_math bw_one_pole }}}
* description {{{
* First-order multimode filter.
* }}}
* changelog {{{
* BW_NULL
.bw_mm1_reset_state_multi()
and updated C++
@@ -144,7 +149,7 @@ static inline void bw_mm1_reset_state_multi(
* array.
*
* The corresponding initial output values are written into the `y_0` array,
- * if not `NULL`.
+ * if not `BW_NULL`.
*
* #### bw_mm1_update_coeffs_ctrl()
* ```>>> */
@@ -281,8 +286,8 @@ static inline char bw_mm1_state_is_valid(
* seems to be the case and `0` if it is certainly not. False positives are
* possible, false negatives are not.
*
- * If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
- * is supposed to be associated to `coeffs`).
+ * If `coeffs` is not `BW_NULL` extra cross-checks might be performed
+ * (`state` is supposed to be associated to `coeffs`).
*
* `state` must at least point to a readable memory block of size greater
* than or equal to that of `bw_mm1_state`.
@@ -338,7 +343,7 @@ struct bw_mm1_state {
static inline void bw_mm1_init(
bw_mm1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
bw_lp1_init(&coeffs->lp1_coeffs);
bw_gain_init(&coeffs->gain_x_coeffs);
@@ -360,7 +365,7 @@ static inline void bw_mm1_init(
static inline void bw_mm1_set_sample_rate(
bw_mm1_coeffs * BW_RESTRICT coeffs,
float sample_rate) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm1_coeffs_state_init);
BW_ASSERT(bw_is_finite(sample_rate) && sample_rate > 0.f);
@@ -378,7 +383,7 @@ static inline void bw_mm1_set_sample_rate(
static inline void bw_mm1_reset_coeffs(
bw_mm1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm1_coeffs_state_set_sample_rate);
@@ -398,10 +403,10 @@ static inline float bw_mm1_reset_state(
const bw_mm1_coeffs * BW_RESTRICT coeffs,
bw_mm1_state * BW_RESTRICT state,
float x_0) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm1_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT(bw_is_finite(x_0));
const float lp = bw_lp1_reset_state(&coeffs->lp1_coeffs, &state->lp1_state, x_0);
@@ -425,18 +430,18 @@ static inline void bw_mm1_reset_state_multi(
const float * x_0,
float * y_0,
size_t n_channels) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm1_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x_0 != NULL);
+ BW_ASSERT(x_0 != BW_NULL);
- if (y_0 != NULL)
+ if (y_0 != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
y_0[i] = bw_mm1_reset_state(coeffs, state[i], x_0[i]);
else
@@ -445,12 +450,12 @@ static inline void bw_mm1_reset_state_multi(
BW_ASSERT_DEEP(bw_mm1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm1_coeffs_state_reset_coeffs);
- BW_ASSERT_DEEP(y_0 != NULL ? bw_has_only_finite(y_0, n_channels) : 1);
+ BW_ASSERT_DEEP(y_0 != BW_NULL ? bw_has_only_finite(y_0, n_channels) : 1);
}
static inline void bw_mm1_update_coeffs_ctrl(
bw_mm1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm1_coeffs_state_reset_coeffs);
@@ -464,7 +469,7 @@ static inline void bw_mm1_update_coeffs_ctrl(
static inline void bw_mm1_update_coeffs_audio(
bw_mm1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm1_coeffs_state_reset_coeffs);
@@ -480,10 +485,10 @@ static inline float bw_mm1_process1(
const bw_mm1_coeffs * BW_RESTRICT coeffs,
bw_mm1_state * BW_RESTRICT state,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm1_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_mm1_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
@@ -506,14 +511,14 @@ static inline void bw_mm1_process(
const float * x,
float * y,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm1_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_mm1_state_is_valid(coeffs, state));
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
bw_mm1_update_coeffs_ctrl(coeffs);
for (size_t i = 0; i < n_samples; i++) {
@@ -534,17 +539,17 @@ static inline void bw_mm1_process_multi(
float * const * y,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm1_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x != NULL);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(x != BW_NULL);
+ BW_ASSERT(y != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -565,7 +570,7 @@ static inline void bw_mm1_process_multi(
static inline void bw_mm1_set_cutoff(
bw_mm1_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm1_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -580,7 +585,7 @@ static inline void bw_mm1_set_cutoff(
static inline void bw_mm1_set_prewarp_at_cutoff(
bw_mm1_coeffs * BW_RESTRICT coeffs,
char value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm1_coeffs_state_init);
@@ -593,7 +598,7 @@ static inline void bw_mm1_set_prewarp_at_cutoff(
static inline void bw_mm1_set_prewarp_freq(
bw_mm1_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm1_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -608,7 +613,7 @@ static inline void bw_mm1_set_prewarp_freq(
static inline void bw_mm1_set_coeff_x(
bw_mm1_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm1_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -622,7 +627,7 @@ static inline void bw_mm1_set_coeff_x(
static inline void bw_mm1_set_coeff_lp(
bw_mm1_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm1_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm1_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -635,7 +640,7 @@ static inline void bw_mm1_set_coeff_lp(
static inline char bw_mm1_coeffs_is_valid(
const bw_mm1_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_mm1_coeffs"))
@@ -650,17 +655,17 @@ static inline char bw_mm1_coeffs_is_valid(
static inline char bw_mm1_state_is_valid(
const bw_mm1_coeffs * BW_RESTRICT coeffs,
const bw_mm1_state * BW_RESTRICT state) {
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (state->hash != bw_hash_sdbm("bw_mm1_state"))
return 0;
- if (coeffs != NULL && coeffs->reset_id != state->coeffs_reset_id)
+ if (coeffs != BW_NULL && coeffs->reset_id != state->coeffs_reset_id)
return 0;
#endif
- return bw_lp1_state_is_valid(coeffs ? &coeffs->lp1_coeffs : NULL, &state->lp1_state);
+ return bw_lp1_state_is_valid(coeffs ? &coeffs->lp1_coeffs : BW_NULL, &state->lp1_state);
}
#ifdef __cplusplus
diff --git a/include/bw_mm2.h b/include/bw_mm2.h
index 978c27b..482121e 100644
--- a/include/bw_mm2.h
+++ b/include/bw_mm2.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2022, 2023 Orastron Srl unipersonale
+ * Copyright (C) 2022-2024 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
@@ -20,13 +20,18 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common bw_gain bw_math bw_one_pole bw_svf }}}
* description {{{
* Second-order multimode filter.
* }}}
* changelog {{{
* BW_NULL
.bw_mm2_reset_state_multi()
and updated C++
@@ -144,7 +149,7 @@ static inline void bw_mm2_reset_state_multi(
* array.
*
* The corresponding initial output values are written into the `y_0` array,
- * if not `NULL`.
+ * if not `BW_NULL`.
*
* #### bw_mm2_update_coeffs_ctrl()
* ```>>> */
@@ -318,8 +323,8 @@ static inline char bw_mm2_state_is_valid(
* seems to be the case and `0` if it is certainly not. False positives are
* possible, false negatives are not.
*
- * If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
- * is supposed to be associated to `coeffs`).
+ * If `coeffs` is not `BW_NULL` extra cross-checks might be performed
+ * (`state` is supposed to be associated to `coeffs`).
*
* `state` must at least point to a readable memory block of size greater
* than or equal to that of `bw_mm2_state`.
@@ -377,7 +382,7 @@ struct bw_mm2_state {
static inline void bw_mm2_init(
bw_mm2_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
bw_svf_init(&coeffs->svf_coeffs);
bw_gain_init(&coeffs->gain_x_coeffs);
@@ -405,7 +410,7 @@ static inline void bw_mm2_init(
static inline void bw_mm2_set_sample_rate(
bw_mm2_coeffs * BW_RESTRICT coeffs,
float sample_rate) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm2_coeffs_state_init);
BW_ASSERT(bw_is_finite(sample_rate) && sample_rate > 0.f);
@@ -425,7 +430,7 @@ static inline void bw_mm2_set_sample_rate(
static inline void bw_mm2_reset_coeffs(
bw_mm2_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm2_coeffs_state_set_sample_rate);
@@ -447,10 +452,10 @@ static inline float bw_mm2_reset_state(
const bw_mm2_coeffs * BW_RESTRICT coeffs,
bw_mm2_state * BW_RESTRICT state,
float x_0) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm2_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT(bw_is_finite(x_0));
float lp, bp, hp;
@@ -479,18 +484,18 @@ static inline void bw_mm2_reset_state_multi(
const float * x_0,
float * y_0,
size_t n_channels) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm2_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x_0 != NULL);
+ BW_ASSERT(x_0 != BW_NULL);
- if (y_0 != NULL)
+ if (y_0 != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
y_0[i] = bw_mm2_reset_state(coeffs, state[i], x_0[i]);
else
@@ -499,12 +504,12 @@ static inline void bw_mm2_reset_state_multi(
BW_ASSERT_DEEP(bw_mm2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm2_coeffs_state_reset_coeffs);
- BW_ASSERT_DEEP(y_0 != NULL ? bw_has_only_finite(y_0, n_channels) : 1);
+ BW_ASSERT_DEEP(y_0 != BW_NULL ? bw_has_only_finite(y_0, n_channels) : 1);
}
static inline void bw_mm2_update_coeffs_ctrl(
bw_mm2_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm2_coeffs_state_reset_coeffs);
@@ -520,7 +525,7 @@ static inline void bw_mm2_update_coeffs_ctrl(
static inline void bw_mm2_update_coeffs_audio(
bw_mm2_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm2_coeffs_state_reset_coeffs);
@@ -538,10 +543,10 @@ static inline float bw_mm2_process1(
const bw_mm2_coeffs * BW_RESTRICT coeffs,
bw_mm2_state * BW_RESTRICT state,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm2_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_mm2_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
@@ -567,14 +572,14 @@ static inline void bw_mm2_process(
const float * x,
float * y,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm2_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_mm2_state_is_valid(coeffs, state));
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
bw_mm2_update_coeffs_ctrl(coeffs);
for (size_t i = 0; i < n_samples; i++) {
@@ -595,17 +600,17 @@ static inline void bw_mm2_process_multi(
float * const * y,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm2_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x != NULL);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(x != BW_NULL);
+ BW_ASSERT(y != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -626,7 +631,7 @@ static inline void bw_mm2_process_multi(
static inline void bw_mm2_set_cutoff(
bw_mm2_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm2_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -641,7 +646,7 @@ static inline void bw_mm2_set_cutoff(
static inline void bw_mm2_set_Q(
bw_mm2_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm2_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -656,7 +661,7 @@ static inline void bw_mm2_set_Q(
static inline void bw_mm2_set_prewarp_at_cutoff(
bw_mm2_coeffs * BW_RESTRICT coeffs,
char value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm2_coeffs_state_init);
@@ -669,7 +674,7 @@ static inline void bw_mm2_set_prewarp_at_cutoff(
static inline void bw_mm2_set_prewarp_freq(
bw_mm2_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm2_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -684,7 +689,7 @@ static inline void bw_mm2_set_prewarp_freq(
static inline void bw_mm2_set_coeff_x(
bw_mm2_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm2_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -698,7 +703,7 @@ static inline void bw_mm2_set_coeff_x(
static inline void bw_mm2_set_coeff_lp(
bw_mm2_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm2_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -712,7 +717,7 @@ static inline void bw_mm2_set_coeff_lp(
static inline void bw_mm2_set_coeff_bp(
bw_mm2_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm2_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -726,7 +731,7 @@ static inline void bw_mm2_set_coeff_bp(
static inline void bw_mm2_set_coeff_hp(
bw_mm2_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_mm2_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_mm2_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -739,7 +744,7 @@ static inline void bw_mm2_set_coeff_hp(
static inline char bw_mm2_coeffs_is_valid(
const bw_mm2_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_mm2_coeffs"))
@@ -758,17 +763,17 @@ static inline char bw_mm2_coeffs_is_valid(
static inline char bw_mm2_state_is_valid(
const bw_mm2_coeffs * BW_RESTRICT coeffs,
const bw_mm2_state * BW_RESTRICT state) {
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (state->hash != bw_hash_sdbm("bw_mm2_state"))
return 0;
- if (coeffs != NULL && coeffs->reset_id != state->coeffs_reset_id)
+ if (coeffs != BW_NULL && coeffs->reset_id != state->coeffs_reset_id)
return 0;
#endif
- return bw_svf_state_is_valid(coeffs ? &coeffs->svf_coeffs : NULL, &state->svf_state);
+ return bw_svf_state_is_valid(coeffs ? &coeffs->svf_coeffs : BW_NULL, &state->svf_state);
}
#ifdef __cplusplus
diff --git a/include/bw_noise_gate.h b/include/bw_noise_gate.h
index 4765830..321505e 100644
--- a/include/bw_noise_gate.h
+++ b/include/bw_noise_gate.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2022, 2023 Orastron Srl unipersonale
+ * Copyright (C) 2022-2024 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
@@ -20,13 +20,18 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common bw_env_follow bw_math bw_one_pole }}}
* description {{{
* Noise gate with independent sidechain input.
* }}}
* changelog {{{
* BW_NULL
.BW_NULL
.bw_noise_gen_reset_coeffs()
,
@@ -245,8 +250,8 @@ struct bw_noise_gen_coeffs {
static inline void bw_noise_gen_init(
bw_noise_gen_coeffs * BW_RESTRICT coeffs,
uint64_t * BW_RESTRICT state) {
- BW_ASSERT(coeffs != NULL);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
+ BW_ASSERT(state != BW_NULL);
coeffs->rand_state = state;
coeffs->sample_rate_scaling = 0;
@@ -262,7 +267,7 @@ static inline void bw_noise_gen_init(
static inline void bw_noise_gen_set_sample_rate(
bw_noise_gen_coeffs * BW_RESTRICT coeffs,
float sample_rate) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_noise_gen_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_noise_gen_coeffs_state_init);
BW_ASSERT(bw_is_finite(sample_rate) && sample_rate > 0.f);
@@ -278,7 +283,7 @@ static inline void bw_noise_gen_set_sample_rate(
static inline void bw_noise_gen_reset_coeffs(
bw_noise_gen_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_noise_gen_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_noise_gen_coeffs_state_set_sample_rate);
@@ -293,7 +298,7 @@ static inline void bw_noise_gen_reset_coeffs(
static inline void bw_noise_gen_update_coeffs_ctrl(
bw_noise_gen_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_noise_gen_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_noise_gen_coeffs_state_reset_coeffs);
@@ -302,7 +307,7 @@ static inline void bw_noise_gen_update_coeffs_ctrl(
static inline void bw_noise_gen_update_coeffs_audio(
bw_noise_gen_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_noise_gen_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_noise_gen_coeffs_state_reset_coeffs);
@@ -311,7 +316,7 @@ static inline void bw_noise_gen_update_coeffs_audio(
static inline float bw_noise_gen_process1(
const bw_noise_gen_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_noise_gen_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_noise_gen_coeffs_state_reset_coeffs);
@@ -326,7 +331,7 @@ static inline float bw_noise_gen_process1(
static inline float bw_noise_gen_process1_scaling(
const bw_noise_gen_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_noise_gen_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_noise_gen_coeffs_state_reset_coeffs);
@@ -343,10 +348,10 @@ static inline void bw_noise_gen_process(
bw_noise_gen_coeffs * BW_RESTRICT coeffs,
float * BW_RESTRICT y,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_noise_gen_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_noise_gen_coeffs_state_reset_coeffs);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
if (coeffs->sample_rate_scaling)
for (size_t i = 0; i < n_samples; i++)
@@ -365,10 +370,10 @@ static inline void bw_noise_gen_process_multi(
float * BW_RESTRICT const * BW_RESTRICT y,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_noise_gen_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_noise_gen_coeffs_state_reset_coeffs);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -385,7 +390,7 @@ static inline void bw_noise_gen_process_multi(
static inline void bw_noise_gen_set_sample_rate_scaling(
bw_noise_gen_coeffs * BW_RESTRICT coeffs,
char value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_noise_gen_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_noise_gen_coeffs_state_init);
@@ -397,7 +402,7 @@ static inline void bw_noise_gen_set_sample_rate_scaling(
static inline float bw_noise_gen_get_scaling_k(
const bw_noise_gen_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_noise_gen_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_noise_gen_coeffs_state_set_sample_rate);
@@ -406,7 +411,7 @@ static inline float bw_noise_gen_get_scaling_k(
static inline char bw_noise_gen_coeffs_is_valid(
const bw_noise_gen_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_noise_gen_coeffs"))
@@ -415,7 +420,7 @@ static inline char bw_noise_gen_coeffs_is_valid(
return 0;
#endif
- if (coeffs->rand_state == NULL)
+ if (coeffs->rand_state == BW_NULL)
return 0;
#ifdef BW_DEBUG_DEEP
diff --git a/include/bw_notch.h b/include/bw_notch.h
index b02ae45..63c50a3 100644
--- a/include/bw_notch.h
+++ b/include/bw_notch.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2022, 2023 Orastron Srl unipersonale
+ * Copyright (C) 2022-2024 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
@@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common bw_math bw_one_pole bw_svf }}}
* description {{{
* Second-order notch filter with unitary gain at DC and asymptotically as
@@ -28,6 +28,11 @@
* }}}
* changelog {{{
* BW_NULL
.bw_notch_reset_state_multi()
and updated C++
@@ -146,7 +151,7 @@ static inline void bw_notch_reset_state_multi(
* array.
*
* The corresponding initial output values are written into the `y_0` array,
- * if not `NULL`.
+ * if not `BW_NULL`.
*
* #### bw_notch_update_coeffs_ctrl()
* ```>>> */
@@ -272,8 +277,8 @@ static inline char bw_notch_state_is_valid(
* seems to be the case and `0` if it is certainly not. False positives are
* possible, false negatives are not.
*
- * If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
- * is supposed to be associated to `coeffs`).
+ * If `coeffs` is not `BW_NULL` extra cross-checks might be performed
+ * (`state` is supposed to be associated to `coeffs`).
*
* `state` must at least point to a readable memory block of size greater
* than or equal to that of `bw_notch_state`.
@@ -326,7 +331,7 @@ struct bw_notch_state {
static inline void bw_notch_init(
bw_notch_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
bw_svf_init(&coeffs->svf_coeffs);
@@ -342,7 +347,7 @@ static inline void bw_notch_init(
static inline void bw_notch_set_sample_rate(
bw_notch_coeffs * BW_RESTRICT coeffs,
float sample_rate) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_notch_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_notch_coeffs_state_init);
BW_ASSERT(bw_is_finite(sample_rate) && sample_rate > 0.f);
@@ -358,7 +363,7 @@ static inline void bw_notch_set_sample_rate(
static inline void bw_notch_reset_coeffs(
bw_notch_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_notch_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_notch_coeffs_state_set_sample_rate);
@@ -376,10 +381,10 @@ static inline float bw_notch_reset_state(
const bw_notch_coeffs * BW_RESTRICT coeffs,
bw_notch_state * BW_RESTRICT state,
float x_0) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_notch_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_notch_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT(bw_is_finite(x_0));
float lp, bp, hp;
@@ -404,18 +409,18 @@ static inline void bw_notch_reset_state_multi(
const float * x_0,
float * y_0,
size_t n_channels) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_notch_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_notch_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x_0 != NULL);
+ BW_ASSERT(x_0 != BW_NULL);
- if (y_0 != NULL)
+ if (y_0 != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
y_0[i] = bw_notch_reset_state(coeffs, state[i], x_0[i]);
else
@@ -424,12 +429,12 @@ static inline void bw_notch_reset_state_multi(
BW_ASSERT_DEEP(bw_notch_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_notch_coeffs_state_reset_coeffs);
- BW_ASSERT_DEEP(y_0 != NULL ? bw_has_only_finite(y_0, n_channels) : 1);
+ BW_ASSERT_DEEP(y_0 != BW_NULL ? bw_has_only_finite(y_0, n_channels) : 1);
}
static inline void bw_notch_update_coeffs_ctrl(
bw_notch_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_notch_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_notch_coeffs_state_reset_coeffs);
@@ -441,7 +446,7 @@ static inline void bw_notch_update_coeffs_ctrl(
static inline void bw_notch_update_coeffs_audio(
bw_notch_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_notch_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_notch_coeffs_state_reset_coeffs);
@@ -455,10 +460,10 @@ static inline float bw_notch_process1(
const bw_notch_coeffs * BW_RESTRICT coeffs,
bw_notch_state * BW_RESTRICT state,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_notch_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_notch_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_notch_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
@@ -480,14 +485,14 @@ static inline void bw_notch_process(
const float * x,
float * y,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_notch_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_notch_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_notch_state_is_valid(coeffs, state));
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
bw_notch_update_coeffs_ctrl(coeffs);
for (size_t i = 0; i < n_samples; i++) {
@@ -508,17 +513,17 @@ static inline void bw_notch_process_multi(
float * const * y,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_notch_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_notch_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x != NULL);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(x != BW_NULL);
+ BW_ASSERT(y != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -539,7 +544,7 @@ static inline void bw_notch_process_multi(
static inline void bw_notch_set_cutoff(
bw_notch_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_notch_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_notch_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -554,7 +559,7 @@ static inline void bw_notch_set_cutoff(
static inline void bw_notch_set_Q(
bw_notch_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_notch_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_notch_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -569,7 +574,7 @@ static inline void bw_notch_set_Q(
static inline void bw_notch_set_prewarp_at_cutoff(
bw_notch_coeffs * BW_RESTRICT coeffs,
char value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_notch_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_notch_coeffs_state_init);
@@ -582,7 +587,7 @@ static inline void bw_notch_set_prewarp_at_cutoff(
static inline void bw_notch_set_prewarp_freq(
bw_notch_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_notch_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_notch_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -596,7 +601,7 @@ static inline void bw_notch_set_prewarp_freq(
static inline char bw_notch_coeffs_is_valid(
const bw_notch_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_notch_coeffs"))
@@ -611,17 +616,17 @@ static inline char bw_notch_coeffs_is_valid(
static inline char bw_notch_state_is_valid(
const bw_notch_coeffs * BW_RESTRICT coeffs,
const bw_notch_state * BW_RESTRICT state) {
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (state->hash != bw_hash_sdbm("bw_notch_state"))
return 0;
- if (coeffs != NULL && coeffs->reset_id != state->coeffs_reset_id)
+ if (coeffs != BW_NULL && coeffs->reset_id != state->coeffs_reset_id)
return 0;
#endif
- return bw_svf_state_is_valid(coeffs ? &coeffs->svf_coeffs : NULL, &state->svf_state);
+ return bw_svf_state_is_valid(coeffs ? &coeffs->svf_coeffs : BW_NULL, &state->svf_state);
}
#ifdef __cplusplus
diff --git a/include/bw_note_queue.h b/include/bw_note_queue.h
index 76758b9..c402f38 100644
--- a/include/bw_note_queue.h
+++ b/include/bw_note_queue.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2023 Orastron Srl unipersonale
+ * Copyright (C) 2023, 2024 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
@@ -20,7 +20,7 @@
/*!
* module_type {{{ utility }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common }}}
* description {{{
* Simple data structure that helps keeping track of note on/off events and
@@ -30,6 +30,11 @@
* }}}
* changelog {{{
* BW_NULL
.status
member from
@@ -172,7 +177,7 @@ extern "C" {
static inline void bw_note_queue_reset(
bw_note_queue * BW_RESTRICT queue) {
- BW_ASSERT(queue != NULL);
+ BW_ASSERT(queue != BW_NULL);
for (int i = 0; i < 128; i++) {
queue->status[i].pressed = 0;
queue->status[i].velocity = 0.f;
@@ -184,7 +189,7 @@ static inline void bw_note_queue_reset(
static inline void bw_note_queue_clear(
bw_note_queue * BW_RESTRICT queue) {
- BW_ASSERT(queue != NULL);
+ BW_ASSERT(queue != BW_NULL);
BW_ASSERT_DEEP(bw_note_queue_is_valid(queue));
queue->n_events = 0;
}
@@ -195,7 +200,7 @@ static inline void bw_note_queue_add(
char pressed,
float velocity,
char force_went_off) {
- BW_ASSERT(queue != NULL);
+ BW_ASSERT(queue != BW_NULL);
BW_ASSERT_DEEP(bw_note_queue_is_valid(queue));
BW_ASSERT(note < 128);
BW_ASSERT(bw_is_finite(velocity) && velocity <= 1.f);
@@ -227,7 +232,7 @@ static inline void bw_note_queue_add(
static inline char bw_note_queue_is_valid(
const bw_note_queue * BW_RESTRICT queue) {
- BW_ASSERT(queue != NULL);
+ BW_ASSERT(queue != BW_NULL);
if (queue->n_events >= 128 || queue->n_pressed >= 128)
return 0;
diff --git a/include/bw_one_pole.h b/include/bw_one_pole.h
index c9d9ca4..59fbac9 100644
--- a/include/bw_one_pole.h
+++ b/include/bw_one_pole.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2022, 2023 Orastron Srl unipersonale
+ * Copyright (C) 2022-2024 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
@@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common bw_math }}}
* description {{{
* One-pole (6 dB/oct) lowpass filter with unitary DC gain, separate attack
@@ -30,6 +30,11 @@
* }}}
* changelog {{{
* BW_NULL
.bw_one_pole_reset_state_multi()
and updated
@@ -174,7 +179,7 @@ static inline void bw_one_pole_reset_state_multi(
* array.
*
* The corresponding initial output values are written into the
- * `y_0` array, if not `NULL`.
+ * `y_0` array, if not `BW_NULL`.
*
* #### bw_one_pole_update_coeffs_ctrl()
* ```>>> */
@@ -262,7 +267,7 @@ static inline void bw_one_pole_process(
* first `n_samples` of the output buffer `y`, while using and updating both
* `coeffs` and `state` (control and audio rate).
*
- * `y` may be `NULL`.
+ * `y` may be `BW_NULL`.
*
* #### bw_one_pole_process_multi()
* ```>>> */
@@ -279,7 +284,7 @@ static inline void bw_one_pole_process_multi(
* using and updating both the common `coeffs` and each of the `n_channels`
* `state`s (control and audio rate).
*
- * `y` or any element of `y` may be `NULL`.
+ * `y` or any element of `y` may be `BW_NULL`.
*
* #### bw_one_pole_set_cutoff()
* ```>>> */
@@ -438,8 +443,8 @@ static inline char bw_one_pole_state_is_valid(
* seems to be the case and `0` if it is certainly not. False positives are
* possible, false negatives are not.
*
- * If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
- * is supposed to be associated to `coeffs`).
+ * If `coeffs` is not `BW_NULL` extra cross-checks might be performed
+ * (`state` is supposed to be associated to `coeffs`).
*
* `state` must at least point to a readable memory block of size greater
* than or equal to that of `bw_one_pole_state`.
@@ -507,7 +512,7 @@ struct bw_one_pole_state {
static inline void bw_one_pole_init(
bw_one_pole_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
coeffs->cutoff_up = INFINITY;
coeffs->cutoff_down = INFINITY;
@@ -526,7 +531,7 @@ static inline void bw_one_pole_init(
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(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
BW_ASSERT(bw_is_finite(sample_rate) && sample_rate > 0.f);
@@ -557,7 +562,7 @@ static inline void bw_one_pole_do_update_coeffs_ctrl(
static inline void bw_one_pole_reset_coeffs(
bw_one_pole_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_set_sample_rate);
@@ -576,10 +581,10 @@ static inline float bw_one_pole_reset_state(
const bw_one_pole_coeffs * BW_RESTRICT coeffs,
bw_one_pole_state * BW_RESTRICT state,
float x_0) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_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(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT(bw_is_finite(x_0));
(void)coeffs;
@@ -604,18 +609,18 @@ static inline void bw_one_pole_reset_state_multi(
const float * x_0,
float * y_0,
size_t n_channels) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_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(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x_0 != NULL);
+ BW_ASSERT(x_0 != BW_NULL);
- if (y_0 != NULL)
+ if (y_0 != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
y_0[i] = bw_one_pole_reset_state(coeffs, state[i], x_0[i]);
else
@@ -624,12 +629,12 @@ static inline void bw_one_pole_reset_state_multi(
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(y_0 != NULL ? bw_has_only_finite(y_0, n_channels) : 1);
+ BW_ASSERT_DEEP(y_0 != BW_NULL ? bw_has_only_finite(y_0, n_channels) : 1);
}
static inline void bw_one_pole_update_coeffs_ctrl(
bw_one_pole_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
@@ -641,7 +646,7 @@ static inline void bw_one_pole_update_coeffs_ctrl(
static inline void bw_one_pole_update_coeffs_audio(
bw_one_pole_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
@@ -652,10 +657,10 @@ 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(coeffs != BW_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(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
@@ -674,10 +679,10 @@ 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(coeffs != BW_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(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
@@ -699,10 +704,10 @@ 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(coeffs != BW_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(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
@@ -724,10 +729,10 @@ 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(coeffs != BW_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(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
@@ -746,10 +751,10 @@ 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(coeffs != BW_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(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
@@ -771,10 +776,10 @@ 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(coeffs != BW_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(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
@@ -798,16 +803,16 @@ static inline void bw_one_pole_process(
const float * x,
float * y,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_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(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(coeffs, state));
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
bw_one_pole_update_coeffs_ctrl(coeffs);
- if (y != NULL) {
+ if (y != BW_NULL) {
if (coeffs->mA1u != coeffs->mA1d) {
if (coeffs->st2 != 0.f) {
if (coeffs->sticky_mode == bw_one_pole_sticky_mode_abs)
@@ -870,7 +875,7 @@ static inline void bw_one_pole_process(
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(bw_one_pole_state_is_valid(coeffs, state));
- BW_ASSERT_DEEP(y != NULL ? bw_has_only_finite(y, n_samples) : 1);
+ BW_ASSERT_DEEP(y != BW_NULL ? bw_has_only_finite(y, n_samples) : 1);
}
static inline void bw_one_pole_process_multi(
@@ -880,30 +885,30 @@ static inline void bw_one_pole_process_multi(
float * const * y,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_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(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
#ifndef BW_NO_DEBUG
- if (y != NULL)
+ if (y != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
- BW_ASSERT(y[i] == NULL || y[j] == NULL || y[i] != y[j]);
+ BW_ASSERT(y[i] == BW_NULL || y[j] == BW_NULL || y[i] != y[j]);
#endif
bw_one_pole_update_coeffs_ctrl(coeffs);
- if (y != NULL) {
+ if (y != BW_NULL) {
if (coeffs->mA1u != coeffs->mA1d) {
if (coeffs->st2 != 0.f) {
if (coeffs->sticky_mode == bw_one_pole_sticky_mode_abs)
for (size_t j = 0; j < n_channels; j++)
- if (y[j] != NULL)
+ if (y[j] != BW_NULL)
for (size_t i = 0; i < n_samples; i++)
y[j][i] = bw_one_pole_process1_asym_sticky_abs(coeffs, state[j], x[j][i]);
else
@@ -912,7 +917,7 @@ static inline void bw_one_pole_process_multi(
else
for (size_t j = 0; j < n_channels; j++)
- if (y[j] != NULL)
+ if (y[j] != BW_NULL)
for (size_t i = 0; i < n_samples; i++)
y[j][i] = bw_one_pole_process1_asym_sticky_rel(coeffs, state[j], x[j][i]);
else
@@ -921,7 +926,7 @@ static inline void bw_one_pole_process_multi(
}
else {
for (size_t j = 0; j < n_channels; j++)
- if (y[j] != NULL)
+ if (y[j] != BW_NULL)
for (size_t i = 0; i < n_samples; i++)
y[j][i] = bw_one_pole_process1_asym(coeffs, state[j], x[j][i]);
else
@@ -933,7 +938,7 @@ static inline void bw_one_pole_process_multi(
if (coeffs->st2 != 0.f) {
if (coeffs->sticky_mode == bw_one_pole_sticky_mode_abs)
for (size_t j = 0; j < n_channels; j++)
- if (y[j] != NULL)
+ if (y[j] != BW_NULL)
for (size_t i = 0; i < n_samples; i++)
y[j][i] = bw_one_pole_process1_sticky_abs(coeffs, state[j], x[j][i]);
else
@@ -941,7 +946,7 @@ static inline void bw_one_pole_process_multi(
bw_one_pole_process1_sticky_abs(coeffs, state[j], x[j][i]);
else
for (size_t j = 0; j < n_channels; j++)
- if (y[j] != NULL)
+ if (y[j] != BW_NULL)
for (size_t i = 0; i < n_samples; i++)
y[j][i] = bw_one_pole_process1_sticky_rel(coeffs, state[j], x[j][i]);
else
@@ -950,7 +955,7 @@ static inline void bw_one_pole_process_multi(
}
else {
for (size_t j = 0; j < n_channels; j++)
- if (y[j] != NULL)
+ if (y[j] != BW_NULL)
for (size_t i = 0; i < n_samples; i++)
y[j][i] = bw_one_pole_process1(coeffs, state[j], x[j][i]);
else
@@ -1002,7 +1007,7 @@ static inline void bw_one_pole_process_multi(
static inline void bw_one_pole_set_cutoff(
bw_one_pole_coeffs *BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
BW_ASSERT(!bw_is_nan(value));
@@ -1018,7 +1023,7 @@ static inline void bw_one_pole_set_cutoff(
static inline void bw_one_pole_set_cutoff_up(
bw_one_pole_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
BW_ASSERT(!bw_is_nan(value));
@@ -1039,7 +1044,7 @@ static inline void bw_one_pole_set_cutoff_up(
static inline void bw_one_pole_set_cutoff_down(
bw_one_pole_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
BW_ASSERT(!bw_is_nan(value));
@@ -1060,7 +1065,7 @@ static inline void bw_one_pole_set_cutoff_down(
static inline void bw_one_pole_set_tau(
bw_one_pole_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
BW_ASSERT(!bw_is_nan(value));
@@ -1076,7 +1081,7 @@ static inline void bw_one_pole_set_tau(
static inline void bw_one_pole_set_tau_up(
bw_one_pole_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
BW_ASSERT(!bw_is_nan(value));
@@ -1092,7 +1097,7 @@ static inline void bw_one_pole_set_tau_up(
static inline void bw_one_pole_set_tau_down(
bw_one_pole_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
BW_ASSERT(!bw_is_nan(value));
@@ -1108,7 +1113,7 @@ static inline void bw_one_pole_set_tau_down(
static inline void bw_one_pole_set_sticky_thresh(
bw_one_pole_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
BW_ASSERT(!bw_is_nan(value));
@@ -1129,7 +1134,7 @@ static inline void bw_one_pole_set_sticky_thresh(
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(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init);
BW_ASSERT(value == bw_one_pole_sticky_mode_abs || value == bw_one_pole_sticky_mode_rel);
@@ -1142,15 +1147,15 @@ static inline void bw_one_pole_set_sticky_mode(
static inline float bw_one_pole_get_y_z1(
const bw_one_pole_state * BW_RESTRICT state) {
- BW_ASSERT(state != NULL);
- BW_ASSERT_DEEP(bw_one_pole_state_is_valid(NULL, state));
+ BW_ASSERT(state != BW_NULL);
+ BW_ASSERT_DEEP(bw_one_pole_state_is_valid(BW_NULL, state));
return state->y_z1;
}
static inline char bw_one_pole_coeffs_is_valid(
const bw_one_pole_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_one_pole_coeffs"))
@@ -1190,13 +1195,13 @@ static inline char bw_one_pole_coeffs_is_valid(
static inline char bw_one_pole_state_is_valid(
const bw_one_pole_coeffs * BW_RESTRICT coeffs,
const bw_one_pole_state * BW_RESTRICT state) {
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (state->hash != bw_hash_sdbm("bw_one_pole_state"))
return 0;
- if (coeffs != NULL && coeffs->reset_id != state->coeffs_reset_id)
+ if (coeffs != BW_NULL && coeffs->reset_id != state->coeffs_reset_id)
return 0;
#endif
diff --git a/include/bw_osc_filt.h b/include/bw_osc_filt.h
index 542b467..00fe322 100644
--- a/include/bw_osc_filt.h
+++ b/include/bw_osc_filt.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2022, 2023 Orastron Srl unipersonale
+ * Copyright (C) 2022-2024 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
@@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common }}}
* description {{{
* Post-filter to decolorate oscillator waveshapers when antialiasing is on.
@@ -33,6 +33,11 @@
* }}}
* changelog {{{
* BW_NULL
.BW_NULL
.bw_osc_pulse_process()
and
@@ -177,7 +182,7 @@ static inline void bw_osc_pulse_process(
* buffer `y`, while using and updating `coeffs` (control and audio rate).
*
* If antialiasing is enabled, `x_inc` must contain phase increment
- * values, otherwise it is ignored and can be `NULL`.
+ * values, otherwise it is ignored and can be `BW_NULL`.
*
* All samples in `x` must be in [`0.f`, `1.f`).
*
@@ -200,7 +205,7 @@ static inline void bw_osc_pulse_process_multi(
*
* If antialiasing is enabled, each of the `n_channels` buffers pointed by
* `x_inc` must contain phase increment values, otherwise `x_inc` is ignored
- * and can be `NULL`.
+ * and can be `BW_NULL`.
*
* All samples in `x` must be in [`0.f`, `1.f`).
*
@@ -284,7 +289,7 @@ struct bw_osc_pulse_coeffs {
static inline void bw_osc_pulse_init(
bw_osc_pulse_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
bw_one_pole_init(&coeffs->smooth_coeffs);
bw_one_pole_set_tau(&coeffs->smooth_coeffs, 0.005f);
@@ -302,7 +307,7 @@ static inline void bw_osc_pulse_init(
static inline void bw_osc_pulse_set_sample_rate(
bw_osc_pulse_coeffs * BW_RESTRICT coeffs,
float sample_rate) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_pulse_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_pulse_coeffs_state_init);
BW_ASSERT(bw_is_finite(sample_rate) && sample_rate > 0.f);
@@ -319,7 +324,7 @@ static inline void bw_osc_pulse_set_sample_rate(
static inline void bw_osc_pulse_reset_coeffs(
bw_osc_pulse_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_pulse_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_pulse_coeffs_state_set_sample_rate);
@@ -334,7 +339,7 @@ static inline void bw_osc_pulse_reset_coeffs(
static inline void bw_osc_pulse_update_coeffs_ctrl(
bw_osc_pulse_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_pulse_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_pulse_coeffs_state_reset_coeffs);
@@ -343,7 +348,7 @@ static inline void bw_osc_pulse_update_coeffs_ctrl(
static inline void bw_osc_pulse_update_coeffs_audio(
bw_osc_pulse_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_pulse_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_pulse_coeffs_state_reset_coeffs);
@@ -356,7 +361,7 @@ static inline void bw_osc_pulse_update_coeffs_audio(
static inline float bw_osc_pulse_process1(
const bw_osc_pulse_coeffs * BW_RESTRICT coeffs,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_pulse_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_pulse_coeffs_state_reset_coeffs);
BW_ASSERT(bw_is_finite(x));
@@ -384,7 +389,7 @@ static inline float bw_osc_pulse_process1_antialias(
const bw_osc_pulse_coeffs * BW_RESTRICT coeffs,
float x,
float x_inc) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_pulse_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_pulse_coeffs_state_reset_coeffs);
BW_ASSERT(bw_is_finite(x));
@@ -425,14 +430,14 @@ static inline void bw_osc_pulse_process(
const float * x_inc,
float * y,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_pulse_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_pulse_coeffs_state_reset_coeffs);
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
- BW_ASSERT(coeffs->antialiasing ? x_inc != NULL : 1);
+ BW_ASSERT(coeffs->antialiasing ? x_inc != BW_NULL : 1);
BW_ASSERT_DEEP(coeffs->antialiasing ? bw_has_only_finite(x_inc, n_samples) : 1);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
if (coeffs->antialiasing)
for (size_t i = 0; i < n_samples; i++) {
@@ -457,11 +462,11 @@ static inline void bw_osc_pulse_process_multi(
float * const * y,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_pulse_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_pulse_coeffs_state_reset_coeffs);
- BW_ASSERT(x != NULL);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(x != BW_NULL);
+ BW_ASSERT(y != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -488,7 +493,7 @@ static inline void bw_osc_pulse_process_multi(
static inline void bw_osc_pulse_set_antialiasing(
bw_osc_pulse_coeffs * BW_RESTRICT coeffs,
char value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_pulse_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_pulse_coeffs_state_init);
@@ -501,7 +506,7 @@ static inline void bw_osc_pulse_set_antialiasing(
static inline void bw_osc_pulse_set_pulse_width(
bw_osc_pulse_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_pulse_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_pulse_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -515,7 +520,7 @@ static inline void bw_osc_pulse_set_pulse_width(
static inline char bw_osc_pulse_coeffs_is_valid(
const bw_osc_pulse_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_osc_pulse_coeffs"))
diff --git a/include/bw_osc_saw.h b/include/bw_osc_saw.h
index 18f9199..944f00c 100644
--- a/include/bw_osc_saw.h
+++ b/include/bw_osc_saw.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2022, 2023 Orastron Srl unipersonale
+ * Copyright (C) 2022-2024 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
@@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common bw_math }}}
* description {{{
* Sawtooth oscillator waveshaper with PolyBLEP antialiasing.
@@ -36,6 +36,11 @@
* }}}
* changelog {{{
* BW_NULL
.bw_osc_saw_set_sample_rate()
,
@@ -180,7 +185,7 @@ static inline void bw_osc_saw_process(
* buffer `y`, while using `coeffs`.
*
* If antialiasing is enabled, `x_inc` must contain phase increment values,
- * otherwise it is ignored and can be `NULL`.
+ * otherwise it is ignored and can be `BW_NULL`.
*
* All samples in `x` must be in [`0.f`, `1.f`).
*
@@ -202,7 +207,7 @@ static inline void bw_osc_saw_process_multi(
*
* If antialiasing is enabled, each of the `n_channels` buffers pointed by
* `x_inc` must contain phase increment values, otherwise `x_inc` is ignored
- * and can be `NULL`.
+ * and can be `BW_NULL`.
*
* All samples in `x` must be in [`0.f`, `1.f`).
*
@@ -268,7 +273,7 @@ struct bw_osc_saw_coeffs {
static inline void bw_osc_saw_init(
bw_osc_saw_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
coeffs->antialiasing = 0;
@@ -283,7 +288,7 @@ static inline void bw_osc_saw_init(
static inline void bw_osc_saw_set_sample_rate(
bw_osc_saw_coeffs * BW_RESTRICT coeffs,
float sample_rate) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_saw_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_saw_coeffs_state_init);
BW_ASSERT(bw_is_finite(sample_rate) && sample_rate > 0.f);
@@ -300,7 +305,7 @@ static inline void bw_osc_saw_set_sample_rate(
static inline void bw_osc_saw_reset_coeffs(
bw_osc_saw_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_saw_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_saw_coeffs_state_set_sample_rate);
@@ -315,7 +320,7 @@ static inline void bw_osc_saw_reset_coeffs(
static inline void bw_osc_saw_update_coeffs_ctrl(
bw_osc_saw_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_saw_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_saw_coeffs_state_reset_coeffs);
@@ -324,7 +329,7 @@ static inline void bw_osc_saw_update_coeffs_ctrl(
static inline void bw_osc_saw_update_coeffs_audio(
bw_osc_saw_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_saw_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_saw_coeffs_state_reset_coeffs);
@@ -334,7 +339,7 @@ static inline void bw_osc_saw_update_coeffs_audio(
static inline float bw_osc_saw_process1(
const bw_osc_saw_coeffs * BW_RESTRICT coeffs,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_saw_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_saw_coeffs_state_reset_coeffs);
BW_ASSERT(bw_is_finite(x));
@@ -362,7 +367,7 @@ static inline float bw_osc_saw_process1_antialias(
const bw_osc_saw_coeffs * BW_RESTRICT coeffs,
float x,
float x_inc) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_saw_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_saw_coeffs_state_reset_coeffs);
BW_ASSERT(bw_is_finite(x));
@@ -396,14 +401,14 @@ static inline void bw_osc_saw_process(
const float * x_inc,
float * y,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_saw_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_saw_coeffs_state_reset_coeffs);
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
- BW_ASSERT(coeffs->antialiasing ? x_inc != NULL : 1);
+ BW_ASSERT(coeffs->antialiasing ? x_inc != BW_NULL : 1);
BW_ASSERT_DEEP(coeffs->antialiasing ? bw_has_only_finite(x_inc, n_samples) : 1);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
if (coeffs->antialiasing)
for (size_t i = 0; i < n_samples; i++)
@@ -424,23 +429,23 @@ static inline void bw_osc_saw_process_multi(
float * const * y,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_saw_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_saw_coeffs_state_reset_coeffs);
- BW_ASSERT(x != NULL);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(x != BW_NULL);
+ BW_ASSERT(y != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(y[i] != y[j]);
#endif
- if (x_inc != NULL)
+ if (x_inc != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
bw_osc_saw_process(coeffs, x[i], x_inc[i], y[i], n_samples);
else
for (size_t i = 0; i < n_channels; i++)
- bw_osc_saw_process(coeffs, x[i], NULL, y[i], n_samples);
+ bw_osc_saw_process(coeffs, x[i], BW_NULL, y[i], n_samples);
BW_ASSERT_DEEP(bw_osc_saw_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_saw_coeffs_state_reset_coeffs);
@@ -449,7 +454,7 @@ static inline void bw_osc_saw_process_multi(
static inline void bw_osc_saw_set_antialiasing(
bw_osc_saw_coeffs * BW_RESTRICT coeffs,
char value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_saw_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_saw_coeffs_state_init);
@@ -461,7 +466,7 @@ static inline void bw_osc_saw_set_antialiasing(
static inline char bw_osc_saw_coeffs_is_valid(
const bw_osc_saw_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_osc_saw_coeffs"))
diff --git a/include/bw_osc_sin.h b/include/bw_osc_sin.h
index c5728b5..9ccceaa 100644
--- a/include/bw_osc_sin.h
+++ b/include/bw_osc_sin.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2022, 2023 Orastron Srl unipersonale
+ * Copyright (C) 2022-2024 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
@@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common bw_math }}}
* description {{{
* Sinusoidal oscillator waveshaper.
@@ -30,6 +30,11 @@
* }}}
* changelog {{{
* BW_NULL
.bw_osc_sin_process()
and
@@ -149,9 +154,9 @@ static inline void bw_osc_sin_process(
const float * x,
float * y,
size_t n_samples) {
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
for (size_t i = 0; i < n_samples; i++)
y[i] = bw_osc_sin_process1(x[i]);
@@ -164,8 +169,8 @@ static inline void bw_osc_sin_process_multi(
float * const * y,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(x != NULL);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(x != BW_NULL);
+ BW_ASSERT(y != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
diff --git a/include/bw_osc_tri.h b/include/bw_osc_tri.h
index 3b414e5..9d547f1 100644
--- a/include/bw_osc_tri.h
+++ b/include/bw_osc_tri.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2022, 2023 Orastron Srl unipersonale
+ * Copyright (C) 2022-2024 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
@@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common bw_math bw_one_pole }}}
* description {{{
* Triangle oscillator waveshaper with variable slope (increasing time over
@@ -37,6 +37,11 @@
* }}}
* changelog {{{
* BW_NULL
.bw_osc_tri_process()
and
@@ -179,7 +184,7 @@ static inline void bw_osc_tri_process(
* buffer `y`, while using and updating `coeffs`.
*
* If antialiasing is enabled, `x_inc` must contain phase increment values,
- * otherwise it is ignored and can be `NULL`.
+ * otherwise it is ignored and can be `BW_NULL`.
*
* All samples in `x` must be in [`0.f`, `1.f`).
*
@@ -201,7 +206,7 @@ static inline void bw_osc_tri_process_multi(
* common `coeffs` (control and audio rate).
*
* If antialiasing is enabled, `x_inc` must contain `n_channels` buffers of
- * phase increment values, otherwise it is ignored and can be `NULL`.
+ * phase increment values, otherwise it is ignored and can be `BW_NULL`.
*
* All samples in `x` must be in [`0.f`, `1.f`).
*
@@ -285,7 +290,7 @@ struct bw_osc_tri_coeffs {
static inline void bw_osc_tri_init(
bw_osc_tri_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
bw_one_pole_init(&coeffs->smooth_coeffs);
bw_one_pole_set_tau(&coeffs->smooth_coeffs, 0.005f);
@@ -303,7 +308,7 @@ static inline void bw_osc_tri_init(
static inline void bw_osc_tri_set_sample_rate(
bw_osc_tri_coeffs * BW_RESTRICT coeffs,
float sample_rate) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_tri_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_tri_coeffs_state_init);
BW_ASSERT(bw_is_finite(sample_rate) && sample_rate > 0.f);
@@ -320,7 +325,7 @@ static inline void bw_osc_tri_set_sample_rate(
static inline void bw_osc_tri_reset_coeffs(
bw_osc_tri_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_tri_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_tri_coeffs_state_set_sample_rate);
@@ -335,7 +340,7 @@ static inline void bw_osc_tri_reset_coeffs(
static inline void bw_osc_tri_update_coeffs_ctrl(
bw_osc_tri_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_tri_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_tri_coeffs_state_reset_coeffs);
@@ -344,7 +349,7 @@ static inline void bw_osc_tri_update_coeffs_ctrl(
static inline void bw_osc_tri_update_coeffs_audio(
bw_osc_tri_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_tri_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_tri_coeffs_state_reset_coeffs);
@@ -357,7 +362,7 @@ static inline void bw_osc_tri_update_coeffs_audio(
static inline float bw_osc_tri_process1(
const bw_osc_tri_coeffs * BW_RESTRICT coeffs,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_tri_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_tri_coeffs_state_reset_coeffs);
BW_ASSERT(bw_is_finite(x));
@@ -386,7 +391,7 @@ static inline float bw_osc_tri_process1_antialias(
const bw_osc_tri_coeffs * BW_RESTRICT coeffs,
float x,
float x_inc) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_tri_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_tri_coeffs_state_reset_coeffs);
BW_ASSERT(bw_is_finite(x));
@@ -432,14 +437,14 @@ static inline void bw_osc_tri_process(
const float * x_inc,
float * y,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_tri_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_tri_coeffs_state_reset_coeffs);
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
- BW_ASSERT(coeffs->antialiasing ? x_inc != NULL : 1);
+ BW_ASSERT(coeffs->antialiasing ? x_inc != BW_NULL : 1);
BW_ASSERT_DEEP(coeffs->antialiasing ? bw_has_only_finite(x_inc, n_samples) : 1);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
if (coeffs->antialiasing)
for (size_t i = 0; i < n_samples; i++) {
@@ -464,11 +469,11 @@ static inline void bw_osc_tri_process_multi(
float * const * y,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_tri_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_tri_coeffs_state_reset_coeffs);
- BW_ASSERT(x != NULL);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(x != BW_NULL);
+ BW_ASSERT(y != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -495,7 +500,7 @@ static inline void bw_osc_tri_process_multi(
static inline void bw_osc_tri_set_antialiasing(
bw_osc_tri_coeffs * BW_RESTRICT coeffs,
char value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_tri_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_tri_coeffs_state_init);
@@ -508,7 +513,7 @@ static inline void bw_osc_tri_set_antialiasing(
static inline void bw_osc_tri_set_slope(
bw_osc_tri_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_osc_tri_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_osc_tri_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -522,7 +527,7 @@ static inline void bw_osc_tri_set_slope(
static inline char bw_osc_tri_coeffs_is_valid(
const bw_osc_tri_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_osc_tri_coeffs"))
diff --git a/include/bw_pan.h b/include/bw_pan.h
index 4aaf4d8..81bd33d 100644
--- a/include/bw_pan.h
+++ b/include/bw_pan.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2023 Orastron Srl unipersonale
+ * Copyright (C) 2023, 2024 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
@@ -20,13 +20,18 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common bw_gain bw_math bw_one_pole }}}
* description {{{
* Stereo panner with -3 dB center pan law.
* }}}
* changelog {{{
* BW_NULL
.BW_NULL
.bw_peak_reset_state_multi()
and updated C++
@@ -157,7 +162,7 @@ static inline void bw_peak_reset_state_multi(
* array.
*
* The corresponding initial output values are written into the `y_0` array,
- * if not `NULL`.
+ * if not `BW_NULL`.
*
* #### bw_peak_update_coeffs_ctrl()
* ```>>> */
@@ -352,8 +357,8 @@ static inline char bw_peak_state_is_valid(
* seems to be the case and `0` if it is certainly not. False positives are
* possible, false negatives are not.
*
- * If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
- * is supposed to be associated to `coeffs`).
+ * If `coeffs` is not `BW_NULL` extra cross-checks might be performed
+ * (`state` is supposed to be associated to `coeffs`).
*
* `state` must at least point to a readable memory block of size greater
* than or equal to that of `bw_peak_state`.
@@ -421,7 +426,7 @@ struct bw_peak_state {
static inline void bw_peak_init(
bw_peak_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
bw_mm2_init(&coeffs->mm2_coeffs);
coeffs->Q = 0.5f;
@@ -441,7 +446,7 @@ static inline void bw_peak_init(
static inline void bw_peak_set_sample_rate(
bw_peak_coeffs * BW_RESTRICT coeffs,
float sample_rate) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_peak_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_peak_coeffs_state_init);
BW_ASSERT(bw_is_finite(sample_rate) && sample_rate > 0.f);
@@ -479,7 +484,7 @@ static inline void bw_peak_update_mm2_params(
static inline void bw_peak_reset_coeffs(
bw_peak_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_peak_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_peak_coeffs_state_set_sample_rate);
BW_ASSERT_DEEP(coeffs->use_bandwidth
@@ -503,10 +508,10 @@ static inline float bw_peak_reset_state(
const bw_peak_coeffs * BW_RESTRICT coeffs,
bw_peak_state * BW_RESTRICT state,
float x_0) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_peak_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_peak_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT(bw_is_finite(x_0));
const float y = bw_mm2_reset_state(&coeffs->mm2_coeffs, &state->mm2_state, x_0);
@@ -529,18 +534,18 @@ static inline void bw_peak_reset_state_multi(
const float * x_0,
float * y_0,
size_t n_channels) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_peak_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_peak_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x_0 != NULL);
+ BW_ASSERT(x_0 != BW_NULL);
- if (y_0 != NULL)
+ if (y_0 != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
y_0[i] = bw_peak_reset_state(coeffs, state[i], x_0[i]);
else
@@ -549,12 +554,12 @@ static inline void bw_peak_reset_state_multi(
BW_ASSERT_DEEP(bw_peak_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_peak_coeffs_state_reset_coeffs);
- BW_ASSERT_DEEP(y_0 != NULL ? bw_has_only_finite(y_0, n_channels) : 1);
+ BW_ASSERT_DEEP(y_0 != BW_NULL ? bw_has_only_finite(y_0, n_channels) : 1);
}
static inline void bw_peak_update_coeffs_ctrl(
bw_peak_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_peak_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_peak_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->use_bandwidth
@@ -571,7 +576,7 @@ static inline void bw_peak_update_coeffs_ctrl(
static inline void bw_peak_update_coeffs_audio(
bw_peak_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_peak_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_peak_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->use_bandwidth
@@ -589,14 +594,14 @@ static inline float bw_peak_process1(
const bw_peak_coeffs * BW_RESTRICT coeffs,
bw_peak_state * BW_RESTRICT state,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_peak_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_peak_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->use_bandwidth
? bw_sqrtf(bw_pow2f(coeffs->bandwidth) * coeffs->peak_gain) * bw_rcpf(bw_pow2f(coeffs->bandwidth) - 1.f) >= 1e-6f
&& bw_sqrtf(bw_pow2f(coeffs->bandwidth) * coeffs->peak_gain) * bw_rcpf(bw_pow2f(coeffs->bandwidth) - 1.f) <= 1e6f
: 1);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_peak_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
@@ -616,18 +621,18 @@ static inline void bw_peak_process(
const float * x,
float * y,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_peak_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_peak_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->use_bandwidth
? bw_sqrtf(bw_pow2f(coeffs->bandwidth) * coeffs->peak_gain) * bw_rcpf(bw_pow2f(coeffs->bandwidth) - 1.f) >= 1e-6f
&& bw_sqrtf(bw_pow2f(coeffs->bandwidth) * coeffs->peak_gain) * bw_rcpf(bw_pow2f(coeffs->bandwidth) - 1.f) <= 1e6f
: 1);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_peak_state_is_valid(coeffs, state));
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
bw_peak_update_coeffs_ctrl(coeffs);
for (size_t i = 0; i < n_samples; i++) {
@@ -648,7 +653,7 @@ static inline void bw_peak_process_multi(
float * const * y,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_peak_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_peak_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(coeffs->state >= bw_peak_coeffs_state_reset_coeffs);
@@ -656,14 +661,14 @@ static inline void bw_peak_process_multi(
? bw_sqrtf(bw_pow2f(coeffs->bandwidth) * coeffs->peak_gain) * bw_rcpf(bw_pow2f(coeffs->bandwidth) - 1.f) >= 1e-6f
&& bw_sqrtf(bw_pow2f(coeffs->bandwidth) * coeffs->peak_gain) * bw_rcpf(bw_pow2f(coeffs->bandwidth) - 1.f) <= 1e6f
: 1);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x != NULL);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(x != BW_NULL);
+ BW_ASSERT(y != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -684,7 +689,7 @@ static inline void bw_peak_process_multi(
static inline void bw_peak_set_cutoff(
bw_peak_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_peak_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_peak_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -699,7 +704,7 @@ static inline void bw_peak_set_cutoff(
static inline void bw_peak_set_Q(
bw_peak_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_peak_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_peak_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -720,7 +725,7 @@ static inline void bw_peak_set_Q(
static inline void bw_peak_set_prewarp_at_cutoff(
bw_peak_coeffs * BW_RESTRICT coeffs,
char value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_peak_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_peak_coeffs_state_init);
@@ -733,7 +738,7 @@ static inline void bw_peak_set_prewarp_at_cutoff(
static inline void bw_peak_set_prewarp_freq(
bw_peak_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_peak_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_peak_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -748,7 +753,7 @@ static inline void bw_peak_set_prewarp_freq(
static inline void bw_peak_set_peak_gain_lin(
bw_peak_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_peak_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_peak_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -769,7 +774,7 @@ static inline void bw_peak_set_peak_gain_lin(
static inline void bw_peak_set_peak_gain_dB(
bw_peak_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_peak_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_peak_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -784,7 +789,7 @@ static inline void bw_peak_set_peak_gain_dB(
static inline void bw_peak_set_bandwidth(
bw_peak_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_peak_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_peak_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -805,7 +810,7 @@ static inline void bw_peak_set_bandwidth(
static inline void bw_peak_set_use_bandwidth(
bw_peak_coeffs * BW_RESTRICT coeffs,
char value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_peak_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_peak_coeffs_state_init);
@@ -823,7 +828,7 @@ static inline void bw_peak_set_use_bandwidth(
static inline char bw_peak_coeffs_is_valid(
const bw_peak_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_peak_coeffs"))
@@ -852,17 +857,17 @@ static inline char bw_peak_coeffs_is_valid(
static inline char bw_peak_state_is_valid(
const bw_peak_coeffs * BW_RESTRICT coeffs,
const bw_peak_state * BW_RESTRICT state) {
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (state->hash != bw_hash_sdbm("bw_peak_state"))
return 0;
- if (coeffs != NULL && coeffs->reset_id != state->coeffs_reset_id)
+ if (coeffs != BW_NULL && coeffs->reset_id != state->coeffs_reset_id)
return 0;
#endif
- return bw_mm2_state_is_valid(coeffs ? &coeffs->mm2_coeffs : NULL, &state->mm2_state);
+ return bw_mm2_state_is_valid(coeffs ? &coeffs->mm2_coeffs : BW_NULL, &state->mm2_state);
}
#undef BW_PEAK_PARAM_Q
diff --git a/include/bw_phase_gen.h b/include/bw_phase_gen.h
index 4f5d66d..2a258dd 100644
--- a/include/bw_phase_gen.h
+++ b/include/bw_phase_gen.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2022, 2023 Orastron Srl unipersonale
+ * Copyright (C) 2022-2024 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
@@ -31,7 +31,8 @@
* BW_NULL
.BW_NULL
.BW_NULL
.bw_pink_filt_reset_coeffs()
,
@@ -175,7 +180,7 @@ static inline void bw_pink_filt_reset_state_multi(
* array.
*
* The corresponding initial output values are written into the `y_0` array,
- * if not `NULL`.
+ * if not `BW_NULL`.
*
* #### bw_pink_filt_update_coeffs_ctrl()
* ```>>> */
@@ -290,8 +295,8 @@ static inline char bw_pink_filt_state_is_valid(
* seems to be the case and `0` if it is certainly not. False positives are
* possible, false negatives are not.
*
- * If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
- * is supposed to be associated to `coeffs`).
+ * If `coeffs` is not `BW_NULL` extra cross-checks might be performed
+ * (`state` is supposed to be associated to `coeffs`).
*
* `state` must at least point to a readable memory block of size greater
* than or equal to that of `bw_pink_filt_state`.
@@ -348,7 +353,7 @@ struct bw_pink_filt_state {
static inline void bw_pink_filt_init(
bw_pink_filt_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
coeffs->sample_rate_scaling = 0;
@@ -364,7 +369,7 @@ static inline void bw_pink_filt_init(
static inline void bw_pink_filt_set_sample_rate(
bw_pink_filt_coeffs * BW_RESTRICT coeffs,
float sample_rate) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_pink_filt_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_pink_filt_coeffs_state_init);
BW_ASSERT(bw_is_finite(sample_rate) && sample_rate > 0.f);
@@ -380,7 +385,7 @@ static inline void bw_pink_filt_set_sample_rate(
static inline void bw_pink_filt_reset_coeffs(
bw_pink_filt_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_pink_filt_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_pink_filt_coeffs_state_set_sample_rate);
@@ -398,10 +403,10 @@ static inline float bw_pink_filt_reset_state(
const bw_pink_filt_coeffs * BW_RESTRICT coeffs,
bw_pink_filt_state * BW_RESTRICT state,
float x_0) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_pink_filt_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_pink_filt_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT(bw_is_finite(x_0));
(void)coeffs;
@@ -429,18 +434,18 @@ static inline void bw_pink_filt_reset_state_multi(
const float * x_0,
float * y_0,
size_t n_channels) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_pink_filt_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_pink_filt_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x_0 != NULL);
+ BW_ASSERT(x_0 != BW_NULL);
- if (y_0 != NULL)
+ if (y_0 != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
y_0[i] = bw_pink_filt_reset_state(coeffs, state[i], x_0[i]);
else
@@ -449,12 +454,12 @@ static inline void bw_pink_filt_reset_state_multi(
BW_ASSERT_DEEP(bw_pink_filt_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_pink_filt_coeffs_state_reset_coeffs);
- BW_ASSERT_DEEP(y_0 != NULL ? bw_has_only_finite(y_0, n_channels) : 1);
+ BW_ASSERT_DEEP(y_0 != BW_NULL ? bw_has_only_finite(y_0, n_channels) : 1);
}
static inline void bw_pink_filt_update_coeffs_ctrl(
bw_pink_filt_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_pink_filt_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_pink_filt_coeffs_state_reset_coeffs);
@@ -463,7 +468,7 @@ static inline void bw_pink_filt_update_coeffs_ctrl(
static inline void bw_pink_filt_update_coeffs_audio(
bw_pink_filt_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_pink_filt_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_pink_filt_coeffs_state_reset_coeffs);
@@ -474,10 +479,10 @@ static inline float bw_pink_filt_process1(
const bw_pink_filt_coeffs * BW_RESTRICT coeffs,
bw_pink_filt_state * BW_RESTRICT state,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_pink_filt_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_pink_filt_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_pink_filt_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
@@ -503,10 +508,10 @@ static inline float bw_pink_filt_process1_scaling(
const bw_pink_filt_coeffs * BW_RESTRICT coeffs,
bw_pink_filt_state * BW_RESTRICT state,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_pink_filt_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_pink_filt_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_pink_filt_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
@@ -526,14 +531,14 @@ static inline void bw_pink_filt_process(
const float * x,
float * y,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_pink_filt_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_pink_filt_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_pink_filt_state_is_valid(coeffs, state));
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
if (coeffs->sample_rate_scaling)
for (size_t i = 0; i < n_samples; i++)
@@ -555,17 +560,17 @@ static inline void bw_pink_filt_process_multi(
float * const * y,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_pink_filt_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_pink_filt_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x != NULL);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(x != BW_NULL);
+ BW_ASSERT(y != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -582,7 +587,7 @@ static inline void bw_pink_filt_process_multi(
static inline void bw_pink_filt_set_sample_rate_scaling(
bw_pink_filt_coeffs * BW_RESTRICT coeffs,
char value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_pink_filt_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_pink_filt_coeffs_state_init);
@@ -594,7 +599,7 @@ static inline void bw_pink_filt_set_sample_rate_scaling(
static inline float bw_pink_filt_get_scaling_k(
const bw_pink_filt_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_pink_filt_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_pink_filt_coeffs_state_set_sample_rate);
@@ -603,7 +608,7 @@ static inline float bw_pink_filt_get_scaling_k(
static inline char bw_pink_filt_coeffs_is_valid(
const bw_pink_filt_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_pink_filt_coeffs"))
@@ -623,13 +628,13 @@ static inline char bw_pink_filt_coeffs_is_valid(
static inline char bw_pink_filt_state_is_valid(
const bw_pink_filt_coeffs * BW_RESTRICT coeffs,
const bw_pink_filt_state * BW_RESTRICT state) {
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (state->hash != bw_hash_sdbm("bw_pink_filt_state"))
return 0;
- if (coeffs != NULL && coeffs->reset_id != state->coeffs_reset_id)
+ if (coeffs != BW_NULL && coeffs->reset_id != state->coeffs_reset_id)
return 0;
#endif
diff --git a/include/bw_ppm.h b/include/bw_ppm.h
index be3b7a9..7b736b5 100644
--- a/include/bw_ppm.h
+++ b/include/bw_ppm.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2023 Orastron Srl unipersonale
+ * Copyright (C) 2023, 2024 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
@@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common bw_env_follow bw_math bw_one_pole }}}
* description {{{
* Digital peak programme meter with adjustable integration time constant.
@@ -30,6 +30,11 @@
* }}}
* changelog {{{
* BW_NULL
.-600.f
.BW_NULL
.bw_randf()
.BW_NULL
.BW_NULL
.BW_NULL
.BW_NULL
.bw_slew_lim_reset_state_multi()
and updated
@@ -150,7 +155,7 @@ static inline void bw_slew_lim_reset_state_multi(
* array.
*
* The corresponding initial output values are written into the
- * `y_0` array, if not `NULL`.
+ * `y_0` array, if not `BW_NULL`.
*
* #### bw_slew_lim_update_coeffs_ctrl()
* ```>>> */
@@ -219,7 +224,7 @@ static inline void bw_slew_lim_process(
* first `n_samples` of the output buffer `y`, while using and updating both
* `coeffs` and `state` (control and audio rate).
*
- * `y` may be `NULL`.
+ * `y` may be `BW_NULL`.
*
* #### bw_slew_lim_process_multi()
* ```>>> */
@@ -236,7 +241,7 @@ static inline void bw_slew_lim_process_multi(
* using and updating both the common `coeffs` and each of the `n_channels`
* `state`s (control and audio rate).
*
- * `y` or any element of `y` may be `NULL`.
+ * `y` or any element of `y` may be `BW_NULL`.
*
* #### bw_slew_lim_set_max_rate()
* ```>>> */
@@ -316,8 +321,8 @@ static inline char bw_slew_lim_state_is_valid(
* seems to be the case and `0` if it is certainly not. False positives are
* possible, false negatives are not.
*
- * If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
- * is supposed to be associated to `coeffs`).
+ * If `coeffs` is not `BW_NULL` extra cross-checks might be performed
+ * (`state` is supposed to be associated to `coeffs`).
*
* `state` must at least point to a readable memory block of size greater
* than or equal to that of `bw_slew_lim_state`.
@@ -377,7 +382,7 @@ struct bw_slew_lim_state {
static inline void bw_slew_lim_init(
bw_slew_lim_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
coeffs->max_rate_up = INFINITY;
coeffs->max_rate_down = INFINITY;
@@ -394,7 +399,7 @@ static inline void bw_slew_lim_init(
static inline void bw_slew_lim_set_sample_rate(
bw_slew_lim_coeffs * BW_RESTRICT coeffs,
float sample_rate) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_init);
BW_ASSERT(bw_is_finite(sample_rate) && sample_rate > 0.f);
@@ -417,7 +422,7 @@ static inline void bw_slew_lim_do_update_coeffs_ctrl(
static inline void bw_slew_lim_reset_coeffs(
bw_slew_lim_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_set_sample_rate);
@@ -435,10 +440,10 @@ static inline float bw_slew_lim_reset_state(
const bw_slew_lim_coeffs * BW_RESTRICT coeffs,
bw_slew_lim_state * BW_RESTRICT state,
float x_0) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT(bw_is_finite(x_0));
(void)coeffs;
@@ -463,18 +468,18 @@ static inline void bw_slew_lim_reset_state_multi(
const float * x_0,
float * y_0,
size_t n_channels) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x_0 != NULL);
+ BW_ASSERT(x_0 != BW_NULL);
- if (y_0 != NULL)
+ if (y_0 != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
y_0[i] = bw_slew_lim_reset_state(coeffs, state[i], x_0[i]);
else
@@ -483,12 +488,12 @@ static inline void bw_slew_lim_reset_state_multi(
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
- BW_ASSERT_DEEP(y_0 != NULL ? bw_has_only_finite(y_0, n_channels) : 1);
+ BW_ASSERT_DEEP(y_0 != BW_NULL ? bw_has_only_finite(y_0, n_channels) : 1);
}
static inline void bw_slew_lim_update_coeffs_ctrl(
bw_slew_lim_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
@@ -500,7 +505,7 @@ static inline void bw_slew_lim_update_coeffs_ctrl(
static inline void bw_slew_lim_update_coeffs_audio(
bw_slew_lim_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
@@ -511,10 +516,10 @@ static inline float bw_slew_lim_process1(
const bw_slew_lim_coeffs * BW_RESTRICT coeffs,
bw_slew_lim_state * BW_RESTRICT state,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
BW_ASSERT(bw_is_finite(coeffs->max_inc) && bw_is_finite(coeffs->max_dec));
@@ -534,10 +539,10 @@ static inline float bw_slew_lim_process1_up(
const bw_slew_lim_coeffs * BW_RESTRICT coeffs,
bw_slew_lim_state * BW_RESTRICT state,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
BW_ASSERT(bw_is_finite(coeffs->max_inc));
@@ -557,10 +562,10 @@ static inline float bw_slew_lim_process1_down(
const bw_slew_lim_coeffs * BW_RESTRICT coeffs,
bw_slew_lim_state * BW_RESTRICT state,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
BW_ASSERT(bw_is_finite(coeffs->max_dec));
@@ -580,10 +585,10 @@ static inline float bw_slew_lim_process1_none(
const bw_slew_lim_coeffs * BW_RESTRICT coeffs,
bw_slew_lim_state * BW_RESTRICT state,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
@@ -603,16 +608,16 @@ static inline void bw_slew_lim_process(
const float * x,
float * y,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state));
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
bw_slew_lim_update_coeffs_ctrl(coeffs);
- if (y != NULL) {
+ if (y != BW_NULL) {
if (coeffs->max_rate_up != INFINITY) {
if (coeffs->max_rate_down != INFINITY)
for (size_t i = 0; i < n_samples; i++)
@@ -650,7 +655,7 @@ static inline void bw_slew_lim_process(
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state));
- BW_ASSERT_DEEP(y != NULL ? bw_has_only_finite(y, n_samples) : 1);
+ BW_ASSERT_DEEP(y != BW_NULL ? bw_has_only_finite(y, n_samples) : 1);
}
static inline void bw_slew_lim_process_multi(
@@ -660,29 +665,29 @@ static inline void bw_slew_lim_process_multi(
float * const * y,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
#ifndef BW_NO_DEBUG
- if (y != NULL)
+ if (y != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
- BW_ASSERT(y[i] == NULL || y[j] == NULL || y[i] != y[j]);
+ BW_ASSERT(y[i] == BW_NULL || y[j] == BW_NULL || y[i] != y[j]);
#endif
bw_slew_lim_update_coeffs_ctrl(coeffs);
- if (y != NULL) {
+ if (y != BW_NULL) {
if (coeffs->max_rate_up != INFINITY) {
if (coeffs->max_rate_down != INFINITY)
for (size_t j = 0; j < n_channels; j++)
- if (y[j] != NULL)
+ if (y[j] != BW_NULL)
for (size_t i = 0; i < n_samples; i++)
y[j][i] = bw_slew_lim_process1(coeffs, state[j], x[j][i]);
else
@@ -691,14 +696,14 @@ static inline void bw_slew_lim_process_multi(
else
for (size_t j = 0; j < n_channels; j++)
for (size_t i = 0; i < n_samples; i++)
- if (y[j] != NULL)
+ if (y[j] != BW_NULL)
y[j][i] = bw_slew_lim_process1_up(coeffs, state[j], x[j][i]);
else
bw_slew_lim_process1_up(coeffs, state[j], x[j][i]);
} else {
if (coeffs->max_rate_down != INFINITY)
for (size_t j = 0; j < n_channels; j++)
- if (y[j] != NULL)
+ if (y[j] != BW_NULL)
for (size_t i = 0; i < n_samples; i++)
y[j][i] = bw_slew_lim_process1_down(coeffs, state[j], x[j][i]);
else
@@ -706,18 +711,18 @@ static inline void bw_slew_lim_process_multi(
bw_slew_lim_process1_down(coeffs, state[j], x[j][i]);
else
for (size_t j = 0; j < n_channels; j++) {
- BW_ASSERT(state[j] != NULL);
+ BW_ASSERT(state[j] != BW_NULL);
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state[j]));
- BW_ASSERT(x[j] != NULL);
+ BW_ASSERT(x[j] != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x[j], n_samples));
- if (y[j] != NULL)
+ if (y[j] != BW_NULL)
for (size_t i = 0; i < n_samples; i++)
y[j][i] = x[j][i];
state[j]->y_z1 = x[j][n_samples - 1];
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state[j]));
- BW_ASSERT_DEEP(y[j] != NULL ? bw_has_only_finite(y[j], n_samples) : 1);
+ BW_ASSERT_DEEP(y[j] != BW_NULL ? bw_has_only_finite(y[j], n_samples) : 1);
}
}
} else {
@@ -737,9 +742,9 @@ static inline void bw_slew_lim_process_multi(
bw_slew_lim_process1_down(coeffs, state[j], x[j][i]);
else
for (size_t j = 0; j < n_channels; j++) {
- BW_ASSERT(state[j] != NULL);
+ BW_ASSERT(state[j] != BW_NULL);
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state[j]));
- BW_ASSERT(x[j] != NULL);
+ BW_ASSERT(x[j] != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x[j], n_samples));
state[j]->y_z1 = x[j][n_samples - 1];
@@ -756,7 +761,7 @@ static inline void bw_slew_lim_process_multi(
static inline void bw_slew_lim_set_max_rate(
bw_slew_lim_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_init);
BW_ASSERT(!bw_is_nan(value));
@@ -772,7 +777,7 @@ static inline void bw_slew_lim_set_max_rate(
static inline void bw_slew_lim_set_max_rate_up(
bw_slew_lim_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_init);
BW_ASSERT(!bw_is_nan(value));
@@ -787,7 +792,7 @@ static inline void bw_slew_lim_set_max_rate_up(
static inline void bw_slew_lim_set_max_rate_down(
bw_slew_lim_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_init);
BW_ASSERT(!bw_is_nan(value));
@@ -801,15 +806,15 @@ static inline void bw_slew_lim_set_max_rate_down(
static inline float bw_slew_lim_get_y_z1(
const bw_slew_lim_state * BW_RESTRICT state) {
- BW_ASSERT(state != NULL);
- BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(NULL, state));
+ BW_ASSERT(state != BW_NULL);
+ BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(BW_NULL, state));
return state->y_z1;
}
static inline char bw_slew_lim_coeffs_is_valid(
const bw_slew_lim_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_slew_lim_coeffs"))
@@ -843,13 +848,13 @@ static inline char bw_slew_lim_coeffs_is_valid(
static inline char bw_slew_lim_state_is_valid(
const bw_slew_lim_coeffs * BW_RESTRICT coeffs,
const bw_slew_lim_state * BW_RESTRICT state) {
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (state->hash != bw_hash_sdbm("bw_slew_lim_state"))
return 0;
- if (coeffs != NULL && coeffs->reset_id != state->coeffs_reset_id)
+ if (coeffs != BW_NULL && coeffs->reset_id != state->coeffs_reset_id)
return 0;
#endif
diff --git a/include/bw_sr_reduce.h b/include/bw_sr_reduce.h
index e9b0fe2..e066d88 100644
--- a/include/bw_sr_reduce.h
+++ b/include/bw_sr_reduce.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2022, 2023 Orastron Srl unipersonale
+ * Copyright (C) 2022-2024 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
@@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common bw_math }}}
* description {{{
* Sample rate reducer.
@@ -31,6 +31,11 @@
* }}}
* changelog {{{
* BW_NULL
.bw_sr_reduce_set_sample_rate()
,
@@ -152,7 +157,7 @@ static inline void bw_sr_reduce_reset_state_multi(
* array.
*
* The corresponding initial output values are written into the `y_0` array,
- * if not `NULL`.
+ * if not `BW_NULL`.
*
* #### bw_sr_reduce_update_coeffs_ctrl()
* ```>>> */
@@ -240,8 +245,8 @@ static inline char bw_sr_reduce_state_is_valid(
* seems to be the case and `0` if it is certainly not. False positives are
* possible, false negatives are not.
*
- * If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
- * is supposed to be associated to `coeffs`).
+ * If `coeffs` is not `BW_NULL` extra cross-checks might be performed
+ * (`state` is supposed to be associated to `coeffs`).
*
* `state` must at least point to a readable memory block of size greater
* than or equal to that of `bw_sr_reduce_state`.
@@ -295,7 +300,7 @@ struct bw_sr_reduce_state {
static inline void bw_sr_reduce_init(
bw_sr_reduce_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
coeffs->ratio = 1.f;
@@ -311,7 +316,7 @@ static inline void bw_sr_reduce_init(
static inline void bw_sr_reduce_set_sample_rate(
bw_sr_reduce_coeffs * BW_RESTRICT coeffs,
float sample_rate) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_sr_reduce_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_sr_reduce_coeffs_state_init);
BW_ASSERT(bw_is_finite(sample_rate) && sample_rate > 0.f);
@@ -328,7 +333,7 @@ static inline void bw_sr_reduce_set_sample_rate(
static inline void bw_sr_reduce_reset_coeffs(
bw_sr_reduce_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_sr_reduce_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_sr_reduce_coeffs_state_set_sample_rate);
@@ -346,10 +351,10 @@ static inline float bw_sr_reduce_reset_state(
const bw_sr_reduce_coeffs * BW_RESTRICT coeffs,
bw_sr_reduce_state * BW_RESTRICT state,
float x_0) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_sr_reduce_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_sr_reduce_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT(bw_is_finite(x_0));
(void)coeffs;
@@ -375,18 +380,18 @@ static inline void bw_sr_reduce_reset_state_multi(
const float * x_0,
float * y_0,
size_t n_channels) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_sr_reduce_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_sr_reduce_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x_0 != NULL);
+ BW_ASSERT(x_0 != BW_NULL);
- if (y_0 != NULL)
+ if (y_0 != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
y_0[i] = bw_sr_reduce_reset_state(coeffs, state[i], x_0[i]);
else
@@ -395,12 +400,12 @@ static inline void bw_sr_reduce_reset_state_multi(
BW_ASSERT_DEEP(bw_sr_reduce_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_sr_reduce_coeffs_state_reset_coeffs);
- BW_ASSERT_DEEP(y_0 != NULL ? bw_has_only_finite(y_0, n_channels) : 1);
+ BW_ASSERT_DEEP(y_0 != BW_NULL ? bw_has_only_finite(y_0, n_channels) : 1);
}
static inline void bw_sr_reduce_update_coeffs_ctrl(
bw_sr_reduce_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_sr_reduce_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_sr_reduce_coeffs_state_reset_coeffs);
@@ -409,7 +414,7 @@ static inline void bw_sr_reduce_update_coeffs_ctrl(
static inline void bw_sr_reduce_update_coeffs_audio(
bw_sr_reduce_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_sr_reduce_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_sr_reduce_coeffs_state_reset_coeffs);
@@ -420,10 +425,10 @@ static inline float bw_sr_reduce_process1(
const bw_sr_reduce_coeffs * BW_RESTRICT coeffs,
bw_sr_reduce_state * BW_RESTRICT state,
float x) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_sr_reduce_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_sr_reduce_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_sr_reduce_state_is_valid(coeffs, state));
BW_ASSERT(bw_is_finite(x));
@@ -448,14 +453,14 @@ static inline void bw_sr_reduce_process(
const float * x,
float * y,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_sr_reduce_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_sr_reduce_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_sr_reduce_state_is_valid(coeffs, state));
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
for (size_t i = 0; i < n_samples; i++)
y[i] = bw_sr_reduce_process1(coeffs, state, x[i]);
@@ -473,17 +478,17 @@ static inline void bw_sr_reduce_process_multi(
float * const * y,
size_t n_channels,
size_t n_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_sr_reduce_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_sr_reduce_coeffs_state_reset_coeffs);
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x != NULL);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(x != BW_NULL);
+ BW_ASSERT(y != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
@@ -500,7 +505,7 @@ static inline void bw_sr_reduce_process_multi(
static inline void bw_sr_reduce_set_ratio(
bw_sr_reduce_coeffs * BW_RESTRICT coeffs,
float value) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_sr_reduce_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_sr_reduce_coeffs_state_init);
BW_ASSERT(bw_is_finite(value));
@@ -514,7 +519,7 @@ static inline void bw_sr_reduce_set_ratio(
static inline char bw_sr_reduce_coeffs_is_valid(
const bw_sr_reduce_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_sr_reduce_coeffs"))
@@ -529,13 +534,13 @@ static inline char bw_sr_reduce_coeffs_is_valid(
static inline char bw_sr_reduce_state_is_valid(
const bw_sr_reduce_coeffs * BW_RESTRICT coeffs,
const bw_sr_reduce_state * BW_RESTRICT state) {
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (state->hash != bw_hash_sdbm("bw_sr_reduce_state"))
return 0;
- if (coeffs != NULL && coeffs->reset_id != state->coeffs_reset_id)
+ if (coeffs != BW_NULL && coeffs->reset_id != state->coeffs_reset_id)
return 0;
#endif
diff --git a/include/bw_src.h b/include/bw_src.h
index eb4e617..49f53b9 100644
--- a/include/bw_src.h
+++ b/include/bw_src.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2023 Orastron Srl unipersonale
+ * Copyright (C) 2023, 2024 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
@@ -20,13 +20,18 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common bw_math }}}
* description {{{
* Aribtrary-ratio IIR sample rate converter.
* }}}
* changelog {{{
* BW_NULL
.bw_src_reset_state_multi()
and updated C++
@@ -130,7 +135,7 @@ static inline void bw_src_reset_state_multi(
* array.
*
* The corresponding initial output values are written into the `y_0` array,
- * if not `NULL`.
+ * if not `BW_NULL`.
*
* #### bw_src_process()
* ```>>> */
@@ -200,8 +205,8 @@ static inline char bw_src_state_is_valid(
* seems to be the case and `0` if it is certainly not. False positives are
* possible, false negatives are not.
*
- * If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
- * is supposed to be associated to `coeffs`).
+ * If `coeffs` is not `BW_NULL` extra cross-checks might be performed
+ * (`state` is supposed to be associated to `coeffs`).
*
* `state` must at least point to a readable memory block of size greater
* than or equal to that of `bw_src_state`.
@@ -257,7 +262,7 @@ struct bw_src_state {
static inline void bw_src_init(
bw_src_coeffs * BW_RESTRICT coeffs,
float ratio) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT(ratio > 0.f);
coeffs->k = ratio >= 1.f ? 1.f / ratio : -1.f / ratio;
@@ -283,9 +288,9 @@ static inline float bw_src_reset_state(
const bw_src_coeffs * BW_RESTRICT coeffs,
bw_src_state * BW_RESTRICT state,
float x_0) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_src_coeffs_is_valid(coeffs));
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT(bw_is_finite(x_0));
if (coeffs->k < 0) {
@@ -325,17 +330,17 @@ static inline void bw_src_reset_state_multi(
const float * x_0,
float * y_0,
size_t n_channels) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_src_coeffs_is_valid(coeffs));
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x_0 != NULL);
+ BW_ASSERT(x_0 != BW_NULL);
- if (y_0 != NULL)
+ if (y_0 != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
y_0[i] = bw_src_reset_state(coeffs, state[i], x_0[i]);
else
@@ -343,7 +348,7 @@ static inline void bw_src_reset_state_multi(
bw_src_reset_state(coeffs, state[i], x_0[i]);
BW_ASSERT_DEEP(bw_src_coeffs_is_valid(coeffs));
- BW_ASSERT_DEEP(y_0 != NULL ? bw_has_only_finite(y_0, n_channels) : 1);
+ BW_ASSERT_DEEP(y_0 != BW_NULL ? bw_has_only_finite(y_0, n_channels) : 1);
}
static inline void bw_src_process(
@@ -353,16 +358,16 @@ static inline void bw_src_process(
float * BW_RESTRICT y,
size_t * BW_RESTRICT n_in_samples,
size_t * BW_RESTRICT n_out_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_src_coeffs_is_valid(coeffs));
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_src_state_is_valid(coeffs, state));
- BW_ASSERT(n_in_samples != NULL);
- BW_ASSERT(n_out_samples != NULL);
+ BW_ASSERT(n_in_samples != BW_NULL);
+ BW_ASSERT(n_out_samples != BW_NULL);
BW_ASSERT(n_in_samples != n_out_samples);
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, *n_in_samples));
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
BW_ASSERT(x != y);
size_t i = 0;
@@ -444,16 +449,16 @@ static inline void bw_src_process_multi(
size_t n_channels,
size_t * BW_RESTRICT n_in_samples,
size_t * BW_RESTRICT n_out_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_src_coeffs_is_valid(coeffs));
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x != NULL);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(x != BW_NULL);
+ BW_ASSERT(y != BW_NULL);
BW_ASSERT((void *)x != (void *)y);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
@@ -463,8 +468,8 @@ static inline void bw_src_process_multi(
for (size_t j = 0; j < n_channels; j++)
BW_ASSERT((void *)x[i] != (void *)y[j]);
#endif
- BW_ASSERT(n_in_samples != NULL);
- BW_ASSERT(n_out_samples != NULL);
+ BW_ASSERT(n_in_samples != BW_NULL);
+ BW_ASSERT(n_out_samples != BW_NULL);
BW_ASSERT(n_in_samples != n_out_samples);
for (size_t i = 0; i < n_channels; i++)
@@ -475,7 +480,7 @@ static inline void bw_src_process_multi(
static inline char bw_src_coeffs_is_valid(
const bw_src_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_src_coeffs"))
@@ -493,13 +498,13 @@ static inline char bw_src_coeffs_is_valid(
static inline char bw_src_state_is_valid(
const bw_src_coeffs * BW_RESTRICT coeffs,
const bw_src_state * BW_RESTRICT state) {
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (state->hash != bw_hash_sdbm("bw_src_state"))
return 0;
- if (coeffs != NULL && coeffs->reset_id != state->coeffs_reset_id)
+ if (coeffs != BW_NULL && coeffs->reset_id != state->coeffs_reset_id)
return 0;
#endif
diff --git a/include/bw_src_int.h b/include/bw_src_int.h
index 905ae5b..580a3cd 100644
--- a/include/bw_src_int.h
+++ b/include/bw_src_int.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2023 Orastron Srl unipersonale
+ * Copyright (C) 2023, 2024 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
@@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common bw_math }}}
* description {{{
* Integer-ratio IIR sample rate converter.
@@ -33,6 +33,11 @@
* }}}
* changelog {{{
* BW_NULL
.bw_src_int_reset_state_multi()
and updated
@@ -139,7 +144,7 @@ static inline void bw_src_int_reset_state_multi(
* array.
*
* The corresponding initial output values are written into the `y_0` array,
- * if not `NULL`.
+ * if not `BW_NULL`.
*
* #### bw_src_int_process()
* ```>>> */
@@ -184,7 +189,7 @@ static inline void bw_src_int_process_multi(
* A given buffer cannot be used both as an input and output buffer.
*
* `n_out_samples` is filled with the number of generated output samples for
- * each output buffer, if not `NULL`.
+ * each output buffer, if not `BW_NULL`.
*
* #### bw_src_int_coeffs_is_valid()
* ```>>> */
@@ -208,8 +213,8 @@ static inline char bw_src_int_state_is_valid(
* seems to be the case and `0` if it is certainly not. False positives are
* possible, false negatives are not.
*
- * If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
- * is supposed to be associated to `coeffs`).
+ * If `coeffs` is not `BW_NULL` extra cross-checks might be performed
+ * (`state` is supposed to be associated to `coeffs`).
*
* `state` must at least point to a readable memory block of size greater
* than or equal to that of `bw_src_int_state`.
@@ -262,7 +267,7 @@ struct bw_src_int_state {
static inline void bw_src_int_init(
bw_src_int_coeffs * BW_RESTRICT coeffs,
int ratio) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT(ratio < -1 || ratio > 1);
coeffs->ratio = ratio;
@@ -288,9 +293,9 @@ static inline float bw_src_int_reset_state(
const bw_src_int_coeffs * BW_RESTRICT coeffs,
bw_src_int_state * BW_RESTRICT state,
float x_0) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_src_int_coeffs_is_valid(coeffs));
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT(bw_is_finite(x_0));
if (coeffs->ratio < 0) {
@@ -327,17 +332,17 @@ static inline void bw_src_int_reset_state_multi(
const float * x_0,
float * y_0,
size_t n_channels) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_src_int_coeffs_is_valid(coeffs));
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x_0 != NULL);
+ BW_ASSERT(x_0 != BW_NULL);
- if (y_0 != NULL)
+ if (y_0 != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
y_0[i] = bw_src_int_reset_state(coeffs, state[i], x_0[i]);
else
@@ -345,7 +350,7 @@ static inline void bw_src_int_reset_state_multi(
bw_src_int_reset_state(coeffs, state[i], x_0[i]);
BW_ASSERT_DEEP(bw_src_int_coeffs_is_valid(coeffs));
- BW_ASSERT_DEEP(y_0 != NULL ? bw_has_only_finite(y_0, n_channels) : 1);
+ BW_ASSERT_DEEP(y_0 != BW_NULL ? bw_has_only_finite(y_0, n_channels) : 1);
}
static inline size_t bw_src_int_process(
@@ -354,13 +359,13 @@ static inline size_t bw_src_int_process(
const float * BW_RESTRICT x,
float * BW_RESTRICT y,
size_t n_in_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_src_int_coeffs_is_valid(coeffs));
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
BW_ASSERT_DEEP(bw_src_int_state_is_valid(coeffs, state));
- BW_ASSERT(x != NULL);
+ BW_ASSERT(x != BW_NULL);
BW_ASSERT_DEEP(bw_has_only_finite(x, n_in_samples));
- BW_ASSERT(y != NULL);
+ BW_ASSERT(y != BW_NULL);
BW_ASSERT(x != y);
size_t n = 0;
@@ -420,16 +425,16 @@ static inline void bw_src_int_process_multi(
size_t n_channels,
size_t n_in_samples,
size_t * BW_RESTRICT n_out_samples) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_src_int_coeffs_is_valid(coeffs));
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
for (size_t j = i + 1; j < n_channels; j++)
BW_ASSERT(state[i] != state[j]);
#endif
- BW_ASSERT(x != NULL);
- BW_ASSERT(y != NULL);
+ BW_ASSERT(x != BW_NULL);
+ BW_ASSERT(y != BW_NULL);
BW_ASSERT((void *)x != (void *)y);
#ifndef BW_NO_DEBUG
for (size_t i = 0; i < n_channels; i++)
@@ -440,7 +445,7 @@ static inline void bw_src_int_process_multi(
BW_ASSERT((void *)x[i] != (void *)y[j]);
#endif
- if (n_out_samples != NULL)
+ if (n_out_samples != BW_NULL)
for (size_t i = 0; i < n_channels; i++)
n_out_samples[i] = bw_src_int_process(coeffs, state[i], x[i], y[i], n_in_samples);
else
@@ -452,7 +457,7 @@ static inline void bw_src_int_process_multi(
static inline char bw_src_int_coeffs_is_valid(
const bw_src_int_coeffs * BW_RESTRICT coeffs) {
- BW_ASSERT(coeffs != NULL);
+ BW_ASSERT(coeffs != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (coeffs->hash != bw_hash_sdbm("bw_src_int_coeffs"))
@@ -470,13 +475,13 @@ static inline char bw_src_int_coeffs_is_valid(
static inline char bw_src_int_state_is_valid(
const bw_src_int_coeffs * BW_RESTRICT coeffs,
const bw_src_int_state * BW_RESTRICT state) {
- BW_ASSERT(state != NULL);
+ BW_ASSERT(state != BW_NULL);
#ifdef BW_DEBUG_DEEP
if (state->hash != bw_hash_sdbm("bw_src_int_state"))
return 0;
- if (coeffs != NULL && coeffs->reset_id != state->coeffs_reset_id)
+ if (coeffs != BW_NULL && coeffs->reset_id != state->coeffs_reset_id)
return 0;
#endif
diff --git a/include/bw_svf.h b/include/bw_svf.h
index 8135511..0324939 100644
--- a/include/bw_svf.h
+++ b/include/bw_svf.h
@@ -1,7 +1,7 @@
/*
* Brickworks
*
- * Copyright (C) 2022, 2023 Orastron Srl unipersonale
+ * Copyright (C) 2022-2024 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
@@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
- * version {{{ 1.0.0 }}}
+ * version {{{ 1.0.1 }}}
* requires {{{ bw_common bw_math bw_one_pole }}}
* description {{{
* State variable filter (2nd order, 12 dB/oct) model with separated lowpass,
@@ -28,6 +28,11 @@
* }}}
* changelog {{{
* BW_NULL
.BW_NULL
.BW_NULL
.BW_NULL
.