reactos/dll/win32/mmdrv/auxil.c
Amine Khaldi c424146e2c Create a branch for cmake bringup.
svn path=/branches/cmake-bringup/; revision=48236
2010-07-24 18:52:44 +00:00

106 lines
2.6 KiB
C

/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Multimedia
* FILE: lib/mmdrv/auxil.c
* PURPOSE: Multimedia User Mode Driver
* PROGRAMMER: Andrew Greenwood
* Aleksey Bragin
* UPDATE HISTORY:
* Mar 16, 2004: Created skeleton implementation
*/
#include "mmdrv.h"
#include "wave.h"
#define NDEBUG
#include <debug.h>
APIENTRY DWORD auxMessage(UINT dwId,
UINT uMessage,
DWORD dwUser,
DWORD dwParam1,
DWORD dwParam2)
{
MMRESULT Result;
AUX_DD_VOLUME Volume;
DPRINT("auxMessage\n");
// the following cases are documented by DDK
switch (uMessage)
{
case AUXDM_GETDEVCAPS:
DPRINT("AUXDM_GETDEVCAPS");
return GetDeviceCapabilities(dwId, AuxDevice, (LPBYTE)dwParam1, (DWORD)dwParam2);
case AUXDM_GETNUMDEVS:
DPRINT("AUXDM_GETNUMDEVS");
return GetDeviceCount(AuxDevice);
case AUXDM_GETVOLUME:
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:
DPRINT("AUXDM_SETVOLUME");
Volume.Right = HIWORD(dwParam1) << 16;
Volume.Left = LOWORD(dwParam1) << 16;
return AuxSetAudio(dwId, (PBYTE)&Volume, sizeof(Volume));
}
return MMSYSERR_NOERROR;
}
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;
}
DWORD AuxSetAudio(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_SET_VOLUME, (LPVOID)pVolume, sizeVolume, NULL, 0,
&BytesReturned, NULL) ? MMSYSERR_NOERROR : TranslateStatus();
CloseHandle(DeviceHandle);
return Result;
}