Skip to content

Struct audio_encoder

struct audio_encoder audio

struct audio_encoder { … }

Abstract base class for audio encoders, providing methods for opening, writing, and closing audio files.

destructor ~audio_encoder()

virtual ~audio_encoder()

Destructor to close and finalize file encoding.

Fully qualified name: kfr::audio_encoder::~audio_encoder()

Declared at audio/encoder.hpp:49

function open(std::shared_ptr<binary_writer>, const audiofile_format &, audio_decoder *)

[[nodiscard]] virtual expected<void, audiofile_error> open(std::shared_ptr<binary_writer> writer,
                                                           const audiofile_format& format,
                                                           audio_decoder* copyMetadataFrom = nullptr) = 0

Opens the encoder with a binary writer and format.

Parameters
writer Shared pointer to the binary writer.
format Audio file format to use.
copyMetadataFrom Optional decoder to copy metadata from.
Returns
Expected result indicating success or an audiofile error.

Fully qualified name: kfr::audio_encoder::open(std::shared_ptr<binary_writer>, const audiofile_format &, audio_decoder *)

Declared at audio/encoder.hpp:56

function open(const file_path &, const audiofile_format &, audio_decoder *)

[[nodiscard]] expected<void, audiofile_error> open(const file_path& path, const audiofile_format& format,
                                                   audio_decoder* copyMetadataFrom = nullptr)

Opens the encoder with a file path and format.

Parameters
path Path to the file to open.
format Audio file format to use.
copyMetadataFrom Optional decoder to copy metadata from.
Returns
Expected result indicating success or an audiofile error.

Fully qualified name: kfr::audio_encoder::open(const file_path &, const audiofile_format &, audio_decoder *)

Declared at audio/encoder.hpp:65

function write(const audio_data_interleaved &)

[[nodiscard]] virtual expected<void, audiofile_error> write(const audio_data_interleaved& data) = 0

Writes a chunk of interleaved audio data to the encoder.

Parameters
data Interleaved audio data to write.
Returns
Expected result indicating success or an audiofile error.

Fully qualified name: kfr::audio_encoder::write(const audio_data_interleaved &)

Declared at audio/encoder.hpp:83

function close()

[[nodiscard]] virtual expected<uint64_t, audiofile_error> close() = 0

Closes the encoder and finalizes the file.

Returns
Expected result with the total number of frames written or an audiofile error.

Fully qualified name: kfr::audio_encoder::close()

Declared at audio/encoder.hpp:87

function format()

[[nodiscard]] const std::optional<audiofile_format>& format() const noexcept

Retrieves the current audio file format.

Returns
Optional containing the audio file format if set.

Fully qualified name: kfr::audio_encoder::format()

Declared at audio/encoder.hpp:91

function writer()

std::shared_ptr<binary_writer> writer() const noexcept

Retrieves the binary writer associated with the encoder.

Returns
Shared pointer to the binary writer.

Fully qualified name: kfr::audio_encoder::writer()

Declared at audio/encoder.hpp:95

variable m_format

std::optional<audiofile_format> m_format

Fully qualified name: kfr::audio_encoder::m_format

Declared at audio/encoder.hpp:98

variable m_writer

std::shared_ptr<binary_writer> m_writer

Fully qualified name: kfr::audio_encoder::m_writer

Declared at audio/encoder.hpp:99

Fully qualified name: kfr::audio_encoder

Declared at audio/encoder.hpp:45

This file was generated by cxxdox, a C++ documentation generator based on MkDocs Material and libclang.