|
arduino-audio-tools
|
Fixed-point Q1.14 number: a plain 16-bit signed integer holding 1 integer bit and 14 fractional bits (value = raw / 16384.0). Covers the range [-2.0, 1.99993896484375] with a resolution of ~6.1e-5, using only integer add/sub/mul/div – no hardware floating-point instructions. More...
#include <Q1_14.h>
Public Member Functions | |
| q1_14_t ()=default | |
| q1_14_t (const q1_14_t &in)=default | |
| q1_14_t (double in) | |
| q1_14_t (float in) | |
| q1_14_t (int in) | |
| operator float () const | |
| operator int () const | |
| truncates toward zero, like (int)someFloat – integer-only, no FPU | |
| bool | operator!= (float o) const |
| bool | operator!= (q1_14_t o) const |
| q1_14_t | operator* (float o) const |
| q1_14_t | operator* (q1_14_t o) const |
| q1_14_t & | operator*= (q1_14_t o) |
| q1_14_t | operator+ (float o) const |
| q1_14_t | operator+ (q1_14_t o) const |
| q1_14_t & | operator+= (q1_14_t o) |
| q1_14_t | operator- () const |
| q1_14_t | operator- (float o) const |
| q1_14_t | operator- (q1_14_t o) const |
| q1_14_t & | operator-= (q1_14_t o) |
| q1_14_t | operator/ (float o) const |
| q1_14_t | operator/ (q1_14_t o) const |
| q1_14_t & | operator/= (q1_14_t o) |
| bool | operator< (float o) const |
| bool | operator< (q1_14_t o) const |
| bool | operator<= (float o) const |
| bool | operator<= (q1_14_t o) const |
| q1_14_t & | operator= (const q1_14_t &other)=default |
| q1_14_t & | operator= (float other) |
| bool | operator== (float o) const |
| bool | operator== (q1_14_t o) const |
| bool | operator> (float o) const |
| bool | operator> (q1_14_t o) const |
| bool | operator>= (float o) const |
| bool | operator>= (q1_14_t o) const |
| int16_t | raw () const |
| raw underlying Q1.14 representation | |
| int16_t | scale (int16_t sample) const |
| scales a 16-bit PCM sample by this Q1.14 factor | |
| int24_t | scale (int24_t sample) const |
| scales a 24-bit PCM sample by this Q1.14 factor | |
| int32_t | scale (int32_t sample) const |
| scales a 32-bit PCM sample by this Q1.14 factor | |
| int16_t | toInt16 () const |
| converts to a 16-bit PCM sample (-32768..32767) | |
| int24_t | toInt24 () const |
| converts to a 24-bit PCM sample (-8388608..8388607) | |
| int32_t | toInt32 () const |
| converts to a 32-bit PCM sample (-2147483648..2147483647) | |
Static Public Member Functions | |
| static q1_14_t | fromInt16 (int16_t sample) |
| builds a q1_14_t from a 16-bit PCM sample (-32768..32767) | |
| static q1_14_t | fromInt24 (int24_t sample) |
| builds a q1_14_t from a 24-bit PCM sample (-8388608..8388607) | |
| static q1_14_t | fromInt32 (int32_t sample) |
| builds a q1_14_t from a 32-bit PCM sample (-2147483648..2147483647) | |
| static q1_14_t | fromRaw (int16_t raw) |
| builds a q1_14_t directly from a raw Q1.14 value (no scaling) | |
Static Public Attributes | |
| static constexpr int | kFractionalBits = 14 |
| static constexpr int32_t | kScale = 1 << kFractionalBits |
Protected Member Functions | |
| float | toFloat () const |
Static Protected Member Functions | |
| static int16_t | clamp (int32_t v) |
| static int32_t | clampRange32 (int32_t v, int32_t lo, int32_t hi) |
| static int64_t | clampRange64 (int64_t v, int64_t lo, int64_t hi) |
| static int16_t | fromFloat (float in) |
Protected Attributes | |
| int16_t | value = 0 |
Fixed-point Q1.14 number: a plain 16-bit signed integer holding 1 integer bit and 14 fractional bits (value = raw / 16384.0). Covers the range [-2.0, 1.99993896484375] with a resolution of ~6.1e-5, using only integer add/sub/mul/div – no hardware floating-point instructions.
|
default |
|
inline |
|
inline |
|
inline |
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inlinestatic |
builds a q1_14_t from a 16-bit PCM sample (-32768..32767)
builds a q1_14_t from a 24-bit PCM sample (-8388608..8388607)
|
inlinestatic |
builds a q1_14_t from a 32-bit PCM sample (-2147483648..2147483647)
|
inlinestatic |
builds a q1_14_t directly from a raw Q1.14 value (no scaling)
|
inline |
|
inlineexplicit |
truncates toward zero, like (int)someFloat – integer-only, no FPU
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
raw underlying Q1.14 representation
|
inline |
scales a 16-bit PCM sample by this Q1.14 factor
|
inline |
scales a 32-bit PCM sample by this Q1.14 factor
|
inlineprotected |
|
inline |
converts to a 16-bit PCM sample (-32768..32767)
|
inline |
converts to a 24-bit PCM sample (-8388608..8388607)
|
inline |
converts to a 32-bit PCM sample (-2147483648..2147483647)
|
staticconstexpr |
|
staticconstexpr |
|
protected |