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
10#include <QtGui/qquaternion.h>
11#include <QtGui/qvector3d.h>
12
13QT_BEGIN_NAMESPACE
14
15class QAudioEngine;
16class QAudioRoomPrivate;
17
18class Q_SPATIALAUDIO_EXPORT QAudioRoom : public QObject
19{
20 Q_OBJECT
21 Q_PROPERTY(QVector3D position READ position WRITE setPosition NOTIFY positionChanged)
22 Q_PROPERTY(QVector3D dimensions READ dimensions WRITE setDimensions NOTIFY dimensionsChanged)
23 Q_PROPERTY(QQuaternion rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
24 Q_PROPERTY(float reflectionGain READ reflectionGain WRITE setReflectionGain NOTIFY reflectionGainChanged)
25 Q_PROPERTY(float reverbGain READ reverbGain WRITE setReverbGain NOTIFY reverbGainChanged)
26 Q_PROPERTY(float reverbTime READ reverbTime WRITE setReverbTime NOTIFY reverbTimeChanged)
27 Q_PROPERTY(float reverbBrightness READ reverbBrightness WRITE setReverbBrightness NOTIFY reverbBrightnessChanged)
28public:
29 explicit QAudioRoom(QAudioEngine *engine);
30 ~QAudioRoom() override;
31
32 enum Material {
33 Transparent,
34 AcousticCeilingTiles,
35 BrickBare,
36 BrickPainted,
37 ConcreteBlockCoarse,
38 ConcreteBlockPainted,
39 CurtainHeavy,
40 FiberGlassInsulation,
41 GlassThin,
42 GlassThick,
43 Grass,
44 LinoleumOnConcrete,
45 Marble,
46 Metal,
47 ParquetOnConcrete,
48 PlasterRough,
49 PlasterSmooth,
50 PlywoodPanel,
51 PolishedConcreteOrTile,
52 Sheetrock,
53 WaterOrIceSurface,
54 WoodCeiling,
55 WoodPanel,
56 UniformMaterial,
57 };
58
59 enum Wall {
60 LeftWall,
61 RightWall,
62 Floor,
63 Ceiling,
64 FrontWall,
65 BackWall
66 };
67
68 void setPosition(QVector3D pos);
69 QVector3D position() const;
70
71 void setDimensions(QVector3D dim);
72 QVector3D dimensions() const;
73
74 void setRotation(const QQuaternion &q);
75 QQuaternion rotation() const;
76
77 void setWallMaterial(Wall wall, Material material);
78 Material wallMaterial(Wall wall) const;
79
80 void setReflectionGain(float factor);
81 float reflectionGain() const;
82
83 void setReverbGain(float factor);
84 float reverbGain() const;
85
86 void setReverbTime(float factor);
87 float reverbTime() const;
88
89 void setReverbBrightness(float factor);
90 float reverbBrightness() const;
91
92Q_SIGNALS:
93 void positionChanged();
94 void dimensionsChanged();
95 void rotationChanged();
96 void wallsChanged();
97 void reflectionGainChanged();
98 void reverbGainChanged();
99 void reverbTimeChanged();
100 void reverbBrightnessChanged();
101
102private:
103 Q_DECLARE_PRIVATE(QAudioRoom)
104
105 // ### Qt7: remove unused member
106 QT6_ONLY(Q_DECL_UNUSED_MEMBER void *unused = nullptr;) // for ABI compatibility
107};
108
109QT_END_NAMESPACE
110
111#endif
112

source code of qtmultimedia/src/spatialaudio/qaudioroom.h