ReactOS 0.4.15-dev-7788-g1ad9096
advanced.c File Reference
#include "sndvol32.h"
Include dependency graph for advanced.c:

Go to the source code of this file.

Classes

struct  _ADVANCED_DATA
 

Typedefs

typedef struct _ADVANCED_DATA ADVANCED_DATA
 
typedef struct _ADVANCED_DATAPADVANCED_DATA
 

Functions

static VOID OnInitDialog (HWND hwndDlg, PADVANCED_DATA pData)
 
static VOID OnHScroll (HWND hwndDlg, PADVANCED_DATA pData, DWORD dwCtrlID)
 
INT_PTR CALLBACK AdvancedDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Typedef Documentation

◆ ADVANCED_DATA

◆ PADVANCED_DATA

Function Documentation

◆ AdvancedDlgProc()

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

Definition at line 225 of file advanced.c.

230{
232
234
235 switch (uMsg)
236 {
237 case WM_INITDIALOG:
239 if (pData != NULL)
240 {
242 pData->Context = (PADVANCED_CONTEXT)((LONG_PTR)lParam);
243 OnInitDialog(hwndDlg, pData);
244 }
245 return TRUE;
246
247 case WM_COMMAND:
248 switch (LOWORD(wParam))
249 {
250 case IDOK:
251 EndDialog(hwndDlg, IDOK);
252 break;
253 }
254 break;
255
256 case WM_HSCROLL:
257 if (pData != NULL)
258 {
261 }
262 break;
263
264 case WM_CLOSE:
265 EndDialog(hwndDlg, IDCANCEL);
266 break;
267
268 case WM_DESTROY:
269 if (pData != NULL)
270 {
273 }
274 break;
275 }
276
277 return FALSE;
278}
struct _ADVANCED_DATA * PADVANCED_DATA
static VOID OnHScroll(HWND hwndDlg, PADVANCED_DATA pData, DWORD dwCtrlID)
Definition: advanced.c:182
static VOID OnInitDialog(HWND hwndDlg, PADVANCED_DATA pData)
Definition: advanced.c:25
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define LOWORD(l)
Definition: pedump.c:82
#define TB_THUMBTRACK
Definition: commctrl.h:2078
struct _ADVANCED_CONTEXT * PADVANCED_CONTEXT
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
#define WM_CLOSE
Definition: winuser.h:1621
#define DWLP_USER
Definition: winuser.h:872
#define WM_HSCROLL
Definition: winuser.h:1743
#define IDCANCEL
Definition: winuser.h:831
#define WM_COMMAND
Definition: winuser.h:1740
#define WM_INITDIALOG
Definition: winuser.h:1739
#define IDOK
Definition: winuser.h:830
int WINAPI GetDlgCtrlID(_In_ HWND)
#define WM_DESTROY
Definition: winuser.h:1609
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

◆ OnHScroll()

static VOID OnHScroll ( HWND  hwndDlg,
PADVANCED_DATA  pData,
DWORD  dwCtrlID 
)
static

Definition at line 182 of file advanced.c.

