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
qsoundeffect.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QSOUNDEFFECT_H
5#define QSOUNDEFFECT_H
6
7#include <QtMultimedia/qtmultimediaglobal.h>
8#include <QtMultimedia/qaudio.h>
9#include <QtCore/qobject.h>
10#include <QtCore/qurl.h>
11#include <QtCore/qstringlist.h>
12
13
15
16
18class QAudioDevice;
19
20class Q_MULTIMEDIA_EXPORT QSoundEffect : public QObject
21{
23 Q_CLASSINFO("DefaultMethod", "play()")
24 Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
25 Q_PROPERTY(int loops READ loopCount WRITE setLoopCount NOTIFY loopCountChanged)
26 Q_PROPERTY(int loopsRemaining READ loopsRemaining NOTIFY loopsRemainingChanged)
27 Q_PROPERTY(float volume READ volume WRITE setVolume NOTIFY volumeChanged)
28 Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
29 Q_PROPERTY(bool playing READ isPlaying NOTIFY playingChanged)
30 Q_PROPERTY(Status status READ status NOTIFY statusChanged)
31 Q_PROPERTY(QAudioDevice audioDevice READ audioDevice WRITE setAudioDevice NOTIFY audioDeviceChanged)
32
33public:
34 enum Loop
35 {
36 Infinite = -2
37 };
38 Q_ENUM(Loop)
39
47 Q_ENUM(Status)
48
49 explicit QSoundEffect(QObject *parent = nullptr);
50 explicit QSoundEffect(const QAudioDevice &audioDevice, QObject *parent = nullptr);
52
53 static QStringList supportedMimeTypes();
54
55 QUrl source() const;
56 void setSource(const QUrl &url);
57
58 int loopCount() const;
59 int loopsRemaining() const;
60 void setLoopCount(int loopCount);
61
63 void setAudioDevice(const QAudioDevice &device);
64
65 float volume() const;
66 void setVolume(float volume);
67
68 bool isMuted() const;
69 void setMuted(bool muted);
70
71 bool isLoaded() const;
72
73 bool isPlaying() const;
74 Status status() const;
75
86
87public Q_SLOTS:
88 void play();
89 void stop();
90
91private:
92 Q_DISABLE_COPY(QSoundEffect)
93 QSoundEffectPrivate *d = nullptr;
94};
95
97
98
99#endif // QSOUNDEFFECT_H
IOBluetoothDevice * device
The QAudioDevice class provides an information about audio devices and their functionality.
\inmodule QtCore
Definition qobject.h:103
The QSoundEffect class provides a way to play low latency sound effects.
void sourceChanged()
The sourceChanged signal is emitted when the source has been changed.
void playingChanged()
\qmlsignal QtMultimedia::SoundEffect::mutedChanged()
QAudioDevice audioDevice()
void audioDeviceChanged()
void loopsRemainingChanged()
\qmlsignal QtMultimedia::SoundEffect::loopCountChanged()
void loadedChanged()
\qmlsignal QtMultimedia::SoundEffect::sourceChanged()
void volumeChanged()
\qmlsignal QtMultimedia::SoundEffect::loopsRemainingChanged()
Status
\value Null No source has been set or the source is null.
Loop
\value Infinite Used as a parameter to \l setLoopCount() for infinite looping
void mutedChanged()
\qmlsignal QtMultimedia::SoundEffect::volumeChanged()
void loopCountChanged()
\qmlsignal QtMultimedia::SoundEffect::loadedChanged()
void statusChanged()
\qmlsignal QtMultimedia::SoundEffect::playingChanged()
\inmodule QtCore
\inmodule QtCore
Definition qurl.h:94
void statusChanged(QQmlComponent::Status status)
[1]
Definition qlogging.cpp:11
Combined button and popup list for selecting options.
GLsizei GLsizei GLchar * source
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_CLASSINFO(name, value)
#define Q_SLOTS
#define Q_SIGNALS
QUrl url("example.com")
[constructor-url-reference]