| 1 | /**************************************************************************** | 
|---|
| 2 | ** | 
|---|
| 3 | ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 
|---|
| 4 | ** All rights reserved. | 
|---|
| 5 | ** Contact: Nokia Corporation (qt-info@nokia.com) | 
|---|
| 6 | ** | 
|---|
| 7 | ** This file is part of the QtMultimedia module of the Qt Toolkit. | 
|---|
| 8 | ** | 
|---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$ | 
|---|
| 10 | ** Commercial Usage | 
|---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in | 
|---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the | 
|---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in | 
|---|
| 14 | ** a written agreement between you and Nokia. | 
|---|
| 15 | ** | 
|---|
| 16 | ** GNU Lesser General Public License Usage | 
|---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Lesser | 
|---|
| 18 | ** General Public License version 2.1 as published by the Free Software | 
|---|
| 19 | ** Foundation and appearing in the file LICENSE.LGPL included in the | 
|---|
| 20 | ** packaging of this file.  Please review the following information to | 
|---|
| 21 | ** ensure the GNU Lesser General Public License version 2.1 requirements | 
|---|
| 22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | 
|---|
| 23 | ** | 
|---|
| 24 | ** In addition, as a special exception, Nokia gives you certain additional | 
|---|
| 25 | ** rights.  These rights are described in the Nokia Qt LGPL Exception | 
|---|
| 26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | 
|---|
| 27 | ** | 
|---|
| 28 | ** GNU General Public License Usage | 
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU | 
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software | 
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the | 
|---|
| 32 | ** packaging of this file.  Please review the following information to | 
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be | 
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html. | 
|---|
| 35 | ** | 
|---|
| 36 | ** If you have questions regarding the use of this file, please contact | 
|---|
| 37 | ** Nokia at qt-info@nokia.com. | 
|---|
| 38 | ** $QT_END_LICENSE$ | 
|---|
| 39 | ** | 
|---|
| 40 | ****************************************************************************/ | 
|---|
| 41 |  | 
|---|
| 42 | #include <QtMultimedia/qaudioengine.h> | 
|---|
| 43 |  | 
|---|
| 44 | QT_BEGIN_NAMESPACE | 
|---|
| 45 |  | 
|---|
| 46 | /*! | 
|---|
| 47 | \class QAbstractAudioDeviceInfo | 
|---|
| 48 | \brief The QAbstractAudioDeviceInfo class provides access for QAudioDeviceInfo to access the audio | 
|---|
| 49 | device provided by the plugin. | 
|---|
| 50 | \internal | 
|---|
| 51 |  | 
|---|
| 52 | \ingroup multimedia | 
|---|
| 53 |  | 
|---|
| 54 | This class implements the audio functionality for | 
|---|
| 55 | QAudioDeviceInfo, i.e., QAudioDeviceInfo keeps a | 
|---|
| 56 | QAbstractAudioDeviceInfo and routes function calls to it. For a | 
|---|
| 57 | description of the functionality that QAbstractAudioDeviceInfo | 
|---|
| 58 | implements, you can read the class and functions documentation of | 
|---|
| 59 | QAudioDeviceInfo. | 
|---|
| 60 |  | 
|---|
| 61 | \sa QAudioDeviceInfo | 
|---|
| 62 | */ | 
|---|
| 63 |  | 
|---|
| 64 | /*! | 
|---|
| 65 | \fn virtual QAudioFormat QAbstractAudioDeviceInfo::preferredFormat() const | 
|---|
| 66 | Returns the nearest settings. | 
|---|
| 67 | */ | 
|---|
| 68 |  | 
|---|
| 69 | /*! | 
|---|
| 70 | \fn virtual bool QAbstractAudioDeviceInfo::isFormatSupported(const QAudioFormat& format) const | 
|---|
| 71 | Returns true if \a format is available from audio device. | 
|---|
| 72 | */ | 
|---|
| 73 |  | 
|---|
| 74 | /*! | 
|---|
| 75 | \fn virtual QAudioFormat QAbstractAudioDeviceInfo::nearestFormat(const QAudioFormat& format) const | 
|---|
| 76 | Returns the nearest settings \a format. | 
|---|
| 77 | */ | 
|---|
| 78 |  | 
|---|
| 79 | /*! | 
|---|
| 80 | \fn virtual QString QAbstractAudioDeviceInfo::deviceName() const | 
|---|
| 81 | Returns the audio device name. | 
|---|
| 82 | */ | 
|---|
| 83 |  | 
|---|
| 84 | /*! | 
|---|
| 85 | \fn virtual QStringList QAbstractAudioDeviceInfo::codecList() | 
|---|
| 86 | Returns the list of currently available codecs. | 
|---|
| 87 | */ | 
|---|
| 88 |  | 
|---|
| 89 | /*! | 
|---|
| 90 | \fn virtual QList<int> QAbstractAudioDeviceInfo::frequencyList() | 
|---|
| 91 | Returns the list of currently available frequencies. | 
|---|
| 92 | */ | 
|---|
| 93 |  | 
|---|
| 94 | /*! | 
|---|
| 95 | \fn virtual QList<int> QAbstractAudioDeviceInfo::channelsList() | 
|---|
| 96 | Returns the list of currently available channels. | 
|---|
| 97 | */ | 
|---|
| 98 |  | 
|---|
| 99 | /*! | 
|---|
| 100 | \fn virtual QList<int> QAbstractAudioDeviceInfo::sampleSizeList() | 
|---|
| 101 | Returns the list of currently available sample sizes. | 
|---|
| 102 | */ | 
|---|
| 103 |  | 
|---|
| 104 | /*! | 
|---|
| 105 | \fn virtual QList<QAudioFormat::Endian> QAbstractAudioDeviceInfo::byteOrderList() | 
|---|
| 106 | Returns the list of currently available byte orders. | 
|---|
| 107 | */ | 
|---|
| 108 |  | 
|---|
| 109 | /*! | 
|---|
| 110 | \fn virtual QList<QAudioFormat::SampleType> QAbstractAudioDeviceInfo::sampleTypeList() | 
|---|
| 111 | Returns the list of currently available sample types. | 
|---|
| 112 | */ | 
|---|
| 113 |  | 
|---|
| 114 | /*! | 
|---|
| 115 | \class QAbstractAudioOutput | 
|---|
| 116 | \brief The QAbstractAudioOutput class provides access for QAudioOutput to access the audio | 
|---|
| 117 | device provided by the plugin. | 
|---|
| 118 | \internal | 
|---|
| 119 |  | 
|---|
| 120 | \ingroup multimedia | 
|---|
| 121 |  | 
|---|
| 122 | QAbstractAudioOutput implements audio functionality for | 
|---|
| 123 | QAudioOutput, i.e., QAudioOutput routes function calls to | 
|---|
| 124 | QAbstractAudioOutput. For a description of the functionality that | 
|---|
| 125 | is implemented, see the QAudioOutput class and function | 
|---|
| 126 | descriptions. | 
|---|
| 127 |  | 
|---|
| 128 | \sa QAudioOutput | 
|---|
| 129 | */ | 
|---|
| 130 |  | 
|---|
| 131 | /*! | 
|---|
| 132 | \fn virtual QIODevice* QAbstractAudioOutput::start(QIODevice* device) | 
|---|
| 133 | Uses the \a device as the QIODevice to transfer data. If \a device is null then the class | 
|---|
| 134 | creates an internal QIODevice. Returns a pointer to the QIODevice being used to handle | 
|---|
| 135 | the data transfer. This QIODevice can be used to write() audio data directly. Passing a | 
|---|
| 136 | QIODevice allows the data to be transfered without any extra code. | 
|---|
| 137 | */ | 
|---|
| 138 |  | 
|---|
| 139 | /*! | 
|---|
| 140 | \fn virtual void QAbstractAudioOutput::stop() | 
|---|
| 141 | Stops the audio output. | 
|---|
| 142 | */ | 
|---|
| 143 |  | 
|---|
| 144 | /*! | 
|---|
| 145 | \fn virtual void QAbstractAudioOutput::reset() | 
|---|
| 146 | Drops all audio data in the buffers, resets buffers to zero. | 
|---|
| 147 | */ | 
|---|
| 148 |  | 
|---|
| 149 | /*! | 
|---|
| 150 | \fn virtual void QAbstractAudioOutput::suspend() | 
|---|
| 151 | Stops processing audio data, preserving buffered audio data. | 
|---|
| 152 | */ | 
|---|
| 153 |  | 
|---|
| 154 | /*! | 
|---|
| 155 | \fn virtual void QAbstractAudioOutput::resume() | 
|---|
| 156 | Resumes processing audio data after a suspend() | 
|---|
| 157 | */ | 
|---|
| 158 |  | 
|---|
| 159 | /*! | 
|---|
| 160 | \fn virtual int QAbstractAudioOutput::bytesFree() const | 
|---|
| 161 | Returns the free space available in bytes in the audio buffer. | 
|---|
| 162 | */ | 
|---|
| 163 |  | 
|---|
| 164 | /*! | 
|---|
| 165 | \fn virtual int QAbstractAudioOutput::periodSize() const | 
|---|
| 166 | Returns the period size in bytes. | 
|---|
| 167 | */ | 
|---|
| 168 |  | 
|---|
| 169 | /*! | 
|---|
| 170 | \fn virtual void QAbstractAudioOutput::setBufferSize(int value) | 
|---|
| 171 | Sets the audio buffer size to \a value in bytes. | 
|---|
| 172 | */ | 
|---|
| 173 |  | 
|---|
| 174 | /*! | 
|---|
| 175 | \fn virtual int QAbstractAudioOutput::bufferSize() const | 
|---|
| 176 | Returns the audio buffer size in bytes. | 
|---|
| 177 | */ | 
|---|
| 178 |  | 
|---|
| 179 | /*! | 
|---|
| 180 | \fn virtual void QAbstractAudioOutput::setNotifyInterval(int ms) | 
|---|
| 181 | Sets the interval for notify() signal to be emitted. This is based on the \a ms | 
|---|
| 182 | of audio data processed not on actual real-time. The resolution of the timer | 
|---|
| 183 | is platform specific. | 
|---|
| 184 | */ | 
|---|
| 185 |  | 
|---|
| 186 | /*! | 
|---|
| 187 | \fn virtual int QAbstractAudioOutput::notifyInterval() const | 
|---|
| 188 | Returns the notify interval in milliseconds. | 
|---|
| 189 | */ | 
|---|
| 190 |  | 
|---|
| 191 | /*! | 
|---|
| 192 | \fn virtual qint64 QAbstractAudioOutput::processedUSecs() const | 
|---|
| 193 | Returns the amount of audio data processed since start() was called in milliseconds. | 
|---|
| 194 | */ | 
|---|
| 195 |  | 
|---|
| 196 | /*! | 
|---|
| 197 | \fn virtual qint64 QAbstractAudioOutput::elapsedUSecs() const | 
|---|
| 198 | Returns the milliseconds since start() was called, including time in Idle and suspend states. | 
|---|
| 199 | */ | 
|---|
| 200 |  | 
|---|
| 201 | /*! | 
|---|
| 202 | \fn virtual QAudio::Error QAbstractAudioOutput::error() const | 
|---|
| 203 | Returns the error state. | 
|---|
| 204 | */ | 
|---|
| 205 |  | 
|---|
| 206 | /*! | 
|---|
| 207 | \fn virtual QAudio::State QAbstractAudioOutput::state() const | 
|---|
| 208 | Returns the state of audio processing. | 
|---|
| 209 | */ | 
|---|
| 210 |  | 
|---|
| 211 | /*! | 
|---|
| 212 | \fn virtual QAudioFormat QAbstractAudioOutput::format() const | 
|---|
| 213 | Returns the QAudioFormat being used. | 
|---|
| 214 | */ | 
|---|
| 215 |  | 
|---|
| 216 | /*! | 
|---|
| 217 | \fn QAbstractAudioOutput::stateChanged(QAudio::State state) | 
|---|
| 218 | This signal is emitted when the device \a state has changed. | 
|---|
| 219 | */ | 
|---|
| 220 |  | 
|---|
| 221 | /*! | 
|---|
| 222 | \fn QAbstractAudioOutput::notify() | 
|---|
| 223 | This signal is emitted when x ms of audio data has been processed | 
|---|
| 224 | the interval set by setNotifyInterval(x). | 
|---|
| 225 | */ | 
|---|
| 226 |  | 
|---|
| 227 |  | 
|---|
| 228 | /*! | 
|---|
| 229 | \class QAbstractAudioInput | 
|---|
| 230 | \brief The QAbstractAudioInput class provides access for QAudioInput to access the audio | 
|---|
| 231 | device provided by the plugin. | 
|---|
| 232 | \internal | 
|---|
| 233 |  | 
|---|
| 234 | \ingroup multimedia | 
|---|
| 235 |  | 
|---|
| 236 | QAudioDeviceInput keeps an instance of QAbstractAudioInput and | 
|---|
| 237 | routes calls to functions of the same name to QAbstractAudioInput. | 
|---|
| 238 | This means that it is QAbstractAudioInput that implements the | 
|---|
| 239 | audio functionality. For a description of the functionality, see | 
|---|
| 240 | the QAudioInput class description. | 
|---|
| 241 |  | 
|---|
| 242 | \sa QAudioInput | 
|---|
| 243 | */ | 
|---|
| 244 |  | 
|---|
| 245 | /*! | 
|---|
| 246 | \fn virtual QIODevice* QAbstractAudioInput::start(QIODevice* device) | 
|---|
| 247 | Uses the \a device as the QIODevice to transfer data. If \a device is null | 
|---|
| 248 | then the class creates an internal QIODevice. Returns a pointer to the | 
|---|
| 249 | QIODevice being used to handle the data transfer. This QIODevice can be used to | 
|---|
| 250 | read() audio data directly. Passing a QIODevice allows the data to be transfered | 
|---|
| 251 | without any extra code. | 
|---|
| 252 | */ | 
|---|
| 253 |  | 
|---|
| 254 | /*! | 
|---|
| 255 | \fn virtual void QAbstractAudioInput::stop() | 
|---|
| 256 | Stops the audio input. | 
|---|
| 257 | */ | 
|---|
| 258 |  | 
|---|
| 259 | /*! | 
|---|
| 260 | \fn virtual void QAbstractAudioInput::reset() | 
|---|
| 261 | Drops all audio data in the buffers, resets buffers to zero. | 
|---|
| 262 | */ | 
|---|
| 263 |  | 
|---|
| 264 | /*! | 
|---|
| 265 | \fn virtual void QAbstractAudioInput::suspend() | 
|---|
| 266 | Stops processing audio data, preserving buffered audio data. | 
|---|
| 267 | */ | 
|---|
| 268 |  | 
|---|
| 269 | /*! | 
|---|
| 270 | \fn virtual void QAbstractAudioInput::resume() | 
|---|
| 271 | Resumes processing audio data after a suspend(). | 
|---|
| 272 | */ | 
|---|
| 273 |  | 
|---|
| 274 | /*! | 
|---|
| 275 | \fn virtual int QAbstractAudioInput::bytesReady() const | 
|---|
| 276 | Returns the amount of audio data available to read in bytes. | 
|---|
| 277 | */ | 
|---|
| 278 |  | 
|---|
| 279 | /*! | 
|---|
| 280 | \fn virtual int QAbstractAudioInput::periodSize() const | 
|---|
| 281 | Returns the period size in bytes. | 
|---|
| 282 | */ | 
|---|
| 283 |  | 
|---|
| 284 | /*! | 
|---|
| 285 | \fn virtual void QAbstractAudioInput::setBufferSize(int value) | 
|---|
| 286 | Sets the audio buffer size to \a value in milliseconds. | 
|---|
| 287 | */ | 
|---|
| 288 |  | 
|---|
| 289 | /*! | 
|---|
| 290 | \fn virtual int QAbstractAudioInput::bufferSize() const | 
|---|
| 291 | Returns the audio buffer size in milliseconds. | 
|---|
| 292 | */ | 
|---|
| 293 |  | 
|---|
| 294 | /*! | 
|---|
| 295 | \fn virtual void QAbstractAudioInput::setNotifyInterval(int ms) | 
|---|
| 296 | Sets the interval for notify() signal to be emitted. This is based | 
|---|
| 297 | on the \a ms of audio data processed not on actual real-time. | 
|---|
| 298 | The resolution of the timer is platform specific. | 
|---|
| 299 | */ | 
|---|
| 300 |  | 
|---|
| 301 | /*! | 
|---|
| 302 | \fn virtual int QAbstractAudioInput::notifyInterval() const | 
|---|
| 303 | Returns the notify interval in milliseconds. | 
|---|
| 304 | */ | 
|---|
| 305 |  | 
|---|
| 306 | /*! | 
|---|
| 307 | \fn virtual qint64 QAbstractAudioInput::processedUSecs() const | 
|---|
| 308 | Returns the amount of audio data processed since start() was called in milliseconds. | 
|---|
| 309 | */ | 
|---|
| 310 |  | 
|---|
| 311 | /*! | 
|---|
| 312 | \fn virtual qint64 QAbstractAudioInput::elapsedUSecs() const | 
|---|
| 313 | Returns the milliseconds since start() was called, including time in Idle and suspend states. | 
|---|
| 314 | */ | 
|---|
| 315 |  | 
|---|
| 316 | /*! | 
|---|
| 317 | \fn virtual QAudio::Error QAbstractAudioInput::error() const | 
|---|
| 318 | Returns the error state. | 
|---|
| 319 | */ | 
|---|
| 320 |  | 
|---|
| 321 | /*! | 
|---|
| 322 | \fn virtual QAudio::State QAbstractAudioInput::state() const | 
|---|
| 323 | Returns the state of audio processing. | 
|---|
| 324 | */ | 
|---|
| 325 |  | 
|---|
| 326 | /*! | 
|---|
| 327 | \fn virtual QAudioFormat QAbstractAudioInput::format() const | 
|---|
| 328 | Returns the QAudioFormat being used | 
|---|
| 329 | */ | 
|---|
| 330 |  | 
|---|
| 331 | /*! | 
|---|
| 332 | \fn QAbstractAudioInput::stateChanged(QAudio::State state) | 
|---|
| 333 | This signal is emitted when the device \a state has changed. | 
|---|
| 334 | */ | 
|---|
| 335 |  | 
|---|
| 336 | /*! | 
|---|
| 337 | \fn QAbstractAudioInput::notify() | 
|---|
| 338 | This signal is emitted when x ms of audio data has been processed | 
|---|
| 339 | the interval set by setNotifyInterval(x). | 
|---|
| 340 | */ | 
|---|
| 341 |  | 
|---|
| 342 |  | 
|---|
| 343 | QT_END_NAMESPACE | 
|---|