Skip to content

Engine

The Amplitude engine.

Detailed Description

This is the main class of the library that manages all the entities and provides methods to create, destroy, and manipulate them. You can also access to the internal state of the engine through the public API.

The Engine is a singleton class, and you can access it using the amEngine macro. Before using most of the methods of the engine, you need to initialize the engine first:

amEngine->Initialize("config.amconfig");
// ...
amEngine->Deinitialize();

Public Functions

Type Name
virtual Entity AddEntity (AmEntityID id) const = 0
Initializes and returns a new Entity .
virtual Environment AddEnvironment (AmEnvironmentID id) const = 0
Initializes and return a new Environment .
virtual Listener AddListener (AmListenerID id) const = 0
Initializes and returns a new Listener .
virtual Room AddRoom (AmRoomID id) const = 0
Initializes and return a new Room .
virtual void AdvanceFrame (AmTime delta) const = 0
Updates the engine state for the given number of milliseconds.
virtual void CancelAllEvents () const = 0
Cancels all events currently being processed.
virtual void CancelEvents (const Entity & entity) const = 0
Cancels events triggered by the given entity.
virtual bool Deinitialize () = 0
Deinitializes the Amplitude engine.
virtual void EnsureSoundBankLoaded (const AmOsString & filename) = 0
Make sure a sound bank is loaded in the engine.
virtual Bus FindBus (const AmString & name) const = 0
Returns the Bus with the specified name.
virtual Bus FindBus (AmBusID id) const = 0
Returns the Bus with the given ID.
virtual AmUInt32 GetActiveEntitiesCount () const = 0
Get the number of active entities in the engine.
virtual AmUInt32 GetActiveEnvironmentsCount () const = 0
Get the number of active environments in the engine.
virtual AmUInt32 GetActiveListenersCount () const = 0
Get the number of active listeners in the engine.
virtual AmUInt32 GetActiveRoomsCount () const = 0
Get the number of active rooms in the engine.
virtual AttenuationHandle GetAttenuationHandle (const AmString & name) const = 0
Gets an AttenuationHandle given its name as defined in its asset file (.amattenuation ).
virtual AttenuationHandle GetAttenuationHandle (AmAttenuationID id) const = 0
Gets an AttenuationHandle given its ID as defined in its asset file (.amattenuation ).
virtual AttenuationHandle GetAttenuationHandleFromFile (const AmOsString & filename) const = 0
Gets an AttenuationHandle given its asset's filename.
virtual Channel GetChannel (AmChannelID channelID) const = 0
Gets the channel with the given ID.
virtual CollectionHandle GetCollectionHandle (const AmString & name) const = 0
Gets a CollectionHandle given its name as defined in its asset file (.amcollection ).
virtual CollectionHandle GetCollectionHandle (AmCollectionID id) const = 0
Gets a CollectionHandle given its ID as defined in its asset file (.amcollection ).
virtual CollectionHandle GetCollectionHandleFromFile (const AmOsString & filename) const = 0
Gets a CollectionHandle given its asset's filename.
virtual const AmOsString & GetConfigurationPath () const = 0
Gets the path to the loaded engine configuration file.
virtual Listener GetDefaultListener () const = 0
Gets the default audio Listener .
virtual AmReal32 GetDopplerFactor () const = 0
Get the Doppler factor, as set in the loaded engine configuration file.
virtual std::shared_ptr< Driver > GetDriver () const = 0
Gets the audio driver used by the Engine .
virtual EffectHandle GetEffectHandle (const AmString & name) const = 0
Gets an EffectHandle given its name as defined in its asset file (.amfx ).
virtual EffectHandle GetEffectHandle (AmEffectID id) const = 0
Gets an EffectHandle given its ID as defined in its asset file (.amfx ).
virtual EffectHandle GetEffectHandleFromFile (const AmOsString & filename) const = 0
Gets an EffectHandle given its asset's filename.
virtual Entity GetEntity (AmEntityID id) const = 0
Returns the Entity with the given ID.
virtual Environment GetEnvironment (AmEnvironmentID id) const = 0
Returns the Environment with the given ID.
virtual EventHandle GetEventHandle (const AmString & name) const = 0
Gets an EventHandle given its name as defined in its asset file (.amevent ).
virtual EventHandle GetEventHandle (AmEventID id) const = 0
Gets an EventHandle given its ID as defined in its asset file (.amevent ).
virtual EventHandle GetEventHandleFromFile (const AmOsString & filename) const = 0
Gets an EventHandle given its asset's filename.
virtual std::shared_ptr< const FileSystem > GetFileSystem () const = 0
Gets the file system implementation used by the engine.
virtual std::shared_ptr< const HRIRSphere > GetHRIRSphere () const = 0
Gets the HRIR sphere defined in the loaded engine configuration.
virtual eHRIRSphereSamplingMode GetHRIRSphereSamplingMode () const = 0
Gets the HRIR sphere sampling mode defined in the loaded engine configuration.
virtual Listener GetListener (AmListenerID id) const = 0
Returns the Listener with the given ID.
virtual AmReal32 GetMasterGain () const = 0
Gets the mixer "master" gain.
virtual AmUInt32 GetMaxEntitiesCount () const = 0
Gets the maximum number of game entities handled by the engine.
virtual AmUInt32 GetMaxEnvironmentsCount () const = 0
Gets the maximum number of environments handled by the engine.
virtual AmUInt32 GetMaxListenersCount () const = 0
Gets the maximum number of listeners handled by the engine.
virtual AmUInt32 GetMaxRoomsCount () const = 0
Gets the maximum number of rooms handled by the engine.
virtual Amplimix * GetMixer () const = 0
Gets the mixer instance.
virtual const Curve & GetObstructionCoefficientCurve () const = 0
Gets the obstruction coefficient curve, as set in the loaded engine configuration file.
virtual const Curve & GetObstructionGainCurve () const = 0
Gets the obstruction gain curve, as set in the loaded engine configuration file.
virtual const Curve & GetOcclusionCoefficientCurve () const = 0
Gets the occlusion coefficient curve, as set in the loaded engine configuration file.
virtual const Curve & GetOcclusionGainCurve () const = 0
Gets the occlusion gain curve, as set in the loaded engine configuration file.
virtual ePanningMode GetPanningMode () const = 0
Gets the panning mode defined in the loaded engine configuration.
virtual PipelineHandle GetPipelineHandle () const = 0
Gets a PipelineHandle from the loaded pipeline asset file (.ampipeline ).
virtual Room GetRoom (AmRoomID id) const = 0
Returns the Room with the given ID.
virtual RtpcHandle GetRtpcHandle (const AmString & name) const = 0
Gets an RtpcHandle given its name as defined in its asset file (.amrtpc ).
virtual RtpcHandle GetRtpcHandle (AmRtpcID id) const = 0
Gets an RtpcHandle given its ID as defined in its asset file (.amrtpc ).
virtual RtpcHandle GetRtpcHandleFromFile (const AmOsString & filename) const = 0
Gets an RtpcHandle given its asset's filename.
virtual AmUInt32 GetSamplesPerStream () const = 0
Get the number of samples to process in one stream, as set in the loaded engine configuration file.
virtual SoundHandle GetSoundHandle (const AmString & name) const = 0
Gets a SoundHandle given its name as defined in its asset file (.amsound ).
virtual SoundHandle GetSoundHandle (AmSoundID id) const = 0
Gets a SoundHandle given its ID as defined in its asset file (.amsound ).
virtual SoundHandle GetSoundHandleFromFile (const AmOsString & filename) const = 0
Gets a SoundHandle given its asset's filename.
virtual SoundObjectHandle GetSoundObjectHandle (const AmString & name) const = 0
Gets a SoundObjectHandle given its name as defined in its asset file.
virtual SoundObjectHandle GetSoundObjectHandle (AmSoundID id) const = 0
Gets a SoundObjectHandle given its ID as defined in its asset file.
virtual SoundObjectHandle GetSoundObjectHandleFromFile (const AmOsString & filename) const = 0
Gets a SoundObjectHandle given its asset's filename.
virtual AmReal32 GetSoundSpeed () const = 0
Gets the speed of sound, as set in the loaded engine configuration file.
virtual SwitchContainerHandle GetSwitchContainerHandle (const AmString & name) const = 0
Gets a SwitchContainerHandle given its name as defined in its asset file (.amswitchcontainer ).
virtual SwitchContainerHandle GetSwitchContainerHandle (AmSwitchContainerID id) const = 0
Gets a SwitchContainerHandle given its ID as defined in its asset file (.amswitchcontainer ).
virtual SwitchContainerHandle GetSwitchContainerHandleFromFile (const AmOsString & filename) const = 0
Gets a SwitchContainerHandle given its asset's filename.
virtual SwitchHandle GetSwitchHandle (const AmString & name) const = 0
Gets a SwitchHandle given its name as defined in its asset file (.amswitch ).
virtual SwitchHandle GetSwitchHandle (AmSwitchID id) const = 0
Gets a SwitchHandle given its ID as defined in its asset file (.amswitch ).
virtual SwitchHandle GetSwitchHandleFromFile (const AmOsString & filename) const = 0
Gets a SwitchHandle given its asset's filename.
virtual AmTime GetTotalTime () const = 0
Gets the total elapsed time in milliseconds since the start of the engine.
virtual bool HasLoadedSoundBank (const AmOsString & filename) const = 0
Checks if a sound bank with the given filename has been loaded.
virtual bool HasLoadedSoundBank (AmBankID id) const = 0
Checks if a sound bank with the given ID has been loaded.
virtual bool HasLoadedSoundBanks () const = 0
Checks if any sound banks have been loaded.
virtual bool Initialize (const AmOsString & configFile) = 0
Initializes the Amplitude engine.
virtual bool IsGameTrackingEnvironmentAmounts () const = 0
Checks whether the game is tracking environment amounts himself.
virtual bool IsInitialized () const = 0
Checks if the Amplitude engine has been successfully initialized.
virtual bool IsMuted () const = 0
Checks whether the engine is currently muted.
virtual bool IsPaused () const = 0
Checks whether the engine is currently paused.
virtual bool IsStopping () const = 0
Checks if the engine is stopping.
virtual bool LoadSoundBank (const AmOsString & filename) = 0
Loads a sound bank from a binary asset file ( .ambank ).
virtual bool LoadSoundBank (const AmOsString & filename, AmBankID & outID) = 0
Loads a sound bank from a binary asset file ( .ambank ).
virtual bool LoadSoundBankFromMemoryView (AmConstVoidPtr ptr, AmSize size) = 0
Loads a sound bank from memory.
virtual bool LoadSoundBankFromMemoryView (AmConstVoidPtr ptr, AmSize size, AmBankID & outID) = 0
Loads a sound bank from memory.
virtual void OnNextFrame (std::function< void(AmTime delta)> callback) const = 0
Executes the given callback on the next frame.
virtual void Pause (bool pause) const = 0
Pauses or resumes all playing sounds and streams.
virtual Channel Play (SwitchContainerHandle handle) const = 0
Plays a switch container associated with the given handle in the World scope.
virtual Channel Play (SwitchContainerHandle handle, const AmVector3 & location) const = 0
Plays a switch container associated with the given handle in the World scope.
virtual Channel Play (SwitchContainerHandle handle, const AmVector3 & location, AmReal32 userGain) const = 0
Plays a switch container associated with the given handle in the World scope.
virtual Channel Play (SwitchContainerHandle handle, const Entity & entity) const = 0
Plays a switch container associated with the given handle in an Entity scope.
virtual Channel Play (SwitchContainerHandle handle, const Entity & entity, AmReal32 userGain) const = 0
Plays a switch container associated with the given handle in an Entity scope.
virtual Channel Play (CollectionHandle handle) const = 0
Plays a collection associated with the given handle in the World scope.
virtual Channel Play (CollectionHandle handle, const AmVector3 & location) const = 0
Plays a collection associated with the given handle in the World scope.
virtual Channel Play (CollectionHandle handle, const AmVector3 & location, AmReal32 userGain) const = 0
Plays a collection associated with the given handle in the World scope.
virtual Channel Play (CollectionHandle handle, const Entity & entity) const = 0
Plays a collection associated with the given handle in the Entity scope.
virtual Channel Play (CollectionHandle handle, const Entity & entity, AmReal32 userGain) const = 0
Plays a collection associated with the given handle in an Entity scope.
virtual Channel Play (SoundHandle handle) const = 0
Plays a sound associated with the given handle in the World scope.
virtual Channel Play (SoundHandle handle, const AmVector3 & location) const = 0
Plays a sound associated with the given handle in the World scope.
virtual Channel Play (SoundHandle handle, const AmVector3 & location, AmReal32 userGain) const = 0
Plays a sound associated with the given handle in the World scope.
virtual Channel Play (SoundHandle handle, const Entity & entity) const = 0
Plays a sound associated with the given sound handle in an Entity scope.
virtual Channel Play (SoundHandle handle, const Entity & entity, AmReal32 userGain) const = 0
Plays a sound associated with the given sound handle in an Entity .
virtual Channel Play (const AmString & name) const = 0
Plays a sound object associated with the given name in the World scope.
virtual Channel Play (const AmString & name, const AmVector3 & location) const = 0
Plays a sound object associated with the given name in the World scope.
virtual Channel Play (const AmString & name, const AmVector3 & location, AmReal32 userGain) const = 0
Plays a sound object associated with the given name in the World scope.
virtual Channel Play (const AmString & name, const Entity & entity) const = 0
Plays a sound object associated with the given name in an Entity scope.
virtual Channel Play (const AmString & name, const Entity & entity, AmReal32 userGain) const = 0
Plays a sound object associated with the given name in an Entity scope.
virtual Channel Play (AmObjectID id) const = 0
Plays a sound object associated with the given ID in the World scope.
virtual Channel Play (AmObjectID id, const AmVector3 & location) const = 0
Plays a sound object associated with the given ID in the World scope.
virtual Channel Play (AmObjectID id, const AmVector3 & location, AmReal32 userGain) const = 0
Plays a sound object associated with the given ID in the World scope.
virtual Channel Play (AmObjectID id, const Entity & entity) const = 0
Plays a sound object associated with the given ID in an Entity scope.
virtual Channel Play (AmObjectID id, const Entity & entity, AmReal32 userGain) const = 0
Plays a sound object associated with the given ID in an Entity scope.
virtual void RemoveEntity (const Entity * entity) const = 0
Removes an Entity .
virtual void RemoveEntity (AmEntityID id) const = 0
Removes an Entity given its ID.
virtual void RemoveEnvironment (const Environment * environment) const = 0
Removes an Environment .
virtual void RemoveEnvironment (AmEnvironmentID id) const = 0
Removes an Environment given its ID.
virtual void RemoveListener (AmListenerID id) const = 0
Removes a Listener given its ID.
virtual void RemoveListener (const Listener * listener) const = 0
Removes a Listener given its handle.
virtual void RemoveRoom (const Room * room) const = 0
Removes a Room .
virtual void RemoveRoom (AmRoomID id) const = 0
Removes a Room given its ID.
virtual void SetDefaultListener (const Listener * listener) = 0
Sets the default sound listener.
virtual void SetDefaultListener (AmListenerID id) = 0
Sets the default sound listener.
virtual void SetFileSystem (std::shared_ptr< FileSystem > fs) = 0
Sets a file system implementation to be used by the engine.
virtual void SetMasterGain (AmReal32 gain) const = 0
Adjusts the "master" gain of the mixer.
virtual void SetMute (bool mute) const = 0
Mutes the engine, but keep processing audio.
virtual void SetRtpcValue (RtpcHandle handle, double value) const = 0
Sets the value of an RTPC .
virtual void SetRtpcValue (AmRtpcID id, double value) const = 0
Sets the value of an RTPC .
virtual void SetRtpcValue (const AmString & name, double value) const = 0
Sets the value of an RTPC .
virtual void SetSwitchState (SwitchHandle handle, AmObjectID stateId) const = 0
Sets the active state of the defined Switch .
virtual void SetSwitchState (SwitchHandle handle, const AmString & stateName) const = 0
Sets the active state of the defined Switch .
virtual void SetSwitchState (SwitchHandle handle, const SwitchState & state) const = 0
Sets the active state of the defined Switch .
virtual void SetSwitchState (AmSwitchID id, AmObjectID stateId) const = 0
Sets the active state of the defined Switch .
virtual void SetSwitchState (AmSwitchID id, const AmString & stateName) const = 0
Sets the active state of the defined Switch .
virtual void SetSwitchState (AmSwitchID id, const SwitchState & state) const = 0
Sets the active state of the defined Switch .
virtual void SetSwitchState (const AmString & name, AmObjectID stateId) const = 0
Sets the active state of the defined Switch .
virtual void SetSwitchState (const AmString & name, const AmString & stateName) const = 0
Sets the active state of the defined Switch .
virtual void SetSwitchState (const AmString & name, const SwitchState & state) const = 0
Sets the active state of the defined Switch .
virtual void StartCloseFileSystem () = 0
Closes the file system, usually in a separate thread.
virtual void StartLoadSoundFiles () = 0
Starts the loading of sound files referenced in loaded sound banks.
virtual void StartOpenFileSystem () = 0
Opens the file system, usually in a separate thread.
virtual void StopAll () const = 0
Stops all playing sound objects.
virtual EventCanceler Trigger (EventHandle handle, const Entity & entity) const = 0
Triggers the event associated with the given handle.
virtual EventCanceler Trigger (const AmString & name, const Entity & entity) const = 0
Triggers the event associated with the given name.
virtual EventCanceler Trigger (AmEventID id, const Entity & entity) const = 0
Triggers the event associated with the given ID.
virtual bool TryFinalizeCloseFileSystem () = 0
Checks if the file system has been fully closed.
virtual bool TryFinalizeLoadSoundFiles () = 0
Checks if the loading of sound files has been completed and releases used resources.
virtual bool TryFinalizeOpenFileSystem () = 0
Checks if the file system has been fully loaded.
virtual void UnloadSoundBank (const AmOsString & filename) = 0
Unloads a sound bank given its filename.
virtual void UnloadSoundBank (AmBankID id) = 0
Unloads a sound bank given its ID.
virtual void UnloadSoundBanks () = 0
Unloads all the loaded sound banks.
virtual const AmVersion * Version () const = 0
Gets the current version of the library.
virtual void WaitUntilFrames (AmUInt64 frameCount) const = 0
Waits until the specified number of frames are ready.
virtual void WaitUntilNextFrame () const = 0
Waits until the next frame is ready.
virtual ~Engine () = default
Default constructor.

