summaryrefslogtreecommitdiffstats
path: root/src/multimedia
diff options
context:
space:
mode:
authorartoka <arto.katajasalo@digia.com>2011-11-28 10:59:12 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-01-31 16:31:38 (GMT)
commit40fb4750910e23d3e7128ca8e0f1c5920b05bd5a (patch)
tree3ecce1e68f83c1cbb3e22cf3c74a27f515099d5e /src/multimedia
parent1ac0ae47bd2271149241ae715f03252d7015459c (diff)
downloadQt-40fb4750910e23d3e7128ca8e0f1c5920b05bd5a.zip
Qt-40fb4750910e23d3e7128ca8e0f1c5920b05bd5a.tar.gz
Qt-40fb4750910e23d3e7128ca8e0f1c5920b05bd5a.tar.bz2
Various qt documentation fixes (wk 43)
Task-number: QTBUG-12389 Task-number: QTBUG-16667 Task-number: QTBUG-6151 Task-number: QTBUG-8625 Task-number: QTBUG-19808 Task-number: QTBUG-12096 Task-number: QTBUG-1231 Task-number: QTBUG-21073 Task-number: QTBUG-8939 Task-number: QTBUG-20399 Task-number: QTBUG-20944 Task-number: QTBUG-7542 Task-number: QTBUG-22095 Task-number: QTBUG-11278 Task-number: QTBUG-15653 Change-Id: Ibc369998d06e7f2f11b01a1ba4c2fb927e3c065b Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
Diffstat (limited to 'src/multimedia')
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo.cpp4
-rw-r--r--src/multimedia/audio/qaudioinput.cpp45
-rw-r--r--src/multimedia/audio/qaudiooutput.cpp45
3 files changed, 12 insertions, 82 deletions
diff --git a/src/multimedia/audio/qaudiodeviceinfo.cpp b/src/multimedia/audio/qaudiodeviceinfo.cpp
index 2f1b86c..31c45b6 100644
--- a/src/multimedia/audio/qaudiodeviceinfo.cpp
+++ b/src/multimedia/audio/qaudiodeviceinfo.cpp
@@ -114,9 +114,9 @@ public:
supported format that is as close as possible to the format with
nearestFormat(). For instance:
- \snippet doc/src/snippets/audio/main.cpp 1
+ \snippet doc/src/snippets/audio/main.cpp 6
\dots 8
- \snippet doc/src/snippets/audio/main.cpp 2
+ \snippet doc/src/snippets/audio/main.cpp 7
A QAudioDeviceInfo is used by Qt to construct
classes that communicate with the device--such as
diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp
index 2fdee31..f13705c 100644
--- a/src/multimedia/audio/qaudioinput.cpp
+++ b/src/multimedia/audio/qaudioinput.cpp
@@ -76,37 +76,9 @@ QT_BEGIN_NAMESPACE
with a QIODevice opened for writing. For instance, to record to a
file, you can:
- \code
- QFile outputFile; // class member.
- QAudioInput* audio; // class member.
- \endcode
-
- \code
- {
- outputFile.setFileName("/tmp/test.raw");
- outputFile.open( QIODevice::WriteOnly | QIODevice::Truncate );
-
- QAudioFormat format;
- // set up the format you want, eg.
- format.setFrequency(8000);
- format.setChannels(1);
- format.setSampleSize(8);
- format.setCodec("audio/pcm");
- format.setByteOrder(QAudioFormat::LittleEndian);
- format.setSampleType(QAudioFormat::UnSignedInt);
-
- QAudioDeviceInfo info = QAudioDeviceInfo::defaultInputDevice();
- if (!info.isFormatSupported(format)) {
- qWarning()<<"default format not supported try to use nearest";
- format = info.nearestFormat(format);
- }
-
- audio = new QAudioInput(format, this);
- QTimer::singleShot(3000, this, SLOT(stopRecording()));
- audio->start(&outputFile);
- // Records audio for 3000ms
- }
- \endcode
+ \snippet doc/src/snippets/audio/main.cpp 3
+ \dots 4
+ \snippet doc/src/snippets/audio/main.cpp 0
This will start recording if the format specified is supported by
the input device (you can check this with
@@ -114,14 +86,7 @@ QT_BEGIN_NAMESPACE
snags, use the error() function to check what went wrong. We stop
recording in the \c stopRecording() slot.
- \code
- void stopRecording()
- {
- audio->stop();
- outputFile->close();
- delete audio;
- }
- \endcode
+ \snippet doc/src/snippets/audio/main.cpp 1
At any point in time, QAudioInput will be in one of four states:
active, suspended, stopped, or idle. These states are specified by
@@ -143,7 +108,7 @@ QT_BEGIN_NAMESPACE
an error is encountered. Connect to the stateChanged() signal to
handle the error:
- \snippet doc/src/snippets/audio/main.cpp 0
+ \snippet doc/src/snippets/audio/main.cpp 2
\sa QAudioOutput, QAudioDeviceInfo
diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp
index 290394c..1db1443 100644
--- a/src/multimedia/audio/qaudiooutput.cpp
+++ b/src/multimedia/audio/qaudiooutput.cpp
@@ -72,35 +72,9 @@ QT_BEGIN_NAMESPACE
needs from the io device. So playing back an audio file is as
simple as:
- \code
- QFile inputFile; // class member.
- QAudioOutput* audio; // class member.
- \endcode
-
- \code
- inputFile.setFileName("/tmp/test.raw");
- inputFile.open(QIODevice::ReadOnly);
-
- QAudioFormat format;
- // Set up the format, eg.
- format.setFrequency(8000);
- format.setChannels(1);
- format.setSampleSize(8);
- format.setCodec("audio/pcm");
- format.setByteOrder(QAudioFormat::LittleEndian);
- format.setSampleType(QAudioFormat::UnSignedInt);
-
- QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
- if (!info.isFormatSupported(format)) {
- qWarning()<<"raw audio format not supported by backend, cannot play audio.";
- return;
- }
-
- audio = new QAudioOutput(format, this);
- connect(audio,SIGNAL(stateChanged(QAudio::State)),SLOT(finishedPlaying(QAudio::State)));
- audio->start(&inputFile);
-
- \endcode
+ \snippet doc/src/snippets/audio/main.cpp 9
+ \dots 4
+ \snippet doc/src/snippets/audio/main.cpp 4
The file will start playing assuming that the audio system and
output device support it. If you run out of luck, check what's
@@ -108,16 +82,7 @@ QT_BEGIN_NAMESPACE
After the file has finished playing, we need to stop the device:
- \code
- void finishedPlaying(QAudio::State state)
- {
- if(state == QAudio::IdleState) {
- audio->stop();
- inputFile.close();
- delete audio;
- }
- }
- \endcode
+ \snippet doc/src/snippets/audio/main.cpp 5
At any given time, the QAudioOutput will be in one of four states:
active, suspended, stopped, or idle. These states are described
@@ -145,7 +110,7 @@ QT_BEGIN_NAMESPACE
You can check for errors by connecting to the stateChanged()
signal:
- \snippet doc/src/snippets/audio/main.cpp 3
+ \snippet doc/src/snippets/audio/main.cpp 8
\sa QAudioInput, QAudioDeviceInfo
*/