ReactOS  0.4.13-dev-563-g0561610
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 
168 test();
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 
206  if (Result == MMSYSERR_NOERROR)
207  {
208  printf("\n");
209  printf("SrcLineIndex %lu\n", SrcIndex);
210  printMixerLine(&SrcLine, MixerIndex);
211  }
212  }
213  }
214  }
217 
218  return 0;
219 }
DWORD fdwSupport
Definition: mmsystem.h:1227
#define CloseHandle
Definition: compat.h:398
UINT WINAPI mixerGetLineInfoW(HMIXEROBJ hmix, LPMIXERLINEW lpmliW, DWORD fdwInfo)
Definition: winmm.c:595
HANDLE hThread
Definition: test.c:11
DWORD cDestinations
Definition: mmsystem.h:1228
#define ZeroMemory
Definition: winbase.h:1635
UINT MMRESULT
Definition: mmsystem.h:962
void printMixerLine(LPMIXERLINEW MixerLine, IN ULONG MixerIndex)
Definition: test.c:70
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define MIXER_OBJECTF_MIXER
Definition: mmsystem.h:300
DWORD dwDestination
Definition: mmsystem.h:1256
_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:426
#define MIXER_GETLINEINFOF_DESTINATION
Definition: mmsystem.h:344
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
DWORD dwSource
Definition: mmsystem.h:1257
#define UlongToHandle(ul)
Definition: basetsd.h:97
VOID test()
Definition: test.c:34
DWORD cbStruct
Definition: mmsystem.h:1255
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
MMVERSION vDriverVersion
Definition: mmsystem.h:1225
UINT WINAPI mixerGetDevCapsW(UINT_PTR uDeviceID, LPMIXERCAPSW lpCaps, UINT uSize)
Definition: winmm.c:317
#define MIXER_GETLINEINFOF_SOURCE
Definition: mmsystem.h:345
UINT WINAPI mixerGetNumDevs(void)
Definition: winmm.c:283
DWORD cConnections
Definition: mmsystem.h:1263
WCHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1226
#define INFINITE
Definition: serial.h:102
#define printf
Definition: config.h:203

