Imagine I have two types of audio file.
i) WAV having PCM-16 bit data
ii) MP3 file of 128 kbps
If I do:
system->createSound() for the (i) WAV file and read data using lock() I get PCM data.
But if I use system->createSound() for the (ii)MP3 file and read data using lock() what would I get?
I learnt that createSound() first decodes the audio file after loading. After decoding in which format does it keeps the decoded data and in which format?
If the format is PCM then what would be the bitrate?
And importantly will lock() read the decoded data or the compressed data of mp3 file
The format a sound’s data is stored in, and subsequently what format is retrieved by lock()
, will depend on the FMOD_MODE
used to create the sound - either PCM data, if the mode decompresses the source audio, or compressed data if a mode like FMOD_CREATECOMPRESSEDSAMPLE
is used.
A sound’s bit rate/sample rate will depend on the asset used. You can get format info on the sound with Sound::getFormat
. However, upon data from the sound being played into the FMOD system, it will be resampled to match the sample rate of the FMOD system’s mixer, which by default is 48kHz, or 24kHz on lower-spec platforms like mobile.