summaryrefslogtreecommitdiffstats
path: root/src/spatialaudioquick3d/qquick3daudioengine_p.h
blob: 9cde33e977c282339d182b087f8e57ba0ed9dbfd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-3.0-only
#ifndef QQUICK3DAUDIOENGINE_H
#define QQUICK3DAUDIOENGINE_H

//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//

#include <private/qquick3dnode_p.h>
#include <QtGui/qvector3d.h>
#include <qaudioengine.h>

QT_BEGIN_NAMESPACE

class QQuick3DSpatialSound;

class QQuick3DAudioEngine : public QObject
{
    Q_OBJECT
    QML_NAMED_ELEMENT(AudioEngine)
    Q_PROPERTY(OutputMode outputMode READ outputMode WRITE setOutputMode NOTIFY outputModeChanged)
    Q_PROPERTY(QAudioDevice outputDevice READ outputDevice WRITE setOutputDevice NOTIFY outputDeviceChanged)
    Q_PROPERTY(float masterVolume READ masterVolume WRITE setMasterVolume NOTIFY masterVolumeChanged)

public:
    // Keep in sync with QAudioEngine::OutputMode
    enum OutputMode {
        Surround,
        Stereo,
        Headphone
    };
    Q_ENUM(OutputMode)

    QQuick3DAudioEngine();
    ~QQuick3DAudioEngine();

    void setOutputMode(OutputMode mode);
    OutputMode outputMode() const;

    void setOutputDevice(const QAudioDevice &device);
    QAudioDevice outputDevice() const;

    void setMasterVolume(float volume);
    float masterVolume() const;

    static QAudioEngine *getEngine();

Q_SIGNALS:
    void outputModeChanged();
    void outputDeviceChanged();
    void masterVolumeChanged();
};

QT_END_NAMESPACE

#endif