1 /*
2  * PROJECT:     ReactOS Sound System "MME Buddy" Library
3  * LICENSE:     GPL - See COPYING in the top level directory
4  * FILE:        lib/sound/mmebuddy/auxiliary/auxMessage.c
5  *
6  * PURPOSE:     Provides the auxMessage exported function, as required by
7  *              the MME API, for auxiliary device support.
8  *
9  * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org)
10 */
11 
12 #include "precomp.h"
13 
14 /*
15     Standard MME driver entry-point for messages relating to auxiliary devices.
16 */
17 DWORD
18 APIENTRY
19 auxMessage(
20     UINT DeviceId,
21     UINT Message,
22     DWORD_PTR PrivateHandle,
23     DWORD_PTR Parameter1,
24     DWORD_PTR Parameter2)
25 {
26     MMRESULT Result = MMSYSERR_NOTSUPPORTED;
27 
28     AcquireEntrypointMutex(AUX_DEVICE_TYPE);
29 
30     SND_TRACE(L"auxMessage - Message type %d\n", Message);
31 
32     switch ( Message )
33     {
34         case AUXDM_GETNUMDEVS :
35         {
36             Result = GetSoundDeviceCount(AUX_DEVICE_TYPE);
37             break;
38         }
39 
40         case AUXDM_GETDEVCAPS :
41         {
42             Result = MmeGetSoundDeviceCapabilities(AUX_DEVICE_TYPE,
43                                                    DeviceId,
44                                                    (PVOID) Parameter1,
45                                                    Parameter2);
46             break;
47         }
48 
49         case AUXDM_GETVOLUME:
50         {
51             Result = MmeGetVolume(AUX_DEVICE_TYPE,
52                                   DeviceId,
53                                   PrivateHandle,
54                                   Parameter1);
55             break;
56         }
57 
58         case AUXDM_SETVOLUME:
59         {
60             Result = MmeSetVolume(AUX_DEVICE_TYPE,
61                                   DeviceId,
62                                   PrivateHandle,
63                                   Parameter1);
64             break;
65         }
66     }
67 
68     SND_TRACE(L"auxMessage returning MMRESULT %d\n", Result);
69 
70     ReleaseEntrypointMutex(AUX_DEVICE_TYPE);
71 
72     return Result;
73 }
74