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 QQUICK3DAUDIOROOM_H |
5 | #define QQUICK3DAUDIOROOM_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <private/qquick3dnode_p.h> |
19 | #include <QtGui/qvector3d.h> |
20 | #include <qaudioroom.h> |
21 | |
22 | QT_BEGIN_NAMESPACE |
23 | |
24 | class QAudioEngine; |
25 | class QAudioRoomPrivate; |
26 | |
27 | class QQuick3DAudioRoom : public QQuick3DNode |
28 | { |
29 | Q_OBJECT |
30 | Q_PROPERTY(QVector3D position READ position WRITE setPosition NOTIFY positionChanged) |
31 | Q_PROPERTY(QVector3D dimensions READ dimensions WRITE setDimensions NOTIFY dimensionsChanged) |
32 | Q_PROPERTY(QQuaternion rotation READ rotation WRITE setRotation NOTIFY rotationChanged) |
33 | Q_PROPERTY(Material leftMaterial READ leftMaterial WRITE setLeftMaterial NOTIFY wallsChanged) |
34 | Q_PROPERTY(Material rightMaterial READ rightMaterial WRITE setRightMaterial NOTIFY wallsChanged) |
35 | Q_PROPERTY(Material frontMaterial READ frontMaterial WRITE setFrontMaterial NOTIFY wallsChanged) |
36 | Q_PROPERTY(Material backMaterial READ backMaterial WRITE setBackMaterial NOTIFY wallsChanged) |
37 | Q_PROPERTY(Material floorMaterial READ floorMaterial WRITE setFloorMaterial NOTIFY wallsChanged) |
38 | Q_PROPERTY(Material ceilingMaterial READ ceilingMaterial WRITE setCeilingMaterial NOTIFY wallsChanged) |
39 | Q_PROPERTY(float reflectionGain READ reflectionGain WRITE setReflectionGain NOTIFY reflectionGainChanged) |
40 | Q_PROPERTY(float reverbGain READ reverbGain WRITE setReverbGain NOTIFY reverbGainChanged) |
41 | Q_PROPERTY(float reverbTime READ reverbTime WRITE setReverbTime NOTIFY reverbTimeChanged) |
42 | Q_PROPERTY(float reverbBrightness READ reverbBrightness WRITE setReverbBrightness NOTIFY reverbBrightnessChanged) |
43 | QML_NAMED_ELEMENT(AudioRoom) |
44 | public: |
45 | QQuick3DAudioRoom(); |
46 | ~QQuick3DAudioRoom(); |
47 | |
48 | enum Material { |
49 | Transparent, |
50 | AcousticCeilingTiles, |
51 | BrickBare, |
52 | BrickPainted, |
53 | ConcreteBlockCoarse, |
54 | ConcreteBlockPainted, |
55 | CurtainHeavy, |
56 | FiberGlassInsulation, |
57 | GlassThin, |
58 | GlassThick, |
59 | Grass, |
60 | LinoleumOnConcrete, |
61 | Marble, |
62 | Metal, |
63 | ParquetOnConcrete, |
64 | PlasterRough, |
65 | PlasterSmooth, |
66 | PlywoodPanel, |
67 | PolishedConcreteOrTile, |
68 | Sheetrock, |
69 | WaterOrIceSurface, |
70 | WoodCeiling, |
71 | WoodPanel, |
72 | Uniform, |
73 | }; |
74 | Q_ENUM(Material) |
75 | |
76 | void setDimensions(QVector3D pos); |
77 | QVector3D dimensions() const; |
78 | |
79 | void setLeftMaterial(Material material); |
80 | Material leftMaterial() const; |
81 | |
82 | void setRightMaterial(Material material); |
83 | Material rightMaterial() const; |
84 | |
85 | void setFrontMaterial(Material material); |
86 | Material frontMaterial() const; |
87 | |
88 | void setBackMaterial(Material material); |
89 | Material backMaterial() const; |
90 | |
91 | void setFloorMaterial(Material material); |
92 | Material floorMaterial() const; |
93 | |
94 | void setCeilingMaterial(Material material); |
95 | Material ceilingMaterial() const; |
96 | |
97 | void setReflectionGain(float factor); |
98 | float reflectionGain() const; |
99 | |
100 | void setReverbGain(float factor); |
101 | float reverbGain() const; |
102 | |
103 | void setReverbTime(float factor); |
104 | float reverbTime() const; |
105 | |
106 | void setReverbBrightness(float factor); |
107 | float reverbBrightness() const; |
108 | |
109 | Q_SIGNALS: |
110 | void positionChanged(); |
111 | void dimensionsChanged(); |
112 | void rotationChanged(); |
113 | void wallsChanged(); |
114 | void reflectionGainChanged(); |
115 | void reverbGainChanged(); |
116 | void reverbTimeChanged(); |
117 | void reverbBrightnessChanged(); |
118 | |
119 | protected Q_SLOTS: |
120 | void updatePosition(); |
121 | void updateRotation(); |
122 | |
123 | private: |
124 | QAudioRoom *m_room; |
125 | }; |
126 | |
127 | QT_END_NAMESPACE |
128 | |
129 | #endif |
130 | |