Update of /cvsroot/audacity/audacity-src/src
In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv4904/src

Modified Files:
        AudioIO.cpp 
Log Message:
Allow Mixer Toolbar to control playback when capture is unavailable
(includes some PortMixer fixes for Linux and Mac; Windows apparently 
worked fine already)


Index: AudioIO.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/AudioIO.cpp,v
retrieving revision 1.237
retrieving revision 1.238
diff -u -d -r1.237 -r1.238
--- AudioIO.cpp 23 Nov 2009 19:51:56 -0000      1.237
+++ AudioIO.cpp 24 Nov 2009 03:16:37 -0000      1.238
@@ -215,6 +215,27 @@
 {
    gAudioIO = new AudioIO();
    gAudioIO->mThread->Run();
+
+   // Make sure device prefs are initialized
+   if (gPrefs->Read(wxT("AudioIO/RecordingDevice"), wxT("")) == wxT("")) {
+      int i = AudioIO::getRecordDevIndex();
+      const PaDeviceInfo *info = Pa_GetDeviceInfo(i);
+      if (info) {
+         gPrefs->Write(wxT("/AudioIO/RecordingDevice"), DeviceName(info));
+         gPrefs->Write(wxT("/AudioIO/Host"),
+               wxString(Pa_GetHostApiInfo(info->hostApi)->name, wxConvLocal));
+      }
+   }
+
+   if (gPrefs->Read(wxT("AudioIO/PlaybackDevice"), wxT("")) == wxT("")) {
+      int i = AudioIO::getPlayDevIndex();
+      const PaDeviceInfo *info = Pa_GetDeviceInfo(i);
+      if (info) {
+         gPrefs->Write(wxT("/AudioIO/PlaybackDevice"), DeviceName(info));
+         gPrefs->Write(wxT("/AudioIO/Host"),
+               wxString(Pa_GetHostApiInfo(info->hostApi)->name, wxConvLocal));
+      }
+   }
 }
 
 void DeinitAudioIO()
@@ -573,6 +594,23 @@
       }
    }
 
+   // finally, try just for playback
+   if ( error ) {
+      error = Pa_OpenStream(&stream,
+                            NULL, &playbackParameters,
+                            highestSampleRate, paFramesPerBufferUnspecified,
+                            paClipOff | paDitherOff,
+                            audacityAudioCallback, NULL);
+      
+      if (!error) {
+         mPortMixer = Px_OpenMixer(stream, 0);
+         if (!mPortMixer) {
+            Pa_CloseStream(stream);
+            error = true;
+         }
+      }
+   }
+
    // if it's still not working, give up
    if( error )
       return;


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Audacity-cvs mailing list
Audacity-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to