Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qambientsound.h
Go to the documentation of this file.
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 QAMBIENTSOUND_H
4#define QAMBIENTSOUND_H
5
6#include <QtSpatialAudio/qtspatialaudioglobal.h>
7#include <QtMultimedia/qtmultimediaglobal.h>
8#include <QtCore/QUrl>
9#include <QtCore/QObject>
10
12
13class QAudioEngine;
15
16class Q_SPATIALAUDIO_EXPORT QAmbientSound : public QObject
17{
19 Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
20 Q_PROPERTY(float volume READ volume WRITE setVolume NOTIFY volumeChanged)
21 Q_PROPERTY(int loops READ loops WRITE setLoops NOTIFY loopsChanged)
22 Q_PROPERTY(bool autoPlay READ autoPlay WRITE setAutoPlay NOTIFY autoPlayChanged)
23
24public:
27
28 void setSource(const QUrl &url);
29 QUrl source() const;
30
31 enum Loops
32 {
33 Infinite = -1,
34 Once = 1
35 };
36 Q_ENUM(Loops)
37
38 int loops() const;
39 void setLoops(int loops);
40
41 bool autoPlay() const;
42 void setAutoPlay(bool autoPlay);
43
44 void setVolume(float volume);
45 float volume() const;
46
47 QAudioEngine *engine() const;
48
54
55public Q_SLOTS:
56 void play();
57 void pause();
58 void stop();
59
60private:
61 void setEngine(QAudioEngine *engine);
63 QAmbientSoundPrivate *d = nullptr;
64};
65
67
68#endif
\inmodule QtSpatialAudio
void volumeChanged()
void loopsChanged()
void sourceChanged()
void autoPlayChanged()
Loops
Lets you control the playback loop using the following values:
\inmodule QtSpatialAudio
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore
Definition qurl.h:94
Combined button and popup list for selecting options.
GLsizei GLsizei GLchar * source
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
#define explicit
QUrl url("example.com")
[constructor-url-reference]
QJSEngine engine
[0]