Mercurial > hg > svapp
comparison framework/MainWindowBase.cpp @ 559:7b115a6505b8 3.0-integration
Handle increases in the overall channel count by closing and reopening the audio device.
author | Chris Cannam |
---|---|
date | Tue, 13 Dec 2016 12:03:48 +0000 |
parents | 7759c2dca846 |
children | 1cc23cee4ebf 58354f2934ec |
comparison
equal
deleted
inserted
replaced
558:206d65e2b69a | 559:7b115a6505b8 |
---|---|
240 this, SLOT(recordDurationChanged(sv_frame_t, sv_samplerate_t))); | 240 this, SLOT(recordDurationChanged(sv_frame_t, sv_samplerate_t))); |
241 } | 241 } |
242 | 242 |
243 connect(m_playSource, SIGNAL(sampleRateMismatch(sv_samplerate_t, sv_samplerate_t, bool)), | 243 connect(m_playSource, SIGNAL(sampleRateMismatch(sv_samplerate_t, sv_samplerate_t, bool)), |
244 this, SLOT(sampleRateMismatch(sv_samplerate_t, sv_samplerate_t, bool))); | 244 this, SLOT(sampleRateMismatch(sv_samplerate_t, sv_samplerate_t, bool))); |
245 connect(m_playSource, SIGNAL(channelCountIncreased()), | |
246 this, SLOT(recreateAudioIO())); | |
245 connect(m_playSource, SIGNAL(audioOverloadPluginDisabled()), | 247 connect(m_playSource, SIGNAL(audioOverloadPluginDisabled()), |
246 this, SLOT(audioOverloadPluginDisabled())); | 248 this, SLOT(audioOverloadPluginDisabled())); |
247 connect(m_playSource, SIGNAL(audioTimeStretchMultiChannelDisabled()), | 249 connect(m_playSource, SIGNAL(audioTimeStretchMultiChannelDisabled()), |
248 this, SLOT(audioTimeStretchMultiChannelDisabled())); | 250 this, SLOT(audioTimeStretchMultiChannelDisabled())); |
249 | 251 |
297 // they refer to. | 299 // they refer to. |
298 | 300 |
299 deleteAudioIO(); | 301 deleteAudioIO(); |
300 | 302 |
301 // Then delete the Application objects. | 303 // Then delete the Application objects. |
302 delete m_resamplerWrapper; | |
303 delete m_playSource; | 304 delete m_playSource; |
304 delete m_recordTarget; | 305 delete m_recordTarget; |
305 | 306 |
306 delete m_viewManager; | 307 delete m_viewManager; |
307 delete m_oscQueue; | 308 delete m_oscQueue; |
2371 | 2372 |
2372 void | 2373 void |
2373 MainWindowBase::deleteAudioIO() | 2374 MainWindowBase::deleteAudioIO() |
2374 { | 2375 { |
2375 // First prevent this trying to call target. | 2376 // First prevent this trying to call target. |
2376 if (m_playSource) m_playSource->setSystemPlaybackTarget(0); | 2377 if (m_playSource) { |
2378 m_playSource->setSystemPlaybackTarget(0); | |
2379 m_playSource->setResamplerWrapper(0); | |
2380 } | |
2377 | 2381 |
2378 // Then delete the breakfastquay::System object. | 2382 // Then delete the breakfastquay::System object. |
2379 // Only one of these two exists! | 2383 // Only one of these two exists! |
2380 delete m_audioIO; | 2384 delete m_audioIO; |
2381 delete m_playTarget; | 2385 delete m_playTarget; |
2382 | 2386 |
2387 // And the breakfastquay resampler wrapper. We need to | |
2388 // delete/recreate this if the channel count changes, which is one | |
2389 // of the use cases for recreateAudioIO() calling this | |
2390 delete m_resamplerWrapper; | |
2391 | |
2383 m_audioIO = 0; | 2392 m_audioIO = 0; |
2384 m_playTarget = 0; | 2393 m_playTarget = 0; |
2394 m_resamplerWrapper = 0; | |
2385 } | 2395 } |
2386 | 2396 |
2387 void | 2397 void |
2388 MainWindowBase::recreateAudioIO() | 2398 MainWindowBase::recreateAudioIO() |
2389 { | 2399 { |