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
qplatformaudioinput_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 QPLATFORMAUDIOINPUT_H
4#define QPLATFORMAUDIOINPUT_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/qaudioinput.h>
20
21#include <functional>
22
23QT_BEGIN_NAMESPACE
24
25class QAudioInput;
26
27class Q_MULTIMEDIA_EXPORT QPlatformAudioInput
28{
29public:
30 explicit QPlatformAudioInput(QAudioInput *qq) : q(qq) { }
31 virtual ~QPlatformAudioInput() = default;
32
33 static QPlatformAudioInput *get(const QAudioInput *input)
34 {
35 if (!input->d->q)
36 return nullptr; // The backend failed to create audio input
37 return input->d;
38 }
39
40 virtual void setAudioDevice(const QAudioDevice & /*device*/) { }
41 virtual void setMuted(bool /*muted*/) {}
42 virtual void setVolume(float /*volume*/) {}
43
44 QAudioInput *const q;
45 QAudioDevice device;
46 float volume = 1.;
47 bool muted = false;
48 std::function<void()> disconnectFunction;
49};
50
51QT_END_NAMESPACE
52
53
54#endif // QPLATFORMAUDIOINPUT_H