Expand description
Type conversion of samples values.
Structs§
- Conversion
Result - A conversion result, containing the resulting value as
valueand a booleanclippedindicating if the value was clipped during conversion. - F32_BE
- 32 bit floating point, big endian. Stored as 4 bytes.
- F32_LE
- 32 bit floating point, little endian. Stored as 4 bytes.
- F64_BE
- 64 bit floating point, big endian. Stored as 8 bytes.
- F64_LE
- 64 bit floating point, little endian. Stored as 8 bytes.
- I16_BE
- 16 bit signed integer, big endian. Stored as 2 bytes.
- I16_LE
- 16 bit signed integer, little endian. Stored as 2 bytes.
- I24_
4LJ_ BE - 24 bit signed integer, big endian. Stored as 4 bytes left justified. The 24 data bits are stored in the three most significant bytes, while the least significant byte is unused padding.
- I24_
4LJ_ LE - 24 bit signed integer, little endian. Stored as 4 bytes left justified. The 24 data bits are stored in the three most significant bytes, while the least significant byte is unused padding.
- I24_
4RJ_ BE - 24 bit signed integer, big endian. Stored as 4 bytes right justified. The 24 data bits are stored in the three least significant bytes, while the most significant byte is unused padding.
- I24_
4RJ_ LE - 24 bit signed integer, little endian. Stored as 4 bytes right justified. The 24 data bits are stored in the three least significant bytes, while the most significant byte is unused padding.
- I24_BE
- 24 bit signed integer, big endian. Stored as 3 bytes.
- I24_LE
- 24 bit signed integer, little endian. Stored as 3 bytes.
- I32_BE
- 32 bit signed integer, big endian. Stored as 4 bytes.
- I32_LE
- 32 bit signed integer, little endian. Stored as 4 bytes.
- I64_BE
- 64 bit signed integer, big endian. Stored as 8 bytes.
- I64_LE
- 64 bit signed integer, little endian. Stored as 8 bytes.
- U16_BE
- 16 bit unsigned integer, big endian. Stored as 2 bytes.
- U16_LE
- 16 bit unsigned integer, little endian. Stored as 2 bytes.
- U24_
4LJ_ BE - 24 bit unsigned integer, big endian. Stored as 4 bytes left justified. The 24 data bits are stored in the three most significant bytes, while the least significant byte is unused padding.
- U24_
4LJ_ LE - 24 bit unsigned integer, little endian. Stored as 4 bytes left justified. The 24 data bits are stored in the three most significant bytes, while the least significant byte is unused padding.
- U24_
4RJ_ BE - 24 bit unsigned integer, big endian. Stored as 4 bytes right justified. The 24 data bits are stored in the three least significant bytes, while the most significant byte is unused padding.
- U24_
4RJ_ LE - 24 bit unsigned integer, little endian. Stored as 4 bytes right justified. The 24 data bits are stored in the three least significant bytes, while the most significant byte is unused padding.
- U24_BE
- 24 bit unsigned integer, big endian. Stored as 3 bytes.
- U24_LE
- 24 bit unsigned integer, little endian. Stored as 3 bytes.
- U32_BE
- 32 bit unsigned integer, big endian. Stored as 4 bytes.
- U32_LE
- 32 bit unsigned integer, little endian. Stored as 4 bytes.
- U64_BE
- 64 bit unsigned integer, big endian. Stored as 8 bytes.
- U64_LE
- 64 bit unsigned integer, little endian. Stored as 8 bytes.
Traits§
- Bytes
Sample - A trait for converting samples stored as raw bytes into a numerical type.
Each implementation defines the associated type
NumericType, which is the nearest matching numeric type for the original format. If a direct match exists, this is used. For example signed 16 bit integer samples use i16. For formats that don’t have a direct match, the next larger numeric type is used. For example for 24 bit signed integers, this means i32. The values are scaled to use the full range of theNumericTypeassociated type. - RawSample
- A trait for converting a given sample type to and from floating point values. The floating point values use the range -1.0 to +1.0. When converting to/from signed integers, the range does not include +1.0. For example, an 8-bit signed integer supports the range -128 to +127. When these values are converted to float, 0 becomes 0.0, -128 becomes -1.0, and 127 becomes 127/128 ≈ 0.992. Unsigned integers are also converted to the same -1.0 to +1.0 range. For an 8-but unsigned integer, 128 is the center point and becomes 0.0. The value 0 becomes -1.0, and 255 becomes 127/128 ≈ 0.992.