# HG changeset patch # User Chris Cannam # Date 1481111502 0 # Node ID baa11365ebddf898fe61933b95b6637b54aeacd6 # Parent 82d7e5cf7517ce2a044470a6ae28b3ffae9ef604# Parent c4391f6c7484db216909d7730ce1acee88a0a0bd Merge from branch bqresample diff -r c4391f6c7484 -r baa11365ebdd framework/MainWindowBase.cpp --- a/framework/MainWindowBase.cpp Mon Dec 05 16:56:36 2016 +0000 +++ b/framework/MainWindowBase.cpp Wed Dec 07 11:51:42 2016 +0000 @@ -2300,27 +2300,44 @@ if (!(m_soundOptions & WithAudioOutput)) return; - //!!! how to handle preferences -/* QSettings settings; settings.beginGroup("Preferences"); - QString targetName = settings.value("audio-target", "").toString(); + QString implementation = settings.value + ("audio-target", "").toString(); + QString suffix; + if (implementation != "") suffix = "-" + implementation; + QString recordDevice = settings.value + ("audio-record-device" + suffix, "").toString(); + QString playbackDevice = settings.value + ("audio-playback-device" + suffix, "").toString(); settings.endGroup(); - AudioTargetFactory *factory = AudioTargetFactory::getInstance(); - - factory->setDefaultCallbackTarget(targetName); -*/ + + if (implementation == "auto") { + implementation = ""; + } + + breakfastquay::AudioFactory::Preference preference; + preference.implementation = implementation.toStdString(); + preference.recordDevice = recordDevice.toStdString(); + preference.playbackDevice = playbackDevice.toStdString(); + + SVCERR << "createAudioIO: Preferred implementation = \"" + << preference.implementation << "\"" << endl; + SVCERR << "createAudioIO: Preferred playback device = \"" + << preference.playbackDevice << "\"" << endl; + SVCERR << "createAudioIO: Preferred record device = \"" + << preference.recordDevice << "\"" << endl; if (m_soundOptions & WithAudioInput) { m_audioIO = breakfastquay::AudioFactory:: - createCallbackIO(m_recordTarget, m_playSource); + createCallbackIO(m_recordTarget, m_playSource, preference); if (m_audioIO) { m_audioIO->suspend(); // start in suspended state m_playSource->setSystemPlaybackTarget(m_audioIO); } } else { m_playTarget = breakfastquay::AudioFactory:: - createCallbackPlayTarget(m_playSource); + createCallbackPlayTarget(m_playSource, preference); if (m_playTarget) { m_playTarget->suspend(); // start in suspended state m_playSource->setSystemPlaybackTarget(m_playTarget); @@ -2329,22 +2346,20 @@ if (!m_playTarget && !m_audioIO) { emit hideSplash(); - -// if (factory->isAutoCallbackTarget(targetName)) { + 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); -/* } else { QMessageBox::warning (this, tr("Couldn't open audio device"), tr("No audio availableFailed to open your preferred audio device (\"%1\").
Audio playback will not be available during this session.
") - .arg(factory->getCallbackTargetDescription(targetName)), + .arg(breakfastquay::AudioFactory:: + getImplementationDescription(implementation.toStdString()) + .c_str()), QMessageBox::Ok); } -*/ - return; } }