ReactOS  0.4.12-dev-18-gf469aca
mixer.c File Reference
#include "sndvol32.h"
Include dependency graph for mixer.c:

Go to the source code of this file.

Macros

#define NO_MIXER_SELECTED   ((UINT)(~0))
 

Functions

static VOID ClearMixerCache (PSND_MIXER Mixer)
 
PSND_MIXER SndMixerCreate (HWND hWndNotification, UINT MixerId)
 
VOID SndMixerDestroy (PSND_MIXER Mixer)
 
VOID SndMixerClose (PSND_MIXER Mixer)
 
BOOL SndMixerQueryControls (PSND_MIXER Mixer, PUINT DisplayControls, LPMIXERLINE LineInfo, LPMIXERCONTROL *Controls)
 
static BOOL SndMixerQueryConnections (PSND_MIXER Mixer, PSND_MIXER_DESTINATION Line)
 
static BOOL SndMixerQueryDestinations (PSND_MIXER Mixer)
 
BOOL SndMixerSelect (PSND_MIXER Mixer, UINT MixerId)
 
UINT SndMixerGetSelection (PSND_MIXER Mixer)
 
INT SndMixerGetProductName (PSND_MIXER Mixer, LPTSTR lpBuffer, UINT uSize)
 
INT SndMixerGetLineName (PSND_MIXER Mixer, DWORD LineID, LPTSTR lpBuffer, UINT uSize, BOOL LongName)
 
BOOL SndMixerEnumProducts (PSND_MIXER Mixer, PFNSNDMIXENUMPRODUCTS EnumProc, PVOID Context)
 
INT SndMixerSetVolumeControlDetails (PSND_MIXER Mixer, DWORD dwControlID, DWORD cbDetails, LPVOID paDetails)
 
INT SndMixerGetVolumeControlDetails (PSND_MIXER Mixer, DWORD dwControlID, DWORD cbDetails, LPVOID paDetails)
 
INT SndMixerGetDestinationCount (PSND_MIXER Mixer)
 
BOOL SndMixerEnumLines (PSND_MIXER Mixer, PFNSNDMIXENUMLINES EnumProc, PVOID Context)
 
BOOL SndMixerEnumConnections (PSND_MIXER Mixer, DWORD LineID, PFNSNDMIXENUMCONNECTIONS EnumProc, PVOID Context)
 
BOOL SndMixerIsDisplayControl (PSND_MIXER Mixer, LPMIXERCONTROL Control)
 

Macro Definition Documentation

◆ NO_MIXER_SELECTED

#define NO_MIXER_SELECTED   ((UINT)(~0))

Definition at line 28 of file mixer.c.

Referenced by SndMixerClose(), SndMixerCreate(), and SndMixerSelect().

Function Documentation

◆ ClearMixerCache()

static VOID ClearMixerCache ( PSND_MIXER  Mixer)
static

Definition at line 31 of file mixer.c.

Referenced by SndMixerDestroy(), and SndMixerSelect().

32 {
34  PSND_MIXER_CONNECTION Con, NextCon;
35 
36  for (Line = Mixer->Lines; Line != NULL; Line = NextLine)
37  {
38  if (Line->Controls != NULL)
39  {
41  0,
42  Line->Controls);
43  }
44 
45  for (Con = Line->Connections; Con != NULL; Con = NextCon)
46  {
47  if (Con->Controls != NULL)
48  {
50  0,
51  Con->Controls);
52  }
53 
54  NextCon = Con->Next;
56  0,
57  Con);
58  }
59 
60  NextLine = Line->Next;
62  0,
63  Line);
64  }
65  Mixer->Lines = NULL;
66 }
PSND_MIXER_DESTINATION Lines
Definition: sndvol32.h:86
smooth NULL
Definition: ftsmooth.c:416
struct _SND_MIXER_DESTINATION * Next
Definition: sndvol32.h:72
LPMIXERCONTROL Controls
Definition: sndvol32.h:65
#define GetProcessHeap()
Definition: compat.h:395
PSND_MIXER_CONNECTION Connections
Definition: sndvol32.h:76
PDOS_DEVICE_NODE Con
Definition: condrv.c:26
struct _SND_MIXER_CONNECTION * Next
Definition: sndvol32.h:63
LPMIXERCONTROL Controls
Definition: sndvol32.h:74
#define HeapFree(x, y, z)
Definition: compat.h:394
BOOLEAN NextLine
Definition: bootvid.c:28
struct Line Line

