Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/multimedia/audio/qaudiooutput.cpp

    r651 r769  
    203203    All that is required is to open the QIODevice.
    204204
     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
    205216    \sa QIODevice
    206217*/
     
    208219void QAudioOutput::start(QIODevice* device)
    209220{
    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 StoppedState
    215     -emit stateChanged()
    216     */
    217221    d->start(device);
    218222}
     
    222226    transfer. This QIODevice can be used to write() audio data directly.
    223227
     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
    224239    \sa QIODevice
    225240*/
     
    227242QIODevice* QAudioOutput::start()
    228243{
    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 StoppedState
    234     -emit stateChanged()
    235     -return internal QIODevice
    236     */
    237244    return d->start(0);
    238245}
    239246
    240247/*!
    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.
    242252*/
    243253
    244254void QAudioOutput::stop()
    245255{
    246     /*
    247     -If StoppedState, return
    248     -set to StoppedState
    249     -detach from audio device
    250     -emit stateChanged()
    251     */
    252256    d->stop();
    253257}
     
    259263void QAudioOutput::reset()
    260264{
    261     /*
    262     -drop all buffered audio, set buffers to zero.
    263     -call stop()
    264     */
    265265    d->reset();
    266266}
     
    268268/*!
    269269    Stops processing audio data, preserving buffered audio data.
     270
     271    Sets error() to QAudio::NoError, state() to QAudio::SuspendedState and
     272    emit stateChanged() signal.
    270273*/
    271274
    272275void QAudioOutput::suspend()
    273276{
    274     /*
    275     -If not ActiveState|IdleState, return
    276     -stop processing audio, saving all buffered audio data
    277     -set NoError and SuspendedState
    278     -emit stateChanged()
    279     */
    280277    d->suspend();
    281278}
     
    283280/*!
    284281    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.
    285289*/
    286290
    287291void QAudioOutput::resume()
    288292{
    289     /*
    290     -If SuspendedState, return
    291     -resume audio
    292     -(PULL MODE): set ActiveState, NoError
    293     -(PUSH MODE): set IdleState, NoError
    294     -kick start audio if needed
    295     -emit stateChanged()
    296     */
    297293     d->resume();
    298294}
     
    300296/*!
    301297    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.
    302301*/
    303302
    304303int QAudioOutput::bytesFree() const
    305304{
    306     /*
    307     -If not ActiveState|IdleState, return 0
    308     -return space available in audio buffer in bytes
    309     */
    310305    return d->bytesFree();
    311306}
     
    354349    Sets the interval for notify() signal to be emitted.
    355350    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.
    357355*/
    358356
     
    372370
    373371/*!
    374     Returns the amount of audio data processed since start()
     372    Returns the amount of audio data processed by the class since start()
    375373    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
    376383*/
    377384
Note: See TracChangeset for help on using the changeset viewer.