carb::audio::fDataFlagUserMemory

Defined in carb/audio/IAudioData.h

constexpr DataFlags carb::audio::fDataFlagUserMemory = 0x04000000

when the fDataFlagInMemory flag is also used, this indicates that the original memory blob should be directly referenced in the new sound data object instead of copying it.

When this flag is used, it is the caller’s responsibility to ensure the memory blob remains valid for the entire lifetime of the sound data object. Note that if the fDataFlagDecode flag is specified and the sound is encoded as a PCM format (either in a WAVE file or raw PCM loaded with fDataFlagFormatRaw), the original memory blob will still be referenced. Using fDataFlagDecode with any other format, such as SampleFormat::eVorbis, will decode the audio into a new buffer and the original blob will no longer be needed.

This flag is useful for creating sound data objects that reference audio data in a sound bank or sound atlas type object that exists for the lifetime of a scene. The original data in the bank or atlas can be referenced directly instead of having to copy it and use twice the memory (and time to copy it).