File audacity-1.3.8-audiodevdefaults.patch of Package audacity

diff -Nur audacity-src-1.3.8-orig/src/prefs/DevicePrefs.cpp audacity-src-1.3.8/src/prefs/DevicePrefs.cpp
--- audacity-src-1.3.8-orig/src/prefs/DevicePrefs.cpp	2009-07-16 05:27:35.000000000 +0200
+++ audacity-src-1.3.8/src/prefs/DevicePrefs.cpp	2009-07-20 20:55:26.000000000 +0200
@@ -172,6 +172,15 @@
    wxArrayString playnames;
    wxArrayString recordnames;
 
+   int playDeviceNum = -1;  // use device name from gPrefs
+   if ( mPlayDevice == wxT("") ) {
+      playDeviceNum = Pa_GetDefaultOutputDevice();
+   }
+   int recDeviceNum = -1;  // use device name from gPrefs
+   if ( mRecordDevice == wxT("") ) {
+      recDeviceNum = Pa_GetDefaultInputDevice();
+   }
+
    for (int i = 0; i < nDevices; i++) {
       const PaDeviceInfo *info = Pa_GetDeviceInfo(i);
       if (info->hostApi == index) {
@@ -182,7 +191,10 @@
          if (info->maxOutputChannels > 0) {
             playnames.Add(name);
             index = mPlay->Append(name, (void *) info);
-            if (device == mPlayDevice) {
+            if (playDeviceNum == i) {
+               mPlay->SetSelection(index);
+            }
+            else if (device == mPlayDevice) {
                mPlay->SetSelection(index);
             }
          }
@@ -190,7 +202,10 @@
          if (info->maxInputChannels > 0) {
             recordnames.Add(name);
             index = mRecord->Append(name, (void *) info);
-            if (device == mRecordDevice) {
+            if (recDeviceNum == i) {
+               mRecord->SetSelection(index);
+            }
+            else if (device == mRecordDevice) {
                mRecord->SetSelection(index);
             }
          }
openSUSE Build Service is sponsored by