Defined in carb/audio/IAudioData.h

struct FlacEncoderSettings

Settings specific to FLAC file encoding.

This is not required when encoding FLAC audio.

Public Members

uint32_t flags = 0

Reserved for future expansion.

FlacFileType fileType = FlacFileType::eFlac

The file container type which will be used.

The default value is FlacFileType::eFlac.

uint32_t bitsPerSample = 0

The number of bits per sample to store.

This can be used to truncate the audio to a smaller value, such as 16. This must be a value within the range of 4-24. Using values other than 8, 12, 16, 20 and 24 requires that streamableSubset is set to false. Although FLAC supports up to 32 bits per sample, the encoder used only supports up to 24 bits per sample. The default value for this will be the bit width of the input format, except for SampleFormat::ePcm32 and SampleFormat::ePcmFloat, which are reduced to 24 bit. This can be set to 0 to use the default for the input type.

uint32_t compressionLevel = 5

Set the compression level preset.

This must be in the range [0-8], where 8 is the maximum compression level. A higher level will have a better compression ratio at the cost of compression time. The default value is 5.

uint32_t blockSize = 0

Set the block size for the encoder to use.

Set this to 0 to let the encoder choose. It is recommended to leave this at 0. The default value is 0.

bool streamableSubset = true

The FLAC ‘streamable subset’ is a subset of the FLAC encoding that is intended to allow decoders that cannot seek to begin playing from the middle of a stream.

If this is set to true, the codec state creation will fail if the following conditions are not met:

  • If the frame rate is above 65536, the frame rate must be divisible by 10. (see the FLAC standard for an explanation of this).

  • bitsPerSample must be 8, 12, 16, 20 or 24.

  • Specific restrictions are placed on blockSize. Please read the FLAC standard if you need to tune that parameter. Setting this to false may improve the compression ratio and decoding speed. Testing has shown only slight improvement from setting this option to false. The default value for this is true.

bool verifyOutput = false

Decode the encoded audio to verify that the encoding was performed correctly.

The encoding will fail if a chunk does not verify. The default value for this is false.