186{
188 DWORD dwControlID = 0, dwStep, dwPosition;
190
191 if (dwCtrlID != IDC_ADV_BASS_SLIDER &&
192 dwCtrlID != IDC_ADV_TREBLE_SLIDER)
193 return;
194
195 if (dwCtrlID == IDC_ADV_BASS_SLIDER)
196 {
197 if (pData->bEnabled[0] == FALSE)
198 return;
199
200 dwControlID = pData->dwControlId[0];
201 dwMaximum = pData->dwMaximum[0];
202 dwMinimum = pData->dwMinimum[0];
203 }
204 else if (dwCtrlID == IDC_ADV_TREBLE_SLIDER)
205 {
206 if (pData->bEnabled[1] == FALSE)
207 return;
208
209 dwControlID = pData->dwControlId[1];
210 dwMaximum = pData->dwMaximum[1];
211 dwMinimum = pData->dwMinimum[1];
212 }
213
214 dwPosition = (DWORD)SendDlgItemMessage(hwndDlg, dwCtrlID, TBM_GETPOS, 0, 0);
215 dwStep = (dwMaximum - dwMinimum) / (VOLUME_MAX - VOLUME_MIN);
216
217 Details.dwValue = (dwPosition * dwStep) + dwMinimum;
218
219 SndMixerSetVolumeControlDetails(pData->Context->Mixer, dwControlID, 1, sizeof(MIXERCONTROLDETAILS_UNSIGNED), &Details);
220}
INT SndMixerSetVolumeControlDetails(PSND_MIXER Mixer, DWORD dwControlID, DWORD cChannels, DWORD cbDetails, LPVOID paDetails)
Definition: mixer.c:474
#define IDC_ADV_BASS_SLIDER
Definition: resources.h:32
#define IDC_ADV_TREBLE_SLIDER
Definition: resources.h:35
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD dwMaximum
Definition: mmsystem.h:1
DWORD dwMinimum
Definition: mmsystem.h:0
#define DWORD
Definition: nt_native.h:44
#define TBM_GETPOS
Definition: commctrl.h:2031
#define VOLUME_MAX
Definition: sndvol32.h:19
#define VOLUME_MIN
Definition: sndvol32.h:18
#define SendDlgItemMessage
Definition: winuser.h:5842

Referenced by AdvancedDlgProc().

◆ OnInitDialog()

static VOID OnInitDialog ( HWND  hwndDlg,
PADVANCED_DATA  pData 
)
static

Definition at line 25 of file advanced.c.