Public Static Functions

Type Name
void AddPluginSearchPath (const AmOsString & path)
Adds a path in the plugin search paths list.
void DestroyInstance ()
Destroys the unique instance of the Amplitude Engine .
Engine * GetInstance ()
Returns a unique instance of the Amplitude Engine .
AmVoidPtr LoadPlugin (const AmOsString & pluginLibraryName)
Loads a plugin library from the given path.
bool RegisterDefaultExtensions ()
Register all default extensions.
std::shared_ptr< T > RegisterExtension (Args &&... args)
Registers an extension into Amplitude.
void RemovePluginSearchPath (const AmOsString & path)
Removes a path from the plugin search paths list.
bool UnregisterDefaultExtensions ()
Unregister all default extensions.
void UnregisterExtension (std::shared_ptr< T > & extension)
Unregisters an extension from Amplitude.

Public Functions Documentation

AddEntity

Initializes and returns a new Entity .

virtual Entity Amplitude::Engine::AddEntity (
    AmEntityID id
) const = 0

Parameters:

  • id The game entity ID.

Returns:

An initialized Entity.

See also: Entity

AddEnvironment

Initializes and return a new Environment .

virtual Environment Amplitude::Engine::AddEnvironment (
    AmEnvironmentID id
) const = 0

Parameters:

  • id The game environment ID.

