comparison framework/MainWindowBase.cpp @ 500:dcd2afbc1bb7 3.0-integration

Merge, but dropping the last commit from the recording branch because I prefer the way it was done here
author Chris Cannam
date Wed, 14 Oct 2015 10:17:32 +0100
parents a4d90cf2bb79 40e7b4e1b569
children c82cae9a9e74
comparison
equal deleted inserted replaced
499:a4d90cf2bb79 500:dcd2afbc1bb7
2679 } 2679 }
2680 2680
2681 if (!m_audioIO) { 2681 if (!m_audioIO) {
2682 createAudioIO(); 2682 createAudioIO();
2683 } 2683 }
2684
2685 if (!m_audioIO) {
2686 //!!! report
2687 return;
2688 }
2684 2689
2685 if (m_recordTarget->isRecording()) { 2690 if (m_recordTarget->isRecording()) {
2686 m_recordTarget->stopRecording(); 2691 stop();
2687 emit audioFileLoaded();
2688 return; 2692 return;
2689 } 2693 }
2690 2694
2695 QAction *action = qobject_cast<QAction *>(sender());
2696
2691 if (m_audioRecordMode == RecordReplaceSession) { 2697 if (m_audioRecordMode == RecordReplaceSession) {
2692 if (!checkSaveModified()) return; 2698 if (!checkSaveModified()) {
2693 } 2699 if (action) action->setChecked(false);
2694 2700 return;
2701 }
2702 }
2703
2704 m_audioIO->resume();
2695 WritableWaveFileModel *model = m_recordTarget->startRecording(); 2705 WritableWaveFileModel *model = m_recordTarget->startRecording();
2696 if (!model) { 2706 if (!model) {
2697 cerr << "ERROR: MainWindowBase::record: Recording failed" << endl; 2707 cerr << "ERROR: MainWindowBase::record: Recording failed" << endl;
2698 //!!! report 2708 //!!! report
2709 if (action) action->setChecked(false);
2699 return; 2710 return;
2700 } 2711 }
2701 2712
2702 if (!model->isOK()) { 2713 if (!model->isOK()) {
2703 m_recordTarget->stopRecording(); 2714 m_recordTarget->stopRecording();
2715 m_audioIO->suspend();
2704 delete model; 2716 delete model;
2705 //!!! ???
2706 return; 2717 return;
2707 } 2718 }
2708 2719
2709 PlayParameterRepository::getInstance()->addPlayable(model); 2720 PlayParameterRepository::getInstance()->addPlayable(model);
2710 2721
2716 bool loadedTemplate = false; 2727 bool loadedTemplate = false;
2717 2728
2718 if (templateName != "") { 2729 if (templateName != "") {
2719 FileOpenStatus tplStatus = openSessionTemplate(templateName); 2730 FileOpenStatus tplStatus = openSessionTemplate(templateName);
2720 if (tplStatus == FileOpenCancelled) { 2731 if (tplStatus == FileOpenCancelled) {
2732 m_recordTarget->stopRecording();
2733 m_audioIO->suspend();
2734 PlayParameterRepository::getInstance()->removePlayable(model);
2721 return; 2735 return;
2722 } 2736 }
2723 if (tplStatus != FileOpenFailed) { 2737 if (tplStatus != FileOpenFailed) {
2724 loadedTemplate = true; 2738 loadedTemplate = true;
2725 } 2739 }