◆ SndMixerClose()

VOID SndMixerClose ( PSND_MIXER  Mixer)

Definition at line 101 of file mixer.c.

Referenced by SndMixerDestroy(), and SndMixerSelect().

102 {
103  if (Mixer->hmx != NULL)
104  {
105  mixerClose(Mixer->hmx);
106  Mixer->hmx = NULL;
107  Mixer->MixerId = NO_MIXER_SELECTED;
108  }
109 }
UINT WINAPI mixerClose(HMIXER hMix)
Definition: winmm.c:389
#define NO_MIXER_SELECTED
Definition: mixer.c:28
smooth NULL
Definition: ftsmooth.c:416
HMIXER hmx
Definition: sndvol32.h:84
UINT MixerId
Definition: sndvol32.h:83

◆ SndMixerCreate()

PSND_MIXER SndMixerCreate ( HWND  hWndNotification,
UINT  MixerId 
)

Definition at line 69 of file mixer.c.

Referenced by DlgPreferencesProc(), and MainWindowProc().

70 {
73  sizeof(SND_MIXER));
74  if (Mixer != NULL)
75  {
76  Mixer->hWndNotification = hWndNotification;
77  Mixer->MixersCount = mixerGetNumDevs();
78  Mixer->MixerId = NO_MIXER_SELECTED;
79 
80  if (Mixer->MixersCount > 0)
81  {
82  /* select the first mixer by default */
83  SndMixerSelect(Mixer, MixerId);
84  }
85  }
86 
87  return Mixer;
88 }
HWND hWndNotification
Definition: sndvol32.h:82
#define NO_MIXER_SELECTED
Definition: mixer.c:28
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
UINT MixerId
Definition: sndvol32.h:83
struct _SND_MIXER * PSND_MIXER
UINT WINAPI mixerGetNumDevs(void)
Definition: winmm.c:283
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
UINT MixersCount
Definition: sndvol32.h:81
BOOL SndMixerSelect(PSND_MIXER Mixer, UINT MixerId)
Definition: mixer.c:304
struct _SND_MIXER SND_MIXER

◆ SndMixerDestroy()

VOID SndMixerDestroy ( PSND_MIXER  Mixer)

Definition at line 91 of file mixer.c.

Referenced by MainWindowProc().

92 {
93  ClearMixerCache(Mixer);
94  SndMixerClose(Mixer);
96  0,
97  Mixer);
98 }
static VOID ClearMixerCache(PSND_MIXER Mixer)
Definition: mixer.c:31
#define GetProcessHeap()
Definition: compat.h:395
VOID SndMixerClose(PSND_MIXER Mixer)
Definition: mixer.c:101
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ SndMixerEnumConnections()

BOOL SndMixerEnumConnections ( PSND_MIXER  Mixer,
DWORD  LineID,
PFNSNDMIXENUMCONNECTIONS  EnumProc,
PVOID  Context 
)

Definition at line 552 of file mixer.c.

Referenced by LoadDialogCtrls(), MainWindowProc(), and UpdatePrefDlgControls().

556 {
557  if (Mixer->hmx)
558  {
560 
561  for (Line = Mixer->Lines; Line != NULL; Line = Line->Next)
562  {
563  if (Line->Info.dwLineID == LineID)
564  {
565  PSND_MIXER_CONNECTION Connection;
566 
567  if (Line->DisplayControls != 0)
568  {
569  if (!EnumProc(Mixer,
570  LineID,
571  &Line->Info,
572  Context))
573  {
574  return FALSE;
575  }
576  }
577 
578  for (Connection = Line->Connections; Connection != NULL; Connection = Connection->Next)
579  {
580  if (!EnumProc(Mixer,
581  LineID,
582  &Connection->Info,
583  Context))
584  {
585  return FALSE;
586  }
587  }
588 
589  return TRUE;
590  }
591  }
592  }
593 
594  return FALSE;
595 }
#define TRUE
Definition: types.h:120
PSND_MIXER_DESTINATION Lines
Definition: sndvol32.h:86
smooth NULL
Definition: ftsmooth.c:416
struct _SND_MIXER_DESTINATION * Next
Definition: sndvol32.h:72
DWORD dwLineID
Definition: mmsystem.h:1235
HMIXER hmx
Definition: sndvol32.h:84
PSND_MIXER_CONNECTION Connections
Definition: sndvol32.h:76
struct _SND_MIXER_CONNECTION * Next
Definition: sndvol32.h:63
static BOOL CALLBACK EnumProc(_In_ HWND hWnd, _In_ LPARAM lParam)
Definition: SetParent.c:53
struct Line Line

