ReactOS 0.4.15-dev-7906-g1b85a5f
test.c File Reference
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <setupapi.h>
#include <ks.h>
#include <ksmedia.h>
#include <mmsystem.h>
#include <mmreg.h>
Include dependency graph for test.c:

Go to the source code of this file.

Functions

DWORD WINAPI MixerThread (LPVOID Parameter)
 
VOID test ()
 
void printMixerLine (LPMIXERLINEW MixerLine, IN ULONG MixerIndex)
 
int main (int argc, char **argv)
 

Variables

HMIXER hMixer
 
HANDLE hThread
 
HWND hwnd
 

Function Documentation

◆ main()

int main ( int argc  ,
char **  argv 
)

Definition at line 160 of file test.c.

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}
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define CloseHandle
Definition: compat.h:739
#define INFINITE
Definition: serial.h:102
unsigned long DWORD
Definition: ntddk_ex.h:95
#define printf
Definition: freeldr.h:93
#define MIXER_OBJECTF_MIXER
Definition: mmsystem.h:300
UINT MMRESULT
Definition: mmsystem.h:962
#define MIXER_GETLINEINFOF_DESTINATION
Definition: mmsystem.h:344
#define MIXER_GETLINEINFOF_SOURCE
Definition: mmsystem.h:345
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
void printMixerLine(LPMIXERLINEW MixerLine, IN ULONG MixerIndex)
Definition: test.c:70
HANDLE hThread
Definition: test.c:11
VOID test()
Definition: test.c:34
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
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
DWORD dwDestination
Definition: mmsystem.h:1256
DWORD dwSource
Definition: mmsystem.h:1257
DWORD cConnections
Definition: mmsystem.h:1263
DWORD cbStruct
Definition: mmsystem.h:1255
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define ZeroMemory
Definition: winbase.h:1712
UINT WINAPI mixerGetDevCapsW(UINT_PTR uDeviceID, LPMIXERCAPSW lpCaps, UINT uSize)
Definition: winmm.c:314
UINT WINAPI mixerGetLineInfoW(HMIXEROBJ hmix, LPMIXERLINEW lpmliW, DWORD fdwInfo)
Definition: winmm.c:592
UINT WINAPI mixerGetNumDevs(void)
Definition: winmm.c:280
_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

◆ MixerThread()

DWORD WINAPI MixerThread ( LPVOID  Parameter)

Definition at line 16 of file test.c.

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}
#define msg(x)
Definition: auth_time.c:54
#define NULL
Definition: types.h:112
#define MM_MIXM_CONTROL_CHANGE
Definition: mmsystem.h:83
#define MM_MIXM_LINE_CHANGE
Definition: mmsystem.h:82
HMIXER hMixer
Definition: test.c:10
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define GetMessage
Definition: winuser.h:5790

Referenced by test().

◆ printMixerLine()

void printMixerLine ( LPMIXERLINEW  MixerLine,
IN ULONG  MixerIndex 
)

Definition at line 70 of file test.c.

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}
#define TRUE
Definition: types.h:120
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define MIXER_SETCONTROLDETAILSF_VALUE
Definition: mmsystem.h:415
struct tMIXERCONTROLDETAILS_BOOLEAN * LPMIXERCONTROLDETAILS_BOOLEAN
#define MIXERCONTROL_CONTROLTYPE_MUX
Definition: mmsystem.h:403
struct tagMIXERCONTROLW MIXERCONTROLW
#define MIXER_GETCONTROLDETAILSF_LISTTEXT
Definition: mmsystem.h:413
#define MIXER_GETLINECONTROLSF_ALL
Definition: mmsystem.h:408
#define MIXER_OBJECTF_HANDLE
Definition: mmsystem.h:299
struct tagMIXERCONTROLDETAILS_LISTTEXTW * LPMIXERCONTROLDETAILS_LISTTEXTW
struct tMIXERCONTROLDETAILS_BOOLEAN MIXERCONTROLDETAILS_BOOLEAN
struct tMIXERCONTROLDETAILS MIXERCONTROLDETAILS
struct tagMIXERCONTROLDETAILS_LISTTEXTW MIXERCONTROLDETAILS_LISTTEXTW
static const WCHAR szName[]
Definition: powrprof.c:45
WCHAR szName[MIXER_LONG_NAME_CHARS]
Definition: mmsystem.h:1310
DWORD dwControlType
Definition: mmsystem.h:1306
DWORD cMultipleItems
Definition: mmsystem.h:1308
union tagMIXERCONTROLW::@3051 Bounds
WCHAR szShortName[MIXER_SHORT_NAME_CHARS]
Definition: mmsystem.h:1309
DWORD dwReserved[6]
Definition: mmsystem.h:1320
union tagMIXERCONTROLW::@3052 Metrics
LPMIXERCONTROLW pamxctrl
Definition: mmsystem.h:1350
struct tagMIXERLINEW::@3046 Target
DWORD fdwLine
Definition: mmsystem.h:1259
DWORD cControls
Definition: mmsystem.h:1264
DWORD dwLineID
Definition: mmsystem.h:1258
WCHAR szName[MIXER_LONG_NAME_CHARS]
Definition: mmsystem.h:1266
DWORD cChannels
Definition: mmsystem.h:1262
DWORD_PTR dwUser
Definition: mmsystem.h:1260
DWORD dwComponentType
Definition: mmsystem.h:1261
WCHAR szShortName[MIXER_SHORT_NAME_CHARS]
Definition: mmsystem.h:1265
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFCOLLECTION _In_ ULONG Index
UINT WINAPI mixerGetLineControlsW(HMIXEROBJ hmix, LPMIXERLINECONTROLSW lpmlcW, DWORD fdwControls)
Definition: winmm.c:571
UINT WINAPI mixerGetControlDetailsW(HMIXEROBJ hmix, LPMIXERCONTROLDETAILS lpmcdW, DWORD fdwDetails)
Definition: winmm.c:423
UINT WINAPI mixerSetControlDetails(HMIXEROBJ hmix, LPMIXERCONTROLDETAILS lpmcd, DWORD fdwDetails)
Definition: winmm.c:681

Referenced by main().

◆ test()

VOID test ( )

Definition at line 34 of file test.c.

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}
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
#define CALLBACK_WINDOW
Definition: mmsystem.h:148
DWORD WINAPI MixerThread(LPVOID Parameter)
Definition: test.c:16
#define WS_POPUP
Definition: pedump.c:616
#define exit(n)
Definition: config.h:202
uint32_t DWORD_PTR
Definition: typedefs.h:65
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
UINT WINAPI mixerOpen(LPHMIXER lphMix, UINT uDeviceID, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen)
Definition: winmm.c:339
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)

Referenced by main().

Variable Documentation

◆ hMixer

◆ hThread

HANDLE hThread

Definition at line 11 of file test.c.

Referenced by main(), and test().

◆ hwnd

Definition at line 12 of file test.c.