Header: | #include <QAudioRoom> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS SpatialAudio) target_link_libraries(mytarget PRIVATE Qt6::SpatialAudio) |
qmake: | QT += spatialaudio |
Inherits: | QObject |
enum | Material { Transparent, AcousticCeilingTiles, BrickBare, BrickPainted, ConcreteBlockCoarse, …, UniformMaterial } |
enum | Wall { LeftWall, RightWall, Floor, Ceiling, FrontWall, BackWall } |
|
|
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 |
void | dimensionsChanged() |
void | positionChanged() |
void | reflectionGainChanged() |
void | reverbBrightnessChanged() |
void | reverbGainChanged() |
void | reverbTimeChanged() |
void | rotationChanged() |
void | wallsChanged() |
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.
Defines different materials that can be applied to the different walls of the room.
Constant | Value | Description |
---|---|---|
QAudioRoom::Transparent |
0 |
The side of the room is open and won't contribute to reflections or reverb. |
QAudioRoom::AcousticCeilingTiles |
1 |
Acoustic tiles that suppress most reflections and reverb. |
QAudioRoom::BrickBare |
2 |
Bare brick wall. |
QAudioRoom::BrickPainted |
3 |
Painted brick wall. |
QAudioRoom::ConcreteBlockCoarse |
4 |
Raw concrete wall |
QAudioRoom::ConcreteBlockPainted |
5 |
Painted concrete wall |
QAudioRoom::CurtainHeavy |
6 |
Heavy curtain. Will mostly reflect low frequencies |
QAudioRoom::FiberGlassInsulation |
7 |
Fiber glass insulation. Only reflects very low frequencies |
QAudioRoom::GlassThin |
8 |
Thin glass wall |
QAudioRoom::GlassThick |
9 |
Thick glass wall |
QAudioRoom::Grass |
10 |
Grass |
QAudioRoom::LinoleumOnConcrete |
11 |
Linoleum floor |
QAudioRoom::Marble |
12 |
Marble floor |
QAudioRoom::Metal |
13 |
Metal |
QAudioRoom::ParquetOnConcrete |
14 |
Parquet wooden floor on concrete |
QAudioRoom::PlasterRough |
15 |
Rough plaster |
QAudioRoom::PlasterSmooth |
16 |
Smooth plaster |
QAudioRoom::PlywoodPanel |
17 |
Plywodden panel |
QAudioRoom::PolishedConcreteOrTile |
18 |
Polished concrete or tiles |
QAudioRoom::Sheetrock |
19 |
Rock |
QAudioRoom::WaterOrIceSurface |
20 |
Water or ice |
QAudioRoom::WoodCeiling |
21 |
Wooden ceiling |
QAudioRoom::WoodPanel |
22 |
Wooden panel |
QAudioRoom::UniformMaterial |
23 |
Artificial material giving uniform reflections on all frequencies |
An enum defining the 6 walls of the room
Constant | Value | Description |
---|---|---|
QAudioRoom::LeftWall |
0 |
Left wall (negative x) |
QAudioRoom::RightWall |
1 |
Right wall (positive x) |
QAudioRoom::Floor |
2 |
Bottom wall (negative y) |
QAudioRoom::Ceiling |
3 |
Top wall (positive y) |
QAudioRoom::FrontWall |
4 |
Front wall (negative z) |
QAudioRoom::BackWall |
5 |
Back wall (positive z) |
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.
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.
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() |
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() |
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() |
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() |
Defines the orientation of the room in 3D space.
Access functions:
QQuaternion | rotation() const |
void | setRotation(const QQuaternion &q) |
Notifier signal:
void | rotationChanged() |
Constructs a QAudioRoom for engine.
[signal]
void QAudioRoom::wallsChanged()Signals when the wall material changes.
[virtual]
QAudioRoom::~QAudioRoom()Destroys the room.
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.
returns the material being used for wall.
See also setWallMaterial(), Material, and QAudioRoom::Wall.