summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJustin McPherson <justin.mcpherson@nokia.com>2009-12-14 01:09:50 (GMT)
committerJustin McPherson <justin.mcpherson@nokia.com>2009-12-14 01:09:50 (GMT)
commitcce709287279a8dd5ac17ed4c9dd09ebb78c4f27 (patch)
tree4d8f23ce11ddd57ffc356d79f9988d7c3f406922 /examples
parent11f61a9c413352e01fd2180250aa3fb09e1b4ac9 (diff)
parentad2509f8d7c634364ae7082dcc83b6906d235750 (diff)
downloadQt-cce709287279a8dd5ac17ed4c9dd09ebb78c4f27.zip
Qt-cce709287279a8dd5ac17ed4c9dd09ebb78c4f27.tar.gz
Qt-cce709287279a8dd5ac17ed4c9dd09ebb78c4f27.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt-multimedia-team into 4.6
Conflicts: configure.exe
Diffstat (limited to 'examples')
-rw-r--r--examples/multimedia/audioinput/audioinput.cpp12
-rw-r--r--examples/multimedia/audiooutput/audiooutput.cpp12
2 files changed, 23 insertions, 1 deletions
diff --git a/examples/multimedia/audioinput/audioinput.cpp b/examples/multimedia/audioinput/audioinput.cpp
index 62afd73..75bddd6 100644
--- a/examples/multimedia/audioinput/audioinput.cpp
+++ b/examples/multimedia/audioinput/audioinput.cpp
@@ -195,7 +195,6 @@ InputTest::InputTest()
pullMode = true;
- // AudioInfo class only supports mono S16LE samples!
format.setFrequency(8000);
format.setChannels(1);
format.setSampleSize(16);
@@ -203,6 +202,17 @@ InputTest::InputTest()
format.setByteOrder(QAudioFormat::LittleEndian);
format.setCodec("audio/pcm");
+ QAudioDeviceInfo info(QAudioDeviceInfo::defaultInputDevice());
+ if (!info.isFormatSupported(format)) {
+ qWarning()<<"default format not supported try to use nearest";
+ format = info.nearestFormat(format);
+ }
+
+ if(format.sampleSize() != 16) {
+ qWarning()<<"audio device doesn't support 16 bit samples, example cannot run";
+ return;
+ }
+
audioInput = new QAudioInput(format,this);
connect(audioInput,SIGNAL(notify()),SLOT(status()));
connect(audioInput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State)));
diff --git a/examples/multimedia/audiooutput/audiooutput.cpp b/examples/multimedia/audiooutput/audiooutput.cpp
index 244840d..b6047db 100644
--- a/examples/multimedia/audiooutput/audiooutput.cpp
+++ b/examples/multimedia/audiooutput/audiooutput.cpp
@@ -170,6 +170,18 @@ AudioTest::AudioTest()
settings.setCodec("audio/pcm");
settings.setByteOrder(QAudioFormat::LittleEndian);
settings.setSampleType(QAudioFormat::SignedInt);
+
+ QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
+ if (!info.isFormatSupported(settings)) {
+ qWarning()<<"default format not supported try to use nearest";
+ settings = info.nearestFormat(settings);
+ }
+
+ if(settings.sampleSize() != 16) {
+ qWarning()<<"audio device doesn't support 16 bit samples, example cannot run";
+ return;
+ }
+
audioOutput = new QAudioOutput(settings,this);
connect(audioOutput,SIGNAL(notify()),SLOT(status()));
connect(audioOutput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State)));