Returns:

An initialized Environment.

See also: Environment

AddListener

Initializes and returns a new Listener .

virtual Listener Amplitude::Engine::AddListener (
    AmListenerID id
) const = 0

Parameters:

  • id The new listener ID.

Returns:

An initialized Listener.

See also: Listener

AddRoom

Initializes and return a new Room .

virtual Room Amplitude::Engine::AddRoom (
    AmRoomID id
) const = 0

Parameters:

  • id The room ID.

Returns:

An initialized Room.

See also: Room

AdvanceFrame

Updates the engine state for the given number of milliseconds.

virtual void Amplitude::Engine::AdvanceFrame (
    AmTime delta
) const = 0

Parameters:

  • delta The number of milliseconds since the last frame.
CancelAllEvents

Cancels all events currently being processed.

virtual void Amplitude::Engine::CancelAllEvents () const = 0

Note:

This method cancels all events currently being processed by the engine. It does not cancel events that are queued for processing.

CancelEvents

Cancels events triggered by the given entity.

virtual void Amplitude::Engine::CancelEvents (
    const Entity & entity
) const = 0

Parameters:

  • entity The entity for which cancel triggered events.
Deinitialize

Deinitializes the Amplitude engine.

virtual bool Amplitude::Engine::Deinitialize () = 0

Returns:

true when the engine has been successfully deinitialized, false otherwise.

EnsureSoundBankLoaded

Make sure a sound bank is loaded in the engine.

virtual void Amplitude::Engine::EnsureSoundBankLoaded (
    const AmOsString & filename
) = 0

If the sound bank referenced by the iven file path is already loaded, the method will do nothing, and the sound bank reference count will be kept unchanged.

Parameters:

  • filename The path to the sound bank asset file to load.
FindBus[1/2]

Returns the Bus with the specified name.

virtual Bus Amplitude::Engine::FindBus (
    const AmString & name
) const = 0

Parameters:

  • name The name of the bus.

Note:

The name should match one of the buses loaded from the asset file (.ambus).

Returns:

A valid Bus if found, otherwise an invalid Bus.

See also: Bus

FindBus[2/2]

Returns the Bus with the given ID.

virtual Bus Amplitude::Engine::FindBus (
    AmBusID id
) const = 0

Parameters:

  • id The ID of the bus.

Note:

The ID should match one of the buses loaded from the asset file (.ambus).

Returns:

A valid Bus if found, otherwise an invalid Bus.

See also: Bus

GetActiveEntitiesCount

Get the number of active entities in the engine.

virtual AmUInt32 Amplitude::Engine::GetActiveEntitiesCount () const = 0

Returns:

The number of active entities.

GetActiveEnvironmentsCount

Get the number of active environments in the engine.

virtual AmUInt32 Amplitude::Engine::GetActiveEnvironmentsCount () const = 0

Returns:

The number of active environments.

GetActiveListenersCount

Get the number of active listeners in the engine.

virtual AmUInt32 Amplitude::Engine::GetActiveListenersCount () const = 0

Returns:

The number of active listeners.

GetActiveRoomsCount

Get the number of active rooms in the engine.

virtual AmUInt32 Amplitude::Engine::GetActiveRoomsCount () const = 0

Returns:

The number of active rooms.

GetAttenuationHandle[1/2]

Gets an AttenuationHandle given its name as defined in its asset file (.amattenuation ).

virtual AttenuationHandle Amplitude::Engine::GetAttenuationHandle (
    const AmString & name
) const = 0

Parameters:

  • name The unique name as defined in the asset file.

Returns:

The AttenuationHandle for the given name, or an invalid handle if no attenuation with that name was found in any loaded sound bank.

GetAttenuationHandle[2/2]

Gets an AttenuationHandle given its ID as defined in its asset file (.amattenuation ).

virtual AttenuationHandle Amplitude::Engine::GetAttenuationHandle (
    AmAttenuationID id
) const = 0

Parameters:

  • id The unique ID as defined in the asset file.

Returns:

The AttenuationHandle for the given ID, or an invalid handle if no attenuation with that ID was found in any loaded sound bank.

GetAttenuationHandleFromFile

Gets an AttenuationHandle given its asset's filename.

virtual AttenuationHandle Amplitude::Engine::GetAttenuationHandleFromFile (
    const AmOsString & filename
) const = 0

Parameters:

  • filename The asset's filename.

Note:

The asset's filename should be a relative path from the attenuators directory of your Amplitude project, not an absolute path from the filesystem base path.

// Assuming the asset file is located in "attenuators/impact.amattenuation"
AttenuationHandle handle = amEngine->GetAttenuationHandleFromFile("impact.amattenuation");

Returns:

The AttenuationHandle for the given asset's filename, or an invalid handle if no attenuation with that filename was found in any loaded sound bank.

GetChannel

Gets the channel with the given ID.

virtual Channel Amplitude::Engine::GetChannel (
    AmChannelID channelID
) const = 0

Parameters:

  • channelID The ID of the channel to get.

Returns:

The channel.

GetCollectionHandle[1/2]

Gets a CollectionHandle given its name as defined in its asset file (.amcollection ).

virtual CollectionHandle Amplitude::Engine::GetCollectionHandle (
    const AmString & name
) const = 0

Parameters:

  • name The unique name as defined in the asset file.

Returns:

The CollectionHandle for the given name, or an invalid handle if no collection with that name was found in any loaded sound bank.

GetCollectionHandle[2/2]

Gets a CollectionHandle given its ID as defined in its asset file (.amcollection ).

virtual CollectionHandle Amplitude::Engine::GetCollectionHandle (
    AmCollectionID id
) const = 0

Parameters:

  • id The unique ID as defined in the asset file.

Returns:

The CollectionHandle for the given ID, or an invalid handle if no collection with that ID was found in any loaded sound bank.

GetCollectionHandleFromFile

Gets a CollectionHandle given its asset's filename.

virtual CollectionHandle Amplitude::Engine::GetCollectionHandleFromFile (
    const AmOsString & filename
) const = 0

Parameters:

  • filename The asset's filename.

Note:

The asset's filename should be a relative path from the collections directory of your Amplitude project, not an absolute path from the filesystem base path.

// Assuming the asset file is located in "collections/weapons/ak47_gunfire.amcollection"
CollectionHandle handle = amEngine->GetCollectionHandleFromFile("weapons/ak47_gunfire.amcollection");

Returns:

The CollectionHandle for the given asset's filename, or an invalid handle if no collection with that filename was found in any loaded sound bank.

GetConfigurationPath

Gets the path to the loaded engine configuration file.

virtual const AmOsString & Amplitude::Engine::GetConfigurationPath () const = 0

Returns:

The path to the engine configuration file.

GetDefaultListener

Gets the default audio Listener .

virtual Listener Amplitude::Engine::GetDefaultListener () const = 0

Returns:

An initialized Listener object if a default listener was set, otherwise an uninitialized Listener object.

See also: Listener

GetDopplerFactor

Get the Doppler factor, as set in the loaded engine configuration file.

virtual AmReal32 Amplitude::Engine::GetDopplerFactor () const = 0

Returns:

The Doppler factor.

GetDriver

Gets the audio driver used by the Engine .

virtual std::shared_ptr< Driver > Amplitude::Engine::GetDriver () const = 0

Returns:

The audio driver.

GetEffectHandle[1/2]

Gets an EffectHandle given its name as defined in its asset file (.amfx ).

virtual EffectHandle Amplitude::Engine::GetEffectHandle (
    const AmString & name
) const = 0

Parameters:

  • name The unique name as defined in the asset file.

Returns:

The EffectHandle for the given name, or an invalid handle if no effect with that name was found in any loaded sound bank.

GetEffectHandle[2/2]

Gets an EffectHandle given its ID as defined in its asset file (.amfx ).

virtual EffectHandle Amplitude::Engine::GetEffectHandle (
    AmEffectID id
) const = 0

Parameters:

  • id The unique ID as defined in the asset file.

Returns:

The EffectHandle for the given ID, or an invalid handle if no effect with that ID was found in any loaded sound bank.

GetEffectHandleFromFile

Gets an EffectHandle given its asset's filename.

virtual EffectHandle Amplitude::Engine::GetEffectHandleFromFile (
    const AmOsString & filename
) const = 0

Parameters:

  • filename The asset's filename.

Note:

The asset's filename should be a relative path from the effects directory of your Amplitude project, not an absolute path from the filesystem base path.

