HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Friends
hi::v1::pcm_format Class Reference

Public Member Functions

constexpr pcm_format (pcm_format &&) noexcept=default
 
constexpr pcm_format (pcm_format const &) noexcept=default
 
constexpr pcm_formatoperator= (pcm_format &&) noexcept=default
 
constexpr pcm_formatoperator= (pcm_format const &) noexcept=default
 
constexpr pcm_format (bool floating_point, std::endian endian, bool lsb, uint8_t num_bytes, uint8_t num_major_bits, uint8_t num_minor_bits) noexcept
 Construct a PCM format.
 
constexpr bool empty () const noexcept
 
constexpr operator bool () const noexcept
 
constexpr bool floating_point () const noexcept
 
constexpr bool fixed_point () const noexcept
 
constexpr std::endian endian () const noexcept
 
uint8_t num_bytes () const noexcept
 The number of bytes a sample is stored in.
 
constexpr bool lsb () const noexcept
 The sample is stored in the least-significant-bits of the storage.
 
constexpr bool msb () const noexcept
 The sample is stored in the most-significant-bits of the storage.
 
uint8_t num_bits () const noexcept
 The number of least significant bits of the storage that is used by the sample.
 
uint8_t num_exponent_bits () const noexcept
 The number of bits in the exponent.
 
uint8_t num_mantissa_bits () const noexcept
 The number of bits in the mantissa.
 
uint8_t num_integral_bits () const noexcept
 The number of integral bits.
 
uint8_t num_fraction_bits () const noexcept
 The number of fractional bits.
 

Static Public Member Functions

static constexpr pcm_format float32 () noexcept
 
static constexpr pcm_format float32_le () noexcept
 
static constexpr pcm_format float32_be () noexcept
 
static constexpr pcm_format sint24 () noexcept
 
static constexpr pcm_format sint24_le () noexcept
 
static constexpr pcm_format sint24_be () noexcept
 
static constexpr pcm_format sint16 () noexcept
 
static constexpr pcm_format sint16_le () noexcept
 
static constexpr pcm_format sint16_be () noexcept
 

Friends

constexpr bool operator== (pcm_format const &, pcm_format const &) noexcept=default
 
constexpr auto operator<=> (pcm_format const &lhs, pcm_format const &rhs) noexcept
 
constexpr friend bool equal_except_bit_depth (pcm_format const &lhs, pcm_format const &rhs) noexcept
 
std::string to_string (pcm_format const &rhs) noexcept
 

Constructor & Destructor Documentation

◆ pcm_format()

constexpr hi::v1::pcm_format::pcm_format ( bool floating_point,
std::endian endian,
bool lsb,
uint8_t num_bytes,
uint8_t num_major_bits,
uint8_t num_minor_bits )
inlineconstexprnoexcept

Construct a PCM format.

Parameters
floating_pointTrue when format is in floating-point, false if format is in fixed-point/signed-integer.
endianThe storage endianness.
lsbTrue when the sample is aligned to the least-significant-bits (LSB) of the storage, false is in most-significant-bits (MSB).
num_bytesThe number of bytes of storage for the sample. Between 1 up to and including 8 bytes.
num_major_bitsThe number of exponent (floating-point) or integral (fixed-point) bits. Between 0 up to and including 15 bits. Set to 0 for signed-integer samples.
num_minor_bitsThe number of mantissa (floating-point) or fractional (fixed-point) bits. Between 1 up to and including 63 bits. Set to the number of bits excluding sign-bit for signed-integer samples.

Member Function Documentation

◆ lsb()

constexpr bool hi::v1::pcm_format::lsb ( ) const
inlineconstexprnoexcept

The sample is stored in the least-significant-bits of the storage.

◆ msb()

constexpr bool hi::v1::pcm_format::msb ( ) const
inlineconstexprnoexcept

The sample is stored in the most-significant-bits of the storage.

◆ num_bits()

uint8_t hi::v1::pcm_format::num_bits ( ) const
inlinenoexcept

The number of least significant bits of the storage that is used by the sample.

This value determines the alignment of the sample within the storage. The value includes all the significant bits of a sample including the sign bit.

This function will return:

  • 8 for a 'floating-point 32 bit PCM' sample format.

◆ num_bytes()

uint8_t hi::v1::pcm_format::num_bytes ( ) const
inlinenoexcept

The number of bytes a sample is stored in.

This value determines the 'storage'

◆ num_exponent_bits()

uint8_t hi::v1::pcm_format::num_exponent_bits ( ) const
inlinenoexcept

The number of bits in the exponent.

This function will return:

  • 32 for a 'floating-point 32 bit PCM' sample format.
  • 32 for a 'fixed point Q7.24 PCM / iOS CoreAudio 8.24' format.
  • 24 for a 'signed integer 24 PCM' format.
Note
It is undefined behavior to call this function on a fixed-point sample format.

◆ num_fraction_bits()

uint8_t hi::v1::pcm_format::num_fraction_bits ( ) const
inlinenoexcept

The number of fractional bits.

In fixed point format these are the number of fractional bits.

For signed-integer formats this value is the number of bits, excluding the sign-bit. This function will return:

  • 24 for a 'fixed point Q7.24 PCM / iOS CoreAudio 8.24' format.
  • 23 for a 'signed integer 24 PCM' format.
Note
It is undefined-behavior to call this function on floating-point sample formats.

◆ num_integral_bits()

uint8_t hi::v1::pcm_format::num_integral_bits ( ) const
inlinenoexcept

The number of integral bits.

In fixed point format these are the number of bits for allowing the sample to overflow above 1.0 or below -1.0.

This function will return:

  • 7 for a 'fixed point Q7.24 PCM / iOS CoreAudio 8.24' format.
  • 0 for a 'signed integer 24 PCM' format.
Note
It is undefined-behavior to call this function on floating-point sample formats.

◆ num_mantissa_bits()

uint8_t hi::v1::pcm_format::num_mantissa_bits ( ) const
inlinenoexcept

The number of bits in the mantissa.

This function will return:

  • 23 for a 'floating-point 32 bit PCM' sample format.
Note
It is undefined behavior to call this function on a fixed-point sample format.

The documentation for this class was generated from the following file: