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 QQUICK3DAMBIENTSOUND_H
4#define QQUICK3DAMBIENTSOUND_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 <QUrl>
19#include <qvector3d.h>
20
21QT_BEGIN_NAMESPACE
22
23class QAmbientSound;
24
25class QQuick3DAmbientSound : public QObject
26{
27 Q_OBJECT
28 Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
29 Q_PROPERTY(float volume READ volume WRITE setVolume NOTIFY volumeChanged)
30 Q_PROPERTY(int loops READ loops WRITE setLoops NOTIFY loopsChanged)
31 Q_PROPERTY(bool autoPlay READ autoPlay WRITE setAutoPlay NOTIFY autoPlayChanged)
32 QML_NAMED_ELEMENT(AmbientSound)
33
34public:
35 QQuick3DAmbientSound();
36 ~QQuick3DAmbientSound();
37
38 void setSource(QUrl source);
39 QUrl source() const;
40
41 void setVolume(float volume);
42 float volume() const;
43
44 enum Loops
45 {
46 Infinite = -1,
47 Once = 1
48 };
49 Q_ENUM(Loops)
50
51 int loops() const;
52 void setLoops(int loops);
53
54 bool autoPlay() const;
55 void setAutoPlay(bool autoPlay);
56
57public Q_SLOTS:
58 void play();
59 void pause();
60 void stop();
61
62Q_SIGNALS:
63 void sourceChanged();
64 void volumeChanged();
65 void loopsChanged();
66 void autoPlayChanged();
67
68private:
69 QAmbientSound *m_sound = nullptr;
70};
71
72QT_END_NAMESPACE
73
74#endif
75

source code of qtmultimedia/src/spatialaudioquick3d/qquick3dambientsound_p.h