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 | |
5 | #ifndef QAUDIOINPUT_H |
6 | #define QAUDIOINPUT_H |
7 | |
8 | #include <QtCore/qiodevice.h> |
9 | |
10 | #include <QtMultimedia/qtmultimediaglobal.h> |
11 | |
12 | #include <QtMultimedia/qaudio.h> |
13 | #include <QtMultimedia/qaudioformat.h> |
14 | #include <QtMultimedia/qaudiodevice.h> |
15 | |
16 | |
17 | QT_BEGIN_NAMESPACE |
18 | |
19 | class QPlatformAudioSource; |
20 | |
21 | class Q_MULTIMEDIA_EXPORT QAudioSource : public QObject |
22 | { |
23 | Q_OBJECT |
24 | |
25 | public: |
26 | explicit QAudioSource(const QAudioFormat &format = QAudioFormat(), QObject *parent = nullptr); |
27 | explicit QAudioSource(const QAudioDevice &audioDeviceInfo, const QAudioFormat &format = QAudioFormat(), QObject *parent = nullptr); |
28 | ~QAudioSource(); |
29 | |
30 | bool isNull() const { return !d; } |
31 | |
32 | QAudioFormat format() const; |
33 | |
34 | void start(QIODevice *device); |
35 | QIODevice* start(); |
36 | |
37 | void stop(); |
38 | void reset(); |
39 | void suspend(); |
40 | void resume(); |
41 | |
42 | void setBufferSize(qsizetype bytes); |
43 | qsizetype bufferSize() const; |
44 | |
45 | qsizetype bytesAvailable() const; |
46 | |
47 | void setVolume(qreal volume); |
48 | qreal volume() const; |
49 | |
50 | qint64 processedUSecs() const; |
51 | qint64 elapsedUSecs() const; |
52 | |
53 | QAudio::Error error() const; |
54 | QAudio::State state() const; |
55 | |
56 | Q_SIGNALS: |
57 | void stateChanged(QAudio::State state); |
58 | |
59 | private: |
60 | Q_DISABLE_COPY(QAudioSource) |
61 | |
62 | QPlatformAudioSource *d; |
63 | }; |
64 | |
65 | QT_END_NAMESPACE |
66 | |
67 | #endif // QAUDIOINPUT_H |
68 | |