头: | #include <QAudioRoom> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS SpatialAudio)
target_link_libraries(mytarget PRIVATE Qt6::SpatialAudio) |
qmake: | QT += spatialaudio |
继承: | 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.
常量 | 值 | 描述 |
---|---|---|
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
常量 | 值 | 描述 |
---|---|---|
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.
访问函数:
QVector3D | dimensions () const |
void | setDimensions (QVector3D dim ) |
通知程序信号:
void | dimensionsChanged () |
另请参阅 position and QAudioEngine::distanceScale .
Defines the position of the center of the room in 3D space. Units are in centimeters by default.
访问函数:
QVector3D | 位置 () const |
void | setPosition (QVector3D pos ) |
通知程序信号:
void | positionChanged () |
另请参阅 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.
访问函数:
float | reflectionGain () const |
void | setReflectionGain (float factor ) |
通知程序信号:
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.
默认为 0。
访问函数:
float | reverbBrightness () const |
void | setReverbBrightness (float factor ) |
通知程序信号:
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.
访问函数:
float | reverbGain () const |
void | setReverbGain (float factor ) |
通知程序信号:
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.
访问函数:
float | reverbTime () const |
void | setReverbTime (float factor ) |
通知程序信号:
void | reverbTimeChanged () |
Defines the orientation of the room in 3D space.
访问函数:
QQuaternion | rotation () const |
void | setRotation (const QQuaternion & q ) |
通知程序信号:
void | rotationChanged () |
[explicit]
QAudioRoom::
QAudioRoom
(
QAudioEngine
*
engine
)
Constructs a QAudioRoom for engine .
[virtual noexcept]
QAudioRoom::
~QAudioRoom
()
Destroys the room.
设置 wall to material .
Different wall materials have different reflection and reverb properties that influence the sound of the room.
另请参阅 wallMaterial (), Material ,和 QAudioRoom::Wall .
returns the material being used for wall .
另请参阅 setWallMaterial (), Material ,和 QAudioRoom::Wall .
[signal]
void
QAudioRoom::
wallsChanged
()
Signals when the wall material changes.