Defined in carb/audio/IAudioUtils.h

struct OutputStreamDesc

a descriptor for opening an output file stream.

This allows sound data to be written to a file in multiple chunks. The output stream will remain open and able to accept more input until it is closed. The output data can be encoded as it is written to the file for certain formats. Attempting to open the stream with a format that doesn’t support encoding will cause the stream to fail.

Public Members

OutputStreamFlags flags = 0

flags to control the behavior of the output stream.

This may be 0 to specify default behavior.

const char *filename

the filename to write the stream to.

This may be a relative or absolute path. If a relative path is used, it will be resolved according to the rules of the IFileSystem interface. If the filename does not include a file extension, one will be added according to the requested output format. If no file extension is desired, the filename should end with a period (‘.’). This may not be nullptr.

SampleFormat inputFormat

the input sample format for the stream.

This will be the format of the data that is passed in the buffers to writeDataToStream(). This must be a PCM format (one of SampleFormat::ePcm*).

SampleFormat outputFormat = SampleFormat::eDefault

the output sample format for the stream.

This will be the format of the data that is written to the output file. If this matches the input data format, the buffer will simply be written to the file stream. This may be SampleFormat::eDefault to use the same format as inputFormat for the output.

size_t frameRate

the data rate of the stream in frames per second.

This value is recorded to the stream but does not affect the actual consumption of data from the buffers.

size_t channels

the number of channels in each frame of the stream.

void *encoderSettings = nullptr

additional output format dependent encoder settings.

This should be nullptr for PCM data formats. Additional objects will be defined for encoder formats that require additional parameters (optional or otherwise). For formats that require additional settings, this may not be nullptr. Use getCodecFormatInfo() to retrieve the info for the codec to find out if the additional settings are required or not.

void *ext = nullptr

reserved for future expansion.

This must be set to nullptr.