comparison 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
comparison
equal deleted inserted replaced
774:7bded7599874 775:56a81812c131
3405 if (m_viewManager) m_viewManager->setGlobalCentreFrame(0); 3405 if (m_viewManager) m_viewManager->setGlobalCentreFrame(0);
3406 3406
3407 SVCERR << "MainWindowBase::record: about to resume" << endl; 3407 SVCERR << "MainWindowBase::record: about to resume" << endl;
3408 m_audioIO->resume(); 3408 m_audioIO->resume();
3409 3409
3410 WritableWaveFileModel *modelPtr = m_recordTarget->startRecording(); 3410 ModelId modelId = m_recordTarget->startRecording();
3411 if (!modelPtr) { 3411 if (modelId.isNone()) {
3412 SVCERR << "ERROR: MainWindowBase::record: Recording failed" << endl; 3412 SVCERR << "ERROR: MainWindowBase::record: Recording failed" << endl;
3413 QMessageBox::critical 3413 QMessageBox::critical
3414 (this, tr("Recording failed"), 3414 (this, tr("Recording failed"),
3415 tr("<b>Recording failed</b><p>Failed to switch to record mode (some internal problem?)</p>")); 3415 tr("<b>Recording failed</b><p>Failed to switch to record mode (some internal problem?)</p>"));
3416 if (action) action->setChecked(false); 3416 if (action) action->setChecked(false);
3417 return; 3417 return;
3418 } 3418 }
3419 3419
3420 if (!modelPtr->isOK()) { 3420 auto model = ModelById::getAs<WritableWaveFileModel>(modelId);
3421 SVCERR << "MainWindowBase::record: Model not OK, stopping and suspending" << endl; 3421 if (!model) {
3422 m_recordTarget->stopRecording(); 3422 SVCERR << "ERROR: MainWindowBase::record: Model lost?" << endl;
3423 m_audioIO->suspend();
3424 if (action) action->setChecked(false); 3423 if (action) action->setChecked(false);
3425 delete modelPtr;
3426 return; 3424 return;
3427 } 3425 }
3428 3426
3429 SVCERR << "MainWindowBase::record: Model is OK, continuing..." << endl; 3427 SVCERR << "MainWindowBase::record: Model is OK, continuing..." << endl;
3430 3428
3431 QString location = modelPtr->getLocation(); 3429 QString location = model->getLocation();
3432
3433 auto modelId = ModelById::add(std::shared_ptr<Model>(modelPtr));
3434 3430
3435 if (m_audioRecordMode == RecordReplaceSession || !getMainModel()) { 3431 if (m_audioRecordMode == RecordReplaceSession || !getMainModel()) {
3436 3432
3437 //!!! duplication with openAudio here 3433 //!!! duplication with openAudio here
3438 3434