# HG changeset patch # User Chris Cannam # Date 1483523833 0 # Node ID 1cc23cee4ebfd7a2601adcd8469128110aa5e447 # Parent 022d6a9e6d75f77a693d31765faead2e578cf014 Report audio driver startup error diff -r 022d6a9e6d75 -r 1cc23cee4ebf framework/MainWindowBase.cpp --- a/framework/MainWindowBase.cpp Mon Dec 19 16:34:38 2016 +0000 +++ b/framework/MainWindowBase.cpp Wed Jan 04 09:57:13 2017 +0000 @@ -2334,17 +2334,21 @@ m_resamplerWrapper = new breakfastquay::ResamplerWrapper(m_playSource); m_playSource->setResamplerWrapper(m_resamplerWrapper); } + + std::string errorString; if (m_soundOptions & WithAudioInput) { m_audioIO = breakfastquay::AudioFactory:: - createCallbackIO(m_recordTarget, m_resamplerWrapper, preference); + createCallbackIO(m_recordTarget, m_resamplerWrapper, + preference, errorString); if (m_audioIO) { m_audioIO->suspend(); // start in suspended state m_playSource->setSystemPlaybackTarget(m_audioIO); } } else { m_playTarget = breakfastquay::AudioFactory:: - createCallbackPlayTarget(m_resamplerWrapper, preference); + createCallbackPlayTarget(m_resamplerWrapper, + preference, errorString); if (m_playTarget) { m_playTarget->suspend(); // start in suspended state m_playSource->setSystemPlaybackTarget(m_playTarget); @@ -2353,20 +2357,37 @@ if (!m_playTarget && !m_audioIO) { emit hideSplash(); + QString message; + QString error = errorString.c_str(); + QString firstBit, secondBit; if (implementation == "") { - QMessageBox::warning - (this, tr("Couldn't open audio device"), - tr("No audio available

Could not open an audio device for playback.

Automatic audio device detection failed. Audio playback will not be available during this session.

"), - QMessageBox::Ok); + if (error == "") { + firstBit = tr("No audio available

Could not open an audio device.

"); + } else { + firstBit = tr("No audio available

Could not open audio device: %1

").arg(error); + } + if (m_soundOptions & WithAudioInput) { + secondBit = tr("

Automatic audio device detection failed. Audio playback and recording will not be available during this session.

"); + } else { + secondBit = tr("

Automatic audio device detection failed. Audio playback will not be available during this session.

"); + } } else { - QMessageBox::warning - (this, tr("Couldn't open audio device"), - tr("No audio available

Failed to open your preferred audio device (\"%1\").

Audio playback will not be available during this session.

") - .arg(breakfastquay::AudioFactory:: - getImplementationDescription(implementation.toStdString()) - .c_str()), - QMessageBox::Ok); + QString driverName = breakfastquay::AudioFactory:: + getImplementationDescription(implementation.toStdString()) + .c_str(); + if (error == "") { + firstBit = tr("No audio available

Failed to open your preferred audio driver (\"%1\").

").arg(driverName); + } else { + firstBit = tr("No audio available

Failed to open your preferred audio driver (\"%1\"): %2.

").arg(driverName).arg(error); + } + if (m_soundOptions & WithAudioInput) { + secondBit = tr("

Audio playback and recording will not be available during this session.

"); + } else { + secondBit = tr("

Audio playback will not be available during this session.

"); + } } + QMessageBox::warning(this, tr("Couldn't open audio device"), + firstBit + secondBit, QMessageBox::Ok); } }