Mercurial > hg > svapp
diff framework/MainWindowBase.cpp @ 487:66b92c188cbd recording
Suspend/resume audio device when not in use to save battery (only implemented for PulseAudioIO so far)
author | Chris Cannam |
---|---|
date | Wed, 16 Sep 2015 15:16:54 +0100 |
parents | 3dbc964f5907 |
children | 6eb28350050d 111e976f9ed4 cd9dec2f47e8 |
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp Wed Sep 16 12:04:26 2015 +0100 +++ b/framework/MainWindowBase.cpp Wed Sep 16 15:16:54 2015 +0100 @@ -2200,6 +2200,7 @@ if (m_soundOptions & WithAudioInput) { m_audioIO = breakfastquay::AudioFactory:: createCallbackIO(m_recordTarget, m_playSource); + m_audioIO->suspend(); // start in suspended state m_playSource->setSystemPlaybackTarget(m_audioIO); } else { m_playTarget = breakfastquay::AudioFactory:: @@ -2661,6 +2662,7 @@ QAction *action = qobject_cast<QAction *>(sender()); if (action) action->setChecked(false); } else { + if (m_audioIO) m_audioIO->resume(); playbackFrameChanged(m_viewManager->getPlaybackFrame()); m_playSource->play(m_viewManager->getPlaybackFrame()); } @@ -2691,7 +2693,9 @@ if (m_audioRecordMode == RecordReplaceSession) { if (!checkSaveModified()) return; } - + + if (m_audioIO) m_audioIO->resume(); + WritableWaveFileModel *model = m_recordTarget->startRecording(); if (!model) { cerr << "ERROR: MainWindowBase::record: Recording failed" << endl; @@ -2705,7 +2709,7 @@ //!!! ??? return; } - + PlayParameterRepository::getInstance()->addPlayable(model); if (m_audioRecordMode == RecordReplaceSession || !getMainModel()) { @@ -3023,6 +3027,8 @@ m_playSource->stop(); + if (m_audioIO) m_audioIO->suspend(); + if (m_paneStack && m_paneStack->getCurrentPane()) { updateVisibleRangeDisplay(m_paneStack->getCurrentPane()); } else {