Audio format.
More...
◆ AudioFormat() [1/2]
constexpr SDL::AudioFormat::AudioFormat |
( |
SDL_AudioFormat |
audioFormat = {} | ) |
|
|
inlineconstexpr |
- Parameters
-
audioFormat | the value to be wrapped |
◆ AudioFormat() [2/2]
constexpr SDL::AudioFormat::AudioFormat |
( |
bool |
sign, |
|
|
bool |
bigendian, |
|
|
bool |
flt, |
|
|
Uint16 |
size |
|
) |
| |
|
inlineconstexpr |
SDL does not support custom audio formats, so this function is not of much use externally, but it can be illustrative as to what the various bits of an AudioFormat mean.
For example, AUDIO_S32LE looks like this:
SDL_DEFINE_AUDIO_FORMAT(1, 0, 0, 32)
- Parameters
-
sign | true for signed data, false for unsigned data. |
bigendian | true for bigendian data, false for littleendian data. |
flt | true for floating point data, false for integer data. |
size | number of bits per sample. |
- Postcondition
- a format value in the style of AudioFormat.
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL 3.2.0.
◆ GetBitSize()
constexpr Uint16 SDL::AudioFormat::GetBitSize |
( |
| ) |
|
|
inlineconstexpr |
For example, AudioFormat.GetBitSize(AUDIO_S16)
returns 16.
- Returns
- data size in bits.
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL 3.2.0.
◆ GetByteSize()
constexpr Uint16 SDL::AudioFormat::GetByteSize |
( |
| ) |
|
|
inlineconstexpr |
For example, AudioFormat.GetByteSize(AUDIO_S16)
returns 2.
- Returns
- data size in bytes.
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL 3.2.0.
◆ GetName()
const char * SDL::AudioFormat::GetName |
( |
| ) |
const |
|
inline |
- Returns
- the human readable name of the specified audio format or "AUDIO_UNKNOWN" if the format isn't recognized.
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL 3.2.0.
◆ GetSilenceValue()
int SDL::AudioFormat::GetSilenceValue |
( |
| ) |
const |
|
inline |
The value returned by this function can be used as the second argument to memset (or memset) to set an audio buffer in a specific format to silence.
- Returns
- a byte value that can be passed to memset.
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL 3.2.0.
◆ IsBigEndian()
constexpr bool SDL::AudioFormat::IsBigEndian |
( |
| ) |
|
|
inlineconstexpr |
For example, AudioFormat.IsBigEndian(AUDIO_S16LE)
returns 0.
- Returns
- non-zero if format is bigendian, zero otherwise.
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL 3.2.0.
◆ IsFloat()
constexpr bool SDL::AudioFormat::IsFloat |
( |
| ) |
|
|
inlineconstexpr |
For example, AudioFormat.IsFloat(AUDIO_S16)
returns 0.
- Returns
- non-zero if format is floating point, zero otherwise.
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL 3.2.0.
◆ IsInt()
constexpr bool SDL::AudioFormat::IsInt |
( |
| ) |
|
|
inlineconstexpr |
For example, AudioFormat.IsInt(AUDIO_F32)
returns 0.
- Returns
- non-zero if format is integer, zero otherwise.
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL 3.2.0.
◆ IsLittleEndian()
constexpr bool SDL::AudioFormat::IsLittleEndian |
( |
| ) |
|
|
inlineconstexpr |
For example, AudioFormat.IsLittleEndian(AUDIO_S16BE)
returns 0.
- Returns
- non-zero if format is littleendian, zero otherwise.
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL 3.2.0.
◆ IsSigned()
constexpr bool SDL::AudioFormat::IsSigned |
( |
| ) |
|
|
inlineconstexpr |
For example, AudioFormat.IsSigned(AUDIO_U8)
returns 0.
- Returns
- non-zero if format is signed, zero otherwise.
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL 3.2.0.
◆ IsUnsigned()
constexpr bool SDL::AudioFormat::IsUnsigned |
( |
| ) |
|
|
inlineconstexpr |
For example, AudioFormat.IsUnsigned(AUDIO_S16)
returns 0.
- Returns
- non-zero if format is unsigned, zero otherwise.
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL 3.2.0.
◆ operator bool()
constexpr SDL::AudioFormat::operator bool |
( |
| ) |
const |
|
inlineexplicitconstexpr |
- Returns
- True if valid state, false otherwise.
◆ operator SDL_AudioFormat()
constexpr SDL::AudioFormat::operator SDL_AudioFormat |
( |
| ) |
const |
|
inlineconstexpr |
The documentation for this class was generated from the following file: