carb::audio::saveToDiskAsFlac

Defined in carb/audio/AudioUtils.h

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

Convert a sound to FLAC.

Note

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

Parameters
  • iface[in] The IAudioData interface to use.

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

  • fileName[in] The name of the file on disk to create the new sound data object from. 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.

  • flags[in] Flags to alter the behavior of this function.

Returns

true if the sound was successfully saved.

Returns

false if the operation failed.