Defined in carb/audio/AudioUtils.h

inline SoundData *carb::audio::convertToFlac(const IAudioUtils *iface, SoundData *snd, uint32_t compressionLevel = 5, uint32_t bitsPerSample = 0, FlacFileType fileType = FlacFileType::eFlac, bool streamableSubset = true, uint32_t blockSize = 0, bool verifyOutput = false)

Convert a sound to FLAC.


It is not recommended to set the encoder settings, apart from compressionLevel, to anything other than their defaults under most circumstances.

  • iface[in] The IAudioData interface to use.

  • snd[in] The sound to convert to a new format. This may not be nullptr.

  • compressionLevel[in] Compression level. See FlacEncoderSettings::compressionLevel.

  • bitsPerSample[in] Bit precision of each audio sample. 0 will automatically choose the appropriate value for the input sample type. See FlacEncoderSettings::bitsPerSample.

  • fileType[in] File container type. See FlacEncoderSettings::fileType.

  • streamableSubset[in] Whether the streamable subset is used. Using the default value is recommended. See FlacEncoderSettings::streamableSubset.

  • blockSize[in] Block size used by the encoder. 0 will let the encoder choose. Letting the encoder choose is recommended. See FlacEncoderSettings::blockSize.

  • verifyOutput[in] Whether output Verification should be enabled. See FlacEncoderSettings::verifyOutput.


The new sound data created. snd and the returned value must both be released after this call once the caller is finished with them.


nullptr if the operation failed.


nullptr if the encoding parameters were invalid.