28{
29 MIXERCONTROLDETAILS_UNSIGNED UnsignedDetails;
30 MIXERCONTROLDETAILS_BOOLEAN BooleanDetails;
31 WCHAR szRawBuffer[256], szCookedBuffer[256];
33 UINT ControlCount = 0, Index;
34 DWORD i, dwStep, dwPosition;
35 DWORD dwOtherControls = 0;
36 RECT rect;
37 LONG dy;
38
39 /* Set the dialog title */
40 LoadStringW(hAppInstance, IDS_ADVANCED_CONTROLS, szRawBuffer, ARRAYSIZE(szRawBuffer));
41 StringCchPrintfW(szCookedBuffer, ARRAYSIZE(szCookedBuffer), szRawBuffer, pData->Context->LineName);
42 SetWindowTextW(hwndDlg, szCookedBuffer);
43
44 /* Disable the tone controls */
46 EnableWindow(GetDlgItem(hwndDlg, i), FALSE);
47
48 /* Initialize the bass and treble trackbars */
55
56 /* Calculate and set ticks */
57 dwStep = (VOLUME_MAX / (VOLUME_TICKS + 1));
58 if (VOLUME_MAX % (VOLUME_TICKS + 1) != 0)
59 dwStep++;
60 for (i = dwStep; i < VOLUME_MAX; i += dwStep)
61 {
64 }
65
66 /* Hide the other controls */
68 ShowWindow(GetDlgItem(hwndDlg, i), SW_HIDE);
69
70 if (SndMixerQueryControls(pData->Context->Mixer, &ControlCount, pData->Context->Line, &Control))
71 {
72 for (Index = 0; Index < ControlCount; Index++)
73 {
74 if (Control[Index].dwControlType == MIXERCONTROL_CONTROLTYPE_BASS)
75 {
76 /* Bass control */
77
78 if (SndMixerGetVolumeControlDetails(pData->Context->Mixer, Control[Index].dwControlID, 1, sizeof(MIXERCONTROLDETAILS_UNSIGNED), (LPVOID)&UnsignedDetails) != -1)
79 {
81 EnableWindow(GetDlgItem(hwndDlg, i), TRUE);
82
83 dwStep = (Control[Index].Bounds.dwMaximum - Control[Index].Bounds.dwMinimum) / (VOLUME_MAX - VOLUME_MIN);
84 dwPosition = (UnsignedDetails.dwValue - Control[Index].Bounds.dwMinimum) / dwStep;
86
87 pData->bEnabled[0] = TRUE;
88 pData->dwControlId[0] = Control[Index].dwControlID;
89 pData->dwMaximum[0] = Control[Index].Bounds.dwMaximum;
90 pData->dwMinimum[0] = Control[Index].Bounds.dwMinimum;
91 }
92 }
93 else if (Control[Index].dwControlType == MIXERCONTROL_CONTROLTYPE_TREBLE)
94 {
95 /* Treble control */
96
97 if (SndMixerGetVolumeControlDetails(pData->Context->Mixer, Control[Index].dwControlID, 1, sizeof(MIXERCONTROLDETAILS_UNSIGNED), (LPVOID)&UnsignedDetails) != -1)
98 {
100 EnableWindow(GetDlgItem(hwndDlg, i), TRUE);
101
102 dwStep = (Control[Index].Bounds.dwMaximum - Control[Index].Bounds.dwMinimum) / (VOLUME_MAX - VOLUME_MIN);
103 dwPosition = (UnsignedDetails.dwValue - Control[Index].Bounds.dwMinimum) / dwStep;
105
106 pData->bEnabled[1] = TRUE;
107 pData->dwControlId[1] = Control[Index].dwControlID;
108 pData->dwMaximum[1] = Control[Index].Bounds.dwMaximum;
109 pData->dwMinimum[1] = Control[Index].Bounds.dwMinimum;
110 }
111 }
113 (Control[Index].dwControlType != MIXERCONTROL_CONTROLTYPE_MUTE))
114 {
115 /* All boolean controls but the Mute control (Maximum of 2) */
116
117 if (dwOtherControls < 2)
118 {
119 if (SndMixerGetVolumeControlDetails(pData->Context->Mixer, Control[Index].dwControlID, 1, sizeof(MIXERCONTROLDETAILS_BOOLEAN), (LPVOID)&BooleanDetails) != -1)
120 {
121 LoadStringW(hAppInstance, IDS_OTHER_CONTROLS1 + dwOtherControls, szRawBuffer, ARRAYSIZE(szRawBuffer));
122 StringCchPrintfW(szCookedBuffer, ARRAYSIZE(szCookedBuffer), szRawBuffer, Control[Index].szName);
123 SetWindowTextW(GetDlgItem(hwndDlg, IDC_ADV_OTHER_CHECK1 + dwOtherControls), szCookedBuffer);
124
125 ShowWindow(GetDlgItem(hwndDlg, IDC_ADV_OTHER_CHECK1 + dwOtherControls), SW_SHOWNORMAL);
126
127 SendDlgItemMessageW(hwndDlg, IDC_ADV_OTHER_CHECK1 + dwOtherControls, BM_SETCHECK, (WPARAM)BooleanDetails.fValue, 0);
128
129 pData->bEnabled[dwOtherControls + 2] = TRUE;
130 pData->dwControlId[dwOtherControls + 2] = Control[Index].dwControlID;
131
132 dwOtherControls++;
133 }
134 }
135 }
136 }
137
138 /* Free controls */
140 }
141
142 if (dwOtherControls != 0)
143 {
144 /* Show the 'Other controls' groupbox and text */
147
148 /* Resize the dialog */
149 GetWindowRect(hwndDlg, &rect);
150
151 dy = MulDiv((dwOtherControls == 1) ? 73 : (73 + 15), pData->Context->MixerWindow->baseUnit.cy, 8);
152 rect.bottom += dy;
153
154 SetWindowPos(hwndDlg, HWND_TOP, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER);
155
156 /* Move the 'Close' button down */
157 GetWindowRect(GetDlgItem(hwndDlg, IDOK), &rect);
159
160 rect.top += dy;
161 rect.bottom += dy;
162
163 SetWindowPos(GetDlgItem(hwndDlg, IDOK), HWND_TOP, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOSIZE | SWP_NOZORDER);
164
165 if (dwOtherControls == 2)
166 {
167 /* Resize the 'Other Controls' groupbox */
170
171 dy = MulDiv(15, pData->Context->MixerWindow->baseUnit.cy, 8);
172 rect.bottom += dy;
173
174 SetWindowPos(GetDlgItem(hwndDlg, IDC_ADV_OTHER_CONTROLS), HWND_TOP, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER);
175 }
176 }
177}
HINSTANCE hAppInstance
Definition: mmc.c:23
BOOL SndMixerQueryControls(PSND_MIXER Mixer, PUINT DisplayControls, LPMIXERLINE LineInfo, LPMIXERCONTROL *Controls)
Definition: mixer.c:112
INT SndMixerGetVolumeControlDetails(PSND_MIXER Mixer, DWORD dwControlID, DWORD cChannels, DWORD cbDetails, LPVOID paDetails)
Definition: mixer.c:498
#define IDC_ADV_OTHER_CONTROLS
Definition: resources.h:36
#define IDC_ADV_OTHER_TEXT
Definition: resources.h:37
#define IDS_ADVANCED_CONTROLS
Definition: resources.h:44
#define IDC_ADV_TREBLE_LOW
Definition: resources.h:33
#define IDS_OTHER_CONTROLS1
Definition: resources.h:45
#define IDC_ADV_OTHER_CHECK1
Definition: resources.h:38
#define IDC_ADV_BASS_LOW
Definition: resources.h:30
#define IDC_ADV_OTHER_CHECK2
Definition: resources.h:39
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
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
GLint dy
Definition: linetemp.h:97
#define MIXERCONTROL_CONTROLTYPE_BOOLEAN
Definition: mmsystem.h:382
#define MIXERCONTROL_CT_UNITS_MASK
Definition: mmsystem.h:370
#define MIXERCONTROL_CT_CLASS_MASK
Definition: mmsystem.h:353
#define MIXERCONTROL_CONTROLTYPE_TREBLE
Definition: mmsystem.h:400
#define MIXERCONTROL_CT_SUBCLASS_MASK
Definition: mmsystem.h:362
#define MIXERCONTROL_CONTROLTYPE_MUTE
Definition: mmsystem.h:384
#define MIXERCONTROL_CONTROLTYPE_BASS
Definition: mmsystem.h:399
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
unsigned int UINT
Definition: ndis.h:50
long LONG
Definition: pedump.c:60
static const WCHAR szName[]
Definition: powrprof.c:45
#define TBM_SETPAGESIZE
Definition: commctrl.h:2051
#define TBM_SETTIC
Definition: commctrl.h:2035
#define TBM_SETRANGE
Definition: commctrl.h:2037
#define TBM_SETPOS
Definition: commctrl.h:2036
#define VOLUME_PAGE_SIZE
Definition: sndvol32.h:21
#define VOLUME_TICKS
Definition: sndvol32.h:20
& rect
Definition: startmenu.cpp:1413
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
#define MAKELONG(a, b)
Definition: typedefs.h:249
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ WDF_WMI_PROVIDER_CONTROL Control
Definition: wdfwmi.h:166
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define SW_SHOWNORMAL
Definition: winuser.h:770
#define SW_HIDE
Definition: winuser.h:768
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOMOVE
Definition: winuser.h:1244
#define SWP_NOSIZE
Definition: winuser.h:1245
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define BM_SETCHECK
Definition: winuser.h:1921
#define HWND_DESKTOP
Definition: winuser.h:1209
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define HWND_TOP
Definition: winuser.h:1207
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define SWP_NOZORDER
Definition: winuser.h:1247
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by AdvancedDlgProc().