summaryrefslogtreecommitdiffstats
path: root/src/multimedia/audio/qaudioinput.cpp
diff options
context:
space:
mode:
authorKurt Korbatits <kurt.korbatits@nokia.com>2009-11-05 04:18:38 (GMT)
committerKurt Korbatits <kurt.korbatits@nokia.com>2009-11-10 03:55:12 (GMT)
commit75fb85bbf1b2dc473f99da72124daa65c5839e01 (patch)
tree83975d52d8430270372400c922f9764d5f7adbf6 /src/multimedia/audio/qaudioinput.cpp
parent74d3a4bf9654c8bbe9139951cc5c9352015438a6 (diff)
downloadQt-75fb85bbf1b2dc473f99da72124daa65c5839e01.zip
Qt-75fb85bbf1b2dc473f99da72124daa65c5839e01.tar.gz
Qt-75fb85bbf1b2dc473f99da72124daa65c5839e01.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/qaudioinput.cpp')
-rw-r--r--src/multimedia/audio/qaudioinput.cpp63
1 files changed, 35 insertions, 28 deletions
diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp
index 7a3be23..e794eaf 100644
--- a/src/multimedia/audio/qaudioinput.cpp
+++ b/src/multimedia/audio/qaudioinput.cpp
@@ -121,15 +121,15 @@ QT_BEGIN_NAMESPACE
when the state changes (stateChanged()).
QAudioInput provides several ways of measuring the time that has
- passed since the start() of the recording. The \c totalTime()
+ passed since the start() of the recording. The \c processedUSecs()
function returns the length of the stream in microseconds written,
i.e., it leaves out the times the audio input was suspended or idle.
- The clock() function returns the time elapsed since start() was called regardless of
+ The elapsedUSecs() function returns the time elapsed since start() was called regardless of
which states the QAudioInput has been in.
If an error should occur, you can fetch its reason with error().
The possible error reasons are described by the QAudio::Error
- enum. The QAudioInput will enter the \l{QAudio::}{StopState} when
+ enum. The QAudioInput will enter the \l{QAudio::}{StoppedState} when
an error is encountered. Connect to the stateChanged() signal to
handle the error:
@@ -176,37 +176,44 @@ QAudioInput::~QAudioInput()
}
/*!
- Uses the \a device as the QIODevice to transfer data.
- If \a device is null then the class creates an internal QIODevice.
+ Uses the \a device as the QIODevice to transfer data.
+ Passing a QIODevice allows the data to be transfered without any extra code.
+ All that is required is to open the QIODevice.
+
+ \sa QIODevice
+*/
+
+void QAudioInput::start(QIODevice* device)
+{
+ /*
+ -If currently not StoppedState, stop
+ -If previous start was push mode, delete internal QIODevice.
+ -open audio input.
+ If ok, NoError and ActiveState, else OpenError and StoppedState.
+ -emit stateChanged()
+ */
+ d->start(device);
+}
+
+/*!
Returns a pointer to the QIODevice being used to handle the data
transfer. This QIODevice can be used to read() 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* QAudioInput::start(QIODevice* device)
+QIODevice* QAudioInput::start()
{
/*
- PULL MODE (valid QIODevice)
- -If currently not StopState, stop
- -If previous start was push mode, delete internal QIODevice.
- -open audio input.
- If ok, NoError and ActiveState, else OpenError and StopState.
- -emit stateChanged()
- -return device
-
- PUSH MODE (device = 0)
- -If currently not StopState, stop
+ -If currently not StoppedState, stop
-If no internal QIODevice, create one.
-open audio input.
- -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);
}
/*!
@@ -225,8 +232,8 @@ QAudioFormat QAudioInput::format() const
void QAudioInput::stop()
{
/*
- -If StopState, return
- -set to StopState
+ -If StoppedState, return
+ -set to StoppedState
-detach from audio device
-emit stateChanged()
*/
@@ -255,7 +262,7 @@ void QAudioInput::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();
@@ -268,7 +275,7 @@ void QAudioInput::suspend()
void QAudioInput::resume()
{
/*
- -If SuspendState, return
+ -If SuspendedState, return
-resume audio
-(PULL MODE): set ActiveState, NoError
-(PUSH MODE): set IdleState, NoError
@@ -357,9 +364,9 @@ int QAudioInput::notifyInterval() const
was called in microseconds.
*/
-qint64 QAudioInput::totalTime() const
+qint64 QAudioInput::processedUSecs() const
{
- return d->totalTime();
+ return d->processedUSecs();
}
/*!
@@ -367,9 +374,9 @@ qint64 QAudioInput::totalTime() const
Suspend states.
*/
-qint64 QAudioInput::clock() const
+qint64 QAudioInput::elapsedUSecs() const
{
- return d->clock();
+ return d->elapsedUSecs();
}
/*!