MPD: MusicChunk Struct Reference

MPD 0.20.18

Public Member Functions | Data Fields | Static Public Attributes
MusicChunk Struct Reference

A chunk of music data. More...

`#include <MusicChunk.hxx>`

Collaboration diagram for MusicChunk:
[legend]

## Public Member Functions
| MusicChunk ()=default
| MusicChunk (const MusicChunk &)=delete
| ~MusicChunk ()
MusicChunk & | operator= (const MusicChunk &)=delete
bool | IsEmpty () const
gcc_pure bool | CheckFormat (AudioFormat audio_format) const noexcept
| Checks if the audio format if the chunk is equal to the specified audio_format. More...
WritableBuffer< void > | Write (AudioFormat af, SongTime data_time, uint16_t bit_rate) noexcept
| Prepares appending to the music chunk. More...
bool | Expand (AudioFormat af, size_t length) noexcept
| Increases the length of the chunk after the caller has written to the buffer returned by Write(). More...

## Data Fields
MusicChunk * | next
| the next chunk in a linked list More...
MusicChunk * | other = nullptr
| An optional chunk which should be mixed into this chunk. More...
float | mix_ratio
| The current mix ratio for cross-fading: 1.0 means play 100% of this chunk, 0.0 means play 100% of the "other" chunk. More...
uint16_t | length = 0
| number of bytes stored in this chunk More...
uint16_t | bit_rate
| current bit rate of the source file More...
SignedSongTime | time
| the time stamp within the song More...
Tag * | tag = nullptr
| An optional tag associated with this chunk (and the following chunks); appears at song boundaries. More...
ReplayGainInfo | replay_gain_info
| Replay gain information associated with this chunk. More...
unsigned | replay_gain_serial
| A serial number for checking if replay gain info has changed since the last chunk. More...
uint8_t | data [CHUNK_SIZE]
| the data (probably PCM) More...
AudioFormat | audio_format

## Static Public Attributes
static constexpr unsigned | IGNORE_REPLAY_GAIN = ~0u
| A magic value for replay_gain_serial which omits updating the #ReplayGainFilter. More...

## Detailed Description

A chunk of music data.

Its format is defined by the MusicPipe::Push() caller.

Definition at line 43 of file MusicChunk.hxx.

## Constructor & Destructor Documentation

## ◆ MusicChunk() [1/2]

MusicChunk::MusicChunk | ( |  | ) |
| default

## ◆ MusicChunk() [2/2]

MusicChunk::MusicChunk | ( | const MusicChunk & |  | ) |
| delete

## ◆ ~MusicChunk()

MusicChunk::~MusicChunk | ( |  | ) |

## Member Function Documentation

## ◆ CheckFormat()

gcc_pure bool MusicChunk::CheckFormat | ( | AudioFormat | audio_format | ) | const
| noexcept

Checks if the audio format if the chunk is equal to the specified audio_format.

## ◆ Expand()

bool MusicChunk::Expand | ( | AudioFormat | af,
|  | size_t | length
| ) |  |
| noexcept

Increases the length of the chunk after the caller has written to the buffer returned by Write().

Parameters

  af | the audio format for the appended data; must stay the same for the life cycle of this chunk
  length | the number of bytes which were appended

Returns
  true if the chunk is full

## ◆ IsEmpty()

bool MusicChunk::IsEmpty | ( |  | ) | const
| inline

Definition at line 112 of file MusicChunk.hxx.

## ◆ operator=()

MusicChunk& MusicChunk::operator= | ( | const MusicChunk & |  | ) |
| delete

## ◆ Write()

WritableBuffer<void> MusicChunk::Write | ( | AudioFormat | af,
|  | SongTime | data_time,
|  | uint16_t | bit_rate
| ) |  |
| noexcept

Prepares appending to the music chunk.

Returns a buffer where you may write into. After you are finished, call Expand().

Parameters

  af | the audio format for the appended data; must stay the same for the life cycle of this chunk
  data_time | the time within the song
  bit_rate | the current bit rate of the source file

Returns
  a writable buffer, or nullptr if the chunk is full

## Field Documentation

## ◆ audio_format

AudioFormat MusicChunk::audio_format

Definition at line 101 of file MusicChunk.hxx.

## ◆ bit_rate

uint16_t MusicChunk::bit_rate

current bit rate of the source file

Definition at line 63 of file MusicChunk.hxx.

## ◆ data

uint8_t MusicChunk::data[CHUNK_SIZE]

the data (probably PCM)

Definition at line 98 of file MusicChunk.hxx.

## ◆ IGNORE_REPLAY_GAIN

constexpr unsigned MusicChunk::IGNORE_REPLAY_GAIN = ~0u
| static

A magic value for replay_gain_serial which omits updating the #ReplayGainFilter.

This is used by "silence" chunks (see PlayerThread::SendSilence()) so they don't affect the replay gain.

Definition at line 88 of file MusicChunk.hxx.

## ◆ length

uint16_t MusicChunk::length = 0

number of bytes stored in this chunk

Definition at line 60 of file MusicChunk.hxx.

## ◆ mix_ratio

float MusicChunk::mix_ratio

The current mix ratio for cross-fading: 1.0 means play 100% of this chunk, 0.0 means play 100% of the "other" chunk.

Definition at line 57 of file MusicChunk.hxx.

## ◆ next

MusicChunk* MusicChunk::next

the next chunk in a linked list

Definition at line 45 of file MusicChunk.hxx.

## ◆ other

MusicChunk* MusicChunk::other = nullptr

An optional chunk which should be mixed into this chunk.

This is used for cross-fading.

Definition at line 51 of file MusicChunk.hxx.

## ◆ replay_gain_info

ReplayGainInfo MusicChunk::replay_gain_info

Replay gain information associated with this chunk.

Only valid if the serial is not 0.

Definition at line 80 of file MusicChunk.hxx.

## ◆ replay_gain_serial

unsigned MusicChunk::replay_gain_serial

A serial number for checking if replay gain info has changed since the last chunk.

The magic value 0 indicates that there is no replay gain info available.

Definition at line 95 of file MusicChunk.hxx.

## ◆ tag

Tag* MusicChunk::tag = nullptr

An optional tag associated with this chunk (and the following chunks); appears at song boundaries.

The tag object is owned by this chunk, and must be freed when this chunk is deinitialized.

Definition at line 74 of file MusicChunk.hxx.

## ◆ time

SignedSongTime MusicChunk::time

the time stamp within the song

Definition at line 66 of file MusicChunk.hxx.

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

- MusicChunk.hxx