// Assuming the asset file is located in "effects/echo.amfx"
EffectHandle handle = amEngine->GetEffectHandleFromFile("echo.amfx");

Returns:

The EffectHandle for the given asset's filename, or an invalid handle if no effect with that filename was found in any loaded sound bank.

GetEntity

Returns the Entity with the given ID.

virtual Entity Amplitude::Engine::GetEntity (
    AmEntityID id
) const = 0

Parameters:

  • id The game entity ID.

Returns:

An initialized Entity if that one has been registered before, otherwise an uninitialized Entity.

See also: Entity

GetEnvironment

Returns the Environment with the given ID.

virtual Environment Amplitude::Engine::GetEnvironment (
    AmEnvironmentID id
) const = 0

Parameters:

  • id The game environment ID.

Returns:

An initialized Environment if that one has been registered before, otherwise an uninitialized Environment.

See also: Environment

GetEventHandle[1/2]

Gets an EventHandle given its name as defined in its asset file (.amevent ).

virtual EventHandle Amplitude::Engine::GetEventHandle (
    const AmString & name
) const = 0

Parameters:

  • name The unique name as defined in the asset file.

Returns:

The EventHandle for the given name, or an invalid handle if no event with that name was found in any loaded sound bank.

GetEventHandle[2/2]

Gets an EventHandle given its ID as defined in its asset file (.amevent ).

virtual EventHandle Amplitude::Engine::GetEventHandle (
    AmEventID id
) const = 0

Parameters:

  • id The unique ID as defined in the asset file.

Returns:

The EventHandle for the given ID, or an invalid handle if no event with that ID was found in any loaded sound bank.

GetEventHandleFromFile

Gets an EventHandle given its asset's filename.

virtual EventHandle Amplitude::Engine::GetEventHandleFromFile (
    const AmOsString & filename
) const = 0

Parameters:

  • filename The asset's filename.

Note:

The asset's filename should be a relative path from the events directory of your Amplitude project, not an absolute path from the filesystem base path.

// Assuming the asset file is located in "events/gameplay/start_menu.amevent"
EventHandle handle = amEngine->GetEventHandleFromFile("gameplay/start_menu.amevent");

Returns:

The EventHandle for the given asset's filename, or an invalid handle if no event with that filename was found in any loaded sound bank.

GetFileSystem

Gets the file system implementation used by the engine.

virtual std::shared_ptr< const FileSystem > Amplitude::Engine::GetFileSystem () const = 0

Returns:

The current file system implementation used by the engine, or nullptr if no file system has been set.

GetHRIRSphere

Gets the HRIR sphere defined in the loaded engine configuration.

virtual std::shared_ptr< const HRIRSphere > Amplitude::Engine::GetHRIRSphere () const = 0

Returns:

The HRIR sphere. If no HRIR sphere is defined, it returns nullptr.

Note:

The HRIR sphere is optional and can be null in some cases. If the engine does not have an HRIR sphere defined, this function will return nullptr.

See also: HRIRSphere

GetHRIRSphereSamplingMode

Gets the HRIR sphere sampling mode defined in the loaded engine configuration.

virtual eHRIRSphereSamplingMode Amplitude::Engine::GetHRIRSphereSamplingMode () const = 0

Returns:

The HRIR sphere sampling mode.

GetListener

Returns the Listener with the given ID.

virtual Listener Amplitude::Engine::GetListener (
    AmListenerID id
) const = 0

Parameters:

  • id The listener ID.

Returns:

An initialized Listener if a one with the given ID has been registered before, otherwise an uninitialized Listener.

See also: Listener

GetMasterGain

Gets the mixer "master" gain.

virtual AmReal32 Amplitude::Engine::GetMasterGain () const = 0

Returns:

The mixer "master" gain.

GetMaxEntitiesCount

Gets the maximum number of game entities handled by the engine.

virtual AmUInt32 Amplitude::Engine::GetMaxEntitiesCount () const = 0

This value does not reflect the maximum number of simultaneous sounds handled by the engine.

Returns:

The maximum number of game entities.

GetMaxEnvironmentsCount

Gets the maximum number of environments handled by the engine.

virtual AmUInt32 Amplitude::Engine::GetMaxEnvironmentsCount () const = 0

Returns:

The maximum number of environments.

GetMaxListenersCount

Gets the maximum number of listeners handled by the engine.

virtual AmUInt32 Amplitude::Engine::GetMaxListenersCount () const = 0

Returns:

The maximum number of listeners.

GetMaxRoomsCount

Gets the maximum number of rooms handled by the engine.

virtual AmUInt32 Amplitude::Engine::GetMaxRoomsCount () const = 0

Returns:

The maximum number of rooms.

GetMixer

Gets the mixer instance.

virtual Amplimix * Amplitude::Engine::GetMixer () const = 0

Returns:

The Amplimix mixer instance.

GetObstructionCoefficientCurve

Gets the obstruction coefficient curve, as set in the loaded engine configuration file.

virtual const Curve & Amplitude::Engine::GetObstructionCoefficientCurve () const = 0

Returns:

The obstruction coefficient curve.

GetObstructionGainCurve

Gets the obstruction gain curve, as set in the loaded engine configuration file.

virtual const Curve & Amplitude::Engine::GetObstructionGainCurve () const = 0

Returns:

The obstruction gain curve.

GetOcclusionCoefficientCurve

Gets the occlusion coefficient curve, as set in the loaded engine configuration file.

virtual const Curve & Amplitude::Engine::GetOcclusionCoefficientCurve () const = 0

Returns:

The occlusion coefficient curve.

GetOcclusionGainCurve

Gets the occlusion gain curve, as set in the loaded engine configuration file.

virtual const Curve & Amplitude::Engine::GetOcclusionGainCurve () const = 0

Returns:

The occlusion gain curve.

GetPanningMode

Gets the panning mode defined in the loaded engine configuration.

virtual ePanningMode Amplitude::Engine::GetPanningMode () const = 0

Returns:

The panning mode.

GetPipelineHandle

Gets a PipelineHandle from the loaded pipeline asset file (.ampipeline ).

virtual PipelineHandle Amplitude::Engine::GetPipelineHandle () const = 0

Note:

Only one pipeline can be loaded at a time. The loaded pipeline asset is defined in the engine configuration file.

Returns:

The PipelineHandle for the loaded pipeline. This method should always return a valid handle.

GetRoom

Returns the Room with the given ID.

virtual Room Amplitude::Engine::GetRoom (
    AmRoomID id
) const = 0

Parameters:

  • id The room ID.

Returns:

An initialized Room if that one has been registered before, otherwise an uninitialized Room.

See also: Room

GetRtpcHandle[1/2]

Gets an RtpcHandle given its name as defined in its asset file (.amrtpc ).

virtual RtpcHandle Amplitude::Engine::GetRtpcHandle (
    const AmString & name
) const = 0

Parameters:

  • name The unique name as defined in the asset file.

Returns:

The RtpcHandle for the given name, or an invalid handle if no RTPC with that name was found in any loaded sound bank.

GetRtpcHandle[2/2]

Gets an RtpcHandle given its ID as defined in its asset file (.amrtpc ).

virtual RtpcHandle Amplitude::Engine::GetRtpcHandle (
    AmRtpcID id
) const = 0

Parameters:

  • id The unique ID as defined in the asset file.

Returns:

The RtpcHandle for the given ID, or an invalid handle if no RTPC with that ID was found in any loaded sound bank.

GetRtpcHandleFromFile

Gets an RtpcHandle given its asset's filename.

virtual RtpcHandle Amplitude::Engine::GetRtpcHandleFromFile (
    const AmOsString & filename
) const = 0

Parameters:

  • filename The asset's filename.

Note:

The asset's filename should be a relative path from the rtpc directory of your Amplitude project, not an absolute path from the filesystem base path.

// Assuming the asset file is located in "rtpc/music_volume.amrtpc"
RtpcHandle handle = amEngine->GetRtpcHandleFromFile("music_volume.amrtpc");

Returns:

The RtpcHandle for the given asset's filename, or an invalid handle if no RTPC with that filename was found in any loaded sound bank.

GetSamplesPerStream

Get the number of samples to process in one stream, as set in the loaded engine configuration file.

virtual AmUInt32 Amplitude::Engine::GetSamplesPerStream () const = 0

Returns:

The number of samples per stream.

GetSoundHandle[1/2]

Gets a SoundHandle given its name as defined in its asset file (.amsound ).

virtual SoundHandle Amplitude::Engine::GetSoundHandle (
    const AmString & name
) const = 0

Parameters:

  • name The unique name as defined in the asset file.

Returns:

The SoundHandle for the given name, or an invalid handle if no sound with that name was found in any loaded sound bank.

GetSoundHandle[2/2]

Gets a SoundHandle given its ID as defined in its asset file (.amsound ).

virtual SoundHandle Amplitude::Engine::GetSoundHandle (
    AmSoundID id
) const = 0

Parameters:

  • id The unique ID as defined in the asset file.

Returns:

The SoundHandle for the given ID, or an invalid handle if no sound with that ID was found in any loaded sound bank.

GetSoundHandleFromFile

Gets a SoundHandle given its asset's filename.

virtual SoundHandle Amplitude::Engine::GetSoundHandleFromFile (
    const AmOsString & filename
) const = 0

Parameters:

  • filename The asset's filename.

Note:

The asset's filename should be a relative path from the sounds directory of your Amplitude project, not an absolute path from the filesystem base path.

// Assuming the asset file is located in "sounds/env/forest/calm_lake_bg.amsound"
SoundHandle handle = amEngine->GetSoundHandleFromFile("env/forest/calm_lake_bg.amsound");

