Skip to content

Environment

class Environment

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

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

Functions

Name Description
Environment Creates an uninitialized Environment.
Environment Creates a wrapper instance over the provided state.
Clear Uninitializes this Environment.
Valid Checks whether this Environment has been initialized.
GetId Returns the unique ID of this Environment.
SetLocation Sets the location of this Environment.
GetLocation Gets the current location of this Environment.
SetOrientation Sets the orientation of this Environment.
GetOrientation Gets the current orientation of this Environment.
GetDirection Gets the direction vector of the Environment.
GetUp Gets the up vector of the Environment.
GetFactor Gets the Environment factor for the given location.
GetFactor Gets the Environment factor for the given entity.
SetEffect Sets the Effect applied in the Environment.
SetEffect Sets the Effect applied in the Environment.
SetEffect Sets the Effect applied in the Environment.
GetEffect Gets the Effect linked to this environment.
SetZone Sets the Zone for this environment.
GetZone Gets the Zone linked to this environment.
GetState Returns the internal state of this Environment.
Update Updates the state of this Environment.

Function Details

Clear

void Clear()

Uninitializes this Environment.

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

Environment

Environment()

Creates an uninitialized Environment.

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

explicit Environment(EnvironmentInternalState* state)

Creates a wrapper instance over the provided state.

Parameter state
The internal state to wrap.

Warning

This constructor is for internal usage only.

GetDirection

[[nodiscard]] AmVec3 GetDirection() const

Gets the direction vector of the Environment.

Return
The direction vector.

GetEffect

[[nodiscard]] const Effect* GetEffect() const

Gets the Effect linked to this environment.

Return
An Effect instance.

GetFactor

[[nodiscard]] AmReal32 GetFactor(const AmVec3& location) const

Gets the Environment factor for the given location.

Parameter location
The location for which compute the environment factor.
Return
The environment factor.

[[nodiscard]] AmReal32 GetFactor(const Entity& entity) const

Gets the Environment factor for the given entity.

Parameter entity
The entity for which compute the environment factor.
Return
The environment factor.

GetId

[[nodiscard]] AmEnvironmentID GetId() const

Returns the unique ID of this Environment.

Return
The Environment unique ID.

GetLocation

[[nodiscard]] const AmVec3& GetLocation() const

Gets the current location of this Environment.

Return
The current location of this Environment.

GetOrientation

[[nodiscard]] const Orientation& GetOrientation() const

Gets the current orientation of this Environment.

Return
The current orientation of this Environment.

GetState

[[nodiscard]] EnvironmentInternalState* GetState() const

Returns the internal state of this Environment.

Return
The Environment internal state.

Warning

This method is for internal usage only.

GetUp

[[nodiscard]] AmVec3 GetUp() const

Gets the up vector of the Environment.

Return
The up vector.

GetZone

[[nodiscard]] Zone* GetZone() const

Gets the Zone linked to this environment.

Return
An Zone instance.

SetEffect

void SetEffect(AmEffectID effect) const

Sets the Effect applied in the Environment.

Parameter effect
The ID of the effect to apply in the Environment.

void SetEffect(const AmString& effect) const

Sets the Effect applied in the Environment.

Parameter effect
The name of the effect to apply in the Environment.

void SetEffect(const Effect* effect) const

Sets the Effect applied in the Environment.

Parameter effect
The effect to apply in the Environment.

SetLocation

void SetLocation(const AmVec3& location) const

Sets the location of this Environment.

Parameter location
The new location.

SetOrientation

void SetOrientation(const Orientation& orientation) const

Sets the orientation of this Environment.

Parameter orientation
The new orientation.

SetZone

void SetZone(Zone* zone) const

Sets the Zone for this environment.

Parameter zone
The environment's zone.

Update

void Update() const

Updates the state of this Environment.

This method is called automatically by the Engine on each frames to update the internal state of the Environment.

Warning

This method is for internal usage only.

Valid

[[nodiscard]] bool Valid() const

Checks whether this Environment has been initialized.

Return
true if this Environment is initialized, false otherwise.