comparison framework/MainWindowBase.cpp @ 492:7c779438edc3 tony-2.0-integration

Suspend audio driver when stopping recording from record button
author Chris Cannam
date Mon, 12 Oct 2015 15:06:02 +0100
parents 7d9cef941d4d
children 4f1d280903ad
comparison
equal deleted inserted replaced
491:2f5ffd36879b 492:7c779438edc3
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
2691 QAction *action = qobject_cast<QAction *>(sender()); 2695 QAction *action = qobject_cast<QAction *>(sender());
2692 2696
2695 if (action) action->setChecked(false); 2699 if (action) action->setChecked(false);
2696 return; 2700 return;
2697 } 2701 }
2698 } 2702 }
2699 2703
2700 if (m_audioIO) m_audioIO->resume(); 2704 m_audioIO->resume();
2701 2705
2702 WritableWaveFileModel *model = m_recordTarget->startRecording(); 2706 WritableWaveFileModel *model = m_recordTarget->startRecording();
2703 if (!model) { 2707 if (!model) {
2704 cerr << "ERROR: MainWindowBase::record: Recording failed" << endl; 2708 cerr << "ERROR: MainWindowBase::record: Recording failed" << endl;
2705 //!!! report 2709 //!!! report
2707 return; 2711 return;
2708 } 2712 }
2709 2713
2710 if (!model->isOK()) { 2714 if (!model->isOK()) {
2711 m_recordTarget->stopRecording(); 2715 m_recordTarget->stopRecording();
2716 m_audioIO->suspend();
2712 delete model; 2717 delete model;
2713 return; 2718 return;
2714 } 2719 }
2715 2720
2716 PlayParameterRepository::getInstance()->addPlayable(model); 2721 PlayParameterRepository::getInstance()->addPlayable(model);
2724 2729
2725 if (templateName != "") { 2730 if (templateName != "") {
2726 FileOpenStatus tplStatus = openSessionTemplate(templateName); 2731 FileOpenStatus tplStatus = openSessionTemplate(templateName);
2727 if (tplStatus == FileOpenCancelled) { 2732 if (tplStatus == FileOpenCancelled) {
2728 m_recordTarget->stopRecording(); 2733 m_recordTarget->stopRecording();
2734 m_audioIO->suspend();
2729 PlayParameterRepository::getInstance()->removePlayable(model); 2735 PlayParameterRepository::getInstance()->removePlayable(model);
2730 return; 2736 return;
2731 } 2737 }
2732 if (tplStatus != FileOpenFailed) { 2738 if (tplStatus != FileOpenFailed) {
2733 loadedTemplate = true; 2739 loadedTemplate = true;