Returns:

The SoundHandle for the given asset's filename, or an invalid handle if no sound with that filename was found in any loaded sound bank.

GetSoundObjectHandle[1/2]

Gets a SoundObjectHandle given its name as defined in its asset file.

virtual SoundObjectHandle Amplitude::Engine::GetSoundObjectHandle (
    const AmString & name
) const = 0

Parameters:

  • name The unique name as defined in the asset file.

Returns:

The SoundObjectHandle for the given name, or an invalid handle if no sound object with that name was found in any loaded sound bank.

Note:

The return value can be a SwitchContainerHandle, a CollectionHandle, or a SoundHandle.

GetSoundObjectHandle[2/2]

Gets a SoundObjectHandle given its ID as defined in its asset file.

virtual SoundObjectHandle Amplitude::Engine::GetSoundObjectHandle (
    AmSoundID id
) const = 0

Parameters:

  • id The unique ID as defined in the asset file.

Returns:

The SoundObjectHandle for the given ID, or an invalid handle if no sound object with that ID was found in any loaded sound bank.

Note:

The return value can be a SwitchContainerHandle, a CollectionHandle, or a SoundHandle.

GetSoundObjectHandleFromFile

Gets a SoundObjectHandle given its asset's filename.

virtual SoundObjectHandle Amplitude::Engine::GetSoundObjectHandleFromFile (
    const AmOsString & filename
) const = 0

Parameters:

  • filename The asset's filename.

Note:

The asset's filename should be a relative path from the sounds, collections, or switch_containers directories of your Amplitude project, not an absolute path from the filesystem base path.

// Assuming the asset file is located in "sounds/env/forest/calm_lake_bg.amsound"
// Note that the return value in this case is indeed a `SoundHandle`
SoundObjectHandle handle = amEngine->GetSoundObjectHandleFromFile("env/forest/calm_lake_bg.amsound");

Returns:

The SoundObjectHandle for the given asset's filename, or an invalid handle if no sound object with that filename was found in any loaded sound bank.

Note:

The return value can be a SwitchContainerHandle, a CollectionHandle, or a SoundHandle.

GetSoundSpeed

Gets the speed of sound, as set in the loaded engine configuration file.

virtual AmReal32 Amplitude::Engine::GetSoundSpeed () const = 0

Returns:

The speed of sound.

GetSwitchContainerHandle[1/2]

Gets a SwitchContainerHandle given its name as defined in its asset file (.amswitchcontainer ).

virtual SwitchContainerHandle Amplitude::Engine::GetSwitchContainerHandle (
    const AmString & name
) const = 0

Parameters:

  • name The unique name as defined in the asset file.

Returns:

The SwitchContainerHandle for the given name, or an invalid handle if no switch container with that name was found in any loaded sound bank.

GetSwitchContainerHandle[2/2]

Gets a SwitchContainerHandle given its ID as defined in its asset file (.amswitchcontainer ).

virtual SwitchContainerHandle Amplitude::Engine::GetSwitchContainerHandle (
    AmSwitchContainerID id
) const = 0

Parameters:

  • id The unique ID as defined in the asset file.

Returns:

The SwitchContainerHandle for the given ID, or an invalid handle if no switch container with that ID was found in any loaded sound bank.

GetSwitchContainerHandleFromFile

Gets a SwitchContainerHandle given its asset's filename.

virtual SwitchContainerHandle Amplitude::Engine::GetSwitchContainerHandleFromFile (
    const AmOsString & filename
) const = 0

Parameters:

  • filename The asset's filename.

Note:

The asset's filename should be a relative path from the switch_containers directory of your Amplitude project, not an absolute path from the filesystem base path.

// Assuming the asset file is located in "switch_containers/footsteps.amswitchcontainer"
SwitchContainerHandle handle = amEngine->GetSwitchContainerHandleFromFile("footsteps.amswitchcontainer");

Returns:

The SwitchContainerHandle for the given asset's filename, or an invalid handle if no switch container with that filename was found in any loaded sound bank.

GetSwitchHandle[1/2]

Gets a SwitchHandle given its name as defined in its asset file (.amswitch ).

virtual SwitchHandle Amplitude::Engine::GetSwitchHandle (
    const AmString & name
) const = 0

Parameters:

  • name The unique name as defined in the asset file.

Returns:

The SwitchHandle for the given name, or an invalid handle if no switch with that name was found in any loaded sound bank.

GetSwitchHandle[2/2]

Gets a SwitchHandle given its ID as defined in its asset file (.amswitch ).

virtual SwitchHandle Amplitude::Engine::GetSwitchHandle (
    AmSwitchID id
) const = 0

Parameters:

  • id The unique ID as defined in the asset file.

Returns:

The SwitchHandle for the given ID, or an invalid handle if no switch with that ID was found in any loaded sound bank.

GetSwitchHandleFromFile

Gets a SwitchHandle given its asset's filename.

virtual SwitchHandle Amplitude::Engine::GetSwitchHandleFromFile (
    const AmOsString & filename
) const = 0

Parameters:

  • filename The asset's filename.

Note:

The asset's filename should be a relative path from the switches directory of your Amplitude project, not an absolute path from the filesystem base path.

// Assuming the asset file is located in "switches/env/surfaces.amswitch"
SwitchHandle handle = amEngine->GetSwitchHandleFromFile("env/surfaces.amswitch");

Returns:

The SwitchHandle for the given asset's filename, or an invalid handle if no switch with that filename was found in any loaded sound bank.

GetTotalTime

Gets the total elapsed time in milliseconds since the start of the engine.

virtual AmTime Amplitude::Engine::GetTotalTime () const = 0

Returns:

The total elapsed time in milliseconds since the start of the engine.

HasLoadedSoundBank[1/2]

Checks if a sound bank with the given filename has been loaded.

virtual bool Amplitude::Engine::HasLoadedSoundBank (
    const AmOsString & filename
) const = 0

Parameters:

  • filename The file to check.

Returns:

true if the sound bank has been loaded, false otherwise.

HasLoadedSoundBank[2/2]

Checks if a sound bank with the given ID has been loaded.

virtual bool Amplitude::Engine::HasLoadedSoundBank (
    AmBankID id
) const = 0

Parameters:

  • id The sound bank id to check.

Returns:

true if the sound bank has been loaded, false otherwise.

HasLoadedSoundBanks

Checks if any sound banks have been loaded.

virtual bool Amplitude::Engine::HasLoadedSoundBanks () const = 0

Returns:

true if any sound banks have been loaded, false otherwise.

Initialize

Initializes the Amplitude engine.

virtual bool Amplitude::Engine::Initialize (
    const AmOsString & configFile
) = 0

Parameters:

  • configFile The path to the configuration file.

Returns:

true when the engine has been successfully initialized, false otherwise.

IsGameTrackingEnvironmentAmounts

Checks whether the game is tracking environment amounts himself.

virtual bool Amplitude::Engine::IsGameTrackingEnvironmentAmounts () const = 0

Returns:

Whether the game is tracking the environment amounts.

IsInitialized

Checks if the Amplitude engine has been successfully initialized.

virtual bool Amplitude::Engine::IsInitialized () const = 0

Returns:

true if the engine has been successfully initialized, false otherwise.

IsMuted

Checks whether the engine is currently muted.

virtual bool Amplitude::Engine::IsMuted () const = 0

Returns:

true if the engine is muted, false otherwise.

IsPaused

Checks whether the engine is currently paused.

virtual bool Amplitude::Engine::IsPaused () const = 0

Returns:

true if the engine is currently paused, false otherwise.

IsStopping

Checks if the engine is stopping.

virtual bool Amplitude::Engine::IsStopping () const = 0

Returns:

true if the engine is stopping, false otherwise.

LoadSoundBank[1/2]

Loads a sound bank from a binary asset file ( .ambank ).

virtual bool Amplitude::Engine::LoadSoundBank (
    const AmOsString & filename
) = 0

This method queues the sound files in that sound bank for loading. Call StartLoadSoundFiles() to trigger the loading of sound files on a separate thread.

Parameters:

  • filename The path to the sound bank asset file.

Returns:

true when the sound bank is successfully loaded, false otherwise.

LoadSoundBank[2/2]

Loads a sound bank from a binary asset file ( .ambank ).

virtual bool Amplitude::Engine::LoadSoundBank (
    const AmOsString & filename,
    AmBankID & outID
) = 0

This method queues the sound files in that sound bank for loading. Call StartLoadSoundFiles() to trigger the loading of sound files on a separate thread.

Parameters:

  • filename The path to the sound bank asset file.
  • outID The ID of the loaded sound bank.

Returns:

true when the sound bank is successfully loaded, false otherwise.

LoadSoundBankFromMemoryView[1/2]

Loads a sound bank from memory.

virtual bool Amplitude::Engine::LoadSoundBankFromMemoryView (
    AmConstVoidPtr ptr,
    AmSize size
) = 0

This method queues the sound files in that sound bank for loading. Call StartLoadSoundFiles() to trigger the loading of sound files on a separate thread.

Parameters:

  • ptr The pointer to the sound bank data to be loaded.
  • size The size of the memory to read.

Note:

The fileData pointer should be null terminated.

Warning:

The fileData pointer should remain valid until the sound bank is unloaded.

Returns:

true when the sound bank is successfully loaded, false otherwise.

LoadSoundBankFromMemoryView[2/2]

Loads a sound bank from memory.

