comparison framework/MainWindowBase.cpp @ 556:21e3aab6e3e7 3.0-integration

Reopen the audio device directly when preference is changed
author Chris Cannam
date Mon, 12 Dec 2016 15:45:33 +0000
parents 8c11ca1ebc39
children 7759c2dca846
comparison
equal deleted inserted replaced
555:2683a8ca36ea 556:21e3aab6e3e7
293 // We have to delete the breakfastquay::SystemPlaybackTarget or 293 // We have to delete the breakfastquay::SystemPlaybackTarget or
294 // breakfastquay::SystemAudioIO object (whichever we have -- it 294 // breakfastquay::SystemAudioIO object (whichever we have -- it
295 // depends on whether we handle recording or not) before we delete 295 // depends on whether we handle recording or not) before we delete
296 // the ApplicationPlaybackSource and ApplicationRecordTarget that 296 // the ApplicationPlaybackSource and ApplicationRecordTarget that
297 // they refer to. 297 // they refer to.
298 298
299 // First prevent this trying to call target. 299 deleteAudioIO();
300 if (m_playSource) m_playSource->setSystemPlaybackTarget(0);
301
302 // Then delete the breakfastquay::System object.
303 // Only one of these two exists!
304 delete m_audioIO;
305 delete m_playTarget;
306 300
307 // Then delete the Application objects. 301 // Then delete the Application objects.
308 delete m_resamplerWrapper; 302 delete m_resamplerWrapper;
309 delete m_playSource; 303 delete m_playSource;
310 delete m_recordTarget; 304 delete m_recordTarget;
2373 QMessageBox::Ok); 2367 QMessageBox::Ok);
2374 } 2368 }
2375 } 2369 }
2376 } 2370 }
2377 2371
2372 void
2373 MainWindowBase::deleteAudioIO()
2374 {
2375 // First prevent this trying to call target.
2376 if (m_playSource) m_playSource->setSystemPlaybackTarget(0);
2377
2378 // Then delete the breakfastquay::System object.
2379 // Only one of these two exists!
2380 delete m_audioIO;
2381 delete m_playTarget;
2382
2383 m_audioIO = 0;
2384 m_playTarget = 0;
2385 }
2386
2387 void
2388 MainWindowBase::recreateAudioIO()
2389 {
2390 deleteAudioIO();
2391 createAudioIO();
2392 }
2393
2378 WaveFileModel * 2394 WaveFileModel *
2379 MainWindowBase::getMainModel() 2395 MainWindowBase::getMainModel()
2380 { 2396 {
2381 if (!m_document) return 0; 2397 if (!m_document) return 0;
2382 return m_document->getMainModel(); 2398 return m_document->getMainModel();