1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #ifndef QAUDIOSYSTEM_H |
41 | #define QAUDIOSYSTEM_H |
42 | |
43 | #include <QtMultimedia/qtmultimediaglobal.h> |
44 | #include <QtMultimedia/qmultimedia.h> |
45 | |
46 | #include <QtMultimedia/qaudio.h> |
47 | #include <QtMultimedia/qaudioformat.h> |
48 | #include <QtMultimedia/qaudiodeviceinfo.h> |
49 | |
50 | QT_BEGIN_NAMESPACE |
51 | |
52 | class QIODevice; |
53 | |
54 | class Q_MULTIMEDIA_EXPORT QAbstractAudioDeviceInfo : public QObject |
55 | { |
56 | Q_OBJECT |
57 | |
58 | public: |
59 | virtual QAudioFormat preferredFormat() const = 0; |
60 | virtual bool isFormatSupported(const QAudioFormat &format) const = 0; |
61 | virtual QString deviceName() const = 0; |
62 | virtual QStringList supportedCodecs() = 0; |
63 | virtual QList<int> supportedSampleRates() = 0; |
64 | virtual QList<int> supportedChannelCounts() = 0; |
65 | virtual QList<int> supportedSampleSizes() = 0; |
66 | virtual QList<QAudioFormat::Endian> supportedByteOrders() = 0; |
67 | virtual QList<QAudioFormat::SampleType> supportedSampleTypes() = 0; |
68 | }; |
69 | |
70 | class Q_MULTIMEDIA_EXPORT QAbstractAudioOutput : public QObject |
71 | { |
72 | Q_OBJECT |
73 | |
74 | public: |
75 | virtual void start(QIODevice *device) = 0; |
76 | virtual QIODevice* start() = 0; |
77 | virtual void stop() = 0; |
78 | virtual void reset() = 0; |
79 | virtual void suspend() = 0; |
80 | virtual void resume() = 0; |
81 | virtual int bytesFree() const = 0; |
82 | virtual int periodSize() const = 0; |
83 | virtual void setBufferSize(int value) = 0; |
84 | virtual int bufferSize() const = 0; |
85 | virtual void setNotifyInterval(int milliSeconds) = 0; |
86 | virtual int notifyInterval() const = 0; |
87 | virtual qint64 processedUSecs() const = 0; |
88 | virtual qint64 elapsedUSecs() const = 0; |
89 | virtual QAudio::Error error() const = 0; |
90 | virtual QAudio::State state() const = 0; |
91 | virtual void setFormat(const QAudioFormat& fmt) = 0; |
92 | virtual QAudioFormat format() const = 0; |
93 | virtual void setVolume(qreal) {} |
94 | virtual qreal volume() const { return 1.0; } |
95 | virtual QString category() const { return QString(); } |
96 | virtual void setCategory(const QString &) { } |
97 | |
98 | Q_SIGNALS: |
99 | void errorChanged(QAudio::Error error); |
100 | void stateChanged(QAudio::State state); |
101 | void notify(); |
102 | }; |
103 | |
104 | class Q_MULTIMEDIA_EXPORT QAbstractAudioInput : public QObject |
105 | { |
106 | Q_OBJECT |
107 | |
108 | public: |
109 | virtual void start(QIODevice *device) = 0; |
110 | virtual QIODevice* start() = 0; |
111 | virtual void stop() = 0; |
112 | virtual void reset() = 0; |
113 | virtual void suspend() = 0; |
114 | virtual void resume() = 0; |
115 | virtual int bytesReady() const = 0; |
116 | virtual int periodSize() const = 0; |
117 | virtual void setBufferSize(int value) = 0; |
118 | virtual int bufferSize() const = 0; |
119 | virtual void setNotifyInterval(int milliSeconds) = 0; |
120 | virtual int notifyInterval() const = 0; |
121 | virtual qint64 processedUSecs() const = 0; |
122 | virtual qint64 elapsedUSecs() const = 0; |
123 | virtual QAudio::Error error() const = 0; |
124 | virtual QAudio::State state() const = 0; |
125 | virtual void setFormat(const QAudioFormat& fmt) = 0; |
126 | virtual QAudioFormat format() const = 0; |
127 | virtual void setVolume(qreal) = 0; |
128 | virtual qreal volume() const = 0; |
129 | |
130 | Q_SIGNALS: |
131 | void errorChanged(QAudio::Error error); |
132 | void stateChanged(QAudio::State state); |
133 | void notify(); |
134 | }; |
135 | |
136 | QT_END_NAMESPACE |
137 | |
138 | #endif // QAUDIOSYSTEM_H |
139 | |