registerSoundAsset(data:identifier:format:normalizationMode:)
Loads a sound asset from memory and adds it to the engine’s list of registered assets.
Declaration
func registerSoundAsset(data: Data, identifier: String?, format: AVAudioFormat, normalizationMode: PHASENormalizationMode) throws -> PHASESoundAssetParameters
- data:
A buffer containing the audio data to register. Audio data needs to be single-channel interleaved PCM, or per-channel de-interleaved PCM with buffers organized back to back.
- identifier:
A unique name for the sound asset. If you provide
nil, the framework determines and sets value for the asset’s identifier. - format:
And object that describes the audio data layout.
- normalizationMode:
An option to calibrate the sound asset for the user’s output device.
Return Value
A sound asset object. If an error occurs, the function returns nil.