Implement AUXDM_GETVOLUME

svn path=/trunk/; revision=19394
This commit is contained in:
Magnus Olsen
2005-11-20 21:42:23 +00:00
parent ff5070b1f7
commit 55050b7b0d
3 changed files with 42 additions and 2 deletions
+33 -1
View File
@@ -23,8 +23,12 @@ APIENTRY DWORD auxMessage(UINT dwId,
DWORD dwParam2)
{
MMRESULT Result;
AUX_DD_VOLUME Volume;
DPRINT("auxMessage\n");
// the following cases are documented by DDK
switch (uMessage)
{
@@ -37,7 +41,15 @@ APIENTRY DWORD auxMessage(UINT dwId,
return GetDeviceCount(AuxDevice);
case AUXDM_GETVOLUME:
return 0;
DPRINT("AUXDM_GETVOLUME");
Result = AuxGetAudio(dwId, (PBYTE) &Volume, sizeof(Volume));
if (Result == MMSYSERR_NOERROR)
{
*(LPDWORD)dwParam1 = (DWORD)MAKELONG(HIWORD(Volume.Left), HIWORD(Volume.Right));
}
return Result;
case AUXDM_SETVOLUME:
return 0;
@@ -47,3 +59,23 @@ APIENTRY DWORD auxMessage(UINT dwId,
}
DWORD AuxGetAudio(DWORD dwID, PBYTE pVolume, DWORD sizeVolume)
{
HANDLE DeviceHandle;
MMRESULT Result;
DWORD BytesReturned;
Result = OpenDevice(AuxDevice, dwID, &DeviceHandle, GENERIC_READ);
if (Result != MMSYSERR_NOERROR)
return Result;
Result = DeviceIoControl(DeviceHandle, IOCTL_AUX_GET_VOLUME, NULL, 0, (LPVOID)pVolume, sizeVolume,
&BytesReturned, NULL) ? MMSYSERR_NOERROR : TranslateStatus();
CloseHandle(DeviceHandle);
return Result;
}
+1 -1
View File
@@ -85,7 +85,7 @@ MMRESULT OpenDevice(UINT DeviceType, DWORD ID, PHANDLE pDeviceHandle,
case AuxDevice :
wsprintf(DeviceName, L"\\\\.%ls%d", AUX_DEVICE_NAME_U + strlen("\\Device"), ID);
break;
default : // Aux
default :
DPRINT("No Auido Device Found");
return MMSYSERR_BADDEVICEID; /* Maybe we should change error code */
};
+8
View File
@@ -79,5 +79,13 @@ typedef struct tag_WAVEALLOC {
MMRESULT AuxReturnCode; // Return code from Aux task
}WAVEALLOC, *PWAVEALLOC;
/* Misc should move to own header */
MMRESULT GetDeviceCapabilities(DWORD ID, UINT DeviceType,
LPBYTE pCaps, DWORD Size);
DWORD AuxGetAudio(DWORD dwID, PBYTE pVolume, DWORD sizeVolume);
typedef struct _AUX_DD_VOLUME {
ULONG Left;
ULONG Right;
} AUX_DD_VOLUME, *PAUX_DD_VOLUME;