Mercurial > hg > svapp
diff framework/MainWindowBase.cpp @ 775:56a81812c131 smoother-recording
Use ModelId for recording model; add mix-to-mono option
author | Chris Cannam |
---|---|
date | Tue, 16 Jun 2020 15:17:50 +0100 |
parents | 7bded7599874 |
children |
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp Wed Jun 03 13:58:29 2020 +0100 +++ b/framework/MainWindowBase.cpp Tue Jun 16 15:17:50 2020 +0100 @@ -3407,8 +3407,8 @@ SVCERR << "MainWindowBase::record: about to resume" << endl; m_audioIO->resume(); - WritableWaveFileModel *modelPtr = m_recordTarget->startRecording(); - if (!modelPtr) { + ModelId modelId = m_recordTarget->startRecording(); + if (modelId.isNone()) { SVCERR << "ERROR: MainWindowBase::record: Recording failed" << endl; QMessageBox::critical (this, tr("Recording failed"), @@ -3417,20 +3417,16 @@ return; } - if (!modelPtr->isOK()) { - SVCERR << "MainWindowBase::record: Model not OK, stopping and suspending" << endl; - m_recordTarget->stopRecording(); - m_audioIO->suspend(); + auto model = ModelById::getAs<WritableWaveFileModel>(modelId); + if (!model) { + SVCERR << "ERROR: MainWindowBase::record: Model lost?" << endl; if (action) action->setChecked(false); - delete modelPtr; return; } - + SVCERR << "MainWindowBase::record: Model is OK, continuing..." << endl; - QString location = modelPtr->getLocation(); - - auto modelId = ModelById::add(std::shared_ptr<Model>(modelPtr)); + QString location = model->getLocation(); if (m_audioRecordMode == RecordReplaceSession || !getMainModel()) {