ReactOS  0.4.15-dev-3294-ge98684e
speakervolume.c File Reference
#include "mmsys.h"
Include dependency graph for speakervolume.c:

Go to the source code of this file.

Classes

struct  _PAGE_DATA
 

Typedefs

typedef struct _PAGE_DATA PAGE_DATA
 
typedef struct _PAGE_DATAPPAGE_DATA
 

Functions

static BOOL OnInitDialog (PPAGE_DATA pPageData, HWND hwndDlg)
 
static VOID OnMixerControlChange (PPAGE_DATA pPageData, HWND hwndDlg)
 
static VOID OnHScroll (PPAGE_DATA pPageData, HWND hwndDlg, WPARAM wParam, LPARAM lParam)
 
static VOID OnSetDefaults (PPAGE_DATA pPageData, HWND hwndDlg)
 
INT_PTR CALLBACK SpeakerVolumeDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR SpeakerVolume (HWND hwndDlg)
 

Typedef Documentation

◆ PAGE_DATA

◆ PPAGE_DATA

Function Documentation

◆ OnHScroll()

static VOID OnHScroll ( PPAGE_DATA  pPageData,
HWND  hwndDlg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 147 of file speakervolume.c.

152 {
153  MIXERCONTROLDETAILS mxcd;
154  DWORD dwValue, dwPosition;
155  INT id, idx, i, j;
156 
158  if (id < 9475 || id > 9503)
159  return;
160 
161  if ((id - 9475) % 4 != 0)
162  return;
163 
164  dwPosition = (DWORD)SendDlgItemMessage(hwndDlg, id, TBM_GETPOS, 0, 0);
165 
166  if (dwPosition == VOLUME_MIN)
167  dwValue = pPageData->volumeMinimum;
168  else if (dwPosition == VOLUME_MAX)
169  dwValue = pPageData->volumeMaximum;
170  else
171  dwValue = (dwPosition * pPageData->volumeStep) + pPageData->volumeMinimum;
172 
173  if (pPageData->volumeSync)
174  {
175  for (i = 0; i < pPageData->volumeChannels; i++)
176  {
177  j = 9475 + (i * 4);
178  if (j != id)
179  SendDlgItemMessage(hwndDlg, j, TBM_SETPOS, (WPARAM)TRUE, dwPosition);
180 
181  pPageData->volumeValues[i].dwValue = dwValue;
182  }
183  }
184  else
185  {
186  idx = (id - 9475) / 4;
187  pPageData->volumeValues[idx].dwValue = dwValue;
188  }
189 
190  mxcd.cbStruct = sizeof(MIXERCONTROLDETAILS);
191  mxcd.dwControlID = pPageData->volumeControlID;
192  mxcd.cChannels = pPageData->volumeChannels;
193  mxcd.cMultipleItems = 0;
195  mxcd.paDetails = pPageData->volumeValues;
196 
198  return;
199 }
UINT WINAPI mixerSetControlDetails(HMIXEROBJ hmix, LPMIXERCONTROLDETAILS lpmcd, DWORD fdwDetails)
Definition: winmm.c:684
struct tMIXERCONTROLDETAILS_UNSIGNED MIXERCONTROLDETAILS_UNSIGNED
#define TRUE
Definition: types.h:120
#define INT
Definition: polytest.cpp:20
DWORD volumeMaximum
Definition: speakervolume.c:16
#define TBM_SETPOS
Definition: commctrl.h:2036
#define VOLUME_MAX
Definition: sndvol32.h:19
UINT_PTR WPARAM
Definition: windef.h:207
#define SendDlgItemMessage
Definition: winuser.h:5818
if(dx==0 &&dy==0)
Definition: linetemp.h:174
#define DWORD
Definition: nt_native.h:44
int32_t INT
Definition: typedefs.h:58
HMIXER hMixer
Definition: speakervolume.c:12
DWORD volumeStep
Definition: speakervolume.c:17
#define MIXER_SETCONTROLDETAILSF_VALUE
Definition: mmsystem.h:415
#define TBM_GETPOS
Definition: commctrl.h:2031
unsigned int idx
Definition: utils.c:41
GLsizei GLenum const GLvoid GLsizei GLenum 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 const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
BOOL volumeSync
Definition: speakervolume.c:19
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MIXER_OBJECTF_HMIXER
Definition: mmsystem.h:301
PMIXERCONTROLDETAILS_UNSIGNED volumeValues
Definition: speakervolume.c:18
GLsizei GLenum const GLvoid GLsizei GLenum 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 const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
DWORD volumeMinimum
Definition: speakervolume.c:15
#define VOLUME_MIN
Definition: sndvol32.h:18
struct tMIXERCONTROLDETAILS MIXERCONTROLDETAILS
DWORD volumeChannels
Definition: speakervolume.c:14
GLenum GLuint id
Definition: glext.h:5579
DWORD volumeControlID
Definition: speakervolume.c:13
#define GetWindowLongPtr
Definition: treelist.c:73
LPARAM lParam
Definition: combotst.c:139
#define GWLP_ID
Definition: winuser.h:854

Referenced by SpeakerVolumeDlgProc().

◆ OnInitDialog()

static BOOL OnInitDialog ( PPAGE_DATA  pPageData,
HWND  hwndDlg 
)
static

Definition at line 25 of file speakervolume.c.

28 {
29  TCHAR szBuffer[256];
30  MIXERLINE mxln;
31  MIXERCONTROL mxc;
32  MIXERLINECONTROLS mxlctrl;
34  INT i, j;
35 
36  /* Open the mixer */
37  if (mixerOpen(&pPageData->hMixer, 0, PtrToUlong(hwndDlg), 0, MIXER_OBJECTF_MIXER | CALLBACK_WINDOW) != MMSYSERR_NOERROR)
38  {
39  MessageBox(hwndDlg, _T("Cannot open mixer"), NULL, MB_OK);
40  return FALSE;
41  }
42 
43  /* Retrieve the mixer information */
44  mxln.cbStruct = sizeof(MIXERLINE);
46 
48  return FALSE;
49 
50  pPageData->volumeChannels = mxln.cChannels;
51 
52  /* Retrieve the line information */
53  mxlctrl.cbStruct = sizeof(MIXERLINECONTROLS);
54  mxlctrl.dwLineID = mxln.dwLineID;
56  mxlctrl.cControls = 1;
57  mxlctrl.cbmxctrl = sizeof(MIXERCONTROL);
58  mxlctrl.pamxctrl = &mxc;
59 
61  return FALSE;
62 
63  pPageData->volumeControlID = mxc.dwControlID;
64  pPageData->volumeMinimum = mxc.Bounds.dwMinimum;
65  pPageData->volumeMaximum = mxc.Bounds.dwMaximum;
66  pPageData->volumeStep = (pPageData->volumeMaximum - pPageData->volumeMinimum) / (VOLUME_MAX - VOLUME_MIN);
67 
68  /* Allocate a buffer for all channel volume values */
69  pPageData->volumeValues = HeapAlloc(GetProcessHeap(),
70  0,
72  if (pPageData->volumeValues == NULL)
73  return FALSE;
74 
75  /* Retrieve the channel volume values */
76  mxcd.cbStruct = sizeof(MIXERCONTROLDETAILS);
77  mxcd.dwControlID = mxc.dwControlID;
78  mxcd.cChannels = mxln.cChannels;
79  mxcd.cMultipleItems = 0;
81  mxcd.paDetails = pPageData->volumeValues;
82 
84  return FALSE;
85 
86  /* Initialize the channels */
87  for (i = 0; i < min(mxln.cChannels, 5); i++)
88  {
89  j = i * 4;
90 
91  /* Set the channel name */
92  LoadString(hApplet, IDS_SPEAKER_LEFT + i, szBuffer, _countof(szBuffer));
93  SetWindowText(GetDlgItem(hwndDlg, 9472 + j), szBuffer);
94 
95  /* Initialize the channel trackbar */
97  SendDlgItemMessage(hwndDlg, 9475 + j, TBM_SETTICFREQ, VOLUME_TICFREQ, 0);
99  SendDlgItemMessage(hwndDlg, 9475 + j, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)(pPageData->volumeValues[i].dwValue - pPageData->volumeMinimum) / pPageData->volumeStep);
100  }
101 
102  /* Hide the unused controls */
103  for (i = mxln.cChannels; i < 8; i++)
104  {
105  j = i * 4;
106  ShowWindow(GetDlgItem(hwndDlg, 9472 + j), SW_HIDE);
107  ShowWindow(GetDlgItem(hwndDlg, 9473 + j), SW_HIDE);
108  ShowWindow(GetDlgItem(hwndDlg, 9474 + j), SW_HIDE);
109  ShowWindow(GetDlgItem(hwndDlg, 9475 + j), SW_HIDE);
110  }
111 
112  return TRUE;
113 }
#define MIXER_GETCONTROLDETAILSF_VALUE
Definition: mmsystem.h:412
#define CALLBACK_WINDOW
Definition: mmsystem.h:148
struct tMIXERCONTROLDETAILS_UNSIGNED MIXERCONTROLDETAILS_UNSIGNED
#define TRUE
Definition: types.h:120
#define SW_HIDE
Definition: winuser.h:762
#define mixerGetLineInfo
Definition: mmsystem.h:2853
#define TBM_SETRANGE
Definition: commctrl.h:2037
#define mixerGetLineControls
Definition: mmsystem.h:2854
DWORD volumeMaximum
Definition: speakervolume.c:16
#define TBM_SETPOS
Definition: commctrl.h:2036
#define VOLUME_MAX
Definition: sndvol32.h:19
HINSTANCE hApplet
Definition: access.c:17
#define MIXER_GETLINEINFOF_COMPONENTTYPE
Definition: mmsystem.h:347
UINT_PTR WPARAM
Definition: windef.h:207
#define SendDlgItemMessage
Definition: winuser.h:5818
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
MIXERLINEA MIXERLINE
Definition: mmsystem.h:2824
int32_t INT
Definition: typedefs.h:58
MIXERCONTROLA MIXERCONTROL
Definition: mmsystem.h:2825
HMIXER hMixer
Definition: speakervolume.c:12
#define MIXER_OBJECTF_MIXER
Definition: mmsystem.h:300
DWORD volumeStep
Definition: speakervolume.c:17
#define FALSE
Definition: types.h:117
LPMIXERCONTROLA pamxctrl
Definition: mmsystem.h:1338
MIXERLINECONTROLSA MIXERLINECONTROLS
Definition: mmsystem.h:2826
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define TBM_SETPAGESIZE
Definition: commctrl.h:2051
LONG_PTR LPARAM
Definition: windef.h:208
UINT WINAPI mixerOpen(LPHMIXER lphMix, UINT uDeviceID, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen)
Definition: winmm.c:342
#define TBM_SETTICFREQ
Definition: commctrl.h:2050
#define VOLUME_PAGESIZE
Definition: mmsys.h:43
#define PtrToUlong(u)
Definition: config.h:107
GLsizei GLenum const GLvoid GLsizei GLenum 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 const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
char TCHAR
Definition: xmlstorage.h:189
DWORD dwLineID
Definition: mmsystem.h:1235
#define _T(x)
Definition: vfdio.h:22
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define VOLUME_TICFREQ
Definition: mmsys.h:42
#define _countof(array)
Definition: sndvol32.h:68
union tagMIXERCONTROLA::@2969 Bounds
#define MIXER_OBJECTF_HMIXER
Definition: mmsystem.h:301
DWORD cChannels
Definition: mmsystem.h:1239
#define MessageBox
Definition: winuser.h:5798
PMIXERCONTROLDETAILS_UNSIGNED volumeValues
Definition: speakervolume.c:18
#define MIXERCONTROL_CONTROLTYPE_VOLUME
Definition: mmsystem.h:398
GLsizei GLenum const GLvoid GLsizei GLenum 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 const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
DWORD volumeMinimum
Definition: speakervolume.c:15
#define MIXERLINE_COMPONENTTYPE_DST_SPEAKERS
Definition: mmsystem.h:319
DWORD cbStruct
Definition: mmsystem.h:1232
#define VOLUME_MIN
Definition: sndvol32.h:18
struct tMIXERCONTROLDETAILS MIXERCONTROLDETAILS
#define SetWindowText
Definition: winuser.h:5833
#define min(a, b)
Definition: monoChain.cc:55
#define mixerGetControlDetails
Definition: mmsystem.h:2855
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
#define MIXER_GETLINECONTROLSF_ONEBYTYPE
Definition: mmsystem.h:410
DWORD dwComponentType
Definition: mmsystem.h:1238
DWORD volumeChannels
Definition: speakervolume.c:14
DWORD volumeControlID
Definition: speakervolume.c:13
#define IDS_SPEAKER_LEFT
Definition: resource.h:74
#define LoadString
Definition: winuser.h:5795

Referenced by SpeakerVolumeDlgProc().

◆ OnMixerControlChange()

static VOID OnMixerControlChange ( PPAGE_DATA  pPageData,
HWND  hwndDlg 
)
static

Definition at line 118 of file speakervolume.c.

121 {
122  MIXERCONTROLDETAILS mxcd;
123  INT i, j;
124 
125  /* Retrieve the channel volume values */
126  mxcd.cbStruct = sizeof(MIXERCONTROLDETAILS);
127  mxcd.dwControlID = pPageData->volumeControlID;
128  mxcd.cChannels = pPageData->volumeChannels;
129  mxcd.cMultipleItems = 0;
131  mxcd.paDetails = pPageData->volumeValues;
132 
134  return;
135 
136  for (i = 0; i < pPageData->volumeChannels; i++)
137  {
138  j = i * 4;
139 
140  SendDlgItemMessage(hwndDlg, 9475 + j, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)(pPageData->volumeValues[i].dwValue - pPageData->volumeMinimum) / pPageData->volumeStep);
141  }
142 }
#define MIXER_GETCONTROLDETAILSF_VALUE
Definition: mmsystem.h:412
struct tMIXERCONTROLDETAILS_UNSIGNED MIXERCONTROLDETAILS_UNSIGNED
#define TRUE
Definition: types.h:120
#define TBM_SETPOS
Definition: commctrl.h:2036
UINT_PTR WPARAM
Definition: windef.h:207
#define SendDlgItemMessage
Definition: winuser.h:5818
int32_t INT
Definition: typedefs.h:58
HMIXER hMixer
Definition: speakervolume.c:12
DWORD volumeStep
Definition: speakervolume.c:17
LONG_PTR LPARAM
Definition: windef.h:208
GLsizei GLenum const GLvoid GLsizei GLenum 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 const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define MIXER_OBJECTF_HMIXER
Definition: mmsystem.h:301
PMIXERCONTROLDETAILS_UNSIGNED volumeValues
Definition: speakervolume.c:18
GLsizei GLenum const GLvoid GLsizei GLenum 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 const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
DWORD volumeMinimum
Definition: speakervolume.c:15
struct tMIXERCONTROLDETAILS MIXERCONTROLDETAILS
#define mixerGetControlDetails
Definition: mmsystem.h:2855
DWORD volumeChannels
Definition: speakervolume.c:14
DWORD volumeControlID
Definition: speakervolume.c:13

