Changeset 769 for trunk/src/multimedia/audio/qaudiooutput.cpp
- Timestamp:
- Aug 2, 2010, 9:27:30 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.3 (added) merged: 768 /branches/vendor/nokia/qt/current merged: 767 /branches/vendor/nokia/qt/4.6.2 removed
- Property svn:mergeinfo changed
-
trunk/src/multimedia/audio/qaudiooutput.cpp
r651 r769 203 203 All that is required is to open the QIODevice. 204 204 205 If able to successfully output audio data to the systems audio device the 206 state() is set to QAudio::ActiveState, error() is set to QAudio::NoError 207 and the stateChanged() signal is emitted. 208 209 If a problem occurs during this process the error() is set to QAudio::OpenError, 210 state() is set to QAudio::StoppedState and stateChanged() signal is emitted. 211 212 In either case, the stateChanged() signal may be emitted either synchronously 213 during execution of the start() function or asynchronously after start() has 214 returned to the caller. 215 205 216 \sa QIODevice 206 217 */ … … 208 219 void QAudioOutput::start(QIODevice* device) 209 220 { 210 /*211 -If currently not StoppedState, stop.212 -If previous start was push mode, delete internal QIODevice.213 -open audio output.214 -If ok, NoError and ActiveState, else OpenError and StoppedState215 -emit stateChanged()216 */217 221 d->start(device); 218 222 } … … 222 226 transfer. This QIODevice can be used to write() audio data directly. 223 227 228 If able to access the systems audio device the state() is set to 229 QAudio::IdleState, error() is set to QAudio::NoError 230 and the stateChanged() signal is emitted. 231 232 If a problem occurs during this process the error() is set to QAudio::OpenError, 233 state() is set to QAudio::StoppedState and stateChanged() signal is emitted. 234 235 In either case, the stateChanged() signal may be emitted either synchronously 236 during execution of the start() function or asynchronously after start() has 237 returned to the caller. 238 224 239 \sa QIODevice 225 240 */ … … 227 242 QIODevice* QAudioOutput::start() 228 243 { 229 /*230 -If currently not StoppedState, stop.231 -If no internal QIODevice, create one.232 -open audio output.233 -If ok, NoError and IdleState, else OpenError and StoppedState234 -emit stateChanged()235 -return internal QIODevice236 */237 244 return d->start(0); 238 245 } 239 246 240 247 /*! 241 Stops the audio output. 248 Stops the audio output, detaching from the system resource. 249 250 Sets error() to QAudio::NoError, state() to QAudio::StoppedState and 251 emit stateChanged() signal. 242 252 */ 243 253 244 254 void QAudioOutput::stop() 245 255 { 246 /*247 -If StoppedState, return248 -set to StoppedState249 -detach from audio device250 -emit stateChanged()251 */252 256 d->stop(); 253 257 } … … 259 263 void QAudioOutput::reset() 260 264 { 261 /*262 -drop all buffered audio, set buffers to zero.263 -call stop()264 */265 265 d->reset(); 266 266 } … … 268 268 /*! 269 269 Stops processing audio data, preserving buffered audio data. 270 271 Sets error() to QAudio::NoError, state() to QAudio::SuspendedState and 272 emit stateChanged() signal. 270 273 */ 271 274 272 275 void QAudioOutput::suspend() 273 276 { 274 /*275 -If not ActiveState|IdleState, return276 -stop processing audio, saving all buffered audio data277 -set NoError and SuspendedState278 -emit stateChanged()279 */280 277 d->suspend(); 281 278 } … … 283 280 /*! 284 281 Resumes processing audio data after a suspend(). 282 283 Sets error() to QAudio::NoError. 284 Sets state() to QAudio::ActiveState if you previously called start(QIODevice*). 285 Sets state() to QAudio::IdleState if you previously called start(). 286 emits stateChanged() signal. 287 288 Note: signal will always be emitted during execution of the resume() function. 285 289 */ 286 290 287 291 void QAudioOutput::resume() 288 292 { 289 /*290 -If SuspendedState, return291 -resume audio292 -(PULL MODE): set ActiveState, NoError293 -(PUSH MODE): set IdleState, NoError294 -kick start audio if needed295 -emit stateChanged()296 */297 293 d->resume(); 298 294 } … … 300 296 /*! 301 297 Returns the free space available in bytes in the audio buffer. 298 299 NOTE: returned value is only valid while in QAudio::ActiveState or QAudio::IdleState 300 state, otherwise returns zero. 302 301 */ 303 302 304 303 int QAudioOutput::bytesFree() const 305 304 { 306 /*307 -If not ActiveState|IdleState, return 0308 -return space available in audio buffer in bytes309 */310 305 return d->bytesFree(); 311 306 } … … 354 349 Sets the interval for notify() signal to be emitted. 355 350 This is based on the \a ms of audio data processed 356 not on actual real-time. The resolution of the timer is platform specific. 351 not on actual real-time. 352 The minimum resolution of the timer is platform specific and values 353 should be checked with notifyInterval() to confirm actual value 354 being used. 357 355 */ 358 356 … … 372 370 373 371 /*! 374 Returns the amount of audio data processed since start()372 Returns the amount of audio data processed by the class since start() 375 373 was called in microseconds. 374 375 Note: The amount of audio data played can be determined by subtracting 376 the microseconds of audio data still in the systems audio buffer. 377 378 \code 379 qint64 bytesInBuffer = bufferSize() - bytesFree(); 380 qint64 usInBuffer = (qint64)(1000000) * bytesInBuffer / ( channels() * sampleSize() / 8 ) / frequency(); 381 qint64 usPlayed = processedUSecs() - usInBuffer; 382 \endcode 376 383 */ 377 384
Note:
See TracChangeset
for help on using the changeset viewer.