comparison framework/MainWindowBase.cpp @ 549:ec189ad4d38f bqresample

Merge from branch bqaudioio
author Chris Cannam
date Wed, 07 Dec 2016 11:52:26 +0000
parents baa11365ebdd
children b9d8c7a690d6
comparison
equal deleted inserted replaced
544:c4391f6c7484 549:ec189ad4d38f
2298 { 2298 {
2299 if (m_playTarget || m_audioIO) return; 2299 if (m_playTarget || m_audioIO) return;
2300 2300
2301 if (!(m_soundOptions & WithAudioOutput)) return; 2301 if (!(m_soundOptions & WithAudioOutput)) return;
2302 2302
2303 //!!! how to handle preferences
2304 /*
2305 QSettings settings; 2303 QSettings settings;
2306 settings.beginGroup("Preferences"); 2304 settings.beginGroup("Preferences");
2307 QString targetName = settings.value("audio-target", "").toString(); 2305 QString implementation = settings.value
2306 ("audio-target", "").toString();
2307 QString suffix;
2308 if (implementation != "") suffix = "-" + implementation;
2309 QString recordDevice = settings.value
2310 ("audio-record-device" + suffix, "").toString();
2311 QString playbackDevice = settings.value
2312 ("audio-playback-device" + suffix, "").toString();
2308 settings.endGroup(); 2313 settings.endGroup();
2309 AudioTargetFactory *factory = AudioTargetFactory::getInstance(); 2314
2310 2315 if (implementation == "auto") {
2311 factory->setDefaultCallbackTarget(targetName); 2316 implementation = "";
2312 */ 2317 }
2318
2319 breakfastquay::AudioFactory::Preference preference;
2320 preference.implementation = implementation.toStdString();
2321 preference.recordDevice = recordDevice.toStdString();
2322 preference.playbackDevice = playbackDevice.toStdString();
2323
2324 SVCERR << "createAudioIO: Preferred implementation = \""
2325 << preference.implementation << "\"" << endl;
2326 SVCERR << "createAudioIO: Preferred playback device = \""
2327 << preference.playbackDevice << "\"" << endl;
2328 SVCERR << "createAudioIO: Preferred record device = \""
2329 << preference.recordDevice << "\"" << endl;
2313 2330
2314 if (m_soundOptions & WithAudioInput) { 2331 if (m_soundOptions & WithAudioInput) {
2315 m_audioIO = breakfastquay::AudioFactory:: 2332 m_audioIO = breakfastquay::AudioFactory::
2316 createCallbackIO(m_recordTarget, m_playSource); 2333 createCallbackIO(m_recordTarget, m_playSource, preference);
2317 if (m_audioIO) { 2334 if (m_audioIO) {
2318 m_audioIO->suspend(); // start in suspended state 2335 m_audioIO->suspend(); // start in suspended state
2319 m_playSource->setSystemPlaybackTarget(m_audioIO); 2336 m_playSource->setSystemPlaybackTarget(m_audioIO);
2320 } 2337 }
2321 } else { 2338 } else {
2322 m_playTarget = breakfastquay::AudioFactory:: 2339 m_playTarget = breakfastquay::AudioFactory::
2323 createCallbackPlayTarget(m_playSource); 2340 createCallbackPlayTarget(m_playSource, preference);
2324 if (m_playTarget) { 2341 if (m_playTarget) {
2325 m_playTarget->suspend(); // start in suspended state 2342 m_playTarget->suspend(); // start in suspended state
2326 m_playSource->setSystemPlaybackTarget(m_playTarget); 2343 m_playSource->setSystemPlaybackTarget(m_playTarget);
2327 } 2344 }
2328 } 2345 }
2329 2346
2330 if (!m_playTarget && !m_audioIO) { 2347 if (!m_playTarget && !m_audioIO) {
2331 emit hideSplash(); 2348 emit hideSplash();
2332 2349 if (implementation == "") {
2333 // if (factory->isAutoCallbackTarget(targetName)) {
2334 QMessageBox::warning 2350 QMessageBox::warning
2335 (this, tr("Couldn't open audio device"), 2351 (this, tr("Couldn't open audio device"),
2336 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>"), 2352 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>"),
2337 QMessageBox::Ok); 2353 QMessageBox::Ok);
2338 /*
2339 } else { 2354 } else {
2340 QMessageBox::warning 2355 QMessageBox::warning
2341 (this, tr("Couldn't open audio device"), 2356 (this, tr("Couldn't open audio device"),
2342 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>") 2357 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>")
2343 .arg(factory->getCallbackTargetDescription(targetName)), 2358 .arg(breakfastquay::AudioFactory::
2359 getImplementationDescription(implementation.toStdString())
2360 .c_str()),
2344 QMessageBox::Ok); 2361 QMessageBox::Ok);
2345 } 2362 }
2346 */
2347 return;
2348 } 2363 }
2349 } 2364 }
2350 2365
2351 WaveFileModel * 2366 WaveFileModel *
2352 MainWindowBase::getMainModel() 2367 MainWindowBase::getMainModel()