carb::audio::saveToDiskAsVorbis
Defined in carb/audio/AudioUtils.h
-
inline bool carb::audio::saveToDiskAsVorbis(const IAudioUtils *iface, SoundData *snd, const char *fileName, float quality = 0.9f, bool nativeChannelOrder = false, SaveFlags flags = 0)
Save a sound to disk as Vorbis.
This may be within the range of -0.1 to 1.0. Vorbis is a lossy codec with variable bitrate, so this doesn’t correlate to an exact bitrate for the output audio. A lower quality increases encode time and decreases decode time. 0.8-0.9 is suitable for cases where near-perfect reproduction of the original audio is desired, such as music that will be listened to on its own. Lower quality values for the audio should be acceptable for most use cases, but the quality value at which artifacts become obvious will depend on the content of the audio, the use case and the quality of the speakers used. With very low quality settings, such as -0.1, audio artifacts will be fairly obvious in music, but for simpler audio, such as voice recordings, the quality loss may not be as noticeable (especially in scenes with background noise). This is 0.9 by default.
Otherwise WAVE channel order will be expected. All codecs use WAVE channel order by default, so this should be set to false in most cases. This is false by default.
- Parameters
iface – [in] The IAudioUtils interface to use.
snd – [in] The sound to convert to a new format. This may not be nullptr.
fileName – [in] The path to the file on disk to save this to.
quality – [in] The encoding quality of the compressed audio.
nativeChannelOrder – [in] If this is true, the encoder will expect its input to be in Vorbis channel order.
flags – [in] Flags to alter the behavior of this function.
- Returns
true if the sound was successfully saved.
- Returns
false if the operation failed.