Home
AV module

AudioBuffer

FIFO buffer for queuing audio samples between encoding stages.

AudioBuffer

#include <icy/av/audiobuffer.h>
struct AudioBuffer

Defined in src/av/include/icy/av/audiobuffer.h:31

FIFO buffer for queuing audio samples between encoding stages.

List of all members

NameKindOwner
fifovariableDeclared here
AudioBufferfunctionDeclared here
~AudioBufferfunctionDeclared here
AudioBufferfunctionDeclared here
operator=functionDeclared here
AudioBufferfunctionDeclared here
operator=functionDeclared here
allocfunctionDeclared here
resetfunctionDeclared here
closefunctionDeclared here
writefunctionDeclared here
readfunctionDeclared here
availablefunctionDeclared here

Public Attributes

ReturnNameDescription
AVAudioFifo *fifoUnderlying FFmpeg audio FIFO handle.

fifo

AVAudioFifo * fifo

Defined in src/av/include/icy/av/audiobuffer.h:71

Underlying FFmpeg audio FIFO handle.

Public Methods

ReturnNameDescription
AudioBuffer
AudioBufferDeleted constructor.
AudioBufferDeleted constructor.
voidallocAllocate the audio FIFO buffer.
voidresetDiscard all samples currently held in the FIFO without freeing the buffer.
voidcloseFree the underlying AVAudioFifo buffer.
voidwriteWrite samples into the FIFO buffer.
boolreadRead samples from the FIFO buffer.
intavailable constReturn the number of samples per channel currently available in the FIFO.

AudioBuffer

AudioBuffer()

Defined in src/av/include/icy/av/audiobuffer.h:33


AudioBuffer

AudioBuffer(const AudioBuffer &) = delete

Defined in src/av/include/icy/av/audiobuffer.h:36

Deleted constructor.


AudioBuffer

AudioBuffer(AudioBuffer &&) = delete

Defined in src/av/include/icy/av/audiobuffer.h:38

Deleted constructor.


alloc

void alloc(const std::string & sampleFmt, int channels, int numSamples = 1024)

Defined in src/av/include/icy/av/audiobuffer.h:46

Allocate the audio FIFO buffer.

Parameters

  • sampleFmt The sample format name (e.g. "s16", "fltp").

  • channels The number of audio channels.

  • numSamples The initial buffer capacity in samples per channel.


reset

void reset()

Defined in src/av/include/icy/av/audiobuffer.h:49

Discard all samples currently held in the FIFO without freeing the buffer.


close

void close()

Defined in src/av/include/icy/av/audiobuffer.h:52

Free the underlying AVAudioFifo buffer.


write

void write(void ** samples, int numSamples)

Defined in src/av/include/icy/av/audiobuffer.h:58

Write samples into the FIFO buffer.

Parameters

  • samples Array of per-channel sample buffers.

  • numSamples The number of samples per channel to write.


read

bool read(void ** samples, int numSamples)

Defined in src/av/include/icy/av/audiobuffer.h:65

Read samples from the FIFO buffer.

Parameters

  • samples Array of per-channel sample buffers to fill.

  • numSamples The number of samples per channel to read.

Returns

True if enough samples were available.


available

const

int available() const

Defined in src/av/include/icy/av/audiobuffer.h:69

Return the number of samples per channel currently available in the FIFO.

Returns

The number of available samples, or zero if the buffer is not allocated.