ReactOS 0.4.16-dev-311-g9382aa2
test.c
Go to the documentation of this file.
1#include <windows.h>
2#include <stdio.h>
3#include <stdlib.h>
4#include <setupapi.h>
5#include <ks.h>
6#include <ksmedia.h>
7#include <mmsystem.h>
8#include <mmreg.h>
9
10HMIXER hMixer;
13
17{
18
19 MSG msg;
20
21 printf("hMixer %p\n", hMixer);
22
23 while(GetMessage(&msg, NULL, 0, 0))
24 {
25 if (msg.message == MM_MIXM_CONTROL_CHANGE)
26 printf("got MM_MIXM_CONTROL_CHANGE wParam %Ix lParam %Ix\n", msg.wParam, msg.lParam);
27 else if (msg.message == MM_MIXM_LINE_CHANGE)
28 printf("got MM_MIXM_LINE_CHANGE wParam %Ix lParam %Ix\n", msg.wParam, msg.lParam);
29 }
30 return 1;
31}
32
33VOID
35{
36
37
38 hwnd = CreateWindowExA(0, "static", "winmm test", WS_POPUP, 0,0,100,100,
39 0, 0, 0, NULL);
40
41
42 if (!hwnd) {
43 printf("failed to create window\n");
44 exit(-1);
45 }
46
47 printf("window created\n");
48
50 {
51 printf("failed to create mixer\n");
52 exit(-2);
53 }
54
56
57 if (hThread == NULL)
58 {
59 printf("failed to create thread\n");
60 exit(-3);
61 }
62}
63
64
65
66
67
68
69void
70printMixerLine(LPMIXERLINEW MixerLine, IN ULONG MixerIndex)
71{
72 MIXERLINECONTROLSW MixerLineControls;
74 MIXERCONTROLDETAILS MixerControlDetails;
75 ULONG Index, SubIndex;
77
78 printf("\n");
79 printf("cChannels %lu\n", MixerLine->cChannels);
80 printf("cConnections %lu\n", MixerLine->cConnections);
81 printf("cControls %lu\n", MixerLine->cControls);
82 printf("dwComponentType %lx\n", MixerLine->dwComponentType);
83 printf("dwDestination %lu\n", MixerLine->dwDestination);
84 printf("dwLineID %lx\n", MixerLine->dwLineID);
85 printf("dwSource %lx\n", MixerLine->dwSource);
86 printf("dwUser %Iu\n", MixerLine->dwUser);
87 printf("fdwLine %lu\n", MixerLine->fdwLine);
88 printf("szName %S\n", MixerLine->szName);
89 printf("szShortName %S\n", MixerLine->szShortName);
90 printf("Target.dwDeviceId %lu\n", MixerLine->Target.dwDeviceID);
91 printf("Target.dwType %lu\n", MixerLine->Target.dwType);
92 printf("Target.szName %S\n", MixerLine->Target.szPname);
93 printf("Target.vDriverVersion %x\n", MixerLine->Target.vDriverVersion);
94 printf("Target.wMid %x\n", MixerLine->Target.wMid );
95 printf("Target.wPid %x\n", MixerLine->Target.wPid);
96
97 MixerLineControls.cbStruct = sizeof(MixerLineControls);
98 MixerLineControls.dwLineID = MixerLine->dwLineID;
99 MixerLineControls.cControls = MixerLine->cControls;
100 MixerLineControls.cbmxctrl= sizeof(MIXERCONTROLW);
101 MixerLineControls.pamxctrl = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, MixerLineControls.cControls * sizeof(MIXERCONTROLW));
102
103 Result = mixerGetLineControlsW((HMIXEROBJ)UlongToHandle(MixerIndex), &MixerLineControls, MIXER_GETLINECONTROLSF_ALL | MIXER_OBJECTF_MIXER);
104
105 printf("Result %u\n", Result);
106
107 for(Index = 0; Index < MixerLine->cControls; Index++)
108 {
109 printf("\n");
110 printf("Control Index: %lu\n", Index);
111 printf("\n");
112 printf("cbStruct %lu\n", MixerLineControls.pamxctrl[Index].cbStruct);
113 printf("dwControlID %lu\n", MixerLineControls.pamxctrl[Index].dwControlID);
114 printf("dwControlType %lx\n", MixerLineControls.pamxctrl[Index].dwControlType);
115 printf("fdwControl %lu\n", MixerLineControls.pamxctrl[Index].fdwControl);
116 printf("cMultipleItems %lu\n", MixerLineControls.pamxctrl[Index].cMultipleItems);
117 printf("szShortName %S\n", MixerLineControls.pamxctrl[Index].szShortName);
118 printf("szName %S\n", MixerLineControls.pamxctrl[Index].szName);
119 printf("Bounds.dwMinimum %lu\n", MixerLineControls.pamxctrl[Index].Bounds.dwMinimum);
120 printf("Bounds.dwMaximum %lu\n", MixerLineControls.pamxctrl[Index].Bounds.dwMaximum);
121
122 printf("Metrics.Reserved[0] %lu\n", MixerLineControls.pamxctrl[Index].Metrics.dwReserved[0]);
123 printf("Metrics.Reserved[1] %lu\n", MixerLineControls.pamxctrl[Index].Metrics.dwReserved[1]);
124 printf("Metrics.Reserved[2] %lu\n", MixerLineControls.pamxctrl[Index].Metrics.dwReserved[2]);
125 printf("Metrics.Reserved[3] %lu\n", MixerLineControls.pamxctrl[Index].Metrics.dwReserved[3]);
126 printf("Metrics.Reserved[4] %lu\n", MixerLineControls.pamxctrl[Index].Metrics.dwReserved[4]);
127 printf("Metrics.Reserved[5] %lu\n", MixerLineControls.pamxctrl[Index].Metrics.dwReserved[5]);
128
130 {
131 ZeroMemory(&MixerControlDetails, sizeof(MixerControlDetails));
132 MixerControlDetails.cbStruct = sizeof(MIXERCONTROLDETAILS);
133 MixerControlDetails.cbDetails = sizeof(MIXERCONTROLDETAILS_LISTTEXTW);
134 MixerControlDetails.cChannels = 1;
135 MixerControlDetails.cMultipleItems = MixerLineControls.pamxctrl[Index].Metrics.dwReserved[0];
136 MixerControlDetails.dwControlID = MixerLineControls.pamxctrl[Index].dwControlID;
137 MixerControlDetails.paDetails = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, MixerControlDetails.cbDetails * MixerControlDetails.cChannels * MixerControlDetails.cMultipleItems);
138
140
141 printf("Result %x\n", Result);
142 ListText = (LPMIXERCONTROLDETAILS_LISTTEXTW)MixerControlDetails.paDetails;
143 for(SubIndex = 0; SubIndex < MixerControlDetails.cMultipleItems; SubIndex++)
144 {
145 printf("dwParam1 %lx\n", ListText[SubIndex].dwParam1);
146 printf("dwParam1 %lx\n", ListText[SubIndex].dwParam2);
147 printf("szName %S\n", ListText[SubIndex].szName);
148 }
149
150 MixerControlDetails.cbDetails = sizeof(MIXERCONTROLDETAILS_BOOLEAN);
151 MixerControlDetails.paDetails = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MIXERCONTROLDETAILS_BOOLEAN) * MixerControlDetails.cMultipleItems);
152 ((LPMIXERCONTROLDETAILS_BOOLEAN)MixerControlDetails.paDetails)->fValue = TRUE;
153
155 printf("Result %x hMixer %p\n", Result, hMixer);
156 }
157 }
158}
159
160int main(int argc, char**argv)
161{
162 DWORD MixerCount, MixerIndex, DestinationIndex, SrcIndex;
163 MIXERCAPSW MixerCaps;
164 MIXERLINEW DstMixerLine, SrcLine;
166
167
168test();
169
170 MixerCount = mixerGetNumDevs();
171
172 printf("MixerCount %lu\n", MixerCount);
173
174 for(MixerIndex = 0; MixerIndex < MixerCount; MixerIndex++)
175 {
176 Result = mixerGetDevCapsW((UINT_PTR)MixerIndex, &MixerCaps, sizeof(MixerCaps));
177
178 printf("\n");
179 printf("Index %lu Result %x\n", MixerIndex, Result);
180 printf("Name :%S\n", MixerCaps.szPname);
181 printf("cDestinations: %lu\n", MixerCaps.cDestinations);
182 printf("fdwSupport %lx\n", MixerCaps.fdwSupport);
183 printf("vDriverVersion %x\n", MixerCaps.vDriverVersion);
184 printf("wMid %x\n", MixerCaps.wMid);
185 printf("wPid %x\n", MixerCaps.wPid);
186
187 for(DestinationIndex = 0; DestinationIndex < MixerCaps.cDestinations; DestinationIndex++)
188 {
189 ZeroMemory(&DstMixerLine, sizeof(DstMixerLine));
190 DstMixerLine.dwDestination = DestinationIndex;
191 DstMixerLine.cbStruct = sizeof(DstMixerLine);
192
194 printf("\n");
195 printf("Destination Index %lu\n", DestinationIndex);
196 printMixerLine(&DstMixerLine, MixerIndex);
197 for(SrcIndex = 0; SrcIndex < DstMixerLine.cConnections; SrcIndex++)
198 {
199 ZeroMemory(&SrcLine, sizeof(SrcLine));
200 SrcLine.dwDestination = DestinationIndex;
201 SrcLine.dwSource = SrcIndex;
202 SrcLine.cbStruct = sizeof(SrcLine);
203
205
207 {
208 printf("\n");
209 printf("SrcLineIndex %lu\n", SrcIndex);
210 printMixerLine(&SrcLine, MixerIndex);
211 }
212 }
213 }
214 }
217
218 return 0;
219}
static int argc
Definition: ServiceArgs.c:12
#define msg(x)
Definition: auth_time.c:54
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
int main()
Definition: test.c:6
#define INFINITE
Definition: serial.h:102
unsigned long DWORD
Definition: ntddk_ex.h:95
#define printf
Definition: freeldr.h:97
#define CALLBACK_WINDOW
Definition: mmsystem.h:148
#define MIXER_OBJECTF_MIXER
Definition: mmsystem.h:300
UINT MMRESULT
Definition: mmsystem.h:962
#define MIXER_SETCONTROLDETAILSF_VALUE
Definition: mmsystem.h:415
struct tMIXERCONTROLDETAILS_BOOLEAN * LPMIXERCONTROLDETAILS_BOOLEAN
#define MIXERCONTROL_CONTROLTYPE_MUX
Definition: mmsystem.h:403
#define MIXER_GETLINEINFOF_DESTINATION
Definition: mmsystem.h:344
#define MM_MIXM_CONTROL_CHANGE
Definition: mmsystem.h:83
struct tagMIXERCONTROLW MIXERCONTROLW
#define MIXER_GETCONTROLDETAILSF_LISTTEXT
Definition: mmsystem.h:413
#define MM_MIXM_LINE_CHANGE
Definition: mmsystem.h:82
#define MIXER_GETLINEINFOF_SOURCE
Definition: mmsystem.h:345
#define MIXER_GETLINECONTROLSF_ALL
Definition: mmsystem.h:408
#define MIXER_OBJECTF_HANDLE
Definition: mmsystem.h:299
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
struct tagMIXERCONTROLDETAILS_LISTTEXTW * LPMIXERCONTROLDETAILS_LISTTEXTW
struct tMIXERCONTROLDETAILS_BOOLEAN MIXERCONTROLDETAILS_BOOLEAN
struct tMIXERCONTROLDETAILS MIXERCONTROLDETAILS
struct tagMIXERCONTROLDETAILS_LISTTEXTW MIXERCONTROLDETAILS_LISTTEXTW
void printMixerLine(LPMIXERLINEW MixerLine, IN ULONG MixerIndex)
Definition: test.c:70
DWORD WINAPI MixerThread(LPVOID Parameter)
Definition: test.c:16
HWND hwnd
Definition: test.c:12
HANDLE hThread
Definition: test.c:11
HMIXER hMixer
Definition: test.c:10
VOID test()
Definition: test.c:34
#define argv
Definition: mplay32.c:18
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define WS_POPUP
Definition: pedump.c:616
static const WCHAR szName[]
Definition: powrprof.c:45
#define exit(n)
Definition: config.h:202
DWORD cDestinations
Definition: mmsystem.h:1228
MMVERSION vDriverVersion
Definition: mmsystem.h:1225
DWORD fdwSupport
Definition: mmsystem.h:1227
WCHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1226
WCHAR szName[MIXER_LONG_NAME_CHARS]
Definition: mmsystem.h:1310
DWORD dwControlType
Definition: mmsystem.h:1306
DWORD cMultipleItems
Definition: mmsystem.h:1308
WCHAR szShortName[MIXER_SHORT_NAME_CHARS]
Definition: mmsystem.h:1309
union tagMIXERCONTROLW::@3045 Bounds
DWORD dwReserved[6]
Definition: mmsystem.h:1320
union tagMIXERCONTROLW::@3046 Metrics
LPMIXERCONTROLW pamxctrl
Definition: mmsystem.h:1350
DWORD fdwLine
Definition: mmsystem.h:1259
DWORD dwDestination
Definition: mmsystem.h:1256
DWORD cControls
Definition: mmsystem.h:1264
DWORD dwSource
Definition: mmsystem.h:1257
DWORD dwLineID
Definition: mmsystem.h:1258
WCHAR szName[MIXER_LONG_NAME_CHARS]
Definition: mmsystem.h:1266
DWORD cChannels
Definition: mmsystem.h:1262
DWORD cConnections
Definition: mmsystem.h:1263
DWORD_PTR dwUser
Definition: mmsystem.h:1260
struct tagMIXERLINEW::@3040 Target
DWORD cbStruct
Definition: mmsystem.h:1255
DWORD dwComponentType
Definition: mmsystem.h:1261
WCHAR szShortName[MIXER_SHORT_NAME_CHARS]
Definition: mmsystem.h:1265
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFCOLLECTION _In_ ULONG Index
#define ZeroMemory
Definition: winbase.h:1737
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define WINAPI
Definition: msvc.h:6
UINT WINAPI mixerGetLineControlsW(HMIXEROBJ hmix, LPMIXERLINECONTROLSW lpmlcW, DWORD fdwControls)
Definition: winmm.c:571
UINT WINAPI mixerGetDevCapsW(UINT_PTR uDeviceID, LPMIXERCAPSW lpCaps, UINT uSize)
Definition: winmm.c:314
UINT WINAPI mixerGetControlDetailsW(HMIXEROBJ hmix, LPMIXERCONTROLDETAILS lpmcdW, DWORD fdwDetails)
Definition: winmm.c:423
UINT WINAPI mixerGetLineInfoW(HMIXEROBJ hmix, LPMIXERLINEW lpmliW, DWORD fdwInfo)
Definition: winmm.c:592
UINT WINAPI mixerGetNumDevs(void)
Definition: winmm.c:280
UINT WINAPI mixerOpen(LPHMIXER lphMix, UINT uDeviceID, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen)
Definition: winmm.c:339
UINT WINAPI mixerSetControlDetails(HMIXEROBJ hmix, LPMIXERCONTROLDETAILS lpmcd, DWORD fdwDetails)
Definition: winmm.c:681
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define GetMessage
Definition: winuser.h:5802
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409
_Inout_opt_ PVOID Parameter
Definition: rtltypes.h:336