1 | // Copyright (C) 2022 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QAUDIOROOM_H |
5 | #define QAUDIOROOM_H |
6 | |
7 | #include <QtSpatialAudio/qtspatialaudioglobal.h> |
8 | #include <QtCore/qobject.h> |
9 | #include <QtGui/qvector3d.h> |
10 | |
11 | QT_BEGIN_NAMESPACE |
12 | |
13 | class QAudioEngine; |
14 | class QAudioRoomPrivate; |
15 | |
16 | class Q_SPATIALAUDIO_EXPORT QAudioRoom : public QObject |
17 | { |
18 | Q_OBJECT |
19 | Q_PROPERTY(QVector3D position READ position WRITE setPosition NOTIFY positionChanged) |
20 | Q_PROPERTY(QVector3D dimensions READ dimensions WRITE setDimensions NOTIFY dimensionsChanged) |
21 | Q_PROPERTY(QQuaternion rotation READ rotation WRITE setRotation NOTIFY rotationChanged) |
22 | Q_PROPERTY(float reflectionGain READ reflectionGain WRITE setReflectionGain NOTIFY reflectionGainChanged) |
23 | Q_PROPERTY(float reverbGain READ reverbGain WRITE setReverbGain NOTIFY reverbGainChanged) |
24 | Q_PROPERTY(float reverbTime READ reverbTime WRITE setReverbTime NOTIFY reverbTimeChanged) |
25 | Q_PROPERTY(float reverbBrightness READ reverbBrightness WRITE setReverbBrightness NOTIFY reverbBrightnessChanged) |
26 | public: |
27 | explicit QAudioRoom(QAudioEngine *engine); |
28 | ~QAudioRoom(); |
29 | |
30 | enum Material { |
31 | Transparent, |
32 | AcousticCeilingTiles, |
33 | BrickBare, |
34 | BrickPainted, |
35 | ConcreteBlockCoarse, |
36 | ConcreteBlockPainted, |
37 | CurtainHeavy, |
38 | FiberGlassInsulation, |
39 | GlassThin, |
40 | GlassThick, |
41 | Grass, |
42 | LinoleumOnConcrete, |
43 | Marble, |
44 | Metal, |
45 | ParquetOnConcrete, |
46 | PlasterRough, |
47 | PlasterSmooth, |
48 | PlywoodPanel, |
49 | PolishedConcreteOrTile, |
50 | Sheetrock, |
51 | WaterOrIceSurface, |
52 | WoodCeiling, |
53 | WoodPanel, |
54 | UniformMaterial, |
55 | }; |
56 | |
57 | enum Wall { |
58 | LeftWall, |
59 | RightWall, |
60 | Floor, |
61 | Ceiling, |
62 | FrontWall, |
63 | BackWall |
64 | }; |
65 | |
66 | void setPosition(QVector3D pos); |
67 | QVector3D position() const; |
68 | |
69 | void setDimensions(QVector3D dim); |
70 | QVector3D dimensions() const; |
71 | |
72 | void setRotation(const QQuaternion &q); |
73 | QQuaternion rotation() const; |
74 | |
75 | void setWallMaterial(Wall wall, Material material); |
76 | Material wallMaterial(Wall wall) const; |
77 | |
78 | void setReflectionGain(float factor); |
79 | float reflectionGain() const; |
80 | |
81 | void setReverbGain(float factor); |
82 | float reverbGain() const; |
83 | |
84 | void setReverbTime(float factor); |
85 | float reverbTime() const; |
86 | |
87 | void setReverbBrightness(float factor); |
88 | float reverbBrightness() const; |
89 | |
90 | Q_SIGNALS: |
91 | void positionChanged(); |
92 | void dimensionsChanged(); |
93 | void rotationChanged(); |
94 | void wallsChanged(); |
95 | void reflectionGainChanged(); |
96 | void reverbGainChanged(); |
97 | void reverbTimeChanged(); |
98 | void reverbBrightnessChanged(); |
99 | |
100 | private: |
101 | friend class QAudioRoomPrivate; |
102 | QAudioRoomPrivate *d; |
103 | }; |
104 | |
105 | QT_END_NAMESPACE |
106 | |
107 | #endif |
108 | |