comparison framework/MainWindowBase.cpp @ 569:1cc23cee4ebf 3.0-integration

Report audio driver startup error
author Chris Cannam
date Wed, 04 Jan 2017 09:57:13 +0000
parents 7b115a6505b8
children 6f54789f3127
comparison
equal deleted inserted replaced
568:022d6a9e6d75 569:1cc23cee4ebf
2332 2332
2333 if (!m_resamplerWrapper) { 2333 if (!m_resamplerWrapper) {
2334 m_resamplerWrapper = new breakfastquay::ResamplerWrapper(m_playSource); 2334 m_resamplerWrapper = new breakfastquay::ResamplerWrapper(m_playSource);
2335 m_playSource->setResamplerWrapper(m_resamplerWrapper); 2335 m_playSource->setResamplerWrapper(m_resamplerWrapper);
2336 } 2336 }
2337
2338 std::string errorString;
2337 2339
2338 if (m_soundOptions & WithAudioInput) { 2340 if (m_soundOptions & WithAudioInput) {
2339 m_audioIO = breakfastquay::AudioFactory:: 2341 m_audioIO = breakfastquay::AudioFactory::
2340 createCallbackIO(m_recordTarget, m_resamplerWrapper, preference); 2342 createCallbackIO(m_recordTarget, m_resamplerWrapper,
2343 preference, errorString);
2341 if (m_audioIO) { 2344 if (m_audioIO) {
2342 m_audioIO->suspend(); // start in suspended state 2345 m_audioIO->suspend(); // start in suspended state
2343 m_playSource->setSystemPlaybackTarget(m_audioIO); 2346 m_playSource->setSystemPlaybackTarget(m_audioIO);
2344 } 2347 }
2345 } else { 2348 } else {
2346 m_playTarget = breakfastquay::AudioFactory:: 2349 m_playTarget = breakfastquay::AudioFactory::
2347 createCallbackPlayTarget(m_resamplerWrapper, preference); 2350 createCallbackPlayTarget(m_resamplerWrapper,
2351 preference, errorString);
2348 if (m_playTarget) { 2352 if (m_playTarget) {
2349 m_playTarget->suspend(); // start in suspended state 2353 m_playTarget->suspend(); // start in suspended state
2350 m_playSource->setSystemPlaybackTarget(m_playTarget); 2354 m_playSource->setSystemPlaybackTarget(m_playTarget);
2351 } 2355 }
2352 } 2356 }
2353 2357
2354 if (!m_playTarget && !m_audioIO) { 2358 if (!m_playTarget && !m_audioIO) {
2355 emit hideSplash(); 2359 emit hideSplash();
2360 QString message;
2361 QString error = errorString.c_str();
2362 QString firstBit, secondBit;
2356 if (implementation == "") { 2363 if (implementation == "") {
2357 QMessageBox::warning 2364 if (error == "") {
2358 (this, tr("Couldn't open audio device"), 2365 firstBit = tr("<b>No audio available</b><p>Could not open an audio device.</p>");
2359 tr("<b>No audio available</b><p>Could not open an audio device for playback.<p>Automatic audio device detection failed. Audio playback will not be available during this session.</p>"), 2366 } else {
2360 QMessageBox::Ok); 2367 firstBit = tr("<b>No audio available</b><p>Could not open audio device: %1</p>").arg(error);
2368 }
2369 if (m_soundOptions & WithAudioInput) {
2370 secondBit = tr("<p>Automatic audio device detection failed. Audio playback and recording will not be available during this session.</p>");
2371 } else {
2372 secondBit = tr("<p>Automatic audio device detection failed. Audio playback will not be available during this session.</p>");
2373 }
2361 } else { 2374 } else {
2362 QMessageBox::warning 2375 QString driverName = breakfastquay::AudioFactory::
2363 (this, tr("Couldn't open audio device"), 2376 getImplementationDescription(implementation.toStdString())
2364 tr("<b>No audio available</b><p>Failed to open your preferred audio device (\"%1\").<p>Audio playback will not be available during this session.</p>") 2377 .c_str();
2365 .arg(breakfastquay::AudioFactory:: 2378 if (error == "") {
2366 getImplementationDescription(implementation.toStdString()) 2379 firstBit = tr("<b>No audio available</b><p>Failed to open your preferred audio driver (\"%1\").</p>").arg(driverName);
2367 .c_str()), 2380 } else {
2368 QMessageBox::Ok); 2381 firstBit = tr("<b>No audio available</b><p>Failed to open your preferred audio driver (\"%1\"): %2.</p>").arg(driverName).arg(error);
2369 } 2382 }
2383 if (m_soundOptions & WithAudioInput) {
2384 secondBit = tr("<p>Audio playback and recording will not be available during this session.</p>");
2385 } else {
2386 secondBit = tr("<p>Audio playback will not be available during this session.</p>");
2387 }
2388 }
2389 QMessageBox::warning(this, tr("Couldn't open audio device"),
2390 firstBit + secondBit, QMessageBox::Ok);
2370 } 2391 }
2371 } 2392 }
2372 2393
2373 void 2394 void
2374 MainWindowBase::deleteAudioIO() 2395 MainWindowBase::deleteAudioIO()