diff --git a/src/hostapi/wdmks/pa_win_wdmks.c b/src/hostapi/wdmks/pa_win_wdmks.c index 40297b7..3c21570 100644 --- a/src/hostapi/wdmks/pa_win_wdmks.c +++ b/src/hostapi/wdmks/pa_win_wdmks.c @@ -59,8 +59,12 @@ #ifdef __GNUC__ #include - #define _WIN32_WINNT 0x0501 - #define WINVER 0x0501 + #ifndef _WIN32_WINNT + #define _WIN32_WINNT 0x0501 + #endif /* #ifndef _WIN32_WINNT */ + #ifndef WINVER + #define WINVER 0x0501 + #endif /* #ifndef WINVER */ #endif #include /* strlen() */ @@ -76,7 +80,7 @@ #include "pa_debugprint.h" #include -#include +/* #include MinGW-w64 4.7.1 from TDM-GCC throws multiple redefinition errors. */ #include #ifdef __GNUC__ diff --git a/src/hostapi/wmme/pa_win_wmme.c b/src/hostapi/wmme/pa_win_wmme.c index d6ac91b..84053eb 100644 --- a/src/hostapi/wmme/pa_win_wmme.c +++ b/src/hostapi/wmme/pa_win_wmme.c @@ -383,6 +383,25 @@ static PaError CloseHandleWithPaError( HANDLE handle ) return result; } +/** + * Sets the transportType of a specific PaDeviceInfo to a + * value deduced by examining the other fields of the specified + * PaDeviceInfo. For example, if name field matches the + * regular expression \(.*USB.*\), the transportType is set to + * USB. + * + * @param deviceInfo the PaDeviceInfo to set the transportType + * of + */ +static void SetDeviceInfoTransportType(PaDeviceInfo *deviceInfo) +{ + const char *s = deviceInfo->name; + + deviceInfo->transportType + = (s && (s = strrchr(s,'(')) && (s = strstr(s,"USB")) && strchr(s,')')) + ? "USB" + : NULL; +} /* PaWinMmeHostApiRepresentation - host api datastructure specific to this implementation */ @@ -688,6 +707,12 @@ static PaError InitializeInputDeviceInfo( PaWinMmeHostApiRepresentation *winMmeH *success = 0; + /* We do not want Microsoft's Sound Mapper because it is a virtual device + * and we want the real (hardware) devices only. + */ + if (WAVE_MAPPER == winMmeInputDeviceId) + return paNoError; + mmresult = waveInGetDevCaps( winMmeInputDeviceId, &wic, sizeof( WAVEINCAPS ) ); if( mmresult == MMSYSERR_NOMEM ) { @@ -730,6 +755,9 @@ static PaError InitializeInputDeviceInfo( PaWinMmeHostApiRepresentation *winMmeH } deviceInfo->name = deviceName; + /* transportType */ + SetDeviceInfoTransportType(deviceInfo); + if( wic.wChannels == 0xFFFF || wic.wChannels < 1 || wic.wChannels > 255 ){ /* For Windows versions using WDM (possibly Windows 98 ME and later) * the kernel mixer sits between the application and the driver. As a result, @@ -856,6 +884,12 @@ static PaError InitializeOutputDeviceInfo( PaWinMmeHostApiRepresentation *winMme *success = 0; + /* We do not want Microsoft's Sound Mapper because it is a virtual device + * and we want the real (hardware) devices only. + */ + if (WAVE_MAPPER == winMmeOutputDeviceId) + return paNoError; + mmresult = waveOutGetDevCaps( winMmeOutputDeviceId, &woc, sizeof( WAVEOUTCAPS ) ); if( mmresult == MMSYSERR_NOMEM ) { @@ -898,6 +932,9 @@ static PaError InitializeOutputDeviceInfo( PaWinMmeHostApiRepresentation *winMme } deviceInfo->name = deviceName; + /* transportType */ + SetDeviceInfoTransportType(deviceInfo); + if( woc.wChannels == 0xFFFF || woc.wChannels < 1 || woc.wChannels > 255 ){ /* For Windows versions using WDM (possibly Windows 98 ME and later) * the kernel mixer sits between the application and the driver. As a result,