fixing doc for non-dsp modules

This commit is contained in:
Stefano D'Angelo 2022-12-03 10:09:21 +01:00
parent 682e9ccbdc
commit fec3040bc2
4 changed files with 61 additions and 102 deletions

View File

@ -18,7 +18,9 @@ Authors: Stefano D'Angelo, Paolo Marrone.
All the code in the repo is released under GPLv3. See the LICENSE file. Alternatively, we offer a commercial license that doesn't restrict usage with respect to time, projects, or developers involved. More details [on the official web page](https://www.orastron.com/brickworks#license-pricing). All the code in the repo is released under GPLv3. See the LICENSE file. Alternatively, we offer a commercial license that doesn't restrict usage with respect to time, projects, or developers involved. More details [on the official web page](https://www.orastron.com/brickworks#license-pricing).
The file examples/common/vst3/plugin.cpp contains code from sse2neon (https://github.com/DLTcollab/sse2neon/), which is released under the MIT license. Details in said file. The file examples/common/vst3/plugin.cpp contains code from sse2neon (https://github.com/DLTcollab/sse2neon/), which was released under the MIT license. Details in said file.
The file include/bw\_rand.h contains code from https://nullprogram.com/blog/2017/09/21/, which was released into the public domain by its author.
VST is a registered trademark of Steinberg Media Technologies GmbH. VST is a registered trademark of Steinberg Media Technologies GmbH.

View File

@ -29,8 +29,8 @@
* <ul> * <ul>
* <li>Version <strong>0.2.0</strong>: * <li>Version <strong>0.2.0</strong>:
* <ul> * <ul>
* <li>Removed BW_MALLOC, BW_REALLOC, and BW_FREE.</li> * <li>Removed <code>BW_MALLOC</code>, <code>BW_REALLOC</code>, and <code>BW_FREE</code>.</li>
* <li>Added BW_RESTRICT.</li> * <li>Added <code>BW_RESTRICT</code>.</li>
* </ul> * </ul>
* </li> * </li>
* <li>Version <strong>0.1.0</strong>: * <li>Version <strong>0.1.0</strong>:
@ -55,16 +55,16 @@
* the command line. * the command line.
* >>> */ * >>> */
#include <bw_config.h> #include <bw_config.h>
/*! ... /*! ...
*
* #### NULL * #### NULL
* If `NULL` is not defined, then `stddef.h` is `#include`d. * If `NULL` is not defined, then `stddef.h` is `#include`d.
* >>> */ * >>> */
#ifndef NULL #ifndef NULL
# include <stddef.h> # include <stddef.h>
#endif #endif
/*! ... /*! ...
*
* #### Exact-width integer types * #### Exact-width integer types
* If <code class="hljs">(u)int{8,16,32,64}_t</code>, * If <code class="hljs">(u)int{8,16,32,64}_t</code>,
* `INT{8,16,32,64}_{MIN,MAX}`, and `UINT{8,16,32,64}_MAX` are not defined, * `INT{8,16,32,64}_{MIN,MAX}`, and `UINT{8,16,32,64}_MAX` are not defined,
@ -74,15 +74,19 @@
#ifndef INT32_MAX #ifndef INT32_MAX
# include <stdint.h> # include <stdint.h>
#endif #endif
/*! ... /*! ...
*
* #### INFINITY * #### INFINITY
* If `INFINITY` is not defined, then `math.h` is `#include`d. * If `INFINITY` is not defined, then `math.h` is `#include`d.
* >>> */ * >>> */
#ifndef INFINITY #ifndef INFINITY
# include <math.h> # include <math.h>
#endif #endif
/*! ...
*
* #### BW_RESTRICT
* If `BW_RESTRICT` is not defined, then it is defined as `restrict` if C99 is supported.
* >>> */
#ifndef BW_RESTRICT #ifndef BW_RESTRICT
# if defined(__STDC__) && (__STDC_VERSION__ >= 199901L) # if defined(__STDC__) && (__STDC_VERSION__ >= 199901L)
# define BW_RESTRICT restrict # define BW_RESTRICT restrict
@ -90,7 +94,6 @@
# define BW_RESTRICT # define BW_RESTRICT
# endif # endif
#endif #endif
/*! ... }}} */ /*! ... }}} */
#endif #endif

View File

@ -81,95 +81,75 @@
#ifndef _BW_MATH_H #ifndef _BW_MATH_H
#define _BW_MATH_H #define _BW_MATH_H
#include <bw_common.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include <bw_common.h>
/*! api {{{ /*! api {{{
* #### bw_signfilli32() * #### bw_signfilli32()
* ```>>> */ * ```>>> */
static inline int32_t bw_signfilli32(int32_t x); static inline int32_t bw_signfilli32(int32_t x);
/*! <<<``` /*! <<<```
* Returns `~0` if `x` is negative, `0` otherwise. * Returns `~0` if `x` is negative, `0` otherwise.
* >>> */ *
/*! ...
* #### bw_mini32() * #### bw_mini32()
* ```>>> */ * ```>>> */
static inline int32_t bw_mini32(int32_t a, int32_t b); static inline int32_t bw_mini32(int32_t a, int32_t b);
/*! <<<``` /*! <<<```
* Returns the minimum of `a` and `b`. * Returns the minimum of `a` and `b`.
* >>> */ *
/*! ...
* #### bw_maxi32() * #### bw_maxi32()
* ```>>> */ * ```>>> */
static inline int32_t bw_maxi32(int32_t a, int32_t b); static inline int32_t bw_maxi32(int32_t a, int32_t b);
/*! <<<``` /*! <<<```
* Returns the maximum of `a` and `b`. * Returns the maximum of `a` and `b`.
* >>> */ *
/*! ...
* #### bw_clipi32() * #### bw_clipi32()
* ```>>> */ * ```>>> */
static inline int32_t bw_clipi32(int32_t x, int32_t m, int32_t M); static inline int32_t bw_clipi32(int32_t x, int32_t m, int32_t M);
/*! <<<``` /*! <<<```
* Returns `x` unless it is smaller than `m`, in which case it returns `m`, * Returns `x` unless it is smaller than `m`, in which case it returns `m`,
* or bigger than `M`, in which case it returns `M`. * or bigger than `M`, in which case it returns `M`.
* >>> */ *
/*! ...
* #### bw_minu32() * #### bw_minu32()
* ```>>> */ * ```>>> */
static inline uint32_t bw_minu32(uint32_t a, uint32_t b); static inline uint32_t bw_minu32(uint32_t a, uint32_t b);
/*! <<<``` /*! <<<```
* Returns the minimum of `a` and `b`. * Returns the minimum of `a` and `b`.
* >>> */ *
/*! ...
* #### bw_maxu32() * #### bw_maxu32()
* ```>>> */ * ```>>> */
static inline uint32_t bw_maxu32(uint32_t a, uint32_t b); static inline uint32_t bw_maxu32(uint32_t a, uint32_t b);
/*! <<<``` /*! <<<```
* Returns the maximum of `a` and `b`. * Returns the maximum of `a` and `b`.
* >>> */ *
/*! ...
* #### bw_clipu32() * #### bw_clipu32()
* ```>>> */ * ```>>> */
static inline uint32_t bw_clipu32(uint32_t x, uint32_t m, uint32_t M); static inline uint32_t bw_clipu32(uint32_t x, uint32_t m, uint32_t M);
/*! <<<``` /*! <<<```
* Returns `x` unless it is smaller than `m`, in which case it returns `m`, * Returns `x` unless it is smaller than `m`, in which case it returns `m`,
* or bigger than `M`, in which case it returns `M`. * or bigger than `M`, in which case it returns `M`.
* >>> */ *
/*! ...
* #### bw_copysignf() * #### bw_copysignf()
* ```>>> */ * ```>>> */
static inline float bw_copysignf(float x, float y); static inline float bw_copysignf(float x, float y);
/*! <<<``` /*! <<<```
* Returns a value that has the absolute value of `x` and the sign of `y`. * Returns a value that has the absolute value of `x` and the sign of `y`.
* >>> */ *
/*! ...
* #### bw_signf() * #### bw_signf()
* ```>>> */ * ```>>> */
static inline float bw_signf(float x); static inline float bw_signf(float x);
/*! <<<``` /*! <<<```
* Returns `1.f` if `x > 0.f`, `-1.f` if `x < 0.f` and `0.f` if `x == 0.f`. * Returns `1.f` if `x > 0.f`, `-1.f` if `x < 0.f` and `0.f` if `x == 0.f`.
* >>> */ *
/*! ...
* #### bw_absf() * #### bw_absf()
* ```>>> */ * ```>>> */
static inline float bw_absf(float x); static inline float bw_absf(float x);
/*! <<<``` /*! <<<```
* Returns the absolute value of `x`. * Returns the absolute value of `x`.
* >>> */ *
/*! ...
* #### bw_min0xf() * #### bw_min0xf()
* ```>>> */ * ```>>> */
static inline float bw_min0xf(float x); static inline float bw_min0xf(float x);
@ -177,9 +157,7 @@ static inline float bw_min0xf(float x);
* Returns the minimum of `0.f` and `x`. * Returns the minimum of `0.f` and `x`.
* *
* `x` must be finite. * `x` must be finite.
* >>> */ *
/*! ...
* #### bw_max0xf() * #### bw_max0xf()
* ```>>> */ * ```>>> */
static inline float bw_max0xf(float x); static inline float bw_max0xf(float x);
@ -187,9 +165,7 @@ static inline float bw_max0xf(float x);
* Returns the maximum of `0.f` and `x`. * Returns the maximum of `0.f` and `x`.
* *
* `x` must be finite. * `x` must be finite.
* >>> */ *
/*! ...
* #### bw_minf() * #### bw_minf()
* ```>>> */ * ```>>> */
static inline float bw_minf(float a, float b); static inline float bw_minf(float a, float b);
@ -197,9 +173,7 @@ static inline float bw_minf(float a, float b);
* Returns the minimum of `a` and `b`. * Returns the minimum of `a` and `b`.
* *
* `a` and `b` must be finite. * `a` and `b` must be finite.
* >>> */ *
/*! ...
* #### bw_maxf() * #### bw_maxf()
* ```>>> */ * ```>>> */
static inline float bw_maxf(float a, float b); static inline float bw_maxf(float a, float b);
@ -207,9 +181,7 @@ static inline float bw_maxf(float a, float b);
* Returns the maximum of `a` and `b`. * Returns the maximum of `a` and `b`.
* *
* `a` and `b` must be finite. * `a` and `b` must be finite.
* >>> */ *
/*! ...
* #### bw_clipf() * #### bw_clipf()
* ```>>> */ * ```>>> */
static inline float bw_clipf(float x, float m, float M); static inline float bw_clipf(float x, float m, float M);
@ -218,18 +190,14 @@ static inline float bw_clipf(float x, float m, float M);
* or bigger than `M`, in which case it returns `M`. * or bigger than `M`, in which case it returns `M`.
* *
* `x`, `m`, and `M` must be finite. * `x`, `m`, and `M` must be finite.
* >>> */ *
/*! ...
* #### bw_truncf() * #### bw_truncf()
* ```>>> */ * ```>>> */
static inline float bw_truncf(float x); static inline float bw_truncf(float x);
/*! <<<``` /*! <<<```
* Returns `x` with its fractional part set to zero (i.e., rounded towards * Returns `x` with its fractional part set to zero (i.e., rounded towards
* zero). * zero).
* >>> */ *
/*! ...
* #### bw_roundf() * #### bw_roundf()
* ```>>> */ * ```>>> */
static inline float bw_roundf(float x); static inline float bw_roundf(float x);
@ -238,18 +206,14 @@ static inline float bw_roundf(float x);
* *
* Halfway cases are rounded away from zero. E.g., `bw_roundf(0.5f)` gives * Halfway cases are rounded away from zero. E.g., `bw_roundf(0.5f)` gives
* `1.f` and `bw_roundf(-0.5f)` gives `-1.f`. * `1.f` and `bw_roundf(-0.5f)` gives `-1.f`.
* >>> */ *
/*! ...
* #### bw_floorf() * #### bw_floorf()
* ```>>> */ * ```>>> */
static inline float bw_floorf(float x); static inline float bw_floorf(float x);
/*! <<<``` /*! <<<```
* Returns the biggest integer lower or equal than `x` (i.e., `x` is rounded * Returns the biggest integer lower or equal than `x` (i.e., `x` is rounded
* down). * down).
* >>> */ *
/*! ...
* #### bw_rcpf_2() * #### bw_rcpf_2()
* ```>>> */ * ```>>> */
static inline float bw_rcpf_2(float x); static inline float bw_rcpf_2(float x);
@ -260,9 +224,7 @@ static inline float bw_rcpf_2(float x);
* range: |`x`| in [2^-90, 2^90]. * range: |`x`| in [2^-90, 2^90].
* *
* Relative error < 0.0013%. * Relative error < 0.0013%.
* >>> */ *
/*! ...
* #### bw_sinf_3() * #### bw_sinf_3()
* ```>>> */ * ```>>> */
static inline float bw_sinf_3(float x); static inline float bw_sinf_3(float x);
@ -271,9 +233,7 @@ static inline float bw_sinf_3(float x);
* radians. * radians.
* *
* Absolute error < 0.011, relative error < 1.7%. * Absolute error < 0.011, relative error < 1.7%.
* >>> */ *
/*! ...
* #### bw_cosf_3() * #### bw_cosf_3()
* ```>>> */ * ```>>> */
static inline float bw_cosf_3(float x); static inline float bw_cosf_3(float x);
@ -282,10 +242,8 @@ static inline float bw_cosf_3(float x);
* radians. * radians.
* *
* Absolute error < 0.011, relative error < 1.7%. * Absolute error < 0.011, relative error < 1.7%.
* >>> */ *
* #### bw_tanf_3()
/*! ...
* #### bw_tanf_div_3()
* ```>>> */ * ```>>> */
static inline float bw_tanf_3(float x); static inline float bw_tanf_3(float x);
/*! <<<``` /*! <<<```
@ -297,9 +255,7 @@ static inline float bw_tanf_3(float x);
* integer number. * integer number.
* *
* Absolute error < 0.06, relative error < 0.8%. * Absolute error < 0.06, relative error < 0.8%.
* >>> */ *
/*! ...
* #### bw_log2f_3() * #### bw_log2f_3()
* ```>>> */ * ```>>> */
static inline float bw_log2f_3(float x); static inline float bw_log2f_3(float x);
@ -307,9 +263,7 @@ static inline float bw_log2f_3(float x);
* Returns an approximation of the base-2 logarithm of `x`. * Returns an approximation of the base-2 logarithm of `x`.
* *
* Absolute error < 0.0055, relative error < 1.5%. * Absolute error < 0.0055, relative error < 1.5%.
* >>> */ *
/*! ...
* #### bw_logf_3() * #### bw_logf_3()
* ```>>> */ * ```>>> */
static inline float bw_logf_3(float x); static inline float bw_logf_3(float x);
@ -317,9 +271,7 @@ static inline float bw_logf_3(float x);
* Returns an approximation of the natural logarithm of `x`. * Returns an approximation of the natural logarithm of `x`.
* *
* Absolute error < 0.0039, relative error < 1.5%. * Absolute error < 0.0039, relative error < 1.5%.
* >>> */ *
/*! ...
* #### bw_pow2f_3() * #### bw_pow2f_3()
* ```>>> */ * ```>>> */
static inline float bw_pow2f_3(float x); static inline float bw_pow2f_3(float x);
@ -327,9 +279,7 @@ static inline float bw_pow2f_3(float x);
* Returns an approximation of 2 raised to the power of `x`. * Returns an approximation of 2 raised to the power of `x`.
* *
* Relative error < 0.062%. * Relative error < 0.062%.
* >>> */ *
/*! ...
* #### bw_expf_3() * #### bw_expf_3()
* ```>>> */ * ```>>> */
static inline float bw_expf_3(float x); static inline float bw_expf_3(float x);
@ -337,9 +287,7 @@ static inline float bw_expf_3(float x);
* Returns an approximation of e (Euler's number) raised to the power of `x`. * Returns an approximation of e (Euler's number) raised to the power of `x`.
* *
* Relative error < 0.062%. * Relative error < 0.062%.
* >>> */ *
/*! ...
* #### bw_omega_3log() * #### bw_omega_3log()
* ```>>> */ * ```>>> */
static inline float bw_omega_3log(float x); static inline float bw_omega_3log(float x);
@ -348,20 +296,20 @@ static inline float bw_omega_3log(float x);
* href="https://en.wikipedia.org/wiki/Wright_omega_function" * href="https://en.wikipedia.org/wiki/Wright_omega_function"
* target="_blank">Wright omega function</a>. * target="_blank">Wright omega function</a>.
* *
* Absolute error < 0.027, relative error < 12% for non-negative input and * Absolute error < 0.27, relative error < 14.6% for non-negative input and
* decreasing with increasing input, goes rapidly to 100% for progressively * decreasing with increasing input, goes rapidly to 100% for progressively
* more negative input. * more negative input.
* >>> */ *
/*! ...
* #### bw_omega_3lognr() * #### bw_omega_3lognr()
* ```>>> */ * ```>>> */
static inline float bw_omega_3lognr(float x); static inline float bw_omega_3lognr(float x);
/*! <<<``` /*! <<<```
* ... * Returns an approximation of `omega(x)`, where `omega` is the <a
* >>> */ * href="https://en.wikipedia.org/wiki/Wright_omega_function"
* target="_blank">Wright omega function</a>.
/*! ... *
* Absolute error < 0.045, relative error < 3.7%.
*
* #### bw_sqrtf_2() * #### bw_sqrtf_2()
* ```>>> */ * ```>>> */
static inline float bw_sqrtf_2(float x); static inline float bw_sqrtf_2(float x);
@ -369,6 +317,14 @@ static inline float bw_sqrtf_2(float x);
* Returns an approximation of the square root of `x`. * Returns an approximation of the square root of `x`.
* *
* Relative error < 0.0007%. * Relative error < 0.0007%.
*
* #### bw_tanhf_3()
* ```>>> */
static inline float bw_tanhf_3(float x);
/*! <<<```
* Returns an approximation of the hyperbolic tangent of `x`.
*
* Absolute error < 0.035, relative error < 6.5%.
* }}} */ * }}} */
/*** Implementation ***/ /*** Implementation ***/

View File

@ -65,10 +65,8 @@ static inline uint32_t bw_randu32(uint64_t *BW_RESTRICT state);
* [`0`, `UINT32_MAX`]. * [`0`, `UINT32_MAX`].
* *
* `state` is a pointer to a 64-bit unsigned integer storing the state * `state` is a pointer to a 64-bit unsigned integer storing the state
* between calls, and which gets updated by calls to this function. * between calls and which gets updated by this function.
* >>> */ *
/*! ...
* #### bw_randf() * #### bw_randf()
* ```>>> */ * ```>>> */
static inline float bw_randf(uint64_t *BW_RESTRICT state); static inline float bw_randf(uint64_t *BW_RESTRICT state);
@ -77,7 +75,7 @@ static inline float bw_randf(uint64_t *BW_RESTRICT state);
* [`-1.f`, `1.f`]. * [`-1.f`, `1.f`].
* *
* `state` is a pointer to a 64-bit unsigned integer storing the state * `state` is a pointer to a 64-bit unsigned integer storing the state
* between calls, and which gets updated by calls to this function. * between calls and which gets updated by this function.
* }}} */ * }}} */
/*** Implementation ***/ /*** Implementation ***/