◆ SndMixerEnumLines()

BOOL SndMixerEnumLines ( PSND_MIXER  Mixer,
PFNSNDMIXENUMLINES  EnumProc,
PVOID  Context 
)

Definition at line 526 of file mixer.c.

Referenced by UpdatePrefDlgControls().

529 {
530  if (Mixer->hmx)
531  {
533 
534  for (Line = Mixer->Lines; Line != NULL; Line = Line->Next)
535  {
536  if (!EnumProc(Mixer,
537  &Line->Info,
538  Line->DisplayControls,
539  Context))
540  {
541  return FALSE;
542  }
543  }
544 
545  return TRUE;
546  }
547 
548  return FALSE;
549 }
#define TRUE
Definition: types.h:120
PSND_MIXER_DESTINATION Lines
Definition: sndvol32.h:86
smooth NULL
Definition: ftsmooth.c:416
struct _SND_MIXER_DESTINATION * Next
Definition: sndvol32.h:72
HMIXER hmx
Definition: sndvol32.h:84
static BOOL CALLBACK EnumProc(_In_ HWND hWnd, _In_ LPARAM lParam)
Definition: SetParent.c:53
struct Line Line

◆ SndMixerEnumProducts()

BOOL SndMixerEnumProducts ( PSND_MIXER  Mixer,
PFNSNDMIXENUMPRODUCTS  EnumProc,
PVOID  Context 
)

Definition at line 431 of file mixer.c.

Referenced by DlgPreferencesProc().

434 {
435  MIXERCAPS Caps;
436  HMIXER hMixer;
437  UINT i;
438  BOOL Ret = TRUE;
439 
440  for (i = 0; i < Mixer->MixersCount; i++)
441  {
442  if (mixerOpen(&hMixer,
443  i,
444  0,
445  0,
446  0) == MMSYSERR_NOERROR)
447  {
448  if (mixerGetDevCaps(i,
449  &Caps,
450  sizeof(Caps)) == MMSYSERR_NOERROR)
451  {
452  if (!EnumProc(Mixer,
453  i,
454  Caps.szPname,
455  Context))
456  {
457  mixerClose(hMixer);
458  Ret = FALSE;
459  break;
460  }
461  }
462  else
463  {
464  DPRINT("Failed to get device capabilities for mixer id %d!\n", i);
465  }
466  mixerClose(hMixer);
467  }
468  }
469 
470  return Ret;
471 }
#define TRUE
Definition: types.h:120
CHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1217
UINT WINAPI mixerClose(HMIXER hMix)
Definition: winmm.c:389
#define mixerGetDevCaps
Definition: mmsystem.h:2842
GLenum GLclampf GLint i
Definition: glfuncs.h:14
HMIXER hMixer
Definition: test.c:10
void DPRINT(...)
Definition: polytest.cpp:61
UINT WINAPI mixerOpen(LPHMIXER lphMix, UINT uDeviceID, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen)
Definition: winmm.c:342
unsigned int BOOL
Definition: ntddk_ex.h:94
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
unsigned int UINT
Definition: ndis.h:50
UINT MixersCount
Definition: sndvol32.h:81
static BOOL CALLBACK EnumProc(_In_ HWND hWnd, _In_ LPARAM lParam)
Definition: SetParent.c:53

◆ SndMixerGetDestinationCount()

INT SndMixerGetDestinationCount ( PSND_MIXER  Mixer)

Definition at line 520 of file mixer.c.

