Skip to content

Room

class Room

The absorption coefficients of the material.

Represents a physical space where sound waves can propagate.

Any sound source within the room will be affected by the room's properties, and got applied early reflections and reverberation effects.

This class is a lightweight wrapper around the internal RoomInternalState class.

Functions

Name Description
Room Creates an uninitialized Room.
Room Creates a wrapper instance over the provided state.
Clear Uninitializes this Room.
Valid Checks whether this Room has been initialized.
GetId Returns the unique ID of this Room.
SetLocation Sets the location Room.
GetLocation Gets the current location of this Room.
SetOrientation Sets the orientation of this Room.
GetOrientation Gets the current orientation of this Room.
GetDirection Gets the direction vector of this Room.
GetUp Gets the up vector of this Room.
SetDimensions Sets the shape's dimensions of this Room.
SetShape Sets the shape representing this Room.
GetShape Gets the shape representing this Room.
SetWallMaterial Sets the material of a specific wall of this Room.
SetAllWallMaterials Sets the material of all walls of this Room.
SetWallMaterials Sets the material of each wall of this Room.
GetWallMaterial Gets the material of a specific wall of this Room.
SetGain Sets the room effects gain.
GetGain Gets the room effects gain.
GetVolume Gets the volume of the Room in m3.
GetSurfaceArea Gets the surface area of a specific wall of this Room.
Update Updates the state of this Room.
GetState Gets the internal state of the Room.

Function Details

Clear

void Clear()

Uninitializes this Room.

This doesn't destroy the internal state it references, it just removes this reference to it.

To completely destroy the Room, use RemoveRoom() method of the Engine instance.

amEngine->RemoveRoom(1234); // You should provide the room ID

GetDirection

[[nodiscard]] AmVec3 GetDirection() const

Gets the direction vector of this Room.

Return
The direction (forward) vector.

GetGain

[[nodiscard]] AmReal32 GetGain() const

Gets the room effects gain.

Return
The room effects gain.

GetId

[[nodiscard]] AmRoomID GetId() const

Returns the unique ID of this Room.

Return
The Room unique ID.

GetLocation

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

Gets the current location of this Room.

Return
The current location of this Room.

GetOrientation

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

Gets the current orientation of this Room.

Return
The current orientation of this Room.

GetShape

[[nodiscard]] const BoxShape& GetShape() const

Gets the shape representing this Room.

Return
The Room shape.

GetState

[[nodiscard]] RoomInternalState* GetState() const

Gets the internal state of the Room.

Return
The Room internal state.

Warning

This method is for internal usage only.

GetSurfaceArea

[[nodiscard]] AmReal32 GetSurfaceArea(RoomWall wall) const

Gets the surface area of a specific wall of this Room.

Parameter wall
The wall to get the surface area for.
Return
The surface area of the specified wall.

GetUp

[[nodiscard]] AmVec3 GetUp() const

Gets the up vector of this Room.

Return
The up vector.

GetVolume

[[nodiscard]] AmReal32 GetVolume() const

Gets the volume of the Room in m3.

Return
The volume of the room's shape.

GetWallMaterial

[[nodiscard]] const RoomMaterial& GetWallMaterial(RoomWall wall) const

Gets the material of a specific wall of this Room.

Parameter wall
The wall to get the material for.
Return
The material of the specified wall.

Room

Room()

Creates an uninitialized Room.

An uninitialized Room doesn't affect sound sources.

To create an initialized Room, use the AddRoom() method of the Engine instance.

amEngine->AddRoom(1234); // You should provide an unique ID

explicit Room(RoomInternalState* state)

Creates a wrapper instance over the provided state.

Parameter state
The internal state to wrap.

Warning

This constructor is for internal usage only.

SetAllWallMaterials

void SetAllWallMaterials(const RoomMaterial& material) const

Sets the material of all walls of this Room.

Parameter material
The new material.

SetDimensions

void SetDimensions(AmVec3 dimensions) const

Sets the shape's dimensions of this Room.

Parameter dimensions
The new dimensions.

SetGain

void SetGain(AmReal32 gain) const

Sets the room effects gain.

Parameter gain
The gain applied to early reflections and reverberations effects.

SetLocation

void SetLocation(const AmVec3& location) const

Sets the location Room.

Parameter location
The new location.

SetOrientation

void SetOrientation(const Orientation& orientation) const

Sets the orientation of this Room.

Parameter orientation
The new orientation.

SetShape

void SetShape(const BoxShape& shape) const

Sets the shape representing this Room.

Parameter shape
The new shape.

SetWallMaterial

void SetWallMaterial(RoomWall wall, const RoomMaterial& material) const

Sets the material of a specific wall of this Room.

Parameter wall
The wall to set the material for.
Parameter material
The new material.

SetWallMaterials

void SetWallMaterials( const RoomMaterial& leftWallMaterial, const RoomMaterial& rightWallMaterial, const RoomMaterial& floorMaterial, const RoomMaterial& ceilingMaterial, const RoomMaterial& frontWallMaterial, const RoomMaterial& backWallMaterial) const

Sets the material of each wall of this Room.

Parameter leftWallMaterial
The material for the left wall.
Parameter rightWallMaterial
The material for the right wall.
Parameter floorMaterial
The material for the floor.
Parameter ceilingMaterial
The material for the ceiling.
Parameter frontWallMaterial
The material for the front wall.
Parameter backWallMaterial
The material for the back wall.

Update

void Update() const

Updates the state of this Room.

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

Warning

This method is for internal usage only.

Valid

[[nodiscard]] bool Valid() const

Checks whether this Room has been initialized.

Return
true if this Room has been initialized with a valid state.