Mercurial > hg > svapp
changeset 623:9e15607531b2
Merge from branch import-audio-data
author | Chris Cannam |
---|---|
date | Wed, 12 Sep 2018 15:58:35 +0100 |
parents | e98a42e94d90 (current diff) 22e455beee3b (diff) |
children | 15a566f26114 51ecc3e2d71c |
files | |
diffstat | 4 files changed, 33 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- a/audio/AudioCallbackRecordTarget.cpp Tue Sep 04 11:32:49 2018 +0100 +++ b/audio/AudioCallbackRecordTarget.cpp Wed Sep 12 15:58:35 2018 +0100 @@ -15,7 +15,7 @@ #include "AudioCallbackRecordTarget.h" #include "base/ViewManagerBase.h" -#include "base/TempDirectory.h" +#include "base/RecordDirectory.h" #include "data/model/WritableWaveFileModel.h" @@ -222,35 +222,6 @@ } } -QString -AudioCallbackRecordTarget::getRecordContainerFolder() -{ - QDir parent(TempDirectory::getInstance()->getContainingPath()); - QString subdirname("recorded"); - - if (!parent.mkpath(subdirname)) { - SVCERR << "ERROR: AudioCallbackRecordTarget::getRecordContainerFolder: Failed to create recorded dir in \"" << parent.canonicalPath() << "\"" << endl; - return ""; - } else { - return parent.filePath(subdirname); - } -} - -QString -AudioCallbackRecordTarget::getRecordFolder() -{ - QDir parent(getRecordContainerFolder()); - QDateTime now = QDateTime::currentDateTime(); - QString subdirname = QString("%1").arg(now.toString("yyyyMMdd")); - - if (!parent.mkpath(subdirname)) { - SVCERR << "ERROR: AudioCallbackRecordTarget::getRecordFolder: Failed to create recorded dir in \"" << parent.canonicalPath() << "\"" << endl; - return ""; - } else { - return parent.filePath(subdirname); - } -} - WritableWaveFileModel * AudioCallbackRecordTarget::startRecording() { @@ -262,7 +233,7 @@ m_model = 0; m_frameCount = 0; - QString folder = getRecordFolder(); + QString folder = RecordDirectory::getRecordDirectory(); if (folder == "") return 0; QDir recordedDir(folder); @@ -277,9 +248,11 @@ m_audioFileName = recordedDir.filePath(filename); - m_model = new WritableWaveFileModel(m_recordSampleRate, - m_recordChannelCount, - m_audioFileName); + m_model = new WritableWaveFileModel + (m_audioFileName, + m_recordSampleRate, + m_recordChannelCount, + WritableWaveFileModel::Normalisation::None); if (!m_model->isOK()) { SVCERR << "ERROR: AudioCallbackRecordTarget::startRecording: Recording failed"
--- a/audio/AudioCallbackRecordTarget.h Tue Sep 04 11:32:49 2018 +0100 +++ b/audio/AudioCallbackRecordTarget.h Wed Sep 12 15:58:35 2018 +0100 @@ -56,9 +56,6 @@ virtual void setInputLevels(float peakLeft, float peakRight) override; virtual void audioProcessingOverload() override { } - - QString getRecordContainerFolder(); - QString getRecordFolder(); virtual bool isRecording() const override { return m_recording; } virtual sv_frame_t getRecordDuration() const override { return m_frameCount; }
--- a/framework/MainWindowBase.cpp Tue Sep 04 11:32:49 2018 +0100 +++ b/framework/MainWindowBase.cpp Wed Sep 12 15:58:35 2018 +0100 @@ -1498,8 +1498,16 @@ } } -// cerr << "mode = " << mode << endl; - + return addOpenedAudioModel(source, newModel, mode, templateName, true); +} + +MainWindowBase::FileOpenStatus +MainWindowBase::addOpenedAudioModel(FileSource source, + WaveFileModel *newModel, + AudioFileOpenMode mode, + QString templateName, + bool registerSource) +{ if (mode == AskUser) { if (getMainModel()) { @@ -1635,7 +1643,9 @@ } } - if (!source.isRemote()) m_audioFile = source.getLocalFilename(); + if (!source.isRemote() && registerSource) { + m_audioFile = source.getLocalFilename(); + } } else if (mode == CreateAdditionalModel) { @@ -1704,12 +1714,16 @@ } updateMenuStates(); - m_recentFiles.addFile(source.getLocation()); - if (!source.isRemote()) { + + if (registerSource) { + m_recentFiles.addFile(source.getLocation()); + } + if (!source.isRemote() && registerSource) { // for file dialog registerLastOpenedFilePath(FileFinder::AudioFile, source.getLocalFilename()); } + m_openingAudioFile = false; currentPaneChanged(m_paneStack->getCurrentPane()); @@ -1856,6 +1870,7 @@ (path, dialog->getFormat(), getMainModel()->getSampleRate()); } + delete dialog; } if (model) {
--- a/framework/MainWindowBase.h Tue Sep 04 11:32:49 2018 +0100 +++ b/framework/MainWindowBase.h Wed Sep 12 15:58:35 2018 +0100 @@ -396,6 +396,12 @@ const WaveFileModel *getMainModel() const; void createDocument(); + FileOpenStatus addOpenedAudioModel(FileSource source, + WaveFileModel *model, + AudioFileOpenMode mode, + QString templateName, + bool registerSource); + sv_frame_t getModelsStartFrame() const; // earliest across all views sv_frame_t getModelsEndFrame() const; // latest across all views