521 {
522  return (Mixer->hmx ? (INT)Mixer->Caps.cDestinations : -1);
523 }
int32_t INT
Definition: typedefs.h:56
MIXERCAPS Caps
Definition: sndvol32.h:85
HMIXER hmx
Definition: sndvol32.h:84
DWORD cDestinations
Definition: mmsystem.h:1219

◆ SndMixerGetLineName()

INT SndMixerGetLineName ( PSND_MIXER  Mixer,
DWORD  LineID,
LPTSTR  lpBuffer,
UINT  uSize,
BOOL  LongName 
)

Definition at line 390 of file mixer.c.

Referenced by EnumConnectionsCallback(), PrefDlgAddConnection(), and WriteLineSettings().

395 {
396  if (Mixer->hmx)
397  {
398  UINT lnsz;
400  LPMIXERLINE lpl = NULL;
401 
402  for (Line = Mixer->Lines; Line != NULL; Line = Line->Next)
403  {
404  if (Line->Info.dwLineID == LineID)
405  {
406  lpl = &Line->Info;
407  break;
408  }
409  }
410 
411  if (lpl != NULL)
412  {
413  lnsz = (UINT) lstrlen(LongName ? lpl->szName : lpl->szShortName);
414  if(lnsz + 1 > uSize)
415  {
416  return lnsz + 1;
417  }
418  else
419  {
420  memcpy(lpBuffer, LongName ? lpl->szName : lpl->szShortName, lnsz * sizeof(TCHAR));
421  lpBuffer[lnsz] = _T('\0');
422  return lnsz;
423  }
424  }
425  }
426 
427  return -1;
428 }
PSND_MIXER_DESTINATION Lines
Definition: sndvol32.h:86
CHAR szShortName[MIXER_SHORT_NAME_CHARS]
Definition: mmsystem.h:1242
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:163
smooth NULL
Definition: ftsmooth.c:416
struct _SND_MIXER_DESTINATION * Next
Definition: sndvol32.h:72
char TCHAR
Definition: xmlstorage.h:189
DWORD dwLineID
Definition: mmsystem.h:1235
#define _T(x)
Definition: vfdio.h:22
HMIXER hmx
Definition: sndvol32.h:84
unsigned int UINT
Definition: ndis.h:50
CHAR szName[MIXER_LONG_NAME_CHARS]
Definition: mmsystem.h:1243
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define lstrlen
Definition: winbase.h:3690
_In_ ULONGLONG _In_ PUNICODE_STRING _In_ PUNICODE_STRING LongName
Definition: fsrtlfuncs.h:336
#define UINT
Definition: msvc.h:27
struct Line Line

◆ SndMixerGetProductName()

INT SndMixerGetProductName ( PSND_MIXER  Mixer,
LPTSTR  lpBuffer,
UINT  uSize 
)

Definition at line 367 of file mixer.c.

Referenced by MainWindowProc(), and UpdatePrefDlgControls().

370 {
371  if (Mixer->hmx)
372  {
373  UINT lnsz = (UINT) lstrlen(Mixer->Caps.szPname);
374  if(lnsz + 1 > uSize)
375  {
376  return lnsz + 1;
377  }
378  else
379  {
380  memcpy(lpBuffer, Mixer->Caps.szPname, lnsz * sizeof(TCHAR));
381  lpBuffer[lnsz] = _T('\0');
382  return lnsz;
383  }
384  }
385 
386  return -1;
387 }
CHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1217
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:163
MIXERCAPS Caps
Definition: sndvol32.h:85
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
HMIXER hmx
Definition: sndvol32.h:84
unsigned int UINT
Definition: ndis.h:50
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define lstrlen
Definition: winbase.h:3690
#define UINT
Definition: msvc.h:27

◆ SndMixerGetSelection()

UINT SndMixerGetSelection ( PSND_MIXER  Mixer)

Definition at line 361 of file mixer.c.

Referenced by DlgPreferencesProc(), and UpdatePrefDlgControls().

362 {
363  return Mixer->MixerId;
364 }
UINT MixerId
Definition: sndvol32.h:83

◆ SndMixerGetVolumeControlDetails()

INT SndMixerGetVolumeControlDetails ( PSND_MIXER  Mixer,
DWORD  dwControlID,
DWORD  cbDetails,
LPVOID  paDetails 
)