virtual bool Amplitude::Engine::LoadSoundBankFromMemoryView (
    AmConstVoidPtr ptr,
    AmSize size,
    AmBankID & outID
) = 0

This method queues the sound files in that sound bank for loading. Call StartLoadSoundFiles() to trigger the loading of sound files on a separate thread.

Parameters:

  • ptr The pointer to the sound bank data to be loaded.
  • size The size of the memory to read.
  • outID The ID of the loaded sound bank.

Note:

The ptr pointer should be null terminated.

Warning:

The ptr pointer should remain valid until the sound bank is unloaded.

Returns:

true when the sound bank is successfully loaded, false otherwise.

OnNextFrame

Executes the given callback on the next frame.

virtual void Amplitude::Engine::OnNextFrame (
    std::function< void(AmTime delta)> callback
) const = 0

Note:

The given callback will be executed at the beginning of the next frame before doing the actual frame update.

Parameters:

  • callback The callback to be called when the next frame is ready.
Pause

Pauses or resumes all playing sounds and streams.

virtual void Amplitude::Engine::Pause (
    bool pause
) const = 0

Parameters:

  • pause Whether to pause or resume the engine.
Play[1/25]

Plays a switch container associated with the given handle in the World scope.

virtual Channel Amplitude::Engine::Play (
    SwitchContainerHandle handle
) const = 0

This method is recommended for switch containers with spatialization disabled, since no positional information needs to be provided.

Parameters:

  • handle A handle to the switch container to play.

Returns:

The channel the switch container is being played on. If the switch container could not be played, or the given handle is invalid, an invalid Channel is returned.

Play[2/25]

Plays a switch container associated with the given handle in the World scope.

virtual Channel Amplitude::Engine::Play (
    SwitchContainerHandle handle,
    const AmVector3 & location
) const = 0

Parameters:

  • handle A handle to the switch container to play.
  • location The location at which the switch container should be played.

Returns:

The channel the switch container is being played on. If the switch container could not be played, or the given handle is invalid, an invalid Channel is returned.

Play[3/25]

Plays a switch container associated with the given handle in the World scope.

virtual Channel Amplitude::Engine::Play (
    SwitchContainerHandle handle,
    const AmVector3 & location,
    AmReal32 userGain
) const = 0

Parameters:

  • handle A handle to the switch container to play.
  • location The location at which the switch container should be played.
  • userGain The gain of the sound. Must be in the range [0, 1].

Note:

The userGain parameter will not be used directly, but instead, it will be used in the final gain computation, which may include other factors like the attenuation and the "master" gain.

Returns:

The channel the switch container is being played on. If the switch container could not be played, or the given handle is invalid, an invalid Channel is returned.

Play[4/25]

Plays a switch container associated with the given handle in an Entity scope.

virtual Channel Amplitude::Engine::Play (
    SwitchContainerHandle handle,
    const Entity & entity
) const = 0

Note:

Switch containers played using this method should have been set in the Entity scope from their asset file. See more here.

Parameters:

  • handle A handle to the switch container to play.
  • entity The entity on which the switch container should be played.

Returns:

The channel the switch container is being played on. If the switch container could not be played, the given handle is invalid, or the given entity is invalid, an invalid Channel is returned.

Play[5/25]

Plays a switch container associated with the given handle in an Entity scope.

virtual Channel Amplitude::Engine::Play (
    SwitchContainerHandle handle,
    const Entity & entity,
    AmReal32 userGain
) const = 0

Note:

Switch containers played using this method should have been set in the Entity scope from their asset file. See more here.

Parameters:

  • handle A handle to the switch container to play.
  • entity The entity on which the switch container should be played.
  • userGain The gain of the sound. Must be in the range [0, 1].

Note:

The userGain parameter will not be used directly, but instead, it will be used in the final gain computation, which may include other factors like the attenuation and the "master" gain.

Returns:

The channel the switch container is being played on. If the switch container could not be played, the given handle is invalid, or the given entity is invalid, an invalid Channel is returned.

Play[6/25]

Plays a collection associated with the given handle in the World scope.

virtual Channel Amplitude::Engine::Play (
    CollectionHandle handle
) const = 0

Parameters:

  • handle A handle to the collection to play.

Returns:

The channel the collection is being played on. If the collection could not be played, or the handle is invalid, an invalid Channel is returned.

Play[7/25]

Plays a collection associated with the given handle in the World scope.

virtual Channel Amplitude::Engine::Play (
    CollectionHandle handle,
    const AmVector3 & location
) const = 0

Parameters:

  • handle A handle to the collection to play.
  • location The location at which the collection should be played.

Returns:

The channel the collection is being played on. If the collection could not be played, or the handle is invalid, an invalid Channel is returned.

Play[8/25]

Plays a collection associated with the given handle in the World scope.

virtual Channel Amplitude::Engine::Play (
    CollectionHandle handle,
    const AmVector3 & location,
    AmReal32 userGain
) const = 0

Parameters:

  • handle A handle to the collection to play.
  • location The location at which the collection should be played.
  • userGain The gain of the sound. Must be in the range [0, 1].

Note:

The userGain parameter will not be used directly, but instead, it will be used in the final gain computation, which may include other factors like the attenuation and the "master" gain.

Returns:

The channel the collection is being played on. If the collection could not be played, or the handle is invalid, an invalid Channel is returned.

Play[9/25]

Plays a collection associated with the given handle in the Entity scope.

virtual Channel Amplitude::Engine::Play (
    CollectionHandle handle,
    const Entity & entity
) const = 0

Note:

Collections played using this method should have been set in the Entity scope from their asset file. See more here.

Parameters:

  • handle A handle to the collection to play.
  • entity The entity on which the collection should be played.

Returns:

The channel the collection is being played on. If the collection could not be played, the given handle is invalid, or the given entity is invalid, an invalid Channel is returned.

Play[10/25]

Plays a collection associated with the given handle in an Entity scope.

virtual Channel Amplitude::Engine::Play (
    CollectionHandle handle,
    const Entity & entity,
    AmReal32 userGain
) const = 0

Note:

Collections played using this method should have been set in the Entity scope from their asset file. See more here.

Parameters:

  • handle A handle to the collection to play.
  • entity The entity on which the collection should be played.
  • userGain The gain of the sound. Must be in the range [0, 1].

Note:

The userGain parameter will not be used directly, but instead, it will be used in the final gain computation, which may include other factors like the attenuation and the "master" gain.

Returns:

The channel the collection is being played on. If the collection could not be played, the given handle is invalid, or the given entity is invalid, an invalid Channel is returned.

Play[11/25]

Plays a sound associated with the given handle in the World scope.

virtual Channel Amplitude::Engine::Play (
    SoundHandle handle
) const = 0

Parameters:

  • handle A handle to the sound to play.

Returns:

The channel the sound is being played on. If the sound could not be played, the given handle is invalid, an invalid Channel is returned.

Play[12/25]

Plays a sound associated with the given handle in the World scope.

virtual Channel Amplitude::Engine::Play (
    SoundHandle handle,
    const AmVector3 & location
) const = 0

Parameters:

  • handle A handle to the sound to play.
  • location The location at which the sound should be played.

Returns:

The channel the sound is being played on. If the sound could not be played, the given handle is invalid, an invalid Channel is returned.

Play[13/25]

Plays a sound associated with the given handle in the World scope.

virtual Channel Amplitude::Engine::Play (
    SoundHandle handle,
    const AmVector3 & location,
    AmReal32 userGain
) const = 0

Parameters:

  • handle A handle to the sound to play.
  • location The location at which the sound should be played.
  • userGain The gain of the sound. Must be in the range [0, 1].

Note:

The userGain parameter will not be used directly, but instead, it will be used in the final gain computation, which may include other factors like the attenuation and the "master" gain.

Returns:

The channel the sound is being played on. If the sound could not be played, the given handle is invalid, an invalid Channel is returned.

Play[14/25]

Plays a sound associated with the given sound handle in an Entity scope.

virtual Channel Amplitude::Engine::Play (
    SoundHandle handle,
    const Entity & entity
) const = 0

Note:

Sounds played using this method should have been set in the Entity scope from their asset file. See more here.

Parameters:

  • handle A handle to the sound to play.
  • entity The entity on which the sound should be played.

Returns:

The channel the sound is being played on. If the sound could not be played, the given handle is invalid, or the given entity is invalid, an invalid Channel is returned.

Play[15/25]

Plays a sound associated with the given sound handle in an Entity .

virtual Channel Amplitude::Engine::Play (
    SoundHandle handle,
    const Entity & entity,
    AmReal32 userGain
) const = 0

Note:

Sounds played using this method should have been set in the Entity scope from their asset file. See more here.

Parameters:

  • handle A handle to the sound to play.
  • entity The entity on which the sound should be played.
  • userGain The gain of the sound. Must be in the range [0, 1].

Note:

The userGain parameter will not be used directly, but instead, it will be used in the final gain computation, which may include other factors like the attenuation and the "master" gain.

Returns:

The channel the sound is being played on. If the sound could not be played, the given handle is invalid, or the given entity is invalid, an invalid Channel is returned.

Play[16/25]

Plays a sound object associated with the given name in the World scope.

virtual Channel Amplitude::Engine::Play (
    const AmString & name
) const = 0

Note:

Playing a sound object with its handle is faster than using the name as using the name requires an internal lookup.

Parameters:

  • name The name of the sound object to play.

Returns:

The channel the sound object is being played on. If the object could not be played, or an object with the given name was not found, an invalid Channel is returned.

Play[17/25]

Plays a sound object associated with the given name in the World scope.

