Implement AUXDM_GETVOLUME
authorMagnus Olsen <magnus@greatlord.com>
Sun, 20 Nov 2005 21:42:23 +0000 (21:42 +0000)
committerMagnus Olsen <magnus@greatlord.com>
Sun, 20 Nov 2005 21:42:23 +0000 (21:42 +0000)
svn path=/trunk/; revision=19394

reactos/lib/mmdrv/auxil.c
reactos/lib/mmdrv/utils.c
reactos/lib/mmdrv/wave.h

index df98119..db5cb9f 100644 (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;
+ }
+
index dec035a..fbe8106 100644 (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 */
     };
index 56aa5b6..eac4afa 100644 (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;