Definition at line 498 of file mixer.c.

Referenced by EnumConnectionsCallback(), and MixerControlChangeCallback().

499 {
500  MIXERCONTROLDETAILS MixerDetails;
501 
502  if (Mixer->hmx)
503  {
504  MixerDetails.cbStruct = sizeof(MIXERCONTROLDETAILS);
505  MixerDetails.dwControlID = dwControlID;
506  MixerDetails.cChannels = 1; //FIXME
507  MixerDetails.cMultipleItems = 0;
508  MixerDetails.cbDetails = cbDetails;
509  MixerDetails.paDetails = paDetails;
510 
512  {
513  return 1;
514  }
515  }
516  return -1;
517 }
#define MIXER_GETCONTROLDETAILSF_VALUE
Definition: mmsystem.h:412
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
HMIXER hmx
Definition: sndvol32.h:84
#define MIXER_OBJECTF_HMIXER
Definition: mmsystem.h:301
struct tMIXERCONTROLDETAILS MIXERCONTROLDETAILS
#define mixerGetControlDetails
Definition: mmsystem.h:2845

◆ SndMixerIsDisplayControl()

BOOL SndMixerIsDisplayControl ( PSND_MIXER  Mixer,
LPMIXERCONTROL  Control 
)

Definition at line 598 of file mixer.c.

Referenced by SndMixerQueryControls().

600 {
601  if (Mixer->hmx && !(Control->fdwControl & MIXERCONTROL_CONTROLF_DISABLED))
602  {
603  switch (Control->dwControlType & MIXERCONTROL_CT_CLASS_MASK)
604  {
607  return TRUE;
608  }
609  }
610 
611  return FALSE;
612 }
#define TRUE
Definition: types.h:120
#define MIXERCONTROL_CT_CLASS_MASK
Definition: mmsystem.h:353
DWORD dwControlType
Definition: mmsystem.h:1280
#define MIXERCONTROL_CT_CLASS_SWITCH
Definition: mmsystem.h:356
#define MIXERCONTROL_CONTROLF_DISABLED
Definition: mmsystem.h:352
HMIXER hmx
Definition: sndvol32.h:84
#define MIXERCONTROL_CT_CLASS_FADER
Definition: mmsystem.h:359

◆ SndMixerQueryConnections()

static BOOL SndMixerQueryConnections ( PSND_MIXER  Mixer,
PSND_MIXER_DESTINATION  Line 
)
static

Definition at line 175 of file mixer.c.

Referenced by SndMixerQueryDestinations().

177 {
178  UINT i, DispControls;
181  BOOL Ret = TRUE;
182 
183  LineInfo.cbStruct = sizeof(LineInfo);
184  for (i = Line->Info.cConnections; i > 0; i--)
185  {
186  LineInfo.dwDestination = Line->Info.dwDestination;
187  LineInfo.dwSource = i - 1;
188  Result = mixerGetLineInfo((HMIXEROBJ)Mixer->hmx,
189  &LineInfo,
191  if (Result == MMSYSERR_NOERROR)
192  {
193  LPMIXERCONTROL Controls = NULL;
195 
196  DPRINT("++ Source: %ws\n", LineInfo.szName);
197 
198  DispControls = 0;
199 
200  if (!SndMixerQueryControls(Mixer,
201  &DispControls,
202  &LineInfo,
203  &Controls))
204  {
205  DPRINT("Failed to query connection controls\n");
206  Ret = FALSE;
207  break;
208  }
209 
212  sizeof(SND_MIXER_CONNECTION));
213  if (Con != NULL)
214  {
215  Con->Info = LineInfo;
216  Con->Controls = Controls;
217  Con->DisplayControls = DispControls;
218  Con->Next = Line->Connections;
219  Line->Connections = Con;
220  }
221  else
222  {
224  0,
225  Controls);
226  }
227  }
228  else
229  {
230  DPRINT("Failed to get connection information: %d\n", Result);
231  Ret = FALSE;
232  break;
233  }
234  }
235 
236  return Ret;
237 }
#define TRUE
Definition: types.h:120
#define mixerGetLineInfo
Definition: mmsystem.h:2843
UINT MMRESULT
Definition: mmsystem.h:962
BOOL SndMixerQueryControls(PSND_MIXER Mixer, PUINT DisplayControls, LPMIXERLINE LineInfo, LPMIXERCONTROL *Controls)
Definition: mixer.c:112
GLenum GLclampf GLint i
Definition: glfuncs.h:14
smooth NULL
Definition: ftsmooth.c:416
_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
void DPRINT(...)
Definition: polytest.cpp:61
LPMIXERCONTROL Controls
Definition: sndvol32.h:65
DWORD cConnections
Definition: mmsystem.h:1240
unsigned int BOOL
Definition: ntddk_ex.h:94
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HMIXER hmx
Definition: sndvol32.h:84
PSND_MIXER_CONNECTION Connections
Definition: sndvol32.h:76
PDOS_DEVICE_NODE Con
Definition: condrv.c:26
unsigned int UINT
Definition: ndis.h:50
CHAR szName[MIXER_LONG_NAME_CHARS]
Definition: mmsystem.h:1243
struct _SND_MIXER_CONNECTION * Next
Definition: sndvol32.h:63
DWORD dwDestination
Definition: mmsystem.h:1233
DWORD cbStruct
Definition: mmsystem.h:1232
#define MIXER_GETLINEINFOF_SOURCE
Definition: mmsystem.h:345
DWORD dwSource
Definition: mmsystem.h:1234
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
struct _SND_MIXER_CONNECTION SND_MIXER_CONNECTION
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ SndMixerQueryControls()

