Update of /cvsroot/audacity/audacity-src/src/toolbars In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv22697/src/toolbars
Modified Files: DeviceToolBar.cpp Log Message: When changing hosts in Device toolbar, try to select a matching device before going with the system default Index: DeviceToolBar.cpp =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/toolbars/DeviceToolBar.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- DeviceToolBar.cpp 16 Nov 2009 17:51:53 -0000 1.7 +++ DeviceToolBar.cpp 20 Nov 2009 06:29:50 -0000 1.8 @@ -241,20 +241,28 @@ { // We changed input; be sure the output device has the same API if (inInfo->hostApi != outInfo->hostApi) { - // Set output device to default for the API - const PaHostApiInfo *apiInfo = Pa_GetHostApiInfo(inInfo->hostApi); - outInfo = Pa_GetDeviceInfo(apiInfo->defaultOutputDevice); - mOutput->SetStringSelection(DeviceName(outInfo)); + // First try setting the same device as the input + if (!mOutput->SetStringSelection(DeviceName(inInfo))) + { + // Not found; set output device to default for the API + const PaHostApiInfo *apiInfo = Pa_GetHostApiInfo(inInfo->hostApi); + outInfo = Pa_GetDeviceInfo(apiInfo->defaultOutputDevice); + mOutput->SetStringSelection(DeviceName(outInfo)); + } } } else if (oldOutIndex != newOutIndex) { // We changed output; be sure the input device has the same API if (outInfo->hostApi != inInfo->hostApi) { - // Set input device to default for the API - const PaHostApiInfo *apiInfo = Pa_GetHostApiInfo(outInfo->hostApi); - inInfo = Pa_GetDeviceInfo(apiInfo->defaultInputDevice); - mInput->SetStringSelection(DeviceName(inInfo)); + // First try setting the same device as the output + if (!mInput->SetStringSelection(DeviceName(outInfo))) + { + // Not found; set input device to default for the API + const PaHostApiInfo *apiInfo = Pa_GetHostApiInfo(outInfo->hostApi); + inInfo = Pa_GetDeviceInfo(apiInfo->defaultInputDevice); + mInput->SetStringSelection(DeviceName(inInfo)); + } } } ------------------------------------------------------------------------------ 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