Referenced by SpeakerVolumeDlgProc().

◆ OnSetDefaults()

static VOID OnSetDefaults ( PPAGE_DATA  pPageData,
HWND  hwndDlg 
)
static

Definition at line 204 of file speakervolume.c.

207 {
208  MIXERCONTROLDETAILS mxcd;
209  DWORD dwValue, i;
210 
211  dwValue = ((VOLUME_MAX - VOLUME_MIN) / 2 * pPageData->volumeStep) + pPageData->volumeMinimum;
212 
213  for (i = 0; i < pPageData->volumeChannels; i++)
214  pPageData->volumeValues[i].dwValue = dwValue;
215 
216  mxcd.cbStruct = sizeof(MIXERCONTROLDETAILS);
217  mxcd.dwControlID = pPageData->volumeControlID;
218  mxcd.cChannels = pPageData->volumeChannels;
219  mxcd.cMultipleItems = 0;
221  mxcd.paDetails = pPageData->volumeValues;
222 
224  return;
225 }
UINT WINAPI mixerSetControlDetails(HMIXEROBJ hmix, LPMIXERCONTROLDETAILS lpmcd, DWORD fdwDetails)
Definition: winmm.c:684
struct tMIXERCONTROLDETAILS_UNSIGNED MIXERCONTROLDETAILS_UNSIGNED
#define VOLUME_MAX
Definition: sndvol32.h:19
HMIXER hMixer
Definition: speakervolume.c:12
DWORD volumeStep
Definition: speakervolume.c:17
#define MIXER_SETCONTROLDETAILSF_VALUE
Definition: mmsystem.h:415
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MIXER_OBJECTF_HMIXER
Definition: mmsystem.h:301
PMIXERCONTROLDETAILS_UNSIGNED volumeValues
Definition: speakervolume.c:18
GLsizei GLenum const GLvoid GLsizei GLenum 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 const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
DWORD volumeMinimum
Definition: speakervolume.c:15
#define VOLUME_MIN
Definition: sndvol32.h:18
DWORD volumeChannels
Definition: speakervolume.c:14
DWORD volumeControlID
Definition: speakervolume.c:13