BOOL SndMixerQueryControls ( PSND_MIXER  Mixer,
PUINT  DisplayControls,
LPMIXERLINE  LineInfo,
LPMIXERCONTROL Controls 
)

Definition at line 112 of file mixer.c.

Referenced by EnumConnectionsCallback(), MixerControlChangeCallback(), SetVolumeCallback(), SndMixerQueryConnections(), and SndMixerQueryDestinations().

116 {
117  if (LineInfo->cControls > 0)
118  {
119  *Controls = (MIXERCONTROL*) HeapAlloc(GetProcessHeap(),
121  LineInfo->cControls * sizeof(MIXERCONTROL));
122  if (*Controls != NULL)
123  {
124  MIXERLINECONTROLS LineControls;
126  UINT j;
127 
128  LineControls.cbStruct = sizeof(LineControls);
129  LineControls.dwLineID = LineInfo->dwLineID;
130  LineControls.cControls = LineInfo->cControls;
131  LineControls.cbmxctrl = sizeof(MIXERCONTROL);
132  LineControls.pamxctrl = (MIXERCONTROL*)(*Controls);
133 
134  Result = mixerGetLineControls((HMIXEROBJ)Mixer->hmx,
135  &LineControls,
137  if (Result == MMSYSERR_NOERROR)
138  {
139  for (j = 0; j < LineControls.cControls; j++)
140  {
141  if (SndMixerIsDisplayControl(Mixer,
142  &(*Controls)[j]))
143  {
144  (*DisplayControls)++;
145  }
146 
147  DPRINT("Line control: %ws (0x%x, 0x%x)\n", (*Controls)[j].szName, (*Controls)[j].fdwControl, (*Controls)[j].dwControlType);
148  }
149 
150  return TRUE;
151  }
152  else
153  {
155  0,
156  *Controls);
157  *Controls = NULL;
158  DPRINT("Failed to get line (ID: 0x%x) controls: %d\n", LineInfo->dwLineID, Result);
159  }
160  }
161  else
162  {
163  DPRINT("Failed to allocate memory for %d line (ID: 0x%x) controls!\n", LineInfo->dwLineID, LineInfo->cControls);
164  }
165 
166  return FALSE;
167  }
168  else
169  {
170  return TRUE;
171  }
172 }
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint j
Definition: glfuncs.h:98
#define TRUE
Definition: types.h:120
#define MIXER_GETLINECONTROLSF_ALL
Definition: mmsystem.h:408
#define mixerGetLineControls
Definition: mmsystem.h:2844
UINT MMRESULT
Definition: mmsystem.h:962
BOOL SndMixerIsDisplayControl(PSND_MIXER Mixer, LPMIXERCONTROL Control)
Definition: mixer.c:598
MIXERCONTROLA MIXERCONTROL
Definition: mmsystem.h:2815
DWORD cControls
Definition: mmsystem.h:1241
LPMIXERCONTROLA pamxctrl
Definition: mmsystem.h:1338
smooth NULL
Definition: ftsmooth.c:416
_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
void DPRINT(...)
Definition: polytest.cpp:61
DWORD dwLineID
Definition: mmsystem.h:1235
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HMIXER hmx
Definition: sndvol32.h:84
unsigned int UINT
Definition: ndis.h:50
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static const WCHAR szName[]
Definition: msipriv.h:1194
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ SndMixerQueryDestinations()

