1 /* 2 * 3 * COPYRIGHT: See COPYING in the top level directory 4 * PROJECT: ReactOS Multimedia 5 * FILE: lib/mmdrv/auxil.c 6 * PURPOSE: Multimedia User Mode Driver 7 * PROGRAMMER: Andrew Greenwood 8 * Aleksey Bragin 9 * UPDATE HISTORY: 10 * Mar 16, 2004: Created skeleton implementation 11 */ 12 13 #include "mmdrv.h" 14 15 #define NDEBUG 16 #include <debug.h> 17 18 #include "wave.h" 19 20 APIENTRY DWORD auxMessage(UINT dwId, 21 UINT uMessage, 22 DWORD dwUser, 23 DWORD dwParam1, 24 DWORD dwParam2) 25 26 { 27 MMRESULT Result; 28 AUX_DD_VOLUME Volume; 29 30 DPRINT("auxMessage\n"); 31 32 33 // the following cases are documented by DDK 34 switch (uMessage) 35 { 36 case AUXDM_GETDEVCAPS: 37 DPRINT("AUXDM_GETDEVCAPS"); 38 return GetDeviceCapabilities(dwId, AuxDevice, (LPBYTE)dwParam1, (DWORD)dwParam2); 39 40 case AUXDM_GETNUMDEVS: 41 DPRINT("AUXDM_GETNUMDEVS"); 42 return GetDeviceCount(AuxDevice); 43 44 case AUXDM_GETVOLUME: 45 DPRINT("AUXDM_GETVOLUME"); 46 Result = AuxGetAudio(dwId, (PBYTE) &Volume, sizeof(Volume)); 47 48 if (Result == MMSYSERR_NOERROR) 49 { 50 *(LPDWORD)dwParam1 = (DWORD)MAKELONG(HIWORD(Volume.Left), HIWORD(Volume.Right)); 51 } 52 return Result; 53 54 55 case AUXDM_SETVOLUME: 56 DPRINT("AUXDM_SETVOLUME"); 57 58 Volume.Right = HIWORD(dwParam1) << 16; 59 Volume.Left = LOWORD(dwParam1) << 16; 60 61 return AuxSetAudio(dwId, (PBYTE)&Volume, sizeof(Volume)); 62 63 } 64 65 return MMSYSERR_NOERROR; 66 } 67 68 69 DWORD AuxGetAudio(DWORD dwID, PBYTE pVolume, DWORD sizeVolume) 70 { 71 HANDLE DeviceHandle; 72 MMRESULT Result; 73 DWORD BytesReturned; 74 75 Result = OpenDevice(AuxDevice, dwID, &DeviceHandle, GENERIC_READ); 76 if (Result != MMSYSERR_NOERROR) 77 return Result; 78 79 80 Result = DeviceIoControl(DeviceHandle, IOCTL_AUX_GET_VOLUME, NULL, 0, (LPVOID)pVolume, sizeVolume, 81 &BytesReturned, NULL) ? MMSYSERR_NOERROR : TranslateStatus(); 82 83 84 CloseHandle(DeviceHandle); 85 86 return Result; 87 } 88 89 DWORD AuxSetAudio(DWORD dwID, PBYTE pVolume, DWORD sizeVolume) 90 { 91 HANDLE DeviceHandle; 92 MMRESULT Result; 93 DWORD BytesReturned; 94 95 Result = OpenDevice(AuxDevice, dwID, &DeviceHandle, GENERIC_READ); 96 if (Result != MMSYSERR_NOERROR) 97 return Result; 98 99 Result = DeviceIoControl(DeviceHandle, IOCTL_AUX_SET_VOLUME, (LPVOID)pVolume, sizeVolume, NULL, 0, 100 &BytesReturned, NULL) ? MMSYSERR_NOERROR : TranslateStatus(); 101 102 103 CloseHandle(DeviceHandle); 104 105 return Result; 106 } 107 108