Skip to content

Audio IO


audio_reader_flac class

template <typename T> audio_reader_flac

FLAC format reader

audio_reader_flac<T> function

audio_reader_flac(
    std::shared_ptr<abstract_reader<>> &&reader)

Constructs FLAC reader

read function

size_t read(T *data, size_t size) override

Reads and decodes audio data

seek function

bool seek(imax offset, seek_origin origin) override

Seeks to specific sample

format function

const audio_format_and_length &format() const override

Returns audio format description

tell function

imax tell() const override

Returns current position


audio_reader_mp3 class

template <typename T> audio_reader_mp3

MP3 format reader

audio_reader_mp3<T> function

audio_reader_mp3(
    std::shared_ptr<abstract_reader<>> &&reader)

Constructs MP3 reader

read function

size_t read(T *data, size_t size) override

Reads and decodes audio data

seek function

bool seek(imax offset, seek_origin origin) override

Seeks to specific sample

format function

const audio_format_and_length &format() const override

Returns audio format description

tell function

imax tell() const override

Returns current position


audio_reader_wav class

template <typename T> audio_reader_wav

WAV format reader

audio_reader_wav<T> function

audio_reader_wav(
    std::shared_ptr<abstract_reader<>> &&reader)

Constructs WAV reader

read function

size_t read(T *data, size_t size) override

Reads and decodes audio data

seek function

bool seek(imax offset, seek_origin origin) override

Seeks to specific sample

format function

const audio_format_and_length &format() const override

Returns audio format description

tell function

imax tell() const override

Returns current position


audio_writer_wav class

template <typename T> audio_writer_wav

WAV format writer

audio_writer_wav<T> function

audio_writer_wav(
    std::shared_ptr<abstract_writer<>> &&writer,
    const audio_format &fmt)

Constructs WAV writer using target writer and format

write function

size_t write(const T *data, size_t size) override

Write data to underlying binary writer data is PCM samples in interleaved format size is the number of samples (PCM frames * channels)


close function

virtual void close() = 0

Finishes writing and closes underlying writer


format function

virtual const audio_format_and_length &format() const = 0

Returns audio format description


virtual const audio_format_and_length &format() const = 0

Returns audio format description


read function

using abstract_reader<T>::read

Reads interleaved audio


write function

using abstract_writer<T>::write

Writes interleaved audio


Auto-generated from sources, Revision 6aea976a464de59d522d0c629e64bf0c044e6777, https://github.com/kfrlib/kfr/blob/6aea976a464de59d522d0c629e64bf0c044e6777/include/kfr/