virtual Channel Amplitude::Engine::Play (
    const AmString & name,
    const AmVector3 & location
) const = 0

Note:

Playing a sound object with its handle is faster than using the name as using the name requires an internal lookup.

Parameters:

  • name The name of the sound object to play.
  • location The location at which the sound should be played.

Returns:

The channel the sound object is being played on. If the object could not be played, or an object with the given name was not found, an invalid Channel is returned.

Play[18/25]

Plays a sound object associated with the given name in the World scope.

virtual Channel Amplitude::Engine::Play (
    const AmString & name,
    const AmVector3 & location,
    AmReal32 userGain
) const = 0

Note:

Playing a sound object with its handle is faster than using the name as using the name requires an internal lookup.

Parameters:

  • name The name of the sound object to play.
  • location The location at which the sound should be played.
  • userGain The gain of the sound. Must be in the range [0, 1].

Note:

The userGain parameter will not be used directly, but instead, it will be used in the final gain computation, which may include other factors like the attenuation and the "master" gain.

Returns:

The channel the sound object is being played on. If the object could not be played, or an object with the given name was not found, an invalid Channel is returned.

Play[19/25]

Plays a sound object associated with the given name in an Entity scope.

virtual Channel Amplitude::Engine::Play (
    const AmString & name,
    const Entity & entity
) const = 0

Note:

Playing a sound object with its handle is faster than using the name as using the name requires an internal lookup.

Note:

Sound objects played using this method should have been set in the Entity scope from their asset file. See more here.

Parameters:

  • name The name of the sound object to play.
  • entity The entity on which the sound object should be played.

Returns:

The channel the sound object is being played on. If the object could not be played, an object with the given name was not found, or the entity is invalid, an invalid Channel is returned.

Play[20/25]

Plays a sound object associated with the given name in an Entity scope.

virtual Channel Amplitude::Engine::Play (
    const AmString & name,
    const Entity & entity,
    AmReal32 userGain
) const = 0

Note:

Playing a sound object with its handle is faster than using the name as using the name requires an internal lookup.

Note:

Sound objects played using this method should have been set in the Entity scope from their asset file. See more here.

Parameters:

  • name The name of the sound object to play.
  • entity The entity on which the sound object should be played.
  • userGain The gain of the sound. Must be in the range [0, 1].

Note:

The userGain parameter will not be used directly, but instead, it will be used in the final gain computation, which may include other factors like the attenuation and the "master" gain.

Returns:

The channel the sound object is being played on. If the object could not be played, an object with the given name was not found, or the entity is invalid, an invalid Channel is returned.

Play[21/25]

Plays a sound object associated with the given ID in the World scope.

virtual Channel Amplitude::Engine::Play (
    AmObjectID id
) const = 0

Note:

Playing a sound object with its handle is faster than using the ID as using the ID requires an internal lookup.

Parameters:

  • id The ID of the sound object to play.

Returns:

The channel the sound object is being played on. If the object could not be played, or an object with the given ID was not found, an invalid Channel is returned.

Play[22/25]

Plays a sound object associated with the given ID in the World scope.

virtual Channel Amplitude::Engine::Play (
    AmObjectID id,
    const AmVector3 & location
) const = 0

Note:

Playing a sound object with its handle is faster than using the ID as using the ID requires an internal lookup.

Parameters:

  • id The ID of the sound object to play.
  • location The location at which the sound object should be played.

Returns:

The channel the sound object is being played on. If the object could not be played, or an object with the given ID was not found, an invalid Channel is returned.

Play[23/25]

Plays a sound object associated with the given ID in the World scope.

virtual Channel Amplitude::Engine::Play (
    AmObjectID id,
    const AmVector3 & location,
    AmReal32 userGain
) const = 0

Note:

Playing a sound object with its handle is faster than using the ID as using the ID requires an internal lookup.

Parameters:

  • id The ID of the sound object to play.
  • location The location at which the sound object should be played.
  • userGain The gain of the sound. Must be in the range [0, 1].

Note:

The userGain parameter will not be used directly, but instead, it will be used in the final gain computation, which may include other factors like the attenuation and the "master" gain.

Returns:

The channel the sound object is being played on. If the object could not be played, or an object with the given ID was not found, an invalid Channel is returned.

Play[24/25]

Plays a sound object associated with the given ID in an Entity scope.

virtual Channel Amplitude::Engine::Play (
    AmObjectID id,
    const Entity & entity
) const = 0

Note:

Playing a sound object with its handle is faster than using the ID as using the ID requires an internal lookup.

Note:

Sound objects played using this method should have been set in the Entity scope from their asset file. See more here.

Parameters:

  • id The ID of the sound object to play.
  • entity The entity on which the sound object should be played.

Returns:

The channel the sound object is being played on. If the object could not be played, an object with the given ID was not found, or the entity is invalid, an invalid Channel is returned.

Play[25/25]

Plays a sound object associated with the given ID in an Entity scope.

virtual Channel Amplitude::Engine::Play (
    AmObjectID id,
    const Entity & entity,
    AmReal32 userGain
) const = 0

Note:

Playing a sound object with its handle is faster than using the ID as using the ID requires an internal lookup.

Note:

Sound objects played using this method should have been set in the Entity scope from their asset file. See more here.

Parameters:

  • id The ID of the sound object to play.
  • entity The entity on which the sound object should be played.
  • userGain The gain of the sound. Must be in the range [0, 1].

Note:

The userGain parameter will not be used directly, but instead, it will be used in the final gain computation, which may include other factors like the attenuation and the "master" gain.

Returns:

The channel the sound object is being played on. If the object could not be played, an object with the given ID was not found, or the entity is invalid, an invalid Channel is returned.

RemoveEntity[1/2]

Removes an Entity .

virtual void Amplitude::Engine::RemoveEntity (
    const Entity * entity
) const = 0

Parameters:

  • entity The game entity to be removed.

See also: Entity

RemoveEntity[2/2]

Removes an Entity given its ID.

virtual void Amplitude::Engine::RemoveEntity (
    AmEntityID id
) const = 0

Parameters:

  • id The ID of the game entity to be removed.

See also: Entity

RemoveEnvironment[1/2]

Removes an Environment .

virtual void Amplitude::Engine::RemoveEnvironment (
    const Environment * environment
) const = 0

Parameters:

  • environment The game environment to be removed.

See also: Environment

RemoveEnvironment[2/2]

Removes an Environment given its ID.

virtual void Amplitude::Engine::RemoveEnvironment (
    AmEnvironmentID id
) const = 0

Parameters:

  • id The ID of the game environment to be removed.

See also: Environment

RemoveListener[1/2]

Removes a Listener given its ID.

virtual void Amplitude::Engine::RemoveListener (
    AmListenerID id
) const = 0

Parameters:

  • id The ID of the Listener to be removed.

See also: Listener

RemoveListener[2/2]

Removes a Listener given its handle.

virtual void Amplitude::Engine::RemoveListener (
    const Listener * listener
) const = 0

Parameters:

  • listener The Listener to be removed.

See also: Listener

RemoveRoom[1/2]

Removes a Room .

virtual void Amplitude::Engine::RemoveRoom (
    const Room * room
) const = 0

Parameters:

  • room The room to be removed.

See also: Room

RemoveRoom[2/2]

Removes a Room given its ID.

virtual void Amplitude::Engine::RemoveRoom (
    AmRoomID id
) const = 0

Parameters:

  • id The ID of the room to be removed.

See also: Room

SetDefaultListener[1/2]

Sets the default sound listener.

virtual void Amplitude::Engine::SetDefaultListener (
    const Listener * listener
) = 0

This method will set the default listener that will render every played sound source.

Note:

This method takes effect only if the listener_fetch_mode engine setting is set to Default.

Parameters:

  • listener A valid and initialized Listener instance.
SetDefaultListener[2/2]

Sets the default sound listener.

virtual void Amplitude::Engine::SetDefaultListener (
    AmListenerID id
) = 0

This method will set the default listener that will render every played sound source.

Note:

This method takes effect only if the listener_fetch_mode engine setting is set to Default.

Parameters:

  • id The ID of a valid and registered Listener.
SetFileSystem

Sets a file system implementation to be used by the engine.

virtual void Amplitude::Engine::SetFileSystem (
    std::shared_ptr< FileSystem > fs
) = 0

Parameters:

  • fs The file system implementation.
SetMasterGain

Adjusts the "master" gain of the mixer.

virtual void Amplitude::Engine::SetMasterGain (
    AmReal32 gain
) const = 0

Parameters:

  • gain The "master" gain.
SetMute

Mutes the engine, but keep processing audio.

virtual void Amplitude::Engine::SetMute (
    bool mute
) const = 0

Parameters:

  • mute Whether to mute or unmute the engine.
SetRtpcValue[1/3]

Sets the value of an RTPC .

virtual void Amplitude::Engine::SetRtpcValue (
    RtpcHandle handle,
    double value
) const = 0

Parameters:

  • handle The handle of the RTPC to update.
  • value The value to set to the RTPC.
SetRtpcValue[2/3]

Sets the value of an RTPC .

virtual void Amplitude::Engine::SetRtpcValue (
    AmRtpcID id,
    double value
) const = 0

Parameters:

  • id The ID of the RTPC to update.
  • value The value to set to the RTPC.
SetRtpcValue[3/3]

Sets the value of an RTPC .

virtual void Amplitude::Engine::SetRtpcValue (
    const AmString & name,
    double value
) const = 0