static BOOL SndMixerQueryDestinations ( PSND_MIXER  Mixer)
static

Definition at line 240 of file mixer.c.

Referenced by SndMixerSelect().

241 {
242  UINT i;
243  BOOL Ret = TRUE;
244 
245  for (i = Mixer->Caps.cDestinations; i > 0; i--)
246  {
248 
251  sizeof(SND_MIXER_DESTINATION));
252  if (Line != NULL)
253  {
254  Line->Info.cbStruct = sizeof(Line->Info);
255  Line->Info.dwDestination = i - 1;
256  if (mixerGetLineInfo((HMIXEROBJ)Mixer->hmx,
257  &Line->Info,
259  {
260  DPRINT("+ Destination: %ws (0x%x, %d)\n", Line->Info.szName, Line->Info.dwLineID, Line->Info.dwComponentType);
261 
262  if (!SndMixerQueryControls(Mixer,
263  &Line->DisplayControls,
264  &Line->Info,
265  &Line->Controls))
266  {
267  DPRINT("Failed to query mixer controls!\n");
268  Ret = FALSE;
269  break;
270  }
271 
272  if (!SndMixerQueryConnections(Mixer, Line))
273  {
274  DPRINT("Failed to query mixer connections!\n");
275  Ret = FALSE;
276  break;
277  }
278 
279  Line->Next = Mixer->Lines;
280  Mixer->Lines = Line;
281  }
282  else
283  {
284  DPRINT("Failed to get line information for id %d!\n", i);
286  0,
287  Line);
288  Ret = FALSE;
289  break;
290  }
291  }
292  else
293  {
294  DPRINT("Allocation of SND_MIXER_DEST structure for id %d failed!\n", i);
295  Ret = FALSE;
296  break;
297  }
298  }
299 
300  return Ret;
301 }
#define TRUE
Definition: types.h:120
PSND_MIXER_DESTINATION Lines
Definition: sndvol32.h:86
#define mixerGetLineInfo
Definition: mmsystem.h:2843
BOOL SndMixerQueryControls(PSND_MIXER Mixer, PUINT DisplayControls, LPMIXERLINE LineInfo, LPMIXERCONTROL *Controls)
Definition: mixer.c:112
GLenum GLclampf GLint i
Definition: glfuncs.h:14
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
struct _SND_MIXER_DESTINATION * Next
Definition: sndvol32.h:72
#define MIXER_GETLINEINFOF_DESTINATION
Definition: mmsystem.h:344
MIXERCAPS Caps
Definition: sndvol32.h:85
DWORD dwLineID
Definition: mmsystem.h:1235
unsigned int BOOL
Definition: ntddk_ex.h:94
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HMIXER hmx
Definition: sndvol32.h:84
unsigned int UINT
Definition: ndis.h:50
CHAR szName[MIXER_LONG_NAME_CHARS]
Definition: mmsystem.h:1243
static BOOL SndMixerQueryConnections(PSND_MIXER Mixer, PSND_MIXER_DESTINATION Line)
Definition: mixer.c:175
DWORD dwDestination
Definition: mmsystem.h:1233
DWORD cDestinations
Definition: mmsystem.h:1219
DWORD cbStruct
Definition: mmsystem.h:1232
struct _SND_MIXER_DESTINATION SND_MIXER_DESTINATION
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
DWORD dwComponentType
Definition: mmsystem.h:1238
LPMIXERCONTROL Controls
Definition: sndvol32.h:74
#define HeapFree(x, y, z)
Definition: compat.h:394
struct Line Line

