Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qplatformaudiooutput_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 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#ifndef QPLATFORMAUDIOOUTPUT_H
4#define QPLATFORMAUDIOOUTPUT_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 <QtMultimedia/private/qtmultimediaglobal_p.h>
18#include <QtMultimedia/qaudiodevice.h>
19#include <QtMultimedia/qaudiooutput.h>
20
21QT_BEGIN_NAMESPACE
22
23class QAudioOutput;
24
25class Q_MULTIMEDIA_EXPORT QPlatformAudioOutput
26{
27public:
28 explicit QPlatformAudioOutput(QAudioOutput *qq) : q(qq) { }
29 virtual ~QPlatformAudioOutput() = default;
30
31 static QPlatformAudioOutput *get(const QAudioOutput *output)
32 {
33 if (!output->d->q)
34 return nullptr; // The backend failed to create audio output
35 return output->d;
36 }
37
38 virtual void setAudioDevice(const QAudioDevice &/*device*/) {}
39 virtual void setMuted(bool /*muted*/) {}
40 virtual void setVolume(float /*volume*/) {}
41
42 QAudioOutput *const q;
43 QAudioDevice device;
44 float volume = 1.;
45 bool muted = false;
46 std::function<void()> disconnectFunction;
47};
48
49QT_END_NAMESPACE
50
51
52#endif // QPLATFORMAUDIOOUTPUT_H