Skip to content

Environment

An Environment is a zone where every spatialized audio playing inside him got applied a specific effect.

Detailed Description

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

Public Functions

Type Name
void Clear ()
Uninitializes this environment.
Environment ()
Creates an uninitialized environment.
Environment (EnvironmentInternalState * state)
Creates a wrapper instance over the provided state.
AmVector3 GetDirection () const
Gets the direction vector of the environment.
const Effect * GetEffect () const
Gets the effect linked to this environment.
AmReal32 GetFactor (const AmVector3 & location) const
Gets the environment factor for the given location.
AmReal32 GetFactor (const Entity & entity) const
Gets the environment factor for the given entity.
AmEnvironmentID GetId () const
Returns the unique ID of this environment.
const AmVector3 & GetLocation () const
Gets the current location of this environment.
const Orientation & GetOrientation () const
Gets the current orientation of this environment.
EnvironmentInternalState * GetState () const
Returns the internal state of this environment.
AmVector3 GetUp () const
Gets the up vector of the environment.
std::shared_ptr< Zone > GetZone () const
Gets the zone linked to this environment.
void SetEffect (AmEffectID effect) const
Sets the effect applied in the environment.
void SetEffect (const AmString & effect) const
Sets the effect applied in the environment.
void SetEffect (const Effect * effect) const
Sets the effect applied in the environment.
void SetLocation (const AmVector3 & location) const
Sets the location of this environment.
void SetOrientation (const Orientation & orientation) const
Sets the orientation of this environment.
void SetZone (std::shared_ptr< Zone > zone) const
Sets the zone for this environment.
void Update () const
Updates the state of this environment.
bool Valid () const
Checks whether this environment has been initialized.

Public Functions Documentation

Clear

Uninitializes this environment.

void Amplitude::Environment::Clear () 

Note:

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

To completely destroy the environment, use the RemoveEnvironment() method of the Engine instance.

amEngine->RemoveEnvironment(1234); // You should provide the environment ID
Environment[1/2]

Creates an uninitialized environment.

Amplitude::Environment::Environment () 

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

To create an initialized environment, use the AddEnvironment() method of the Engine instance.

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

Creates a wrapper instance over the provided state.

explicit Amplitude::Environment::Environment (
    EnvironmentInternalState * state
) 

Parameters:

  • state The internal state to wrap.

Warning:

This constructor is for internal usage only.

GetDirection

Gets the direction vector of the environment.

AmVector3 Amplitude::Environment::GetDirection () const

Returns:

The direction vector.

GetEffect

Gets the effect linked to this environment.

const Effect * Amplitude::Environment::GetEffect () const

Returns:

An Effect instance.

See also: Effect

GetFactor[1/2]

Gets the environment factor for the given location.

AmReal32 Amplitude::Environment::GetFactor (
    const AmVector3 & location
) const

Parameters:

  • location The location for which compute the environment factor.

Returns:

The environment factor.

GetFactor[2/2]

Gets the environment factor for the given entity.

AmReal32 Amplitude::Environment::GetFactor (
    const Entity & entity
) const

Parameters:

  • entity The entity for which compute the environment factor.

Returns:

The environment factor.

GetId

Returns the unique ID of this environment.

AmEnvironmentID Amplitude::Environment::GetId () const

Returns:

The environment's unique ID.

GetLocation

Gets the current location of this environment.

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

Returns:

The current location of this environment.

GetOrientation

Gets the current orientation of this environment.

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

Returns:

The current orientation of this environment.

GetState

Returns the internal state of this environment.

EnvironmentInternalState * Amplitude::Environment::GetState () const

Returns:

The environment internal state.

Warning:

This method is for internal usage only.

GetUp

Gets the up vector of the environment.

AmVector3 Amplitude::Environment::GetUp () const

Returns:

The up vector.

GetZone

Gets the zone linked to this environment.

std::shared_ptr< Zone > Amplitude::Environment::GetZone () const

Returns:

An zone instance.

See also: Zone

SetEffect[1/3]

Sets the effect applied in the environment.

void Amplitude::Environment::SetEffect (
    AmEffectID effect
) const

Parameters:

  • effect The ID of the effect to apply in the environment.

See also: Effect

SetEffect[2/3]

Sets the effect applied in the environment.

void Amplitude::Environment::SetEffect (
    const AmString & effect
) const

Parameters:

  • effect The name of the effect to apply in the environment.

See also: Effect

SetEffect[3/3]

Sets the effect applied in the environment.

void Amplitude::Environment::SetEffect (
    const Effect * effect
) const

Parameters:

  • effect The effect to apply in the environment.

See also: Effect

SetLocation

Sets the location of this environment.

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

Parameters:

  • location The new location.
SetOrientation

Sets the orientation of this environment.

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

Parameters:

  • orientation The new orientation.
SetZone

Sets the zone for this environment.

void Amplitude::Environment::SetZone (
    std::shared_ptr< Zone > zone
) const

Parameters:

  • zone The environment's zone.

See also: Zone

Update

Updates the state of this environment.

void Amplitude::Environment::Update () const

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

Warning:

This method is for internal usage only.

Valid

Checks whether this environment has been initialized.

bool Amplitude::Environment::Valid () const

Returns:

true if this environment is initialized, false otherwise.


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