MPD 0.20.6

- Main Page
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

Public Member Functions | Static Public Member Functions | Data Fields
AudioFormat Struct Reference

This structure describes the format of a raw PCM stream. More...

`#include <AudioFormat.hxx>`

## Public Member Functions
| AudioFormat ()=default
constexpr | AudioFormat (uint32_t _sample_rate, SampleFormat _format, uint8_t _channels)
void | Clear ()
| Clears the object, i.e. More...
constexpr bool | IsDefined () const
| Checks whether the object has a defined value. More...
constexpr bool | IsFullyDefined () const
| Checks whether the object is full, i.e. More...
constexpr bool | IsMaskDefined () const
| Checks whether the object has at least one defined value. More...
bool | IsValid () const
| Returns false if the format is not valid for playback with MPD. More...
bool | IsMaskValid () const
| Returns false if the format mask is not valid for playback with MPD. More...
constexpr bool | operator== (const AudioFormat other) const
constexpr bool | operator!= (const AudioFormat other) const
void | ApplyMask (AudioFormat mask)
gcc_pure AudioFormat | WithMask (AudioFormat mask) const
unsigned | GetSampleSize () const
| Returns the size of each (mono) sample in bytes. More...
unsigned | GetFrameSize () const
| Returns the size of each full frame in bytes. More...
double | GetTimeToSize () const
| Returns the floating point factor which converts a time span to a storage size in bytes. More...

## Static Public Member Functions
static constexpr AudioFormat | Undefined ()

## Data Fields
uint32_t | sample_rate
| The sample rate in Hz. More...
SampleFormat | format
| The format samples are stored in. More...
uint8_t | channels
| The number of channels. More...

## Detailed Description

This structure describes the format of a raw PCM stream.

Definition at line 37 of file AudioFormat.hxx.

## Constructor & Destructor Documentation

AudioFormat::AudioFormat | ( |  | ) |
| default

constexpr AudioFormat::AudioFormat | ( | uint32_t | _sample_rate,
|  | SampleFormat | _format,
|  | uint8_t | _channels
| ) |  |
| inline

Definition at line 70 of file AudioFormat.hxx.

## Member Function Documentation

void AudioFormat::ApplyMask | ( | AudioFormat | mask | ) |

void AudioFormat::Clear | ( |  | ) |
| inline

Clears the object, i.e.

sets all attributes to an undefined (invalid) value.

Definition at line 83 of file AudioFormat.hxx.

unsigned AudioFormat::GetFrameSize | ( |  | ) | const
| inline

Returns the size of each full frame in bytes.

Definition at line 206 of file AudioFormat.hxx.

unsigned AudioFormat::GetSampleSize | ( |  | ) | const
| inline

Returns the size of each (mono) sample in bytes.

Definition at line 200 of file AudioFormat.hxx.

double AudioFormat::GetTimeToSize | ( |  | ) | const
| inline

Returns the floating point factor which converts a time span to a storage size in bytes.

Definition at line 212 of file AudioFormat.hxx.

constexpr bool AudioFormat::IsDefined | ( |  | ) | const
| inline

Checks whether the object has a defined value.

Definition at line 92 of file AudioFormat.hxx.

constexpr bool AudioFormat::IsFullyDefined | ( |  | ) | const
| inline

Checks whether the object is full, i.e.

all attributes are defined. This is more complete than IsDefined(), but slower.

Definition at line 101 of file AudioFormat.hxx.

constexpr bool AudioFormat::IsMaskDefined | ( |  | ) | const
| inline

Checks whether the object has at least one defined value.

Definition at line 109 of file AudioFormat.hxx.

bool AudioFormat::IsMaskValid | ( |  | ) | const
| inline

Returns false if the format mask is not valid for playback with MPD.

This function performs some basic validity checks.

Definition at line 190 of file AudioFormat.hxx.

bool AudioFormat::IsValid | ( |  | ) | const
| inline

Returns false if the format is not valid for playback with MPD.

This function performs some basic validity checks.

Definition at line 178 of file AudioFormat.hxx.

constexpr bool AudioFormat::operator!= | ( | const AudioFormat | other | ) | const
| inline

Definition at line 123 of file AudioFormat.hxx.

constexpr bool AudioFormat::operator== | ( | const AudioFormat | other | ) | const
| inline

Definition at line 117 of file AudioFormat.hxx.

static constexpr AudioFormat AudioFormat::Undefined | ( |  | ) |
| inline static

Definition at line 75 of file AudioFormat.hxx.

gcc_pure AudioFormat AudioFormat::WithMask | ( | AudioFormat | mask | ) | const
| inline

Definition at line 130 of file AudioFormat.hxx.

## Field Documentation

uint8_t AudioFormat::channels

The number of channels.

Channel order follows the FLAC convention (https://xiph.org/flac/format.html):

- 1 channel: mono
- 2 channels: left, right
- 3 channels: left, right, center
- 4 channels: front left, front right, back left, back right
- 5 channels: front left, front right, front center, back/surround left, back/surround right
- 6 channels: front left, front right, front center, LFE, back/surround left, back/surround right
- 7 channels: front left, front right, front center, LFE, back center, side left, side right
- 8 channels: front left, front right, front center, LFE, back left, back right, side left, side right

Definition at line 66 of file AudioFormat.hxx.

SampleFormat AudioFormat::format

The format samples are stored in.

See the #sample_format enum for valid values.

Definition at line 49 of file AudioFormat.hxx.

uint32_t AudioFormat::sample_rate

The sample rate in Hz.

A better name for this attribute is "frame rate", because technically, you have two samples per frame in stereo sound.

Definition at line 43 of file AudioFormat.hxx.

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

- AudioFormat.hxx