Referenced by SpeakerVolumeDlgProc().

◆ SpeakerVolume()

INT_PTR SpeakerVolume ( HWND  hwndDlg)

Definition at line 306 of file speakervolume.c.

308 {
309  PROPSHEETPAGE psp[1];
310  PROPSHEETHEADER psh;
311  TCHAR Caption[256];
312 
313  LoadString(hApplet, IDS_SPEAKER_VOLUME, Caption, _countof(Caption));
314 
315  ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
316  psh.dwSize = sizeof(PROPSHEETHEADER);
317  psh.dwFlags = PSH_PROPSHEETPAGE;
318  psh.hwndParent = hwndDlg;
319  psh.hInstance = hApplet;
320  psh.pszCaption = Caption;
321  psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
322  psh.nStartPage = 0;
323  psh.ppsp = psp;
324 
326  psp[0].dwFlags |= PSP_USETITLE;
327  psp[0].pszTitle = Caption;
328 
329  return (LONG)(PropertySheet(&psh) != -1);
330 }
#define IDS_SPEAKER_VOLUME
Definition: resource.h:73
#define IDD_MULTICHANNEL
Definition: resource.h:29
#define ZeroMemory
Definition: winbase.h:1664
HINSTANCE hApplet
Definition: access.c:17
long LONG
Definition: pedump.c:60
#define PROPSHEETHEADER
Definition: prsht.h:392
char TCHAR
Definition: xmlstorage.h:189
#define _countof(array)
Definition: sndvol32.h:68
static VOID InitPropSheetPage(PROPSHEETPAGE *psp, PSERVICEPROPSHEET dlgInfo, WORD idDlg, DLGPROC DlgProc)
Definition: propsheet.c:15
#define PSP_USETITLE
Definition: prsht.h:26
INT_PTR CALLBACK SpeakerVolumeDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define PSH_PROPSHEETPAGE
Definition: prsht.h:43
#define PropertySheet
Definition: prsht.h:400
#define LoadString
Definition: winuser.h:5795
#define PROPSHEETPAGE
Definition: prsht.h:389

