static void FindDevicePnpInterfaces( DSDeviceNamesAndGUIDs *deviceNamesAndGUIDs )
{
IClassFactory *pClassFactory;
-
if( paWinDsDSoundEntryPoints.DllGetClassObject(&pawin_CLSID_DirectSoundPrivate, &IID_IClassFactory, (PVOID *) &pClassFactory) == S_OK ){
IKsPropertySet *pPropertySet;
if( pClassFactory->lpVtbl->CreateInstance( pClassFactory, NULL, &pawin_IID_IKsPropertySet, (PVOID *) &pPropertySet) == S_OK ){
-
+
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA data;
ULONG bytesReturned;
** The device will not be added to the device list if any errors are encountered.
*/
static PaError AddOutputDeviceInfoFromDirectSound(
- PaWinDsDeviceInfo *winDsDeviceInfo, char *name, LPGUID lpGUID, char *pnpInterface )
+ PaWinDsDeviceInfo *winDsDeviceInfo, char *name, LPGUID lpGUID, char *pnpInterface, PaUtilAllocationGroup *allocations )
{
PaDeviceInfo *deviceInfo = &winDsDeviceInfo->inheritedDeviceInfo;
HRESULT hr;
}
else
{
+ // target device UID property
+ WCHAR duid[39];
+ char *deviceUID;
+ deviceUID = (char *)PaUtil_GroupAllocateMemory(allocations, 39);
+
+ StringFromGUID2(&(*lpGUID), (LPOLESTR) &duid, 39);
+ wcstombs(deviceUID, duid, sizeof(deviceUID));
+ WideCharToMultiByte( CP_ACP, WC_COMPOSITECHECK | WC_DEFAULTCHAR,\
+ duid, -1, deviceUID, 39, NULL, NULL );
+ deviceInfo->deviceUID = deviceUID;
+
memcpy( &winDsDeviceInfo->guid, lpGUID, sizeof(GUID) );
winDsDeviceInfo->lpGUID = &winDsDeviceInfo->guid;
}
** The device will not be added to the device list if any errors are encountered.
*/
static PaError AddInputDeviceInfoFromDirectSoundCapture(
- PaWinDsDeviceInfo *winDsDeviceInfo, char *name, LPGUID lpGUID, char *pnpInterface )
+ PaWinDsDeviceInfo *winDsDeviceInfo, char *name, LPGUID lpGUID, char *pnpInterface, PaUtilAllocationGroup *allocations )
{
PaDeviceInfo *deviceInfo = &winDsDeviceInfo->inheritedDeviceInfo;
HRESULT hr;
}
else
{
+ // target device UID property
+ WCHAR duid[39];
+ char *deviceUID;
+ deviceUID = (char *)PaUtil_GroupAllocateMemory(allocations, 39);
+
+ StringFromGUID2(&(*lpGUID), (LPOLESTR) &duid, 39);
+ wcstombs(deviceUID, duid, sizeof(deviceUID));
+ WideCharToMultiByte( CP_ACP, WC_COMPOSITECHECK | WC_DEFAULTCHAR,\
+ duid, -1, deviceUID, 39, NULL, NULL );
+ deviceInfo->deviceUID = deviceUID;
+
winDsDeviceInfo->lpGUID = &winDsDeviceInfo->guid;
memcpy( &winDsDeviceInfo->guid, lpGUID, sizeof(GUID) );
}
PaUtil_FreeAllAllocations( winDsHostApi->allocations );
PaUtil_DestroyAllocationGroup( winDsHostApi->allocations );
}
-
+
PaUtil_FreeMemory( winDsHostApi );
}
+
+
if( comWasInitialized )
CoUninitialize();
DSDeviceNamesAndGUIDs deviceNamesAndGUIDs;
int i = 0;
int maximumNewDeviceCount = 0;
-
+
/* Check preconditions */
if( !comWasInitialized || scanResults == NULL || newDeviceCount == NULL )
return paInternalError;
for( i = 0 ; i < maximumNewDeviceCount; ++i )
{
PaDeviceInfo *deviceInfo = &deviceInfoArray[i].inheritedDeviceInfo;
- deviceInfo->structVersion = 2;
+ deviceInfo->structVersion = 3;
deviceInfo->hostApi = hostApiIndex;
deviceInfo->name = 0;
result = AddInputDeviceInfoFromDirectSoundCapture( winDsDeviceInfo,
deviceNamesAndGUIDs.inputNamesAndGUIDs.items[i].name,
deviceNamesAndGUIDs.inputNamesAndGUIDs.items[i].lpGUID,
- deviceNamesAndGUIDs.inputNamesAndGUIDs.items[i].pnpInterface );
+ deviceNamesAndGUIDs.inputNamesAndGUIDs.items[i].pnpInterface,
+ winDsHostApi->allocations );
if( result == paNoError )
{
if( deviceNamesAndGUIDs.inputNamesAndGUIDs.items[i].lpGUID == NULL )
result = AddOutputDeviceInfoFromDirectSound( winDsDeviceInfo,
deviceNamesAndGUIDs.outputNamesAndGUIDs.items[i].name,
deviceNamesAndGUIDs.outputNamesAndGUIDs.items[i].lpGUID,
- deviceNamesAndGUIDs.outputNamesAndGUIDs.items[i].pnpInterface );
+ deviceNamesAndGUIDs.outputNamesAndGUIDs.items[i].pnpInterface,
+ winDsHostApi->allocations );
if( result == paNoError )
{
if( deviceNamesAndGUIDs.outputNamesAndGUIDs.items[i].lpGUID == NULL )
#define PA_MME_USE_HIGH_DEFAULT_LATENCY_ (0) /* For debugging glitches. */
+#define DRV_QUERYFUNCTIONINSTANCEID (DRV_RESERVED + 17)
+#define DRV_QUERYFUNCTIONINSTANCEIDSIZE (DRV_RESERVED + 18)
+
#if PA_MME_USE_HIGH_DEFAULT_LATENCY_
#define PA_MME_WIN_9X_DEFAULT_LATENCY_ (0.4)
#define PA_MME_MIN_HOST_OUTPUT_BUFFER_COUNT_ (4)
{
PaError result = paNoError;
char *deviceName; /* non-const ptr */
+ char *deviceUID;
MMRESULT mmresult;
WAVEINCAPS wic;
PaDeviceInfo *deviceInfo = &winMmeDeviceInfo->inheritedDeviceInfo;
QueryWaveInKSFilterMaxChannels( winMmeInputDeviceId, &deviceInfo->maxInputChannels );
#endif /* PAWIN_USE_WDMKS_DEVICE_INFO */
+
+ MMRESULT mmr;
+ size_t cbEndpointIdSize;
+ // Get the size (including the terminating null) of
+ // the endpoint ID string of the waveOut device.
+ mmr = waveInMessage(
+ winMmeInputDeviceId,
+ DRV_QUERYFUNCTIONINSTANCEIDSIZE,
+ (DWORD_PTR)&cbEndpointIdSize, NULL);
+
+ if (mmr == MMSYSERR_NOERROR) // do sizes match?
+ {
+ WCHAR *pstrEndpointId = NULL;
+ pstrEndpointId = (WCHAR *)PaUtil_GroupAllocateMemory(winMmeHostApi->allocations, cbEndpointIdSize);
+
+ // Get the endpoint ID string for this waveOut device.
+ mmr = waveInMessage(
+ winMmeInputDeviceId,
+ DRV_QUERYFUNCTIONINSTANCEID,
+ (DWORD_PTR)pstrEndpointId,
+ cbEndpointIdSize);
+
+ if (mmr == MMSYSERR_NOERROR)
+ {
+ deviceUID = (char *)PaUtil_GroupAllocateMemory(winMmeHostApi->allocations, wcslen(pstrEndpointId));
+ if( !deviceUID )
+ {
+ result = paInsufficientMemory;
+ goto error;
+ }
+ wcstombs(deviceUID, pstrEndpointId, sizeof(deviceUID));
+ WideCharToMultiByte( CP_ACP, WC_COMPOSITECHECK | WC_DEFAULTCHAR,\
+ pstrEndpointId, -1, deviceUID, wcslen(pstrEndpointId), NULL, NULL );
+ deviceInfo->deviceUID = deviceUID;
+ }
+ /*else
+ {
+ char mmeErrorText[ MAXERRORLENGTH ];
+ waveOutGetErrorText( mmr, mmeErrorText, MAXERRORLENGTH );
+ PA_DEBUG(("Error %i: %s\n", mmr ,mmeErrorText));
+ }*/
+ }
+
winMmeDeviceInfo->dwFormats = wic.dwFormats;
DetectDefaultSampleRate( winMmeDeviceInfo, winMmeInputDeviceId,
{
PaError result = paNoError;
char *deviceName; /* non-const ptr */
+ char *deviceUID;
MMRESULT mmresult;
WAVEOUTCAPS woc;
PaDeviceInfo *deviceInfo = &winMmeDeviceInfo->inheritedDeviceInfo;
winMmeDeviceInfo->deviceOutputChannelCountIsKnown = 1;
#endif /* PAWIN_USE_WDMKS_DEVICE_INFO */
+ MMRESULT mmr;
+ size_t cbEndpointIdSize;
+ // Get the size (including the terminating null) of
+ // the endpoint ID string of the waveOut device.
+ mmr = waveOutMessage(
+ winMmeOutputDeviceId,
+ DRV_QUERYFUNCTIONINSTANCEIDSIZE,
+ (DWORD_PTR)&cbEndpointIdSize, NULL);
+
+ if (mmr == MMSYSERR_NOERROR) // do sizes match?
+ {
+ WCHAR *pstrEndpointId = NULL;
+ pstrEndpointId = (WCHAR *)PaUtil_GroupAllocateMemory(winMmeHostApi->allocations, cbEndpointIdSize);
+
+ // Get the endpoint ID string for this waveOut device.
+ mmr = waveOutMessage(
+ winMmeOutputDeviceId,
+ DRV_QUERYFUNCTIONINSTANCEID,
+ (DWORD_PTR)pstrEndpointId,
+ cbEndpointIdSize);
+
+ if (mmr == MMSYSERR_NOERROR)
+ {
+ deviceUID = (char *)PaUtil_GroupAllocateMemory(winMmeHostApi->allocations, wcslen(pstrEndpointId));
+ if( !deviceUID )
+ {
+ result = paInsufficientMemory;
+ goto error;
+ }
+ wcstombs(deviceUID, pstrEndpointId, sizeof(deviceUID));
+
+ WideCharToMultiByte( CP_ACP, WC_COMPOSITECHECK | WC_DEFAULTCHAR,\
+ pstrEndpointId, -1, deviceUID, wcslen(pstrEndpointId), NULL, NULL );
+ deviceInfo->deviceUID = deviceUID;
+ }
+ /*else
+ {
+ char mmeErrorText[ MAXERRORLENGTH ];
+ waveOutGetErrorText( mmr, mmeErrorText, MAXERRORLENGTH );
+ PA_DEBUG(("Error %i: %s\n", mmr ,mmeErrorText));
+ }*/
+ }
+
winMmeDeviceInfo->dwFormats = woc.dwFormats;
DetectDefaultSampleRate( winMmeDeviceInfo, winMmeOutputDeviceId,
(*hostApi)->info.type = paMME;
(*hostApi)->info.name = "MME";
-
/* initialise device counts and default devices under the assumption that
there are no devices. These values are incremented below if and when
devices are successfully initialized.
preferredDeviceStatusFlags = 0;
waveOutPreferredDevice = -1;
+
waveOutMessage( (HWAVEOUT)WAVE_MAPPER, DRVM_MAPPER_PREFERRED_GET, (DWORD_PTR)&waveOutPreferredDevice, (DWORD_PTR)&preferredDeviceStatusFlags );
maximumPossibleDeviceCount = 0;
UINT winMmeDeviceId = (UINT)((i==-1) ? WAVE_MAPPER : i);
PaWinMmeDeviceInfo *wmmeDeviceInfo = &deviceInfoArray[ (*hostApi)->info.deviceCount ];
PaDeviceInfo *deviceInfo = &wmmeDeviceInfo->inheritedDeviceInfo;
- deviceInfo->structVersion = 2;
+ deviceInfo->structVersion = 3;
deviceInfo->hostApi = hostApiIndex;
deviceInfo->maxInputChannels = 0;
UINT winMmeDeviceId = (UINT)((i==-1) ? WAVE_MAPPER : i);
PaWinMmeDeviceInfo *wmmeDeviceInfo = &deviceInfoArray[ (*hostApi)->info.deviceCount ];
PaDeviceInfo *deviceInfo = &wmmeDeviceInfo->inheritedDeviceInfo;
- deviceInfo->structVersion = 2;
+ deviceInfo->structVersion = 3;
deviceInfo->hostApi = hostApiIndex;
deviceInfo->maxInputChannels = 0;