changeset 550:c732251237b1 bqresample

Merge from branch 3.0-integration
author Chris Cannam
date Wed, 07 Dec 2016 12:04:41 +0000
parents ec189ad4d38f (diff) 4de547a5905c (current diff)
children b9d8c7a690d6
files audio/AudioCallbackPlaySource.cpp audio/AudioCallbackPlaySource.h
diffstat 3 files changed, 37 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/audio/AudioCallbackPlaySource.cpp	Tue Dec 06 15:59:06 2016 +0000
+++ b/audio/AudioCallbackPlaySource.cpp	Wed Dec 07 12:04:41 2016 +0000
@@ -1308,6 +1308,9 @@
         return false;
     }
 
+    // space is now the number of samples that can be written on each
+    // channel's write ringbuffer
+    
     sv_frame_t f = m_writeBufferFill;
 	
     bool readWriteEqual = (m_readBuffers == m_writeBuffers);
--- a/audio/AudioCallbackPlaySource.h	Tue Dec 06 15:59:06 2016 +0000
+++ b/audio/AudioCallbackPlaySource.h	Wed Dec 07 12:04:41 2016 +0000
@@ -39,6 +39,10 @@
     class RubberBandStretcher;
 }
 
+namespace breakfastquay {
+    class Resampler;
+}
+
 class Model;
 class ViewManagerBase;
 class AudioGenerator;
--- a/framework/MainWindowBase.cpp	Tue Dec 06 15:59:06 2016 +0000
+++ b/framework/MainWindowBase.cpp	Wed Dec 07 12:04:41 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("<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>"),
 	     QMessageBox::Ok);
-/*
         } else {
             QMessageBox::warning
                 (this, tr("Couldn't open audio device"),
                  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>")
-                 .arg(factory->getCallbackTargetDescription(targetName)),
+                 .arg(breakfastquay::AudioFactory::
+                      getImplementationDescription(implementation.toStdString())
+                      .c_str()),
                  QMessageBox::Ok);
         }
-*/
-            return;
     }
 }