Defined in carb/audio/AudioUtils.h

inline SoundData *carb::audio::createSoundFromBlob(const IAudioData *iface, const void *dataBlob, size_t dataLength, bool streaming = false, size_t autoStream = 0, SampleFormat fmt = SampleFormat::eDefault, DataFlags flags = 0)

create a sound data object from a blob in memory.

  • iface[in] The IAudioData interface to use.

  • dataBlob[in] the blob of data to load the asset from. This may not be nullptr. This should include the entire contents of the original asset file.

  • dataLength[in] the length of the data blob in bytes. This may not be zero.

  • streaming[in] set to true to create a streaming sound. This will be decoded as it plays. Set to false to decode the sound immediately on load.

  • autoStream[in] The threshold in bytes at which the new sound data object will decide to stream instead of decode into memory. If the decoded size of the sound will be larger than this value, it will be streamed from its original source instead of decoded. Set this to 0 to disable auto-streaming. This will be ignored if the data is already uncompressed PCM.

  • fmt[in] The format the sound should be decoded into. By default, the decoder choose its preferred format.

  • flags[in] Optional flags to change the behavior. This can be any of: fDataFlagSkipMetaData, fDataFlagSkipEventPoints, fDataFlagCalcPeaks or fDataFlagUserMemory.


The new sound data if successfully created and loaded. This object must be released once it is no longer needed.


nullptr if the operation failed. This may include the file not being accessible, the file’s data not being the correct format, or a decoding error occurs.