Update of /cvsroot/audacity/audacity-src/src
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv7459

Modified Files:
        AudioIO.cpp 
Log Message:
Only close mixer on device changes.

Index: AudioIO.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/AudioIO.cpp,v
retrieving revision 1.158
retrieving revision 1.159
diff -u -d -r1.158 -r1.159
--- AudioIO.cpp 23 May 2007 23:26:38 -0000      1.158
+++ AudioIO.cpp 1 Jun 2007 04:11:01 -0000       1.159
@@ -246,14 +246,15 @@
 AudioIO::~AudioIO()
 {
 #if defined(USE_PORTMIXER)
-   if( mPortMixer ) {
+   if (mPortMixer) {
       #if __WXMAC__
       if (Px_SupportsPlaythrough(mPortMixer) && mPreviousHWPlaythrough >= 0.0)
          Px_SetPlaythrough(mPortMixer, mPreviousHWPlaythrough);
+         mPreviousHWPlaythrough = -1.0;
       #endif
       Px_CloseMixer(mPortMixer);
+      mPortMixer = NULL;
    }
-   mPortMixer = NULL;
 #endif
    Pa_Terminate();
 
@@ -351,15 +352,21 @@
 void AudioIO::HandleDeviceChange()
 {
    // This should not happen, but it would screw things up if it did.
-   if( IsStreamActive() )
+   if (IsStreamActive())
       return;
 
 #if defined(USE_PORTMIXER)
    const PaDeviceInfo* info;
 
-   if( mPortMixer )
+   if (mPortMixer) {
+      #if __WXMAC__
+      if (Px_SupportsPlaythrough(mPortMixer) && mPreviousHWPlaythrough >= 0.0)
+         Px_SetPlaythrough(mPortMixer, mPreviousHWPlaythrough);
+         mPreviousHWPlaythrough = -1.0;
+      #endif
       Px_CloseMixer(mPortMixer);
-   mPortMixer = NULL;
+      mPortMixer = NULL;
+   }
 
 #if USE_PORTAUDIO_V19
    int recDeviceNum = Pa_GetDefaultInputDevice();
@@ -658,17 +665,7 @@
                                  audacityAudioCallback, NULL );
 
 #if USE_PORTMIXER
-   if (mPortMixer) {
-      #if __WXMAC__
-      if (Px_SupportsPlaythrough(mPortMixer) && mPreviousHWPlaythrough >= 0.0)
-         Px_SetPlaythrough(mPortMixer, mPreviousHWPlaythrough);
-      #endif
-      Px_CloseMixer(mPortMixer);
-   }
-   mPortMixer = NULL;
    if (mPortStreamV19 != NULL && mLastPaError == paNoError) {
-      mPortMixer = Px_OpenMixer(mPortStreamV19, 0);
-
       #ifdef __MACOSX__
       if (mPortMixer) {
          if (Px_SupportsPlaythrough(mPortMixer)) {
@@ -761,17 +758,7 @@
                                  audacityAudioCallback, NULL );
 
 #if USE_PORTMIXER
-   if (mPortMixer) {
-      #if __WXMAC__
-      if (Px_SupportsPlaythrough(mPortMixer) && mPreviousHWPlaythrough >= 0.0)
-         Px_SetPlaythrough(mPortMixer, mPreviousHWPlaythrough);
-      #endif
-      Px_CloseMixer(mPortMixer);
-   }
-   mPortMixer = NULL;
    if (mPortStreamV18 != NULL && mLastPaError == paNoError) {
-      mPortMixer = Px_OpenMixer(mPortStreamV18, 0);
-
       #ifdef __MACOSX__
       if (mPortMixer) {
          if (Px_SupportsPlaythrough(mPortMixer)) {
@@ -1122,6 +1109,7 @@
       #if __WXMAC__
       if (Px_SupportsPlaythrough(mPortMixer) && mPreviousHWPlaythrough >= 0.0)
          Px_SetPlaythrough(mPortMixer, mPreviousHWPlaythrough);
+         mPreviousHWPlaythrough = -1.0;
       #endif
    }
   #endif


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to