Parameters:

  • name THe name of the RTPC to update.
  • value The value to set to the RTPC.
SetSwitchState[1/9]

Sets the active state of the defined Switch .

virtual void Amplitude::Engine::SetSwitchState (
    SwitchHandle handle,
    AmObjectID stateId
) const = 0

Parameters:

  • handle The handle of the Switch.
  • stateId The ID of the active state to set.
SetSwitchState[2/9]

Sets the active state of the defined Switch .

virtual void Amplitude::Engine::SetSwitchState (
    SwitchHandle handle,
    const AmString & stateName
) const = 0

Parameters:

  • handle The handle of the Switch.
  • stateName The name of the active state to set.
SetSwitchState[3/9]

Sets the active state of the defined Switch .

virtual void Amplitude::Engine::SetSwitchState (
    SwitchHandle handle,
    const SwitchState & state
) const = 0

Parameters:

  • handle The handle of the Switch.
  • state The active state to set.
SetSwitchState[4/9]

Sets the active state of the defined Switch .

virtual void Amplitude::Engine::SetSwitchState (
    AmSwitchID id,
    AmObjectID stateId
) const = 0

Parameters:

  • id The ID of the Switch to update.
  • stateId The ID of the active state to set.
SetSwitchState[5/9]

Sets the active state of the defined Switch .

virtual void Amplitude::Engine::SetSwitchState (
    AmSwitchID id,
    const AmString & stateName
) const = 0

Parameters:

  • id The ID of the Switch to update.
  • stateName The name of the active state to set.
SetSwitchState[6/9]

Sets the active state of the defined Switch .

virtual void Amplitude::Engine::SetSwitchState (
    AmSwitchID id,
    const SwitchState & state
) const = 0

Parameters:

  • id The ID of the Switch to update.
  • state The active state to set.
SetSwitchState[7/9]

Sets the active state of the defined Switch .

virtual void Amplitude::Engine::SetSwitchState (
    const AmString & name,
    AmObjectID stateId
) const = 0

Parameters:

  • name The name of the Switch to update.
  • stateId The ID of the active state to set.
SetSwitchState[8/9]

Sets the active state of the defined Switch .

virtual void Amplitude::Engine::SetSwitchState (
    const AmString & name,
    const AmString & stateName
) const = 0

Parameters:

  • name The name of the Switch to update.
  • stateName The name of the active state to set.
SetSwitchState[9/9]

Sets the active state of the defined Switch .

virtual void Amplitude::Engine::SetSwitchState (
    const AmString & name,
    const SwitchState & state
) const = 0

Parameters:

  • name The name of the Switch to update.
  • state The active state to set.
StartCloseFileSystem

Closes the file system, usually in a separate thread.

virtual void Amplitude::Engine::StartCloseFileSystem () = 0
StartLoadSoundFiles

Starts the loading of sound files referenced in loaded sound banks.

virtual void Amplitude::Engine::StartLoadSoundFiles () = 0

This process will run in another thread. You must call TryFinalizeLoadSoundFiles() to know when the loading has completed and to automatically release used resources.

StartOpenFileSystem

Opens the file system, usually in a separate thread.

virtual void Amplitude::Engine::StartOpenFileSystem () = 0
StopAll

Stops all playing sound objects.

virtual void Amplitude::Engine::StopAll () const = 0

This is the equivalent of calling Stop() on all generated channels.

Trigger[1/3]

Triggers the event associated with the given handle.

virtual EventCanceler Amplitude::Engine::Trigger (
    EventHandle handle,
    const Entity & entity
) const = 0

Parameters:

  • handle The handle of the event to trigger.
  • entity The entity on which trigger the event.

Returns:

An EventCanceler object which may be used to cancel the execution of the event.

Trigger[2/3]

Triggers the event associated with the given name.

virtual EventCanceler Amplitude::Engine::Trigger (
    const AmString & name,
    const Entity & entity
) const = 0

Note:

Triggering an event with its EventHandle is faster than using the event name as using the name requires an internal lookup.

Parameters:

  • name The name of the event to trigger.
  • entity The entity on which trigger the event.

Returns:

An EventCanceler object which may be used to cancel the execution of the event.

Trigger[3/3]

Triggers the event associated with the given ID.

virtual EventCanceler Amplitude::Engine::Trigger (
    AmEventID id,
    const Entity & entity
) const = 0

Note:

Triggering an event with its EventHandle is faster than using the event ID as using the ID requires an internal lookup.

Parameters:

  • id The ID of event to trigger.
  • entity The entity on which trigger the event.

Returns:

An EventCanceler object which may be used to cancel the execution of the event.

TryFinalizeCloseFileSystem

Checks if the file system has been fully closed.

virtual bool Amplitude::Engine::TryFinalizeCloseFileSystem () = 0

This method is helpful when the file system implementation is closed asynchronously. You can use this method to wait until the file system is fully closed.

// Close the file system
amEngine->StartCloseFileSystem();
while (!amEngine->TryFinalizeCloseFileSystem()) {
    // Wait until the file system is fully closed
    Thread::Sleep(100);
}
// The file system is now closed
//...

Returns:

true if the file system has been fully closed, false otherwise.

TryFinalizeLoadSoundFiles

Checks if the loading of sound files has been completed and releases used resources.

virtual bool Amplitude::Engine::TryFinalizeLoadSoundFiles () = 0

Note:

This method should be called after calling StartLoadSoundFiles().

// Start loading sound files
amEngine->StartLoadSoundFiles();
while (!amEngine->TryFinalizeLoadSoundFiles()) {
    // Wait for loading to complete
    Thread::Sleep(100);
}
// Sound files have been loaded, and used resources have been released

Returns:

true when the sound files have been successfully loaded, false otherwise.

TryFinalizeOpenFileSystem

Checks if the file system has been fully loaded.

virtual bool Amplitude::Engine::TryFinalizeOpenFileSystem () = 0

This method is helpful when the file system implementation is loaded asynchronously. You can use this method to wait until the file system is fully loaded before using it.

// Open the file system
amEngine->StartOpenFileSystem();
while (!amEngine->TryFinalizeOpenFileSystem()) {
    // Wait until the file system is fully loaded
    Thread::Sleep(100);
}
// Use the file system now
//...

Returns:

true if the file system has been fully loaded, false otherwise.

UnloadSoundBank[1/2]

Unloads a sound bank given its filename.

virtual void Amplitude::Engine::UnloadSoundBank (
    const AmOsString & filename
) = 0

Parameters:

  • filename The file to unload.
UnloadSoundBank[2/2]

Unloads a sound bank given its ID.

virtual void Amplitude::Engine::UnloadSoundBank (
    AmBankID id
) = 0

Parameters:

  • id The sound bank id to unload.
UnloadSoundBanks

Unloads all the loaded sound banks.

virtual void Amplitude::Engine::UnloadSoundBanks () = 0
Version

Gets the current version of the library.

virtual const AmVersion * Amplitude::Engine::Version () const = 0

Returns:

The version string structure

WaitUntilFrames

Waits until the specified number of frames are ready.

virtual void Amplitude::Engine::WaitUntilFrames (
    AmUInt64 frameCount
) const = 0

Note:

This method blocks the current thread until the specified number of frames is ready.

Parameters:

  • frameCount The number of frames to wait until.
WaitUntilNextFrame

Waits until the next frame is ready.

virtual void Amplitude::Engine::WaitUntilNextFrame () const = 0

Note:

This method blocks the current thread until the next frame is ready.

~Engine

Default constructor.

virtual Amplitude::Engine::~Engine () = default

Public Static Functions Documentation

AddPluginSearchPath

Adds a path in the plugin search paths list.

static void Amplitude::Engine::AddPluginSearchPath (
    const AmOsString & path
) 

Parameters:

  • path The path to add in the plugins search paths list.
DestroyInstance

Destroys the unique instance of the Amplitude Engine .

static void Amplitude::Engine::DestroyInstance () 
GetInstance

Returns a unique instance of the Amplitude Engine .

static Engine * Amplitude::Engine::GetInstance () 
LoadPlugin

Loads a plugin library from the given path.

static AmVoidPtr Amplitude::Engine::LoadPlugin (
    const AmOsString & pluginLibraryName
) 

Parameters:

  • pluginLibraryName The name of the plugin library to load.

Returns:

A handle to the loaded plugin library.

RegisterDefaultExtensions

Register all default extensions.

static bool Amplitude::Engine::RegisterDefaultExtensions () 
RegisterExtension

Registers an extension into Amplitude.

template<typename T, class... Args>
static inline std::shared_ptr< T > Amplitude::Engine::RegisterExtension (
    Args &&... args
) 

Note:

Amplitude will automatically create a new instance of the extension by calling the class constructor with the specified arguments.

Parameters:

  • args The arguments to pass to the extension class constructor.

Returns:

The registered extension.

RemovePluginSearchPath

Removes a path from the plugin search paths list.

static void Amplitude::Engine::RemovePluginSearchPath (
    const AmOsString & path
) 

Parameters:

  • path The path to remove from the plugins search path list.
UnregisterDefaultExtensions

Unregister all default extensions.

static bool Amplitude::Engine::UnregisterDefaultExtensions () 
UnregisterExtension

Unregisters an extension from Amplitude.

template<typename T>
static inline void Amplitude::Engine::UnregisterExtension (
    std::shared_ptr< T > & extension
) 

Parameters:

  • extension The extension to unregister. The pointer will automatically be discarded by calling this method.

The documentation for this class was generated from the following file: include/SparkyStudios/Audio/Amplitude/Core/Engine.h