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:
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 .
Parameters:
-
idThe game entity ID.
Returns:
An initialized Entity.
See also: Entity
AddEnvironment
Initializes and return a new Environment .
Parameters:
-
idThe game environment ID.
Returns:
An initialized Environment.
See also: Environment
AddListener
Initializes and returns a new Listener .
Parameters:
-
idThe new listener ID.
Returns:
An initialized Listener.
See also: Listener
AddRoom
Initializes and return a new Room .
Parameters:
-
idThe room ID.
Returns:
An initialized Room.
See also: Room
AdvanceFrame
Updates the engine state for the given number of milliseconds.
Parameters:
-
deltaThe number of milliseconds since the last frame.
CancelAllEvents
Cancels all events currently being processed.
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.
Parameters:
-
entityThe entity for which cancel triggered events.
Deinitialize
Deinitializes the Amplitude engine.
Returns:
true when the engine has been successfully deinitialized, false otherwise.
EnsureSoundBankLoaded
Make sure a sound bank is loaded in the engine.
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:
filenameThe path to the sound bank asset file to load.
FindBus[1/2]
Returns the Bus with the specified name.
Parameters:
-
nameThe 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.
Parameters:
-
idThe 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.
Returns:
The number of active entities.
GetActiveEnvironmentsCount
Get the number of active environments in the engine.
Returns:
The number of active environments.
GetActiveListenersCount
Get the number of active listeners in the engine.
Returns:
The number of active listeners.
GetActiveRoomsCount
Get the number of active rooms in the engine.
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:
-
nameThe 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 ).
Parameters:
-
idThe 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:
-
filenameThe 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.
Parameters:
-
channelIDThe 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 ).
Parameters:
-
nameThe 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 ).
Parameters:
-
idThe 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:
-
filenameThe 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.
Returns:
The path to the engine configuration file.
GetDefaultListener
Gets the default audio Listener .
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.
Returns:
The Doppler factor.
GetEffectHandle[1/2]
Gets an EffectHandle given its name as defined in its asset file (.amfx ).
Parameters:
-
nameThe 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 ).
Parameters:
-
idThe 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:
-
filenameThe 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.
Parameters:
-
idThe 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.
Parameters:
-
idThe 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 ).
Parameters:
-
nameThe 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 ).
Parameters:
-
idThe 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:
-
filenameThe 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.
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.
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.
Returns:
The HRIR sphere sampling mode.
GetListener
Returns the Listener with the given ID.
Parameters:
-
idThe 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.
Returns:
The mixer "master" gain.
GetMaxEntitiesCount
Gets the maximum number of game entities handled by the engine.
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.
Returns:
The maximum number of environments.
GetMaxListenersCount
Gets the maximum number of listeners handled by the engine.
Returns:
The maximum number of listeners.
GetMaxRoomsCount
Gets the maximum number of rooms handled by the engine.
Returns:
The maximum number of rooms.
GetMixer
Gets the mixer instance.
Returns:
The Amplimix mixer instance.
GetObstructionCoefficientCurve
Gets the obstruction coefficient curve, as set in the loaded engine configuration file.
Returns:
The obstruction coefficient curve.
GetObstructionGainCurve
Gets the obstruction gain curve, as set in the loaded engine configuration file.
Returns:
The obstruction gain curve.
GetOcclusionCoefficientCurve
Gets the occlusion coefficient curve, as set in the loaded engine configuration file.
Returns:
The occlusion coefficient curve.
GetOcclusionGainCurve
Gets the occlusion gain curve, as set in the loaded engine configuration file.
Returns:
The occlusion gain curve.
GetPanningMode
Gets the panning mode defined in the loaded engine configuration.
Returns:
The panning mode.
GetPipelineHandle
Gets a PipelineHandle from the loaded pipeline asset file (.ampipeline ).
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.
Parameters:
-
idThe 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 ).
Parameters:
-
nameThe 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 ).
Parameters:
-
idThe 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:
-
filenameThe 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.
Returns:
The number of samples per stream.
GetSoundHandle[1/2]
Gets a SoundHandle given its name as defined in its asset file (.amsound ).
Parameters:
-
nameThe 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 ).
Parameters:
-
idThe 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:
-
filenameThe 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:
-
nameThe 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.
Parameters:
-
idThe 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:
-
filenameThe 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.
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:
-
nameThe 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:
-
idThe 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:
-
filenameThe 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 ).
Parameters:
-
nameThe 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 ).
Parameters:
-
idThe 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:
-
filenameThe 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.
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.
Parameters:
-
filenameThe 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.
Parameters:
-
idThe 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.
Returns:
true if any sound banks have been loaded, false otherwise.
Initialize
Initializes the Amplitude engine.
Parameters:
-
configFileThe 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.
Returns:
Whether the game is tracking the environment amounts.
IsInitialized
Checks if the Amplitude engine has been successfully initialized.
Returns:
true if the engine has been successfully initialized, false otherwise.
IsMuted
Checks whether the engine is currently muted.
Returns:
true if the engine is muted, false otherwise.
IsPaused
Checks whether the engine is currently paused.
Returns:
true if the engine is currently paused, false otherwise.
IsStopping
Checks if the engine is stopping.
Returns:
true if the engine is stopping, false otherwise.
LoadSoundBank[1/2]
Loads a sound bank from a binary asset file ( .ambank ).
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:
-
filenameThe 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 ).
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:
-
filenameThe path to the sound bank asset file. -
outIDThe 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.
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:
-
ptrThe pointer to the sound bank data to be loaded. -
sizeThe 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:
-
ptrThe pointer to the sound bank data to be loaded. -
sizeThe size of the memory to read. -
outIDThe 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:
-
callbackThe callback to be called when the next frame is ready.
Pause
Pauses or resumes all playing sounds and streams.
Parameters:
-
pauseWhether to pause or resume the engine.
Play[1/25]
Plays a switch container associated with the given handle in the World scope.
This method is recommended for switch containers with spatialization disabled, since no positional information needs to be provided.
Parameters:
-
handleA 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:
-
handleA handle to the switch container to play. -
locationThe 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:
-
handleA handle to the switch container to play. -
locationThe location at which the switch container should be played. -
userGainThe 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:
-
handleA handle to the switch container to play. -
entityThe 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:
-
handleA handle to the switch container to play. -
entityThe entity on which the switch container should be played. -
userGainThe 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.
Parameters:
-
handleA 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:
-
handleA handle to the collection to play. -
locationThe 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:
-
handleA handle to the collection to play. -
locationThe location at which the collection should be played. -
userGainThe 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:
-
handleA handle to the collection to play. -
entityThe 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:
-
handleA handle to the collection to play. -
entityThe entity on which the collection should be played. -
userGainThe 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.
Parameters:
-
handleA 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:
-
handleA handle to the sound to play. -
locationThe 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:
-
handleA handle to the sound to play. -
locationThe location at which the sound should be played. -
userGainThe 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.
Note:
Sounds played using this method should have been set in the Entity scope from their asset file. See more here.
Parameters:
-
handleA handle to the sound to play. -
entityThe 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:
-
handleA handle to the sound to play. -
entityThe entity on which the sound should be played. -
userGainThe 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.
Note:
Playing a sound object with its handle is faster than using the name as using the name requires an internal lookup.
Parameters:
-
nameThe 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:
-
nameThe name of the sound object to play. -
locationThe 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:
-
nameThe name of the sound object to play. -
locationThe location at which the sound should be played. -
userGainThe 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.
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:
-
nameThe name of the sound object to play. -
entityThe 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:
-
nameThe name of the sound object to play. -
entityThe entity on which the sound object should be played. -
userGainThe 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.
Note:
Playing a sound object with its handle is faster than using the ID as using the ID requires an internal lookup.
Parameters:
-
idThe 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.
Note:
Playing a sound object with its handle is faster than using the ID as using the ID requires an internal lookup.
Parameters:
-
idThe ID of the sound object to play. -
locationThe 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:
-
idThe ID of the sound object to play. -
locationThe location at which the sound object should be played. -
userGainThe 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.
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:
-
idThe ID of the sound object to play. -
entityThe 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:
-
idThe ID of the sound object to play. -
entityThe entity on which the sound object should be played. -
userGainThe 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 .
Parameters:
-
entityThe game entity to be removed.
See also: Entity
RemoveEntity[2/2]
Removes an Entity given its ID.
Parameters:
-
idThe ID of the game entity to be removed.
See also: Entity
RemoveEnvironment[1/2]
Removes an Environment .
Parameters:
-
environmentThe game environment to be removed.
See also: Environment
RemoveEnvironment[2/2]
Removes an Environment given its ID.
Parameters:
-
idThe ID of the game environment to be removed.
See also: Environment
RemoveListener[1/2]
Removes a Listener given its ID.
Parameters:
-
idThe ID of theListenerto be removed.
See also: Listener
RemoveListener[2/2]
Removes a Listener given its handle.
Parameters:
-
listenerTheListenerto be removed.
See also: Listener
RemoveRoom[2/2]
Removes a Room given its ID.
Parameters:
-
idThe ID of the room to be removed.
See also: Room
SetDefaultListener[1/2]
Sets the default sound listener.
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:
-
listenerA valid and initializedListenerinstance.
SetDefaultListener[2/2]
Sets the default sound listener.
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:
-
idThe ID of a valid and registeredListener.
SetFileSystem
Sets a file system implementation to be used by the engine.
Parameters:
-
fsThe file system implementation.
SetMasterGain
Adjusts the "master" gain of the mixer.
Parameters:
-
gainThe "master" gain.
SetMute
Mutes the engine, but keep processing audio.
Parameters:
-
muteWhether to mute or unmute the engine.
SetRtpcValue[1/3]
Sets the value of an RTPC .
Parameters:
-
handleThe handle of theRTPCto update. -
valueThe value to set to theRTPC.
SetRtpcValue[2/3]
Sets the value of an RTPC .
Parameters:
-
idThe ID of theRTPCto update. -
valueThe value to set to theRTPC.
SetRtpcValue[3/3]
Sets the value of an RTPC .
Parameters:
-
nameTHe name of theRTPCto update. -
valueThe value to set to theRTPC.
SetSwitchState[1/9]
Sets the active state of the defined Switch .
virtual void Amplitude::Engine::SetSwitchState (
SwitchHandle handle,
AmObjectID stateId
) const = 0
Parameters:
-
handleThe handle of theSwitch. -
stateIdThe 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:
-
handleThe handle of theSwitch. -
stateNameThe 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:
-
handleThe handle of theSwitch. -
stateThe active state to set.
SetSwitchState[4/9]
Sets the active state of the defined Switch .
Parameters:
-
idThe ID of theSwitchto update. -
stateIdThe 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:
-
idThe ID of theSwitchto update. -
stateNameThe 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:
-
idThe ID of theSwitchto update. -
stateThe 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:
-
nameThe name of theSwitchto update. -
stateIdThe 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:
-
nameThe name of theSwitchto update. -
stateNameThe 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:
-
nameThe name of theSwitchto update. -
stateThe active state to set.
StartCloseFileSystem
Closes the file system, usually in a separate thread.
StartLoadSoundFiles
Starts the loading of sound files referenced in loaded sound banks.
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.
StopAll
Stops all playing sound objects.
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:
-
handleThe handle of the event to trigger. -
entityThe 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:
-
nameThe name of the event to trigger. -
entityThe 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.
Note:
Triggering an event with its EventHandle is faster than using the event ID as using the ID requires an internal lookup.
Parameters:
-
idThe ID of event to trigger. -
entityThe 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.
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.
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.
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.
Parameters:
-
filenameThe file to unload.
UnloadSoundBank[2/2]
Unloads a sound bank given its ID.
Parameters:
-
idThe sound bank id to unload.
UnloadSoundBanks
Unloads all the loaded sound banks.
Version
Gets the current version of the library.
Returns:
The version string structure
WaitUntilFrames
Waits until the specified number of frames are ready.
Note:
This method blocks the current thread until the specified number of frames is ready.
Parameters:
-
frameCountThe number of frames to wait until.
WaitUntilNextFrame
Waits until the next frame is ready.
Note:
This method blocks the current thread until the next frame is ready.
Public Static Functions Documentation¶
AddPluginSearchPath
Adds a path in the plugin search paths list.
Parameters:
-
pathThe path to add in the plugins search paths list.
DestroyInstance
Destroys the unique instance of the Amplitude Engine .
GetInstance
Returns a unique instance of the Amplitude Engine .
LoadPlugin
Loads a plugin library from the given path.
Parameters:
-
pluginLibraryNameThe name of the plugin library to load.
Returns:
A handle to the loaded plugin library.
RegisterDefaultExtensions
Register all default extensions.
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:
-
argsThe arguments to pass to the extension class constructor.
Returns:
The registered extension.
RemovePluginSearchPath
Removes a path from the plugin search paths list.
Parameters:
-
pathThe path to remove from the plugins search path list.
UnregisterDefaultExtensions
Unregister all default extensions.
UnregisterExtension
Unregisters an extension from Amplitude.
template<typename T>
static inline void Amplitude::Engine::UnregisterExtension (
std::shared_ptr< T > & extension
)
Parameters:
-
extensionThe 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