| 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 | #ifndef QQUICK3DAUDIOENGINE_H |
| 4 | #define QQUICK3DAUDIOENGINE_H |
| 5 | |
| 6 | // |
| 7 | // W A R N I N G |
| 8 | // ------------- |
| 9 | // |
| 10 | // This file is not part of the Qt API. It exists purely as an |
| 11 | // implementation detail. This header file may change from version to |
| 12 | // version without notice, or even be removed. |
| 13 | // |
| 14 | // We mean it. |
| 15 | // |
| 16 | |
| 17 | #include <private/qquick3dnode_p.h> |
| 18 | #include <QtGui/qvector3d.h> |
| 19 | #include <qaudioengine.h> |
| 20 | |
| 21 | QT_BEGIN_NAMESPACE |
| 22 | |
| 23 | class QQuick3DSpatialSound; |
| 24 | |
| 25 | class QQuick3DAudioEngine : public QObject |
| 26 | { |
| 27 | Q_OBJECT |
| 28 | QML_NAMED_ELEMENT(AudioEngine) |
| 29 | Q_PROPERTY(OutputMode outputMode READ outputMode WRITE setOutputMode NOTIFY outputModeChanged) |
| 30 | Q_PROPERTY(QAudioDevice outputDevice READ outputDevice WRITE setOutputDevice NOTIFY outputDeviceChanged) |
| 31 | Q_PROPERTY(float masterVolume READ masterVolume WRITE setMasterVolume NOTIFY masterVolumeChanged) |
| 32 | |
| 33 | public: |
| 34 | // Keep in sync with QAudioEngine::OutputMode |
| 35 | enum OutputMode { |
| 36 | Surround, |
| 37 | Stereo, |
| 38 | Headphone |
| 39 | }; |
| 40 | Q_ENUM(OutputMode) |
| 41 | |
| 42 | QQuick3DAudioEngine(); |
| 43 | ~QQuick3DAudioEngine() override; |
| 44 | |
| 45 | void setOutputMode(OutputMode mode); |
| 46 | OutputMode outputMode() const; |
| 47 | |
| 48 | void setOutputDevice(const QAudioDevice &device); |
| 49 | QAudioDevice outputDevice() const; |
| 50 | |
| 51 | void setMasterVolume(float volume); |
| 52 | float masterVolume() const; |
| 53 | |
| 54 | static QAudioEngine *getEngine(); |
| 55 | |
| 56 | Q_SIGNALS: |
| 57 | void outputModeChanged(); |
| 58 | void outputDeviceChanged(); |
| 59 | void masterVolumeChanged(); |
| 60 | }; |
| 61 | |
| 62 | QT_END_NAMESPACE |
| 63 | |
| 64 | #endif |
| 65 | |