Skip to content

SoundBank

class SoundBank

Amplitude Sound Bank Asset.

A Sound Bank is a group of Amplitude assets, registered in a single binary. This way allows you to pack the needed data for your game as you want (ie. sound banks per levels). A sound bank need to be loaded by the Engine using Engine::LoadSoundBank() before to play sounds and trigger events inside it. When the sound bank data should be released (ie. changing the level, closing the game, etc.), you need to unload the sound bank using Engine::UnloadSoundBank().

Functions

Name Description
SoundBank Creates an uninitialized SoundBank.
SoundBank Creates a sound bank from the given source file.
Initialize Initializes the sound bank by loading all the packed data.
InitializeFromMemory Initializes the sound bank by loading all the packed data.
Deinitialize Unloads the sound bank from the Engine.
GetId Returns the unique ID of this SoundBank.
GetName Returns the name of this SoundBank.
GetSoundBankDefinition Returns the definition data used to initialize this SoundBank.
GetRefCounter Gets the references counter of this instance.
LoadSoundFiles Load the sound files referenced in the sound bank.

Function Details

Deinitialize

void Deinitialize(Engine* engine)

Unloads the sound bank from the Engine.

Parameter engine
The engine instance from which unload the sound bank.

GetId

[[nodiscard]] AmBankID GetId() const

Returns the unique ID of this SoundBank.

Return
The SoundBank unique ID.

GetName

[[nodiscard]] const AmString& GetName() const

Returns the name of this SoundBank.

Return
The SoundBank name.

GetRefCounter

RefCounter* GetRefCounter()

Gets the references counter of this instance.

Return
The references counter.

GetSoundBankDefinition

[[nodiscard]] const SoundBankDefinition* GetSoundBankDefinition() const

Returns the definition data used to initialize this SoundBank.

Return
The sound bank definition data.

Initialize

bool Initialize(const AmOsString& filename, Engine* engine)

Initializes the sound bank by loading all the packed data.

Parameter filename
The path to the sound bank file.
Parameter engine
The engine instance in which load the sound bank.
Return
true when the operation succeeds, false otherwise.

InitializeFromMemory

bool InitializeFromMemory(const char* fileData, Engine* engine)

Initializes the sound bank by loading all the packed data.

Parameter fileData
The sound bank file content.
Parameter engine
The engine instance in which load the sound bank.
Return
true when the operation succeeds, false otherwise.

LoadSoundFiles

void LoadSoundFiles(const Engine* engine)

Load the sound files referenced in the sound bank.

Parameter engine
The engine instance from which load the sound files.

Warning

This method should not be called directly. It is called automatically by the Engine with the Engine::StartLoadSoundFiles() method.

SoundBank

SoundBank()

Creates an uninitialized SoundBank.

explicit SoundBank(const AmString& source)

Creates a sound bank from the given source file.

Warning

This constructor is for internal usage only.