◆ 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 %x lParam %lx\n", msg.wParam, msg.lParam);
27  else if (msg.message == MM_MIXM_LINE_CHANGE)
28  printf("got MM_MIXM_LINE_CHANGE wParam %x lParam %lx\n", msg.wParam, msg.lParam);
29  }
30  return 1;
31 }
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
HMIXER hMixer
Definition: test.c:10
smooth NULL
Definition: ftsmooth.c:416
#define GetMessage
Definition: winuser.h:5656
#define msg(x)
Definition: auth_time.c:54
#define MM_MIXM_LINE_CHANGE
Definition: mmsystem.h:82
#define printf
Definition: config.h:203
#define MM_MIXM_CONTROL_CHANGE
Definition: mmsystem.h:83

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 %lu\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 
129  if (MixerLineControls.pamxctrl[Index].dwControlType == MIXERCONTROL_CONTROLTYPE_MUX)
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 
139  Result = mixerGetControlDetailsW((HMIXEROBJ)UlongToHandle(MixerIndex), &MixerControlDetails, MIXER_GETCONTROLDETAILSF_LISTTEXT | MIXER_OBJECTF_MIXER);
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 MIXERCONTROL_CONTROLTYPE_MUX
Definition: mmsystem.h:403
UINT WINAPI mixerSetControlDetails(HMIXEROBJ hmix, LPMIXERCONTROLDETAILS lpmcd, DWORD fdwDetails)
Definition: winmm.c:684
WCHAR szName[MIXER_LONG_NAME_CHARS]
Definition: mmsystem.h:1310
#define TRUE
Definition: types.h:120
#define MIXER_GETLINECONTROLSF_ALL
Definition: mmsystem.h:408
WCHAR szShortName[MIXER_SHORT_NAME_CHARS]
Definition: mmsystem.h:1309
LPMIXERCONTROLW pamxctrl
Definition: mmsystem.h:1350
UINT WINAPI mixerGetControlDetailsW(HMIXEROBJ hmix, LPMIXERCONTROLDETAILS lpmcdW, DWORD fdwDetails)
Definition: winmm.c:426
#define MIXER_OBJECTF_HANDLE
Definition: mmsystem.h:299
DWORD dwControlType
Definition: mmsystem.h:1306
struct tMIXERCONTROLDETAILS_BOOLEAN * LPMIXERCONTROLDETAILS_BOOLEAN
#define MIXER_GETCONTROLDETAILSF_LISTTEXT
Definition: mmsystem.h:413
DWORD dwLineID
Definition: mmsystem.h:1258
#define ZeroMemory
Definition: winbase.h:1635
DWORD cMultipleItems
Definition: mmsystem.h:1308
UINT MMRESULT
Definition: mmsystem.h:962
union tagMIXERCONTROLW::@2917 Bounds
struct tagMIXERCONTROLW MIXERCONTROLW
struct tagMIXERLINEW::@2912 Target
#define MIXER_OBJECTF_MIXER
Definition: mmsystem.h:300
WCHAR szShortName[MIXER_SHORT_NAME_CHARS]
Definition: mmsystem.h:1265
#define MIXER_SETCONTROLDETAILSF_VALUE
Definition: mmsystem.h:415
DWORD dwComponentType
Definition: mmsystem.h:1261
HMIXER hMixer
Definition: test.c:10
DWORD dwDestination
Definition: mmsystem.h:1256
_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:426
struct tagMIXERCONTROLDETAILS_LISTTEXTW * LPMIXERCONTROLDETAILS_LISTTEXTW
DWORD cControls
Definition: mmsystem.h:1264
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
DWORD dwSource
Definition: mmsystem.h:1257
DWORD cChannels
Definition: mmsystem.h:1262
#define UlongToHandle(ul)
Definition: basetsd.h:97
DWORD dwUser
Definition: mmsystem.h:1260
static const UCHAR Index[8]
Definition: usbohci.c:18
DWORD fdwLine
Definition: mmsystem.h:1259
UINT WINAPI mixerGetLineControlsW(HMIXEROBJ hmix, LPMIXERLINECONTROLSW lpmlcW, DWORD fdwControls)
Definition: winmm.c:574
DWORD dwReserved[6]
Definition: mmsystem.h:1320
struct tagMIXERCONTROLDETAILS_LISTTEXTW MIXERCONTROLDETAILS_LISTTEXTW
struct tMIXERCONTROLDETAILS_BOOLEAN MIXERCONTROLDETAILS_BOOLEAN
WCHAR szName[MIXER_LONG_NAME_CHARS]
Definition: mmsystem.h:1266
struct tMIXERCONTROLDETAILS MIXERCONTROLDETAILS
DWORD cConnections
Definition: mmsystem.h:1263
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static const WCHAR szName[]
Definition: msipriv.h:1194
union tagMIXERCONTROLW::@2918 Metrics
unsigned int ULONG
Definition: retypes.h:1
#define printf
Definition: config.h:203

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 }
DWORD WINAPI MixerThread(LPVOID Parameter)
Definition: test.c:16
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define CALLBACK_WINDOW
Definition: mmsystem.h:148
HANDLE hThread
Definition: test.c:11
#define MIXER_OBJECTF_MIXER
Definition: mmsystem.h:300
HMIXER hMixer
Definition: test.c:10
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:111
smooth NULL
Definition: ftsmooth.c:416
UINT WINAPI mixerOpen(LPHMIXER lphMix, UINT uDeviceID, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen)
Definition: winmm.c:342
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define WS_POPUP
Definition: pedump.c:616
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)
void exit(int exitcode)
Definition: _exit.c:33
#define printf
Definition: config.h:203

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.