Skip to content

Entity

An Entity represents a spatially positioned object in the game.

Detailed Description

Amplitude uses entities to link sound to an object in the game. Each sound played from an entity gets the location and orientation data from that entity.

The Entity class is a lightweight reference to an EntityInternalState object which is managed internally by the Engine.

Public Functions

Type Name
void Clear ()
Uninitializes this entity.
Entity ()
Creates an uninitialized entity.
Entity (EntityInternalState * state)
Creates a wrapper instance over the provided state.
AmUInt64 GetActiveChannelCount () const
Gets the number of active channels for this entity.
AmVector3 GetDirection () const
Gets the direction vector of the entity.
AmReal32 GetDirectivity () const
Gets the directivity of sounds played by this entity.
AmReal32 GetDirectivitySharpness () const
Gets the directivity sharpness of sounds played by this entity.
AmReal32 GetEnvironmentFactor (AmEnvironmentID environment) const
Gets the environment factor of this entity for the given environment.
const std::unordered_map< AmEnvironmentID, AmReal32 > & GetEnvironments () const
Gets the list of environments where this entity belongs or has visited.
AmEntityID GetId () const
Gets the ID of this entity.
const AmVector3 & GetLocation () const
Gets the current location of this entity.
AmReal32 GetObstruction () const
Gets the obstruction level of sounds played by this entity.
AmReal32 GetOcclusion () const
Gets the occlusion level of sounds played by this entity.
const Orientation & GetOrientation () const
Gets the orientation of the entity.
EntityInternalState * GetState () const
Returns the internal state of this entity.
AmVector3 GetUp () const
Gets the up vector of the entity.
const AmVector3 & GetVelocity () const
Gets the velocity of the entity.
void SetDirectivity (AmReal32 directivity, AmReal32 sharpness) const
Sets the directivity and sharpness of sounds played by this entity.
void SetEnvironmentFactor (AmEnvironmentID environment, AmReal32 factor) const
Sets the environment factor for this entity in the given environment.
void SetLocation (const AmVector3 & location) const
Sets the location of this entity.
void SetObstruction (AmReal32 obstruction) const
Sets the obstruction level of sounds played by this entity.
void SetOcclusion (AmReal32 occlusion) const
Sets the occlusion level of sounds played by this entity.
void SetOrientation (const Orientation & orientation) const
Sets the orientation of this entity.
void Update () const
Updates the state of this entity.
bool Valid () const
Checks whether this entity has been initialized.

Public Functions Documentation

Clear

Uninitializes this entity.

void Amplitude::Entity::Clear () 

Note:

This does not destroy the internal state it references, it just removes this reference to it.

To completely destroy the entity, use the RemoveEntity() method of the Engine instance.

amEngine->RemoveEntity(1234); // You should provide the entity ID
Entity[1/2]

Creates an uninitialized entity.

Amplitude::Entity::Entity () 

An uninitialized entity cannot provide location and orientation information, and therefore cannot play sounds.

To create an initialized entity, use the AddEntity() method of the Engine instance.

amEngine->AddEntity(1234); // You should provide a unique ID
Entity[2/2]

Creates a wrapper instance over the provided state.

explicit Amplitude::Entity::Entity (
    EntityInternalState * state
) 

Parameters:

  • state The internal state to wrap.

Warning:

This constructor is for internal usage only.

GetActiveChannelCount

Gets the number of active channels for this entity.

AmUInt64 Amplitude::Entity::GetActiveChannelCount () const

Returns:

The number of active channels.

GetDirection

Gets the direction vector of the entity.

AmVector3 Amplitude::Entity::GetDirection () const

Returns:

The direction vector.

GetDirectivity

Gets the directivity of sounds played by this entity.

AmReal32 Amplitude::Entity::GetDirectivity () const

Returns:

The directivity of sound sources.

GetDirectivitySharpness

Gets the directivity sharpness of sounds played by this entity.

AmReal32 Amplitude::Entity::GetDirectivitySharpness () const

Returns:

The directivity sharpness of sounds played by this entity.

GetEnvironmentFactor

Gets the environment factor of this entity for the given environment.

AmReal32 Amplitude::Entity::GetEnvironmentFactor (
    AmEnvironmentID environment
) const

Parameters:

  • environment The environment ID.

Returns:

The environment factor.

GetEnvironments

Gets the list of environments where this entity belongs or has visited.

const std::unordered_map< AmEnvironmentID, AmReal32 > & Amplitude::Entity::GetEnvironments () const

Returns:

The list of environments where this entity belongs or has visited.

GetId

Gets the ID of this entity.

AmEntityID Amplitude::Entity::GetId () const

Returns:

The entity ID.

GetLocation

Gets the current location of this entity.

const AmVector3 & Amplitude::Entity::GetLocation () const

Returns:

The current location of this entity.

GetObstruction

Gets the obstruction level of sounds played by this entity.

AmReal32 Amplitude::Entity::GetObstruction () const

Returns:

The obstruction amount.

GetOcclusion

Gets the occlusion level of sounds played by this entity.

AmReal32 Amplitude::Entity::GetOcclusion () const

Returns:

The occlusion amount.

GetOrientation

Gets the orientation of the entity.

const Orientation & Amplitude::Entity::GetOrientation () const

Returns:

The entity's orientation.

GetState

Returns the internal state of this entity.

EntityInternalState * Amplitude::Entity::GetState () const

Returns:

The entity internal state.

Warning:

This method is for internal usage only.

GetUp

Gets the up vector of the entity.

AmVector3 Amplitude::Entity::GetUp () const

Returns:

The up vector.

GetVelocity

Gets the velocity of the entity.

const AmVector3 & Amplitude::Entity::GetVelocity () const

Returns:

The entity's velocity.

SetDirectivity

Sets the directivity and sharpness of sounds played by this entity.

void Amplitude::Entity::SetDirectivity (
    AmReal32 directivity,
    AmReal32 sharpness
) const

Parameters:

  • directivity The directivity of the sound source, in the range [0, 1].
  • sharpness The directivity sharpness of the sound source, in the range [1, +INF]. Increasing this value increases the directivity towards the front of the source.
SetEnvironmentFactor

Sets the environment factor for this entity in the given environment.

void Amplitude::Entity::SetEnvironmentFactor (
    AmEnvironmentID environment,
    AmReal32 factor
) const

Parameters:

  • environment The environment ID.
  • factor The environment factor.
SetLocation

Sets the location of this entity.

void Amplitude::Entity::SetLocation (
    const AmVector3 & location
) const

Parameters:

  • location The new location.
SetObstruction

Sets the obstruction level of sounds played by this entity.

void Amplitude::Entity::SetObstruction (
    AmReal32 obstruction
) const

Parameters:

  • obstruction The obstruction amount.
SetOcclusion

Sets the occlusion level of sounds played by this entity.

void Amplitude::Entity::SetOcclusion (
    AmReal32 occlusion
) const

Parameters:

  • occlusion The occlusion amount.
SetOrientation

Sets the orientation of this entity.

void Amplitude::Entity::SetOrientation (
    const Orientation & orientation
) const

Parameters:

  • orientation The new orientation.
Update

Updates the state of this entity.

void Amplitude::Entity::Update () const

The Engine calls this method automatically on each frame to update the internal state of the entity.

Warning:

This method is for internal usage only.

Valid

Checks whether this entity has been initialized.

bool Amplitude::Entity::Valid () const

Returns:

true if this entity is initialized, false otherwise.


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