comparison framework/MainWindowBase.cpp @ 498:cd9dec2f47e8 recording

Fix suspending/resuming audio device; it wasn't suspending when playback reached the end, only when the user stopped explicitly
author Chris Cannam
date Tue, 22 Sep 2015 17:12:37 +0100
parents 66b92c188cbd
children a4d90cf2bb79
comparison
equal deleted inserted replaced
487:66b92c188cbd 498:cd9dec2f47e8
2200 if (m_soundOptions & WithAudioInput) { 2200 if (m_soundOptions & WithAudioInput) {
2201 m_audioIO = breakfastquay::AudioFactory:: 2201 m_audioIO = breakfastquay::AudioFactory::
2202 createCallbackIO(m_recordTarget, m_playSource); 2202 createCallbackIO(m_recordTarget, m_playSource);
2203 m_audioIO->suspend(); // start in suspended state 2203 m_audioIO->suspend(); // start in suspended state
2204 m_playSource->setSystemPlaybackTarget(m_audioIO); 2204 m_playSource->setSystemPlaybackTarget(m_audioIO);
2205 m_recordTarget->setSystemRecordSource(m_audioIO);
2205 } else { 2206 } else {
2206 m_playTarget = breakfastquay::AudioFactory:: 2207 m_playTarget = breakfastquay::AudioFactory::
2207 createCallbackPlayTarget(m_playSource); 2208 createCallbackPlayTarget(m_playSource);
2208 m_playSource->setSystemPlaybackTarget(m_playTarget); 2209 m_playSource->setSystemPlaybackTarget(m_playTarget);
2209 } 2210 }
2660 if (m_recordTarget->isRecording() || m_playSource->isPlaying()) { 2661 if (m_recordTarget->isRecording() || m_playSource->isPlaying()) {
2661 stop(); 2662 stop();
2662 QAction *action = qobject_cast<QAction *>(sender()); 2663 QAction *action = qobject_cast<QAction *>(sender());
2663 if (action) action->setChecked(false); 2664 if (action) action->setChecked(false);
2664 } else { 2665 } else {
2665 if (m_audioIO) m_audioIO->resume();
2666 playbackFrameChanged(m_viewManager->getPlaybackFrame()); 2666 playbackFrameChanged(m_viewManager->getPlaybackFrame());
2667 m_playSource->play(m_viewManager->getPlaybackFrame()); 2667 m_playSource->play(m_viewManager->getPlaybackFrame());
2668 } 2668 }
2669 } 2669 }
2670 2670
2691 } 2691 }
2692 2692
2693 if (m_audioRecordMode == RecordReplaceSession) { 2693 if (m_audioRecordMode == RecordReplaceSession) {
2694 if (!checkSaveModified()) return; 2694 if (!checkSaveModified()) return;
2695 } 2695 }
2696
2697 if (m_audioIO) m_audioIO->resume();
2698 2696
2699 WritableWaveFileModel *model = m_recordTarget->startRecording(); 2697 WritableWaveFileModel *model = m_recordTarget->startRecording();
2700 if (!model) { 2698 if (!model) {
2701 cerr << "ERROR: MainWindowBase::record: Recording failed" << endl; 2699 cerr << "ERROR: MainWindowBase::record: Recording failed" << endl;
2702 //!!! report 2700 //!!! report
3025 emit audioFileLoaded(); 3023 emit audioFileLoaded();
3026 } 3024 }
3027 3025
3028 m_playSource->stop(); 3026 m_playSource->stop();
3029 3027
3030 if (m_audioIO) m_audioIO->suspend();
3031
3032 if (m_paneStack && m_paneStack->getCurrentPane()) { 3028 if (m_paneStack && m_paneStack->getCurrentPane()) {
3033 updateVisibleRangeDisplay(m_paneStack->getCurrentPane()); 3029 updateVisibleRangeDisplay(m_paneStack->getCurrentPane());
3034 } else { 3030 } else {
3035 m_myStatusMessage = ""; 3031 m_myStatusMessage = "";
3036 getStatusLabel()->setText(""); 3032 getStatusLabel()->setText("");