Referenced by VolumeDlgProc().

◆ SpeakerVolumeDlgProc()

INT_PTR CALLBACK SpeakerVolumeDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 230 of file speakervolume.c.

235 {
236  PPAGE_DATA pPageData;
237 
239 
240  pPageData = (PPAGE_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
241 
242  switch(uMsg)
243  {
244  case WM_INITDIALOG:
246  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pPageData);
247 
248  if (pPageData)
249  {
250  OnInitDialog(pPageData, hwndDlg);
251  }
252  break;
253 
254  case WM_DESTROY:
255  if (pPageData)
256  {
257  if (pPageData->volumeValues)
258  HeapFree(GetProcessHeap(), 0, pPageData->volumeValues);
259 
260  if (pPageData->hMixer)
261  mixerClose(pPageData->hMixer);
262 
263  HeapFree(GetProcessHeap(), 0, pPageData);
264  pPageData = NULL;
266  }
267  break;
268 
269  case WM_HSCROLL:
270  if (pPageData)
271  {
272  OnHScroll(pPageData, hwndDlg, wParam, lParam);
273  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
274  }
275  break;
276 
277  case WM_COMMAND:
278  switch (LOWORD(wParam))
279  {
280  case 9504:
281  if (HIWORD(wParam) == BN_CLICKED)
282  pPageData->volumeSync = (SendDlgItemMessage(hwndDlg, 9504, BM_GETCHECK, 0, 0) == BST_CHECKED);
283  break;
284 
285  case 9505:
286  OnSetDefaults(pPageData, hwndDlg);
287  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
288  break;
289  }
290  break;
291 
292  case WM_NOTIFY:
293  return TRUE;
294 
296  if (pPageData)
297  OnMixerControlChange(pPageData, hwndDlg);
298  break;
299  }
300 
301  return FALSE;
302 }
static VOID OnHScroll(PPAGE_DATA pPageData, HWND hwndDlg, WPARAM wParam, LPARAM lParam)
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
UINT WINAPI mixerClose(HMIXER hMix)
Definition: winmm.c:389
#define SendDlgItemMessage
Definition: winuser.h:5818
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
HMIXER hMixer
Definition: speakervolume.c:12
#define FALSE
Definition: types.h:117
static VOID OnSetDefaults(PPAGE_DATA pPageData, HWND hwndDlg)
struct _PAGE_DATA * PPAGE_DATA
static VOID OnMixerControlChange(PPAGE_DATA pPageData, HWND hwndDlg)
#define BM_GETCHECK
Definition: winuser.h:1901
#define WM_DESTROY
Definition: winuser.h:1592
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL volumeSync
Definition: speakervolume.c:19
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define BN_CLICKED
Definition: winuser.h:1908
static BOOL OnInitDialog(PPAGE_DATA pPageData, HWND hwndDlg)
Definition: speakervolume.c:25
#define DWLP_USER
Definition: winuser.h:866
PMIXERCONTROLDETAILS_UNSIGNED volumeValues
Definition: speakervolume.c:18
#define WM_COMMAND
Definition: winuser.h:1723
struct _PAGE_DATA PAGE_DATA
HWND WINAPI GetParent(_In_ HWND)
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
#define WM_HSCROLL
Definition: winuser.h:1726
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define BST_CHECKED
Definition: winuser.h:197
#define HIWORD(l)
Definition: typedefs.h:247
#define GetWindowLongPtr
Definition: treelist.c:73
#define WM_INITDIALOG
Definition: winuser.h:1722
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:594
#define WM_NOTIFY
Definition: richedit.h:61
#define MM_MIXM_CONTROL_CHANGE
Definition: mmsystem.h:83

Referenced by SpeakerVolume().