◆ SndMixerSelect()

BOOL SndMixerSelect ( PSND_MIXER  Mixer,
UINT  MixerId 
)

Definition at line 304 of file mixer.c.

Referenced by SndMixerCreate(), and UpdatePrefDlgControls().

306 {
307  if (MixerId >= Mixer->MixersCount)
308  {
309  return FALSE;
310  }
311 
312  SndMixerClose(Mixer);
313 
314  if (mixerOpen(&Mixer->hmx,
315  MixerId,
316  (DWORD_PTR)Mixer->hWndNotification,
317  0,
319  mixerOpen(&Mixer->hmx,
320  MixerId,
321  (DWORD_PTR)Mixer->hWndNotification,
322  0,
324  mixerOpen(&Mixer->hmx,
325  MixerId,
326  0,
327  0,
328  0) == MMSYSERR_NOERROR)
329  {
330  if (mixerGetDevCaps(MixerId,
331  &Mixer->Caps,
332  sizeof(Mixer->Caps)) == MMSYSERR_NOERROR)
333  {
334  BOOL Ret = FALSE;
335 
336  Mixer->MixerId = MixerId;
337 
338  ClearMixerCache(Mixer);
339 
340  Ret = SndMixerQueryDestinations(Mixer);
341 
342  if (!Ret)
343  {
344  ClearMixerCache(Mixer);
345  }
346 
347  return Ret;
348  }
349  else
350  {
351  mixerClose(Mixer->hmx);
352  }
353  }
354 
355  Mixer->hmx = NULL;
356  Mixer->MixerId = NO_MIXER_SELECTED;
357  return FALSE;
358 }
#define CALLBACK_WINDOW
Definition: mmsystem.h:148
UINT WINAPI mixerClose(HMIXER hMix)
Definition: winmm.c:389
static BOOL SndMixerQueryDestinations(PSND_MIXER Mixer)
Definition: mixer.c:240
#define mixerGetDevCaps
Definition: mmsystem.h:2842
static VOID ClearMixerCache(PSND_MIXER Mixer)
Definition: mixer.c:31
HWND hWndNotification
Definition: sndvol32.h:82
#define MIXER_OBJECTF_MIXER
Definition: mmsystem.h:300
#define NO_MIXER_SELECTED
Definition: mixer.c:28
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
MIXERCAPS Caps
Definition: sndvol32.h:85
unsigned int BOOL
Definition: ntddk_ex.h:94
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
HMIXER hmx
Definition: sndvol32.h:84
VOID SndMixerClose(PSND_MIXER Mixer)
Definition: mixer.c:101
UINT MixerId
Definition: sndvol32.h:83
uint32_t DWORD_PTR
Definition: typedefs.h:63
UINT MixersCount
Definition: sndvol32.h:81

◆ SndMixerSetVolumeControlDetails()

INT SndMixerSetVolumeControlDetails ( PSND_MIXER  Mixer,
DWORD  dwControlID,
DWORD  cbDetails,
LPVOID  paDetails 
)

Definition at line 474 of file mixer.c.

Referenced by SetVolumeCallback().

475 {
476  MIXERCONTROLDETAILS MixerDetails;
477 
478  if (Mixer->hmx)
479  {
480  MixerDetails.cbStruct = sizeof(MIXERCONTROLDETAILS);
481  MixerDetails.dwControlID = dwControlID;
482  MixerDetails.cChannels = 1; //FIXME
483  MixerDetails.cMultipleItems = 0;
484  MixerDetails.cbDetails = cbDetails;
485  MixerDetails.paDetails = paDetails;
486 
488  {
489  return 1;
490  }
491  }
492 
493  return -1;
494 }
UINT WINAPI mixerSetControlDetails(HMIXEROBJ hmix, LPMIXERCONTROLDETAILS lpmcd, DWORD fdwDetails)
Definition: winmm.c:684
#define MIXER_GETCONTROLDETAILSF_VALUE
Definition: mmsystem.h:412
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
HMIXER hmx
Definition: sndvol32.h:84
#define MIXER_OBJECTF_HMIXER
Definition: mmsystem.h:301
struct tMIXERCONTROLDETAILS MIXERCONTROLDETAILS