comparison framework/MainWindowBase.cpp @ 488:6eb28350050d tony-2.0-integration

Merge from branch recording
author Chris Cannam
date Thu, 17 Sep 2015 12:08:29 +0100
parents 21d3cf5c8f21 66b92c188cbd
children 7d9cef941d4d
comparison
equal deleted inserted replaced
485:21d3cf5c8f21 488:6eb28350050d
2196 */ 2196 */
2197 2197
2198 if (m_soundOptions & WithAudioInput) { 2198 if (m_soundOptions & WithAudioInput) {
2199 m_audioIO = breakfastquay::AudioFactory:: 2199 m_audioIO = breakfastquay::AudioFactory::
2200 createCallbackIO(m_recordTarget, m_playSource); 2200 createCallbackIO(m_recordTarget, m_playSource);
2201 m_audioIO->suspend(); // start in suspended state
2201 m_playSource->setSystemPlaybackTarget(m_audioIO); 2202 m_playSource->setSystemPlaybackTarget(m_audioIO);
2202 } else { 2203 } else {
2203 m_playTarget = breakfastquay::AudioFactory:: 2204 m_playTarget = breakfastquay::AudioFactory::
2204 createCallbackPlayTarget(m_playSource); 2205 createCallbackPlayTarget(m_playSource);
2205 m_playSource->setSystemPlaybackTarget(m_playTarget); 2206 m_playSource->setSystemPlaybackTarget(m_playTarget);
2657 if (m_recordTarget->isRecording() || m_playSource->isPlaying()) { 2658 if (m_recordTarget->isRecording() || m_playSource->isPlaying()) {
2658 stop(); 2659 stop();
2659 QAction *action = qobject_cast<QAction *>(sender()); 2660 QAction *action = qobject_cast<QAction *>(sender());
2660 if (action) action->setChecked(false); 2661 if (action) action->setChecked(false);
2661 } else { 2662 } else {
2663 if (m_audioIO) m_audioIO->resume();
2662 playbackFrameChanged(m_viewManager->getPlaybackFrame()); 2664 playbackFrameChanged(m_viewManager->getPlaybackFrame());
2663 m_playSource->play(m_viewManager->getPlaybackFrame()); 2665 m_playSource->play(m_viewManager->getPlaybackFrame());
2664 } 2666 }
2665 } 2667 }
2666 2668
2687 } 2689 }
2688 2690
2689 if (m_audioRecordMode == RecordReplaceSession) { 2691 if (m_audioRecordMode == RecordReplaceSession) {
2690 if (!checkSaveModified()) return; 2692 if (!checkSaveModified()) return;
2691 } 2693 }
2692 2694
2695 if (m_audioIO) m_audioIO->resume();
2696
2693 WritableWaveFileModel *model = m_recordTarget->startRecording(); 2697 WritableWaveFileModel *model = m_recordTarget->startRecording();
2694 if (!model) { 2698 if (!model) {
2695 cerr << "ERROR: MainWindowBase::record: Recording failed" << endl; 2699 cerr << "ERROR: MainWindowBase::record: Recording failed" << endl;
2696 //!!! report 2700 //!!! report
2697 return; 2701 return;
2701 m_recordTarget->stopRecording(); 2705 m_recordTarget->stopRecording();
2702 delete model; 2706 delete model;
2703 //!!! ??? 2707 //!!! ???
2704 return; 2708 return;
2705 } 2709 }
2706 2710
2707 PlayParameterRepository::getInstance()->addPlayable(model); 2711 PlayParameterRepository::getInstance()->addPlayable(model);
2708 2712
2709 if (m_audioRecordMode == RecordReplaceSession || !getMainModel()) { 2713 if (m_audioRecordMode == RecordReplaceSession || !getMainModel()) {
2710 2714
2711 //!!! duplication with openAudio here 2715 //!!! duplication with openAudio here
3019 emit audioFileLoaded(); 3023 emit audioFileLoaded();
3020 } 3024 }
3021 3025
3022 m_playSource->stop(); 3026 m_playSource->stop();
3023 3027
3028 if (m_audioIO) m_audioIO->suspend();
3029
3024 if (m_paneStack && m_paneStack->getCurrentPane()) { 3030 if (m_paneStack && m_paneStack->getCurrentPane()) {
3025 updateVisibleRangeDisplay(m_paneStack->getCurrentPane()); 3031 updateVisibleRangeDisplay(m_paneStack->getCurrentPane());
3026 } else { 3032 } else {
3027 m_myStatusMessage = ""; 3033 m_myStatusMessage = "";
3028 getStatusLabel()->setText(""); 3034 getStatusLabel()->setText("");