summaryrefslogtreecommitdiffstats
path: root/examples/multimedia/audiorecorder
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@digia.com>2013-04-11 16:20:06 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-16 13:38:43 +0200
commit315bcd075816465e57e703290b0b1404af2ae7c9 (patch)
tree1714ca2cae1f74a3d263a6d992c3fe4570f21736 /examples/multimedia/audiorecorder
parentf2af807c5bef83a6b0f79b3adacae72d8be5b1ad (diff)
Fix file path bug in audiorecorder example
Default path and name of the output wave audio files were wrong. This means the files did not have the right name to be opened on Windows, and did not have the right path because they were being saved to the root folder. (C:/ on windows, and / on OSX). Now we fall back to the default filepath and name when we try to record without giving a path and filename. Task-number: QTBUG-28663 Change-Id: I8c782a31710cac65cd3c1ecd44de10b41c46e93d Reviewed-by: Christian Stromme <christian.stromme@digia.com>
Diffstat (limited to 'examples/multimedia/audiorecorder')
-rw-r--r--examples/multimedia/audiorecorder/audiorecorder.cpp21
-rw-r--r--examples/multimedia/audiorecorder/audiorecorder.h1
2 files changed, 0 insertions, 22 deletions
diff --git a/examples/multimedia/audiorecorder/audiorecorder.cpp b/examples/multimedia/audiorecorder/audiorecorder.cpp
index ac8476803..5f3b0a10a 100644
--- a/examples/multimedia/audiorecorder/audiorecorder.cpp
+++ b/examples/multimedia/audiorecorder/audiorecorder.cpp
@@ -172,9 +172,6 @@ void AudioRecorder::toggleRecord()
if (audioRecorder->state() == QMediaRecorder::StoppedState) {
audioRecorder->setAudioInput(boxValue(ui->audioDeviceBox).toString());
- if (!outputLocationSet)
- audioRecorder->setOutputLocation(generateAudioFilePath());
-
QAudioEncoderSettings settings;
settings.setCodec(boxValue(ui->audioCodecBox).toString());
settings.setSampleRate(boxValue(ui->sampleRateBox).toInt());
@@ -214,24 +211,6 @@ void AudioRecorder::displayErrorMessage()
ui->statusbar->showMessage(audioRecorder->errorString());
}
-QUrl AudioRecorder::generateAudioFilePath()
-{
- QDir outputDir(QDir::rootPath());
-
- int lastImage = 0;
- int fileCount = 0;
- foreach (const QString &fileName, outputDir.entryList(QStringList(QString("testclip_*")))) {
- int imgNumber = fileName.mid(5, fileName.size() - 9).toInt();
- lastImage = qMax(lastImage, imgNumber);
- if (outputDir.exists(fileName))
- fileCount += 1;
- }
- lastImage += fileCount;
- QUrl location(QDir::toNativeSeparators(outputDir.canonicalPath()
- + QString("/testclip_%1").arg(lastImage + 1, 4, 10, QLatin1Char('0'))));
- return location;
-}
-
// This function returns the maximum possible sample value for a given audio format
qreal getPeakValue(const QAudioFormat& format)
{
diff --git a/examples/multimedia/audiorecorder/audiorecorder.h b/examples/multimedia/audiorecorder/audiorecorder.h
index 22cce4bbd..1a12031ec 100644
--- a/examples/multimedia/audiorecorder/audiorecorder.h
+++ b/examples/multimedia/audiorecorder/audiorecorder.h
@@ -71,7 +71,6 @@ private slots:
void updateState(QMediaRecorder::State);
void updateProgress(qint64 pos);
void displayErrorMessage();
- QUrl generateAudioFilePath();
private:
Ui::AudioRecorder *ui;