| 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 | #include "qaudiosystem.h" | 
| 41 |  | 
| 42 | QT_BEGIN_NAMESPACE | 
| 43 |  | 
| 44 | /*! | 
| 45 |     \class QAbstractAudioDeviceInfo | 
| 46 |     \brief The QAbstractAudioDeviceInfo class is a base class for audio backends. | 
| 47 |  | 
| 48 |     \ingroup multimedia | 
| 49 |     \ingroup multimedia_audio | 
| 50 |     \inmodule QtMultimedia | 
| 51 |  | 
| 52 |     This class implements the audio functionality for | 
| 53 |     QAudioDeviceInfo, i.e., QAudioDeviceInfo keeps a | 
| 54 |     QAbstractAudioDeviceInfo and routes function calls to it. For a | 
| 55 |     description of the functionality that QAbstractAudioDeviceInfo | 
| 56 |     implements, you can read the class and functions documentation of | 
| 57 |     QAudioDeviceInfo. | 
| 58 |  | 
| 59 |     \sa QAudioDeviceInfo | 
| 60 |     \sa QAbstractAudioOutput, QAbstractAudioInput | 
| 61 | */ | 
| 62 |  | 
| 63 | /*! | 
| 64 |     \fn virtual QAudioFormat QAbstractAudioDeviceInfo::preferredFormat() const | 
| 65 |     Returns the recommended settings to use. | 
| 66 | */ | 
| 67 |  | 
| 68 | /*! | 
| 69 |     \fn virtual bool QAbstractAudioDeviceInfo::isFormatSupported(const QAudioFormat& format) const | 
| 70 |     Returns true if \a format is available from audio device. | 
| 71 | */ | 
| 72 |  | 
| 73 | /*! | 
| 74 |     \fn virtual QString QAbstractAudioDeviceInfo::deviceName() const | 
| 75 |     Returns the audio device name. | 
| 76 | */ | 
| 77 |  | 
| 78 | /*! | 
| 79 |     \fn virtual QStringList QAbstractAudioDeviceInfo::supportedCodecs() | 
| 80 |     Returns the list of currently available codecs. | 
| 81 | */ | 
| 82 |  | 
| 83 | /*! | 
| 84 |     \fn virtual QList<int> QAbstractAudioDeviceInfo::supportedSampleRates() | 
| 85 |     Returns the list of currently available sample rates. | 
| 86 | */ | 
| 87 |  | 
| 88 | /*! | 
| 89 |     \fn virtual QList<int> QAbstractAudioDeviceInfo::supportedChannelCounts() | 
| 90 |     Returns the list of currently available channels. | 
| 91 | */ | 
| 92 |  | 
| 93 | /*! | 
| 94 |     \fn virtual QList<int> QAbstractAudioDeviceInfo::supportedSampleSizes() | 
| 95 |     Returns the list of currently available sample sizes. | 
| 96 | */ | 
| 97 |  | 
| 98 | /*! | 
| 99 |     \fn virtual QList<QAudioFormat::Endian> QAbstractAudioDeviceInfo::supportedByteOrders() | 
| 100 |     Returns the list of currently available byte orders. | 
| 101 | */ | 
| 102 |  | 
| 103 | /*! | 
| 104 |     \fn virtual QList<QAudioFormat::SampleType> QAbstractAudioDeviceInfo::supportedSampleTypes() | 
| 105 |     Returns the list of currently available sample types. | 
| 106 | */ | 
| 107 |  | 
| 108 | /*! | 
| 109 |     \class QAbstractAudioOutput | 
| 110 |     \brief The QAbstractAudioOutput class is a base class for audio backends. | 
| 111 |  | 
| 112 |     \ingroup multimedia | 
| 113 |     \inmodule QtMultimedia | 
| 114 |  | 
| 115 |     QAbstractAudioOutput implements audio functionality for | 
| 116 |     QAudioOutput, i.e., QAudioOutput routes function calls to | 
| 117 |     QAbstractAudioOutput. For a description of the functionality that | 
| 118 |     is implemented, see the QAudioOutput class and function | 
| 119 |     descriptions. | 
| 120 |  | 
| 121 |     \sa QAudioOutput | 
| 122 | */ | 
| 123 |  | 
| 124 | /*! | 
| 125 |     \fn virtual void QAbstractAudioOutput::start(QIODevice* device) | 
| 126 |     Uses the \a device as the QIODevice to transfer data. | 
| 127 | */ | 
| 128 |  | 
| 129 | /*! | 
| 130 |     \fn virtual QIODevice* QAbstractAudioOutput::start() | 
| 131 |     Returns a pointer to the QIODevice being used to handle | 
| 132 |     the data transfer. This QIODevice can be used to write() audio data directly. | 
| 133 | */ | 
| 134 |  | 
| 135 | /*! | 
| 136 |     \fn virtual void QAbstractAudioOutput::stop() | 
| 137 |     Stops the audio output. | 
| 138 | */ | 
| 139 |  | 
| 140 | /*! | 
| 141 |     \fn virtual void QAbstractAudioOutput::reset() | 
| 142 |     Drops all audio data in the buffers, resets buffers to zero. | 
| 143 | */ | 
| 144 |  | 
| 145 | /*! | 
| 146 |     \fn virtual void QAbstractAudioOutput::suspend() | 
| 147 |     Stops processing audio data, preserving buffered audio data. | 
| 148 | */ | 
| 149 |  | 
| 150 | /*! | 
| 151 |     \fn virtual void QAbstractAudioOutput::resume() | 
| 152 |     Resumes processing audio data after a suspend() | 
| 153 | */ | 
| 154 |  | 
| 155 | /*! | 
| 156 |     \fn virtual int QAbstractAudioOutput::bytesFree() const | 
| 157 |     Returns the free space available in bytes in the audio buffer. | 
| 158 | */ | 
| 159 |  | 
| 160 | /*! | 
| 161 |     \fn virtual int QAbstractAudioOutput::periodSize() const | 
| 162 |     Returns the period size in bytes. | 
| 163 | */ | 
| 164 |  | 
| 165 | /*! | 
| 166 |     \fn virtual void QAbstractAudioOutput::setBufferSize(int value) | 
| 167 |     Sets the audio buffer size to \a value in bytes. | 
| 168 | */ | 
| 169 |  | 
| 170 | /*! | 
| 171 |     \fn virtual int QAbstractAudioOutput::bufferSize() const | 
| 172 |     Returns the audio buffer size in bytes. | 
| 173 | */ | 
| 174 |  | 
| 175 | /*! | 
| 176 |     \fn virtual void QAbstractAudioOutput::setNotifyInterval(int ms) | 
| 177 |     Sets the interval for notify() signal to be emitted. This is based on the \a ms | 
| 178 |     of audio data processed not on actual real-time. The resolution of the timer | 
| 179 |     is platform specific. | 
| 180 | */ | 
| 181 |  | 
| 182 | /*! | 
| 183 |     \fn virtual int QAbstractAudioOutput::notifyInterval() const | 
| 184 |     Returns the notify interval in milliseconds. | 
| 185 | */ | 
| 186 |  | 
| 187 | /*! | 
| 188 |     \fn virtual qint64 QAbstractAudioOutput::processedUSecs() const | 
| 189 |     Returns the amount of audio data processed since start() was called in milliseconds. | 
| 190 | */ | 
| 191 |  | 
| 192 | /*! | 
| 193 |     \fn virtual qint64 QAbstractAudioOutput::elapsedUSecs() const | 
| 194 |     Returns the milliseconds since start() was called, including time in Idle and suspend states. | 
| 195 | */ | 
| 196 |  | 
| 197 | /*! | 
| 198 |     \fn virtual QAudio::Error QAbstractAudioOutput::error() const | 
| 199 |     Returns the error state. | 
| 200 | */ | 
| 201 |  | 
| 202 | /*! | 
| 203 |     \fn virtual QAudio::State QAbstractAudioOutput::state() const | 
| 204 |     Returns the state of audio processing. | 
| 205 | */ | 
| 206 |  | 
| 207 | /*! | 
| 208 |     \fn virtual void QAbstractAudioOutput::setFormat(const QAudioFormat& fmt) | 
| 209 |     Set the QAudioFormat to use to \a fmt. | 
| 210 |     Setting the format is only allowable while in QAudio::StoppedState. | 
| 211 | */ | 
| 212 |  | 
| 213 | /*! | 
| 214 |     \fn virtual QAudioFormat QAbstractAudioOutput::format() const | 
| 215 |     Returns the QAudioFormat being used. | 
| 216 | */ | 
| 217 |  | 
| 218 | /*! | 
| 219 |     \fn virtual void QAbstractAudioOutput::setVolume(qreal volume) | 
| 220 |     Sets the volume. | 
| 221 |     Where \a volume is between 0.0 and 1.0. | 
| 222 | */ | 
| 223 |  | 
| 224 | /*! | 
| 225 |     \fn virtual qreal QAbstractAudioOutput::volume() const | 
| 226 |     Returns the volume in the range 0.0 and 1.0. | 
| 227 | */ | 
| 228 |  | 
| 229 | /*! | 
| 230 |     \fn QAbstractAudioOutput::errorChanged(QAudio::Error error) | 
| 231 |     This signal is emitted when the \a error state has changed. | 
| 232 | */ | 
| 233 |  | 
| 234 | /*! | 
| 235 |     \fn QAbstractAudioOutput::stateChanged(QAudio::State state) | 
| 236 |     This signal is emitted when the device \a state has changed. | 
| 237 | */ | 
| 238 |  | 
| 239 | /*! | 
| 240 |     \fn QAbstractAudioOutput::notify() | 
| 241 |     This signal is emitted when x ms of audio data has been processed | 
| 242 |     the interval set by setNotifyInterval(x). | 
| 243 | */ | 
| 244 |  | 
| 245 |  | 
| 246 | /*! | 
| 247 |     \class QAbstractAudioInput | 
| 248 |     \brief The QAbstractAudioInput class provides access for QAudioInput to access the audio | 
| 249 |     device provided by the plugin. | 
| 250 |  | 
| 251 |     \ingroup multimedia | 
| 252 |     \inmodule QtMultimedia | 
| 253 |  | 
| 254 |     QAudioDeviceInput keeps an instance of QAbstractAudioInput and | 
| 255 |     routes calls to functions of the same name to QAbstractAudioInput. | 
| 256 |     This means that it is QAbstractAudioInput that implements the | 
| 257 |     audio functionality. For a description of the functionality, see | 
| 258 |     the QAudioInput class description. | 
| 259 |  | 
| 260 |     \sa QAudioInput | 
| 261 | */ | 
| 262 |  | 
| 263 | /*! | 
| 264 |     \fn virtual void QAbstractAudioInput::start(QIODevice* device) | 
| 265 |     Uses the \a device as the QIODevice to transfer data. | 
| 266 | */ | 
| 267 |  | 
| 268 | /*! | 
| 269 |     \fn virtual QIODevice* QAbstractAudioInput::start() | 
| 270 |     Returns a pointer to the QIODevice being used to handle | 
| 271 |     the data transfer. This QIODevice can be used to read() audio data directly. | 
| 272 | */ | 
| 273 |  | 
| 274 | /*! | 
| 275 |     \fn virtual void QAbstractAudioInput::stop() | 
| 276 |     Stops the audio input. | 
| 277 | */ | 
| 278 |  | 
| 279 | /*! | 
| 280 |     \fn virtual void QAbstractAudioInput::reset() | 
| 281 |     Drops all audio data in the buffers, resets buffers to zero. | 
| 282 | */ | 
| 283 |  | 
| 284 | /*! | 
| 285 |     \fn virtual void QAbstractAudioInput::suspend() | 
| 286 |     Stops processing audio data, preserving buffered audio data. | 
| 287 | */ | 
| 288 |  | 
| 289 | /*! | 
| 290 |     \fn virtual void QAbstractAudioInput::resume() | 
| 291 |     Resumes processing audio data after a suspend(). | 
| 292 | */ | 
| 293 |  | 
| 294 | /*! | 
| 295 |     \fn virtual int QAbstractAudioInput::bytesReady() const | 
| 296 |     Returns the amount of audio data available to read in bytes. | 
| 297 | */ | 
| 298 |  | 
| 299 | /*! | 
| 300 |     \fn virtual int QAbstractAudioInput::periodSize() const | 
| 301 |     Returns the period size in bytes. | 
| 302 | */ | 
| 303 |  | 
| 304 | /*! | 
| 305 |     \fn virtual void QAbstractAudioInput::setBufferSize(int value) | 
| 306 |     Sets the audio buffer size to \a value in milliseconds. | 
| 307 | */ | 
| 308 |  | 
| 309 | /*! | 
| 310 |     \fn virtual int QAbstractAudioInput::bufferSize() const | 
| 311 |     Returns the audio buffer size in milliseconds. | 
| 312 | */ | 
| 313 |  | 
| 314 | /*! | 
| 315 |     \fn virtual void QAbstractAudioInput::setNotifyInterval(int ms) | 
| 316 |     Sets the interval for notify() signal to be emitted. This is based | 
| 317 |     on the \a ms of audio data processed not on actual real-time. | 
| 318 |     The resolution of the timer is platform specific. | 
| 319 | */ | 
| 320 |  | 
| 321 | /*! | 
| 322 |     \fn virtual int QAbstractAudioInput::notifyInterval() const | 
| 323 |     Returns the notify interval in milliseconds. | 
| 324 | */ | 
| 325 |  | 
| 326 | /*! | 
| 327 |     \fn virtual qint64 QAbstractAudioInput::processedUSecs() const | 
| 328 |     Returns the amount of audio data processed since start() was called in milliseconds. | 
| 329 | */ | 
| 330 |  | 
| 331 | /*! | 
| 332 |     \fn virtual qint64 QAbstractAudioInput::elapsedUSecs() const | 
| 333 |     Returns the milliseconds since start() was called, including time in Idle and suspend states. | 
| 334 | */ | 
| 335 |  | 
| 336 | /*! | 
| 337 |     \fn virtual QAudio::Error QAbstractAudioInput::error() const | 
| 338 |     Returns the error state. | 
| 339 | */ | 
| 340 |  | 
| 341 | /*! | 
| 342 |     \fn virtual QAudio::State QAbstractAudioInput::state() const | 
| 343 |     Returns the state of audio processing. | 
| 344 | */ | 
| 345 |  | 
| 346 | /*! | 
| 347 |     \fn virtual void QAbstractAudioInput::setFormat(const QAudioFormat& fmt) | 
| 348 |     Set the QAudioFormat to use to \a fmt. | 
| 349 |     Setting the format is only allowable while in QAudio::StoppedState. | 
| 350 | */ | 
| 351 |  | 
| 352 | /*! | 
| 353 |     \fn virtual QAudioFormat QAbstractAudioInput::format() const | 
| 354 |     Returns the QAudioFormat being used | 
| 355 | */ | 
| 356 |  | 
| 357 | /*! | 
| 358 |     \fn QAbstractAudioInput::errorChanged(QAudio::Error error) | 
| 359 |     This signal is emitted when the \a error state has changed. | 
| 360 | */ | 
| 361 |  | 
| 362 | /*! | 
| 363 |     \fn QAbstractAudioInput::stateChanged(QAudio::State state) | 
| 364 |     This signal is emitted when the device \a state has changed. | 
| 365 | */ | 
| 366 |  | 
| 367 | /*! | 
| 368 |     \fn QAbstractAudioInput::notify() | 
| 369 |     This signal is emitted when x ms of audio data has been processed | 
| 370 |     the interval set by setNotifyInterval(x). | 
| 371 | */ | 
| 372 |  | 
| 373 |  | 
| 374 | QT_END_NAMESPACE | 
| 375 |  | 
| 376 | #include "moc_qaudiosystem.cpp" | 
| 377 |  |