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
4#ifndef QAUDIOINPUTDEVICE_H
5#define QAUDIOINPUTDEVICE_H
6
7#include <QtCore/qobject.h>
8#include <QtMultimedia/qtmultimediaglobal.h>
9#include <QtMultimedia/qaudio.h>
10
11#include <functional>
12
13QT_BEGIN_NAMESPACE
14
15class QAudioDevice;
16class QPlatformAudioInput;
17
18class Q_MULTIMEDIA_EXPORT QAudioInput : public QObject
19{
20 Q_OBJECT
21 Q_PROPERTY(QAudioDevice device READ device WRITE setDevice NOTIFY deviceChanged)
22 Q_PROPERTY(float volume READ volume WRITE setVolume NOTIFY volumeChanged)
23 Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
24
25public:
26 explicit QAudioInput(QObject *parent = nullptr);
27 explicit QAudioInput(const QAudioDevice &deviceInfo, QObject *parent = nullptr);
28 ~QAudioInput();
29
30 QAudioDevice device() const;
31 float volume() const;
32 bool isMuted() const;
33
34public Q_SLOTS:
35 void setDevice(const QAudioDevice &device);
36 void setVolume(float volume);
37 void setMuted(bool muted);
38
39Q_SIGNALS:
40 void deviceChanged();
41 void volumeChanged(float volume);
42 void mutedChanged(bool muted);
43
44private:
45 QPlatformAudioInput *handle() const { return d; }
46 void setDisconnectFunction(std::function<void()> disconnectFunction);
47 friend class QMediaCaptureSession;
48 Q_DISABLE_COPY(QAudioInput)
49 QPlatformAudioInput *d = nullptr;
50};
51
52QT_END_NAMESPACE
53
54#endif // QAUDIOINPUTDEVICE_H
55

source code of qtmultimedia/src/multimedia/audio/qaudioinput.h