#ifdef __GNUC__
#include <initguid.h>
- #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 <string.h> /* strlen() */
#include "pa_debugprint.h"
#include <windows.h>
-#include <winioctl.h>
+/* #include <winioctl.h> MinGW-w64 4.7.1 from TDM-GCC throws multiple redefinition errors. */
#include <process.h>
#ifdef __GNUC__
return result;
}
+/**
+ * Sets the <tt>transportType</tt> of a specific <tt>PaDeviceInfo</tt> to a
+ * value deduced by examining the other fields of the specified
+ * <tt>PaDeviceInfo</tt>. For example, if <tt>name</tt> field matches the
+ * regular expression <tt>\(.*USB.*\)</tt>, the <tt>transportType</tt> is set to
+ * <tt>USB</tt>.
+ *
+ * @param deviceInfo the <tt>PaDeviceInfo</tt> to set the <tt>transportType</tt>
+ * 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 */
*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 )
{
}
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,
*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 )
{
}
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,