diff options
author | Kurt Korbatits <kurt.korbatits@nokia.com> | 2009-11-05 04:18:38 (GMT) |
---|---|---|
committer | Kurt Korbatits <kurt.korbatits@nokia.com> | 2009-11-05 04:18:38 (GMT) |
commit | 5989d15f73da71b69a27129349a07a15954a8853 (patch) | |
tree | 9bfc7bb98b2074b79291c1e477d8fce77d843ebb /src/multimedia/audio/qaudiooutput.cpp | |
parent | c416d0d026377a5c8659abbd12cb4a8eab7c7264 (diff) | |
download | Qt-5989d15f73da71b69a27129349a07a15954a8853.zip Qt-5989d15f73da71b69a27129349a07a15954a8853.tar.gz Qt-5989d15f73da71b69a27129349a07a15954a8853.tar.bz2 |
Changes to low-level audio API.
QAudioFormat::isNull() -> QAudioFormat::isValid() (inverse logic)
QAudio::SuspendState -> QAudio::SuspendedState
QAudio::StopState -> QAudio::StoppedState
QAudioDeviceInfo::deviceList() -> QAudioDeviceInfo::availableDevices()
clock() -> elapsedUSecs()
totalTime() -> processedUSecs()
QIODevice* start(QIODevice*) -> void start(QIODevice*), QIODevice*
start()
Reviewed-by:Justin McPherson
Diffstat (limited to 'src/multimedia/audio/qaudiooutput.cpp')
-rw-r--r-- | src/multimedia/audio/qaudiooutput.cpp | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp index 81b9496..f8f2fa1 100644 --- a/src/multimedia/audio/qaudiooutput.cpp +++ b/src/multimedia/audio/qaudiooutput.cpp @@ -125,12 +125,12 @@ QT_BEGIN_NAMESPACE not emitted. A typical use-case would be to update a \l{QSlider}{slider} that allows seeking in the stream. If you want the time since playback started regardless of which - states the audio output has been in, clock() is the function for you. + states the audio output has been in, elapsedUSecs() is the function for you. If an error occurs, you can fetch the \l{QAudio::Error}{error type} with the error() function. Please see the QAudio::Error enum for a description of the possible errors that are reported. When - an error is encountered, the state changes to QAudio::StopState. + an error is encountered, the state changes to QAudio::StoppedState. You can check for errors by connecting to the stateChanged() signal: @@ -188,36 +188,42 @@ QAudioFormat QAudioOutput::format() const /*! Uses the \a device as the QIODevice to transfer data. - If \a device is null then the class creates an internal QIODevice. - Returns a pointer to the QIODevice being used to handle the data - transfer. This QIODevice can be used to write() audio data - directly. Passing a QIODevice allows the data to be transfered without any extra code. All that is required is to open the QIODevice. \sa QIODevice */ -QIODevice* QAudioOutput::start(QIODevice* device) +void QAudioOutput::start(QIODevice* device) { /* - PULL MODE (valid QIODevice) - -If currently not StopState, stop. + -If currently not StoppedState, stop. -If previous start was push mode, delete internal QIODevice. -open audio output. - -If ok, NoError and ActiveState, else OpenError and StopState + -If ok, NoError and ActiveState, else OpenError and StoppedState -emit stateChanged() - -return device + */ + d->start(device); +} + +/*! + Returns a pointer to the QIODevice being used to handle the data + transfer. This QIODevice can be used to write() audio data directly. - PUSH MODE (device = 0) - -If currently not StopState, stop. + \sa QIODevice +*/ + +QIODevice* QAudioOutput::start() +{ + /* + -If currently not StoppedState, stop. -If no internal QIODevice, create one. -open audio output. - -If ok, NoError and IdleState, else OpenError and StopState + -If ok, NoError and IdleState, else OpenError and StoppedState -emit stateChanged() -return internal QIODevice */ - return d->start(device); + return d->start(0); } /*! @@ -227,8 +233,8 @@ QIODevice* QAudioOutput::start(QIODevice* device) void QAudioOutput::stop() { /* - -If StopState, return - -set to StopState + -If StoppedState, return + -set to StoppedState -detach from audio device -emit stateChanged() */ @@ -257,7 +263,7 @@ void QAudioOutput::suspend() /* -If not ActiveState|IdleState, return -stop processing audio, saving all buffered audio data - -set NoError and SuspendState + -set NoError and SuspendedState -emit stateChanged() */ d->suspend(); @@ -270,7 +276,7 @@ void QAudioOutput::suspend() void QAudioOutput::resume() { /* - -If SuspendState, return + -If SuspendedState, return -resume audio -(PULL MODE): set ActiveState, NoError -(PUSH MODE): set IdleState, NoError @@ -358,9 +364,9 @@ int QAudioOutput::notifyInterval() const was called in microseconds. */ -qint64 QAudioOutput::totalTime() const +qint64 QAudioOutput::processedUSecs() const { - return d->totalTime(); + return d->processedUSecs(); } /*! @@ -368,9 +374,9 @@ qint64 QAudioOutput::totalTime() const Suspend states. */ -qint64 QAudioOutput::clock() const +qint64 QAudioOutput::elapsedUSecs() const { - return d->clock(); + return d->elapsedUSecs(); } /*! |