QAudioRoom Class

Header: #include <QAudioRoom>
CMake: find_package(Qt6 REQUIRED COMPONENTS SpatialAudio)
target_link_libraries(mytarget PRIVATE Qt6::SpatialAudio)
qmake: QT += spatialaudio
Inherits: QObject

Public Types

enum Material { Transparent, AcousticCeilingTiles, BrickBare, BrickPainted, ConcreteBlockCoarse, …, UniformMaterial }
enum Wall { LeftWall, RightWall, Floor, Ceiling, FrontWall, BackWall }

Properties

Public Functions

QAudioRoom(QAudioEngine *engine)
virtual ~QAudioRoom()
QVector3D dimensions() const
QVector3D position() const
float reflectionGain() const
float reverbBrightness() const
float reverbGain() const
float reverbTime() const
QQuaternion rotation() const
void setDimensions(QVector3D dim)
void setPosition(QVector3D pos)
void setReflectionGain(float factor)
void setReverbBrightness(float factor)
void setReverbGain(float factor)
void setReverbTime(float factor)
void setRotation(const QQuaternion &q)
void setWallMaterial(QAudioRoom::Wall wall, QAudioRoom::Material material)
QAudioRoom::Material wallMaterial(QAudioRoom::Wall wall) const

Signals

Detailed Description

Defines a room for the spatial audio engine.

If the listener is inside a room, first order sound reflections and reverb matching the rooms properties will get applied to the sound field.

A room is always square and defined by its center position, its orientation and dimensions. Each of the 6 walls of the room can be made of different materials that will contribute to the computed reflections and reverb that the listener will experience while being inside the room.

If multiple rooms cover the same position, the engine will use the room with the smallest volume.

Member Type Documentation

enum QAudioRoom::Material

Defines different materials that can be applied to the different walls of the room.

ConstantValueDescription
QAudioRoom::Transparent0The side of the room is open and won't contribute to reflections or reverb.
QAudioRoom::AcousticCeilingTiles1Acoustic tiles that suppress most reflections and reverb.
QAudioRoom::BrickBare2Bare brick wall.
QAudioRoom::BrickPainted3Painted brick wall.
QAudioRoom::ConcreteBlockCoarse4Raw concrete wall
QAudioRoom::ConcreteBlockPainted5Painted concrete wall
QAudioRoom::CurtainHeavy6Heavy curtain. Will mostly reflect low frequencies
QAudioRoom::FiberGlassInsulation7Fiber glass insulation. Only reflects very low frequencies
QAudioRoom::GlassThin8Thin glass wall
QAudioRoom::GlassThick9Thick glass wall
QAudioRoom::Grass10Grass
QAudioRoom::LinoleumOnConcrete11Linoleum floor
QAudioRoom::Marble12Marble floor
QAudioRoom::Metal13Metal
QAudioRoom::ParquetOnConcrete14Parquet wooden floor on concrete
QAudioRoom::PlasterRough15Rough plaster
QAudioRoom::PlasterSmooth16Smooth plaster
QAudioRoom::PlywoodPanel17Plywodden panel
QAudioRoom::PolishedConcreteOrTile18Polished concrete or tiles
QAudioRoom::Sheetrock19Rock
QAudioRoom::WaterOrIceSurface20Water or ice
QAudioRoom::WoodCeiling21Wooden ceiling
QAudioRoom::WoodPanel22Wooden panel
QAudioRoom::UniformMaterial23Artificial material giving uniform reflections on all frequencies

enum QAudioRoom::Wall

An enum defining the 6 walls of the room

ConstantValueDescription
QAudioRoom::LeftWall0Left wall (negative x)
QAudioRoom::RightWall1Right wall (positive x)
QAudioRoom::Floor2Bottom wall (negative y)
QAudioRoom::Ceiling3Top wall (positive y)
QAudioRoom::FrontWall4Front wall (negative z)
QAudioRoom::BackWall5Back wall (positive z)

Property Documentation

dimensions : QVector3D

Defines the dimensions of the room in 3D space. Units are in centimeters by default.

Access functions:

QVector3D dimensions() const
void setDimensions(QVector3D dim)

Notifier signal:

void dimensionsChanged()

See also position and QAudioEngine::distanceScale.

position : QVector3D

Defines the position of the center of the room in 3D space. Units are in centimeters by default.

Access functions:

QVector3D position() const
void setPosition(QVector3D pos)

Notifier signal:

void positionChanged()

See also dimensions and QAudioEngine::distanceScale.

reflectionGain : float

A gain factor for reflections generated in this room. A value from 0 to 1 will dampen reflections, while a value larger than 1 will apply a gain to reflections, making them louder.

The default is 1, a factor of 0 disables reflections. Negative values are mapped to 0.

Access functions:

float reflectionGain() const
void setReflectionGain(float factor)

Notifier signal:

void reflectionGainChanged()

reverbBrightness : float

A brightness factor to be applied to the generated reverb. A positive value will increase reverb for higher frequencies and dampen lower frequencies, a negative value does the reverse.

The default is 0.

Access functions:

float reverbBrightness() const
void setReverbBrightness(float factor)

Notifier signal:

void reverbBrightnessChanged()

reverbGain : float

A gain factor for reverb generated in this room. A value from 0 to 1 will dampen reverb, while a value larger than 1 will apply a gain to the reverb, making it louder.

The default is 1, a factor of 0 disables reverb. Negative values are mapped to 0.

Access functions:

float reverbGain() const
void setReverbGain(float factor)

Notifier signal:

void reverbGainChanged()

reverbTime : float

A factor to be applies to all reverb timings generated for this room. Larger values will lead to longer reverb timings, making the room sound larger.

The default is 1. Negative values are mapped to 0.

Access functions:

float reverbTime() const
void setReverbTime(float factor)

Notifier signal:

void reverbTimeChanged()

rotation : QQuaternion

Defines the orientation of the room in 3D space.

Access functions:

QQuaternion rotation() const
void setRotation(const QQuaternion &q)

Notifier signal:

void rotationChanged()

Member Function Documentation

[explicit] QAudioRoom::QAudioRoom(QAudioEngine *engine)

Constructs a QAudioRoom for engine.

[virtual] QAudioRoom::~QAudioRoom()

Destroys the room.

void QAudioRoom::setWallMaterial(QAudioRoom::Wall wall, QAudioRoom::Material material)

Sets wall to material.

Different wall materials have different reflection and reverb properties that influence the sound of the room.

See also wallMaterial(), Material, and QAudioRoom::Wall.

QAudioRoom::Material QAudioRoom::wallMaterial(QAudioRoom::Wall wall) const

returns the material being used for wall.

See also setWallMaterial(), Material, and QAudioRoom::Wall.

[signal] void QAudioRoom::wallsChanged()

Signals when the wall material changes.

© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.