ReactOS 0.4.17-dev-1190-g4c812f4
sndvol32.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Sound Volume Control
3 * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4 * PURPOSE: Main volume adjustment dialog
5 * COPYRIGHT: Copyright 2004-2005 Thomas Weidenmueller <w3seek@reactos.com>
6 * Copyright 2011 Johannes Anderwald <johannes.anderwald@reactos.org>
7 * Copyright 2018-2019 Eric Kohl <eric.kohl@reactos.org>
8 */
9
10#include "sndvol32.h"
11
12#include <shellapi.h>
13
20
21#define GetDialogData(hwndDlg, type) \
22 ( P##type )GetWindowLongPtr((hwndDlg), DWLP_USER)
23#define GetWindowData(hwnd, type) \
24 ( P##type )GetWindowLongPtr((hwnd), GWL_USERDATA)
25
26/******************************************************************************/
27
28
29
31{
36
37static BOOL CALLBACK
39 UINT Id,
40 LPCTSTR ProductName,
42{
43 LRESULT lres;
45
47
48 lres = SendMessage(FillContext->hComboBox,
50 0,
51 (LPARAM)ProductName);
52 if (lres != CB_ERR)
53 {
54 /* save the index so we don't screw stuff when the combobox is sorted... */
55 SendMessage(FillContext->hComboBox,
57 (WPARAM)lres,
58 Id);
59
60 if (Id == FillContext->Selected)
61 {
62 SendMessage(FillContext->hComboBox,
64 (WPARAM)lres,
65 0);
66 }
67 }
68
69 return TRUE;
70}
71
72static BOOL CALLBACK
75 UINT DisplayControls,
77{
79
81 UNREFERENCED_PARAMETER(DisplayControls);
82
83 switch (Line->dwComponentType)
84 {
86 if (PrefContext->PlaybackID == (DWORD)-1)
87 {
88 PrefContext->PlaybackID = Line->dwLineID;
89
90 if (PrefContext->SelectedLine == (DWORD)-1)
91 {
92 PrefContext->SelectedLine = Line->dwLineID;
93 }
94 }
95 else
96 goto AddToOthersLines;
97
98 break;
99
101 if (PrefContext->RecordingID == (DWORD)-1)
102 {
103 PrefContext->RecordingID = Line->dwLineID;
104
105 if (PrefContext->SelectedLine == (DWORD)-1)
106 {
107 PrefContext->SelectedLine = Line->dwLineID;
108 }
109 }
110 else
111 goto AddToOthersLines;
112
113 break;
114
115 default:
116 {
117 LRESULT lres;
118 HWND hwndCbOthers;
119
120 if (PrefContext->SelectedLine == (DWORD)-1)
121 {
122 PrefContext->SelectedLine = Line->dwLineID;
123 }
124
125AddToOthersLines:
126 hwndCbOthers = GetDlgItem(PrefContext->hwndDlg,
127 IDC_LINE);
128
129 lres = SendMessage(hwndCbOthers,
131 0,
132 (LPARAM)Line->szName);
133 if (lres != CB_ERR)
134 {
135 SendMessage(hwndCbOthers,
137 (WPARAM)lres,
138 Line->dwLineID);
139
140 PrefContext->OtherLines++;
141 }
142 break;
143 }
144 }
145
146 return TRUE;
147}
148
149static BOOL CALLBACK
151 DWORD LineID,
154{
156 HWND hwndControls;
157 LVITEM lvi;
158 UINT i;
159
162
163 if (Line->cControls != 0)
164 {
165 hwndControls = GetDlgItem(PrefContext->hwndDlg,
167
168 lvi.mask = LVIF_TEXT | LVIF_PARAM;
169 lvi.iItem = PrefContext->tmp++;
170 lvi.iSubItem = 0;
171 lvi.pszText = Line->szName;
172 lvi.lParam = (LPARAM)Line->dwSource;
173
174 i = SendMessage(hwndControls,
176 0,
177 (LPARAM)&lvi);
178 if (i != (UINT)-1)
179 {
181 DWORD Flags;
182 BOOL SelLine = FALSE;
183
184 if (SndMixerGetLineName(PrefContext->Mixer,
185 PrefContext->SelectedLine,
186 LineName,
188 TRUE) == -1)
189 {
190 LineName[0] = TEXT('\0');
191 }
192
193 if (ReadLineConfig(PrefContext->DeviceName,
194 LineName,
195 Line->szName,
196 &Flags))
197 {
198 if (Flags != 0x4)
199 {
200 SelLine = TRUE;
201 }
202 }
203
204 ListView_SetCheckState(hwndControls,
205 i,
206 SelLine);
207 }
208 }
209
210 return TRUE;
211}
212
213static VOID
215 DWORD LineID)
216{
217 INT OldID, MixerID = 0;
218 INT DeviceCbIndex;
219
220 /* select the mixer */
221 DeviceCbIndex = SendDlgItemMessage(Context->hwndDlg,
224 0,
225 0);
226 if (DeviceCbIndex != CB_ERR)
227 {
228 MixerID = SendDlgItemMessage(Context->hwndDlg,
231 DeviceCbIndex,
232 0);
233 if (MixerID == CB_ERR)
234 {
235 MixerID = 0;
236 }
237 }
238
239 OldID = Context->Selected;
240 if (MixerID != OldID &&
241 SndMixerSelect(Context->Mixer,
242 MixerID))
243 {
244 Context->Selected = SndMixerGetSelection(Context->Mixer);
245
246 /* update the controls */
247 Context->PlaybackID = (DWORD)-1;
248 Context->RecordingID = (DWORD)-1;
249 Context->OtherLines = 0;
250 Context->SelectedLine = (DWORD)-1;
251
253 Context->DeviceName,
254 sizeof(Context->DeviceName) / sizeof(Context->DeviceName[0]));
255
256 if (SndMixerEnumLines(Context->Mixer,
258 Context))
259 {
260 UINT SelBox = 0;
261
262 /* enable/disable controls and make default selection */
265 Context->PlaybackID != (DWORD)-1);
266 CheckDlgButton(Context->hwndDlg,
268 (Context->PlaybackID != (DWORD)-1 && SelBox++ == 0) ?
270
273 Context->RecordingID != (DWORD)-1);
274 CheckDlgButton(Context->hwndDlg,
276 (Context->RecordingID != (DWORD)-1 && SelBox++ == 0) ?
278
279 if (Context->OtherLines != 0)
280 {
281 /* select the first item in the other lines combo box by default */
283 IDC_LINE,
285 0,
286 0);
287 }
289 IDC_LINE),
290 FALSE);
292 IDC_OTHER),
293 Context->OtherLines != 0);
294 CheckDlgButton(Context->hwndDlg,
295 IDC_LINE,
296 (Context->OtherLines != 0 && SelBox++ == 0) ?
298
299 /* disable the OK button if the device doesn't have any lines */
301 IDOK),
302 Context->PlaybackID != (DWORD)-1 ||
303 Context->RecordingID != (DWORD)-1 ||
304 Context->OtherLines != 0);
305
306 LineID = Context->SelectedLine;
307 }
308 }
309
310 /* update the line sources list */
311 if ((MixerID != OldID && Context->SelectedLine != (DWORD)-1) ||
312 (Context->SelectedLine != LineID && LineID != (DWORD)-1))
313 {
314 Context->SelectedLine = LineID;
315
317 IDC_CONTROLS));
318
319 Context->tmp = 0;
321 LineID,
323 Context);
324 }
325}
326
327static
328VOID
330{
331 HWND hwndControls;
332 INT Count, Index;
334 WCHAR DestinationName[MIXER_LONG_NAME_CHARS];
335 DWORD Flags;
336 PSNDVOL_REG_LINESTATE LineStates;
337
338 /* get list view */
339 hwndControls = GetDlgItem(hwndDlg, IDC_CONTROLS);
340
341 /* get list item count */
342 Count = ListView_GetItemCount(hwndControls);
343
344 /* sanity check */
345 assert(Count);
346
347 if (SndMixerGetLineName(Context->Mixer, Context->SelectedLine, DestinationName, MIXER_LONG_NAME_CHARS, TRUE) == -1)
348 {
349 /* failed to get destination line name */
350 return;
351 }
352
353 /* allocate line states array */
355 if (LineStates == NULL)
356 {
357 /* failed to allocate line states array */
358 return;
359 }
360
361
362 for(Index = 0; Index < Count; Index++)
363 {
364 /* set to empty */
365 LineName[0] = L'\0';
366
367 /* get item text */
368 ListView_GetItemText(hwndControls, Index, 0, LineName, MIXER_LONG_NAME_CHARS);
369
370 /* make sure it is null terminated */
371 LineName[MIXER_LONG_NAME_CHARS-1] = L'\0';
372
373 /* get check state */
374 Flags = (ListView_GetCheckState(hwndControls, Index) == 0 ? 0x4 : 0);
375
376 /* copy line name */
377 wcscpy(LineStates[Index].LineName, LineName);
378
379 /* store flags */
380 LineStates[Index].Flags = Flags;
381 }
382
383 /* now write the line config */
384 WriteLineConfig(Context->DeviceName, DestinationName, LineStates, sizeof(SNDVOL_REG_LINESTATE) * Count);
385
386 /* free line states */
387 HeapFree(GetProcessHeap(), 0, LineStates);
388}
389
390static INT_PTR CALLBACK
392 UINT uMsg,
395{
397
398 switch (uMsg)
399 {
400 case WM_COMMAND:
401 {
402 Context = GetDialogData(hwndDlg,
404 switch (LOWORD(wParam))
405 {
406 case IDC_MIXERDEVICE:
407 {
409 {
411 (DWORD)-1);
412 }
413 break;
414 }
415
416 case IDC_LINE:
417 {
419 {
420 INT LineID;
421 INT Index;
422
423 Index = SendDlgItemMessage(hwndDlg,
424 IDC_LINE,
426 0,
427 0);
428 if (Index != CB_ERR)
429 {
430 LineID = SendDlgItemMessage(hwndDlg,
431 IDC_LINE,
433 Index,
434 0);
435 if (LineID != CB_ERR)
436 {
438 LineID);
439 }
440 }
441 }
442 break;
443 }
444
445 case IDC_PLAYBACK:
446 {
448 Context->PlaybackID);
449 EnableWindow(GetDlgItem(hwndDlg,
450 IDC_LINE),
451 FALSE);
452 break;
453 }
454
455 case IDC_RECORDING:
456 {
458 Context->RecordingID);
459 EnableWindow(GetDlgItem(hwndDlg,
460 IDC_LINE),
461 FALSE);
462 break;
463 }
464
465 case IDC_OTHER:
466 {
467 INT LineCbIndex;
468 INT LineID;
469
470 EnableWindow(GetDlgItem(hwndDlg,
471 IDC_LINE),
472 TRUE);
473
474 LineCbIndex = SendDlgItemMessage(hwndDlg,
475 IDC_LINE,
477 0,
478 0);
479 if (LineCbIndex != CB_ERR)
480 {
481 LineID = SendDlgItemMessage(hwndDlg,
482 IDC_LINE,
484 LineCbIndex,
485 0);
486 if (LineID != CB_ERR)
487 {
489 LineID);
490 }
491 }
492 break;
493 }
494
495 case IDOK:
496 {
497 /* write line settings */
498 WriteLineSettings(Context, hwndDlg);
499
500 /* fall through */
501 }
502 case IDCANCEL:
503 {
504 EndDialog(hwndDlg,
505 LOWORD(wParam));
506 break;
507 }
508 }
509 break;
510 }
511
512 case WM_INITDIALOG:
513 {
514 PREFERENCES_FILL_DEVICES FillDevContext;
515 LVCOLUMN lvc;
516 RECT rcClient;
517 HWND hwndControls;
518
519 SetWindowLongPtr(hwndDlg,
520 DWLP_USER,
523 Context->hwndDlg = hwndDlg;
524 Context->Mixer = SndMixerCreate(hwndDlg, Context->MixerWindow->MixerId);
525 Context->Selected = (UINT)-1;
526
527 FillDevContext.PrefContext = Context;
528 FillDevContext.hComboBox = GetDlgItem(hwndDlg,
530 FillDevContext.Selected = SndMixerGetSelection(Context->Mixer);
533 &FillDevContext);
534
535 /* initialize the list view control */
536 hwndControls = GetDlgItem(hwndDlg,
540
541 GetClientRect(hwndControls,
542 &rcClient);
543 lvc.mask = LVCF_TEXT | LVCF_WIDTH;
544 lvc.pszText = TEXT("");
545 lvc.cx = rcClient.right;
546 SendMessage(hwndControls,
548 0,
549 (LPARAM)&lvc);
550
551 /* update all controls */
553 (DWORD)Context->SelectedLine);
554 return TRUE;
555 }
556
557 case WM_CLOSE:
558 {
559 EndDialog(hwndDlg,
560 IDCANCEL);
561 break;
562 }
563
565 {
566 HWND hwndControls;
567
568 /* Forward WM_SYSCOLORCHANGE */
569 hwndControls = GetDlgItem(hwndDlg, IDC_CONTROLS);
570 SendMessage(hwndControls, WM_SYSCOLORCHANGE, 0, 0);
571 break;
572 }
573 }
574
575 return 0;
576}
577
578/******************************************************************************/
579
580static VOID
582{
583 DWORD Index;
584
585 for(Index = 0; Index < MixerWindow->WindowCount; Index++)
586 {
587 /* destroys the window */
588 DestroyWindow(MixerWindow->Window[Index]);
589 }
590
591 /* free memory */
592 HeapFree(GetProcessHeap(), 0, MixerWindow->Window);
593
594 /* set to null */
595 MixerWindow->Window = NULL;
596 MixerWindow->WindowCount = 0;
597}
598
599static BOOL
601{
602 /* delete existing mixer controls */
604
605 /* load new mixer controls */
606 LoadDialogCtrls(PrefContext);
607
608 return TRUE;
609}
610
611static
612BOOL
615{
616 UINT ControlCount = 0, Index;
621
622 /* check if the line name is equal */
623 if (_wcsicmp(Line->szName, Context->LineName))
624 {
625 /* it is not */
626 return TRUE;
627 }
628
629 /* query controls */
630 if (SndMixerQueryControls(Mixer, &ControlCount, Line, &Control) == FALSE)
631 {
632 /* failed to query for controls */
633 return FALSE;
634 }
635
636 puDetails = HeapAlloc(GetProcessHeap(), 0, Line->cChannels * sizeof(MIXERCONTROLDETAILS_UNSIGNED));
637 if (puDetails == NULL)
638 return FALSE;
639
640 /* now go through all controls and compare control ids */
641 for (Index = 0; Index < ControlCount; Index++)
642 {
643 if (Context->bVertical)
644 {
645 if (Control[Index].dwControlType == MIXERCONTROL_CONTROLTYPE_VOLUME)
646 {
647 DWORD LineOffset, volumePosition, balancePosition;
648 DWORD volumeStep, balanceStep;
649
650 LineOffset = Context->SliderPos;
651
652 volumePosition = (DWORD)SendDlgItemMessage(Preferences.MixerWindow->hWnd, LineOffset * IDC_LINE_SLIDER_VERT, TBM_GETPOS, 0, 0);
653 volumeStep = (Control[Index].Bounds.dwMaximum - Control[Index].Bounds.dwMinimum) / (VOLUME_MAX - VOLUME_MIN);
654
655 if (Line->cChannels == 1)
656 {
657 /* set up details */
658 puDetails[0].dwValue = ((VOLUME_MAX - volumePosition) * volumeStep) + Control[Index].Bounds.dwMinimum;
659 }
660 else if (Line->cChannels == 2)
661 {
662 balancePosition = (DWORD)SendDlgItemMessage(Preferences.MixerWindow->hWnd, LineOffset * IDC_LINE_SLIDER_HORZ, TBM_GETPOS, 0, 0);
663 if (balancePosition == BALANCE_CENTER)
664 {
665 puDetails[0].dwValue = ((VOLUME_MAX - volumePosition) * volumeStep) + Control[Index].Bounds.dwMinimum;
666 puDetails[1].dwValue = ((VOLUME_MAX - volumePosition) * volumeStep) + Control[Index].Bounds.dwMinimum;
667 }
668 else if (balancePosition == BALANCE_LEFT)
669 {
670 puDetails[0].dwValue = ((VOLUME_MAX - volumePosition) * volumeStep) + Control[Index].Bounds.dwMinimum;
671 puDetails[1].dwValue = Control[Index].Bounds.dwMinimum;
672 }
673 else if (balancePosition == BALANCE_RIGHT)
674 {
675 puDetails[0].dwValue = Control[Index].Bounds.dwMinimum;
676 puDetails[1].dwValue = ((VOLUME_MAX - volumePosition) * volumeStep) + Control[Index].Bounds.dwMinimum;
677 }
678 else if (balancePosition < BALANCE_CENTER) // Left
679 {
680 puDetails[0].dwValue = ((VOLUME_MAX - volumePosition) * volumeStep) + Control[Index].Bounds.dwMinimum;
681
682 balanceStep = (puDetails[0].dwValue - Control[Index].Bounds.dwMinimum) / (BALANCE_STEPS / 2);
683
684 puDetails[1].dwValue = (balancePosition * balanceStep) + Control[Index].Bounds.dwMinimum;
685 }
686 else if (balancePosition > BALANCE_CENTER) // Right
687 {
688 puDetails[1].dwValue = ((VOLUME_MAX - volumePosition) * volumeStep) + Control[Index].Bounds.dwMinimum;
689
690 balanceStep = (puDetails[1].dwValue - Control[Index].Bounds.dwMinimum) / (BALANCE_STEPS / 2);
691
692 puDetails[0].dwValue = ((BALANCE_RIGHT - balancePosition) * balanceStep) + Control[Index].Bounds.dwMinimum;
693 }
694 }
695 else
696 {
698
699 /* FIXME */
700 }
701
702 /* set volume */
704
705 /* done */
706 break;
707 }
708 }
709 else if (Context->bSwitch)
710 {
711 if (Control[Index].dwControlType == MIXERCONTROL_CONTROLTYPE_MUTE)
712 {
713 /* set up details */
714 bDetails.fValue = Context->SliderPos;
715
716 /* set volume */
718
719 /* done */
720 break;
721 }
722 }
723 }
724
725 if (puDetails != NULL)
726 HeapFree(GetProcessHeap(), 0, puDetails);
727
728 /* free controls */
730
731
732 /* done */
733 return TRUE;
734}
735
736static
737BOOL
740{
741 PMIXERCONTROLDETAILS_UNSIGNED pVolumeDetails = NULL;
742 UINT ControlCount = 0, Index;
744
745 /* check if the line has controls */
746 if (Line->cControls == 0)
747 {
748 /* no controls */
749 return TRUE;
750 }
751
752 /* query controls */
753 if (SndMixerQueryControls(Mixer, &ControlCount, Line, &Control) == FALSE)
754 {
755 /* failed to query for controls */
756 return FALSE;
757 }
758
759 pVolumeDetails = HeapAlloc(GetProcessHeap(),
760 0,
761 Line->cChannels * sizeof(MIXERCONTROLDETAILS_UNSIGNED));
762 if (pVolumeDetails == NULL)
763 goto done;
764
765 /* now go through all controls and compare control ids */
766 for (Index = 0; Index < ControlCount; Index++)
767 {
768 if (Control[Index].dwControlID == PtrToUlong(Context))
769 {
770 if (Control[Index].dwControlType == MIXERCONTROL_CONTROLTYPE_MUTE)
771 {
773
774 /* get volume control details */
776 {
777 /* update dialog control */
779 }
780 }
781 else if (Control[Index].dwControlType == MIXERCONTROL_CONTROLTYPE_VOLUME)
782 {
783 /* get volume control details */
784 if (SndMixerGetVolumeControlDetails(Preferences.MixerWindow->Mixer, Control[Index].dwControlID, Line->cChannels, sizeof(MIXERCONTROLDETAILS_UNSIGNED), (LPVOID)pVolumeDetails) != -1)
785 {
786 /* update dialog control */
787 DWORD volumePosition, volumeStep, maxVolume, i;
788 DWORD balancePosition, balanceStep;
789
790 volumeStep = (Control[Index].Bounds.dwMaximum - Control[Index].Bounds.dwMinimum) / (VOLUME_MAX - VOLUME_MIN);
791
792 maxVolume = 0;
793 for (i = 0; i < Line->cChannels; i++)
794 {
795 if (pVolumeDetails[i].dwValue > maxVolume)
796 maxVolume = pVolumeDetails[i].dwValue;
797 }
798
799 volumePosition = (maxVolume - Control[Index].Bounds.dwMinimum) / volumeStep;
800
801 if (Line->cChannels == 1)
802 {
803 balancePosition = BALANCE_CENTER;
804 }
805 else if (Line->cChannels == 2)
806 {
807 if (pVolumeDetails[0].dwValue == pVolumeDetails[1].dwValue)
808 {
809 balancePosition = BALANCE_CENTER;
810 }
811 else if (pVolumeDetails[0].dwValue == Control[Index].Bounds.dwMinimum)
812 {
813 balancePosition = BALANCE_RIGHT;
814 }
815 else if (pVolumeDetails[1].dwValue == Control[Index].Bounds.dwMinimum)
816 {
817 balancePosition = BALANCE_LEFT;
818 }
819 else
820 {
821 balanceStep = (maxVolume - Control[Index].Bounds.dwMinimum) / (BALANCE_STEPS / 2);
822
823 if (pVolumeDetails[0].dwValue < pVolumeDetails[1].dwValue)
824 {
825 balancePosition = (pVolumeDetails[0].dwValue - Control[Index].Bounds.dwMinimum) / balanceStep;
826 balancePosition = BALANCE_RIGHT - balancePosition;
827 }
828 else if (pVolumeDetails[1].dwValue < pVolumeDetails[0].dwValue)
829 {
830 balancePosition = (pVolumeDetails[1].dwValue - Control[Index].Bounds.dwMinimum) / balanceStep;
831 balancePosition = BALANCE_LEFT + balancePosition;
832 }
833 }
834 }
835
836 /* Update the volume control slider */
838
839 /* Update the balance control slider */
841 }
842 }
843 break;
844 }
845 }
846
847done:
848 /* Free the volume details */
849 if (pVolumeDetails)
850 HeapFree(GetProcessHeap(), 0, pVolumeDetails);
851
852 /* free controls */
854
855 /* done */
856 return TRUE;
857}
858
859static LRESULT CALLBACK
861 UINT uMsg,
864{
865 PMIXER_WINDOW MixerWindow;
866 DWORD CtrlID, LineOffset, TargetSlider;
867 BOOL bRet;
868 LRESULT Result = 0;
870
871 switch (uMsg)
872 {
873 case WM_COMMAND:
874 {
875 MixerWindow = GetWindowData(hwnd,
877
878 switch (LOWORD(wParam))
879 {
880 case IDM_PROPERTIES:
881 {
883
884 Pref.MixerWindow = MixerWindow;
885 Pref.Mixer = NULL;
887
890 hwnd,
892 (LPARAM)&Pref) == IDOK)
893 {
894 /* update window */
895 TCHAR szProduct[MAXPNAMELEN];
896
897 /* get mixer product name */
899 szProduct,
900 sizeof(szProduct) / sizeof(szProduct[0])) == -1)
901 {
902 /* failed to get name */
903 szProduct[0] = L'\0';
904 }
905 else
906 {
907 /* copy product */
908 wcscpy(Preferences.DeviceName, szProduct);
909 }
910
911 /* destroy old status bar */
912 if (MixerWindow->Mode == NORMAL_MODE)
913 DestroyWindow(MixerWindow->hStatusBar);
914
915 /* update details */
917
918 /* destroy old mixer */
920
921 /* use new selected mixer */
923
924 /* create status window */
925 if (MixerWindow->Mode == NORMAL_MODE)
926 {
928 NULL,
929 hwnd,
930 0);
931 if (MixerWindow->hStatusBar)
932 {
933 /* Set status bar */
934 SendMessage(MixerWindow->hStatusBar,
936 0,
937 (LPARAM)szProduct);
938 }
939 }
940
941 /* rebuild dialog controls */
943 }
944 break;
945 }
946
948 MixerWindow->bShowExtendedControls = !MixerWindow->bShowExtendedControls;
953 break;
954
955 case IDM_EXIT:
956 {
959 break;
960 }
961
962 case IDM_ABOUT:
963 {
964 HICON hAppIcon = (HICON)GetClassLongPtrW(hwnd,
965 GCLP_HICON);
968 NULL,
969 hAppIcon);
970 break;
971 }
972
973 default:
974 {
975 /* get button id */
976 CtrlID = LOWORD(wParam);
977
978 /* check if the message is from the line switch */
979 if (HIWORD(wParam) == BN_CLICKED)
980 {
981 if (CtrlID % IDC_LINE_SWITCH == 0)
982 {
983 /* compute line offset */
984 LineOffset = CtrlID / IDC_LINE_SWITCH;
985
986 /* compute window id of line name static control */
987 CtrlID = LineOffset * IDC_LINE_NAME;
988
989 if (Preferences.MixerWindow->Mixer->MixerId == PLAY_MIXER)
990 {
991 /* get line name */
992 if (GetDlgItemTextW(hwnd, CtrlID, Context.LineName, MIXER_LONG_NAME_CHARS) != 0)
993 {
994 /* setup context */
995 Context.SliderPos = SendMessage((HWND)lParam, BM_GETCHECK, 0, 0);
996 Context.bVertical = FALSE;
997 Context.bSwitch = TRUE;
998
999 /* set volume */
1001 }
1002 }
1003 else if (Preferences.MixerWindow->Mixer->MixerId == RECORD_MIXER)
1004 {
1005 UINT i;
1006
1007 for (i = 0; i < Preferences.MixerWindow->DialogCount; i++)
1008 {
1009 SendDlgItemMessageW(hwnd, (i + 1) * IDC_LINE_SWITCH, BM_SETCHECK, (WPARAM)((i + 1) == LineOffset), 0);
1010 }
1011 }
1012 }
1013 else if (CtrlID % IDC_LINE_ADVANCED == 0)
1014 {
1015 ADVANCED_CONTEXT AdvancedContext;
1016
1017 /* compute line offset */
1018 LineOffset = CtrlID / IDC_LINE_ADVANCED;
1019
1020 /* compute window id of line name static control */
1021 CtrlID = LineOffset * IDC_LINE_NAME;
1022
1023 /* get line name */
1024 if (GetDlgItemTextW(hwnd, CtrlID, AdvancedContext.LineName, MIXER_LONG_NAME_CHARS) != 0)
1025 {
1026 AdvancedContext.MixerWindow = Preferences.MixerWindow;
1027 AdvancedContext.Mixer = Preferences.MixerWindow->Mixer;
1030 AdvancedContext.LineName);
1031 if (AdvancedContext.Line)
1032 {
1035 hwnd,
1037 (LPARAM)&AdvancedContext);
1038 }
1039 }
1040 }
1041 }
1042 }
1043 }
1044 break;
1045 }
1046
1048 {
1049 DPRINT("MM_MIXM_LINE_CHANGE\n");
1050 break;
1051 }
1052
1054 {
1055 DPRINT("MM_MIXM_CONTROL_CHANGE\n");
1056
1057 /* get mixer window */
1058 MixerWindow = GetWindowData(hwnd,
1059 MIXER_WINDOW);
1060
1061 /* sanity checks */
1062 assert(MixerWindow);
1063 assert(MixerWindow->Mixer->hmx == (HMIXER)wParam);
1064
1066 break;
1067 }
1068
1069 case WM_HSCROLL:
1070 case WM_VSCROLL:
1071 TargetSlider = uMsg == WM_HSCROLL ? IDC_LINE_SLIDER_HORZ : IDC_LINE_SLIDER_VERT;
1072
1073 switch (LOWORD(wParam))
1074 {
1075 case TB_LINEUP:
1076 case TB_LINEDOWN:
1077 case TB_PAGEUP:
1078 case TB_PAGEDOWN:
1079 case TB_TOP:
1080 case TB_BOTTOM:
1081 case TB_THUMBTRACK:
1082 /* get dialog item ctrl */
1083 CtrlID = GetDlgCtrlID((HWND)lParam);
1084
1085 /* get line index */
1086 LineOffset = CtrlID / TargetSlider;
1087
1088 /* compute window id of line name static control */
1089 CtrlID = LineOffset * IDC_LINE_NAME;
1090
1091 /* get line name */
1092 if (GetDlgItemTextW(hwnd, CtrlID, Context.LineName, MIXER_LONG_NAME_CHARS) != 0)
1093 {
1094 /* setup context */
1095 Context.SliderPos = LineOffset;
1096 Context.bVertical = TRUE;
1097 Context.bSwitch = FALSE;
1098
1099 /* set volume */
1101 }
1102 break;
1103
1104 default:
1105 break;
1106 }
1107
1108 /* One more time to test if we released the slider or was there any other affection */
1109 switch (LOWORD(wParam))
1110 {
1111 case TB_LINEUP:
1112 case TB_LINEDOWN:
1113 case TB_PAGEUP:
1114 case TB_PAGEDOWN:
1115 case TB_TOP:
1116 case TB_BOTTOM:
1117 case TB_ENDTRACK:
1118 MixerWindow = GetWindowData(hwnd,
1119 MIXER_WINDOW);
1120
1121 /* get dialog item ctrl */
1122 CtrlID = GetDlgCtrlID((HWND)lParam);
1123
1124 /* get line index */
1125 LineOffset = CtrlID / TargetSlider;
1126
1127 if (LineOffset == 1 && MixerWindow->Mixer->MixerId == 0)
1129 break;
1130
1131 default:
1132 break;
1133 }
1134 break;
1135
1136
1137 case WM_CREATE:
1138 {
1139 MixerWindow = ((LPCREATESTRUCT)lParam)->lpCreateParams;
1142 (LONG_PTR)MixerWindow);
1143 MixerWindow->hWnd = hwnd;
1144 MixerWindow->Mixer = SndMixerCreate(MixerWindow->hWnd, MixerWindow->MixerId);
1145 if (MixerWindow->Mixer != NULL)
1146 {
1147 TCHAR szProduct[MAXPNAMELEN];
1148
1149 /* get mixer product name */
1150 if (SndMixerGetProductName(MixerWindow->Mixer,
1151 szProduct,
1152 sizeof(szProduct) / sizeof(szProduct[0])) == -1)
1153 {
1154 /* failed to get name */
1155 szProduct[0] = L'\0';
1156 }
1157
1158
1159 /* initialize preferences */
1161
1162 /* store mixer */
1163 Preferences.Mixer = MixerWindow->Mixer;
1164
1165 /* store mixer window */
1166 Preferences.MixerWindow = MixerWindow;
1167
1168 /* first destination line id */
1169 Preferences.SelectedLine = 0xFFFF0000;
1170
1171 /* copy product */
1172 wcscpy(Preferences.DeviceName, szProduct);
1173
1174 /* Disable the 'Advanced Controls' menu item */
1176
1177 /* Load the placement coordinate data of the window */
1178 bRet = LoadXYCoordWnd(&Preferences);
1179 if (bRet)
1180 {
1181 /*
1182 * LoadXYCoordWnd() might fail for the first time of opening the application which is normal as
1183 * the Sound Control's applet settings haven't been saved yet to the Registry. At this point SetWindowPos()
1184 * call is skipped.
1185 */
1186 SetWindowPos(hwnd, NULL, MixerWindow->WndPosX, MixerWindow->WndPosY, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
1187 }
1188
1189 /* create status window */
1190 if (MixerWindow->Mode == NORMAL_MODE)
1191 {
1192 MixerWindow->hStatusBar = CreateStatusWindow(WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS,
1193 NULL,
1194 hwnd,
1195 0);
1196 if (MixerWindow->hStatusBar)
1197 {
1198 SendMessage(MixerWindow->hStatusBar,
1199 WM_SETTEXT,
1200 0,
1201 (LPARAM)szProduct);
1202 }
1203 }
1204
1206 {
1207 DPRINT("Rebuilding mixer window controls failed!\n");
1208 SndMixerDestroy(MixerWindow->Mixer);
1209 MixerWindow->Mixer = NULL;
1210 Result = -1;
1211 }
1212 }
1213
1215 break;
1216 }
1217
1218 case WM_DESTROY:
1219 {
1220 MixerWindow = GetWindowData(hwnd,
1221 MIXER_WINDOW);
1222 if (MixerWindow != NULL)
1223 {
1224 if (MixerWindow->Mixer != NULL)
1225 {
1226 SndMixerDestroy(MixerWindow->Mixer);
1227 }
1228 if (MixerWindow->hFont)
1229 DeleteObject(MixerWindow->hFont);
1230 HeapFree(hAppHeap, 0, MixerWindow);
1231 }
1232 break;
1233 }
1234
1235 case WM_CLOSE:
1236 {
1238 PostQuitMessage(0);
1239 break;
1240 }
1241
1242 case WM_HOTKEY:
1243 {
1244 if (wParam == HOTKEY_CTRL_S)
1245 {
1248 }
1249 break;
1250 }
1251
1252 default:
1253 {
1255 uMsg,
1256 wParam,
1257 lParam);
1258 break;
1259 }
1260 }
1261
1262 return Result;
1263}
1264
1265static BOOL
1267{
1268 WNDCLASSEX wc;
1269
1270 wc.cbSize = sizeof(WNDCLASSEX);
1273 wc.cbClsExtra = 0;
1274 wc.cbWndExtra = sizeof(PMIXER_WINDOW);
1278 wc.hCursor = LoadCursor(NULL,
1279 IDC_ARROW);
1280 wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
1281 wc.lpszMenuName = NULL;
1283 wc.hIconSm = NULL;
1285
1286 return MainWindowClass != 0;
1287}
1288
1289static VOID
1291{
1293 hAppInstance);
1294}
1295
1296static HWND
1298 WINDOW_MODE WindowMode,
1299 UINT MixerId)
1300{
1301 HWND hWnd;
1302
1303 PMIXER_WINDOW MixerWindow = HeapAlloc(hAppHeap,
1305 sizeof(MIXER_WINDOW));
1306 if (MixerWindow == NULL)
1307 {
1308 return NULL;
1309 }
1310
1311 MixerWindow->Mode = WindowMode;
1312 MixerWindow->MixerId = MixerId;
1313
1314 if (mixerGetNumDevs() > 0)
1315 {
1318 lpAppTitle,
1320 0, 0, 300, 315,
1321 NULL,
1325 MixerWindow);
1326 }
1327 else
1328 {
1329 LPTSTR lpErrMessage;
1330
1331 /*
1332 * no mixer devices are available!
1333 */
1334
1335 hWnd = NULL;
1336 if (AllocAndLoadString(&lpErrMessage,
1339 {
1341 lpErrMessage,
1342 lpAppTitle,
1344 LocalFree(lpErrMessage);
1345 }
1346 }
1347
1348 if (hWnd == NULL)
1349 {
1351 0,
1352 MixerWindow);
1353 }
1354
1355 return hWnd;
1356}
1357
1358static
1359BOOL
1361 DWORD dwStyle,
1362 PWINDOW_MODE pMode,
1363 PUINT pMixerId)
1364{
1365 TCHAR option;
1366
1367 *pMixerId = PLAY_MIXER;
1368 *pMode = (dwStyle & 0x20) ? SMALL_MODE : NORMAL_MODE;
1369
1370 while (*cmdline == _T(' ') || *cmdline == _T('-') || *cmdline == _T('/'))
1371 {
1372 if (*cmdline++ == _T(' '))
1373 continue;
1374
1375 option = *cmdline;
1376 if (option)
1377 cmdline++;
1378 while (*cmdline == _T(' '))
1379 cmdline++;
1380
1381 switch (option)
1382 {
1383 case 'd': /* Device */
1384 case 'D':
1385 break;
1386
1387 case 'n': /* Small size */
1388 case 'N':
1389 *pMode = NORMAL_MODE;
1390 break;
1391
1392 case 's': /* Small size */
1393 case 'S':
1394 *pMode = SMALL_MODE;
1395 break;
1396
1397 case 't': /* Tray size */
1398 case 'T':
1399 *pMode = TRAY_MODE;
1400 break;
1401
1402 case 'p': /* Play mode */
1403 case 'P':
1404 *pMixerId = PLAY_MIXER;
1405 break;
1406
1407 case 'r': /* Record mode */
1408 case 'R':
1409 *pMixerId = RECORD_MIXER;
1410 break;
1411
1412 default:
1413 return FALSE;
1414 }
1415 }
1416
1417 return TRUE;
1418}
1419
1420int WINAPI
1422 HINSTANCE hPrevInstance,
1423 LPTSTR lpszCmdLine,
1424 int nCmdShow)
1425{
1426 MSG Msg;
1427 int Ret = 1;
1428 INITCOMMONCONTROLSEX Controls;
1429 WINDOW_MODE WindowMode = SMALL_MODE;
1430 UINT MixerId = 0;
1431 DWORD dwStyle;
1432
1433 UNREFERENCED_PARAMETER(hPrevInstance);
1434 UNREFERENCED_PARAMETER(nCmdShow);
1435
1438
1439 if (InitAppConfig())
1440 {
1441 dwStyle = GetStyleValue();
1442 HandleCommandLine(lpszCmdLine, dwStyle, &WindowMode, &MixerId);
1443
1444 /* load the application title */
1447 IDS_SNDVOL32))
1448 {
1449 lpAppTitle = NULL;
1450 }
1451
1452 Controls.dwSize = sizeof(INITCOMMONCONTROLSEX);
1454
1455 InitCommonControlsEx(&Controls);
1456
1457 if (WindowMode == TRAY_MODE)
1458 {
1461 NULL,
1463 0);
1464 }
1465 else
1466 {
1468 {
1469 hMainWnd = CreateApplicationWindow(WindowMode, MixerId);
1470 if (hMainWnd != NULL)
1471 {
1472 BOOL bRet;
1473 while ((bRet =GetMessage(&Msg,
1474 NULL,
1475 0,
1476 0)) != 0)
1477 {
1478 if (bRet != -1)
1479 {
1482 }
1483 }
1484
1486 Ret = 0;
1487 }
1488 else
1489 {
1490 DPRINT("Failed to create application window (LastError: %d)!\n", GetLastError());
1491 }
1492
1494 }
1495 else
1496 {
1497 DPRINT("Failed to register application classes (LastError: %d)!\n", GetLastError());
1498 }
1499 }
1500
1501 if (lpAppTitle != NULL)
1502 {
1504 }
1505
1507 }
1508 else
1509 {
1510 DPRINT("Unable to open the Volume Control registry key!\n");
1511 }
1512
1513 return Ret;
1514}
DWORD Id
#define IDD_ADVANCED
Definition: resource.h:10
HWND hWnd
Definition: settings.c:17
#define IDM_ABOUT
Definition: resource.h:29
#define IDM_EXIT
Definition: resource.h:27
INT AllocAndLoadString(OUT LPTSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID)
Definition: misc.c:59
#define IDI_MAINAPP
Definition: resource.h:6
VOID UpdateDialogLineSliderControl(PPREFERENCES_CONTEXT PrefContext, LPMIXERLINE Line, DWORD dwDialogID, DWORD Position)
Definition: dialog.c:830
VOID UpdateDialogLineSwitchControl(PPREFERENCES_CONTEXT PrefContext, LPMIXERLINE Line, LONG fValue)
Definition: dialog.c:805
VOID LoadDialogCtrls(PPREFERENCES_CONTEXT PrefContext)
Definition: dialog.c:678
BOOL InitAppConfig(VOID)
Definition: misc.c:138
VOID CloseAppConfig(VOID)
Definition: misc.c:152
DWORD GetStyleValue(VOID)
Definition: misc.c:388
BOOL SaveXYCoordWnd(IN HWND hWnd, IN PPREFERENCES_CONTEXT PrefContext)
Definition: misc.c:218
BOOL WriteLineConfig(IN LPTSTR szDeviceName, IN LPTSTR szLineName, IN PSNDVOL_REG_LINESTATE LineState, IN DWORD cbSize)
Definition: misc.c:272
BOOL LoadXYCoordWnd(IN PPREFERENCES_CONTEXT PrefContext)
Definition: misc.c:162
BOOL ReadLineConfig(IN LPTSTR szDeviceName, IN LPTSTR szLineName, IN LPTSTR szControlName, OUT DWORD *Flags)
Definition: misc.c:307
BOOL SndMixerEnumLines(PSND_MIXER Mixer, PFNSNDMIXENUMLINES EnumProc, PVOID Context)
Definition: mixer.c:526
BOOL SndMixerSelect(PSND_MIXER Mixer, UINT MixerId)
Definition: mixer.c:304
VOID SndMixerDestroy(PSND_MIXER Mixer)
Definition: mixer.c:91
LPMIXERLINE SndMixerGetLineByName(PSND_MIXER Mixer, DWORD LineID, LPWSTR LineName)
Definition: mixer.c:615
BOOL SndMixerQueryControls(PSND_MIXER Mixer, PUINT DisplayControls, LPMIXERLINE LineInfo, LPMIXERCONTROL *Controls)
Definition: mixer.c:112
PSND_MIXER SndMixerCreate(HWND hWndNotification, UINT MixerId)
Definition: mixer.c:69
UINT SndMixerGetSelection(PSND_MIXER Mixer)
Definition: mixer.c:361
INT SndMixerGetProductName(PSND_MIXER Mixer, LPTSTR lpBuffer, UINT uSize)
Definition: mixer.c:367
INT SndMixerGetLineName(PSND_MIXER Mixer, DWORD LineID, LPTSTR lpBuffer, UINT uSize, BOOL LongName)
Definition: mixer.c:390
BOOL SndMixerEnumProducts(PSND_MIXER Mixer, PFNSNDMIXENUMPRODUCTS EnumProc, PVOID Context)
Definition: mixer.c:431
INT SndMixerGetVolumeControlDetails(PSND_MIXER Mixer, DWORD dwControlID, DWORD cChannels, DWORD cbDetails, LPVOID paDetails)
Definition: mixer.c:498
BOOL SndMixerEnumConnections(PSND_MIXER Mixer, DWORD LineID, PFNSNDMIXENUMCONNECTIONS EnumProc, PVOID Context)
Definition: mixer.c:552
INT SndMixerSetVolumeControlDetails(PSND_MIXER Mixer, DWORD dwControlID, DWORD cChannels, DWORD cbDetails, LPVOID paDetails)
Definition: mixer.c:474
#define IDS_NOMIXERDEVICES
Definition: resources.h:42
#define IDC_OTHER
Definition: resources.h:18
#define IDC_MIXERDEVICE
Definition: resources.h:15
#define IDM_MAINMENU
Definition: resources.h:3
#define IDC_LINE_SLIDER_VERT
Definition: resources.h:25
#define IDC_LINE
Definition: resources.h:19
#define IDM_ADVANCED_CONTROLS
Definition: resources.h:10
#define IDC_PLAYBACK
Definition: resources.h:16
#define IDC_RECORDING
Definition: resources.h:17
#define IDM_PROPERTIES
Definition: resources.h:9
#define IDS_SNDVOL32
Definition: resources.h:41
#define IDD_TRAY_MASTER
Definition: resources.h:52
#define IDC_LINE_ADVANCED
Definition: resources.h:26
#define IDD_PREFERENCES
Definition: resources.h:53
#define IDC_LINE_NAME
Definition: resources.h:22
#define IDC_LINE_SWITCH
Definition: resources.h:23
#define IDC_LINE_SLIDER_HORZ
Definition: resources.h:24
#define IDC_CONTROLS
Definition: resources.h:21
static INT_PTR CALLBACK AdvancedDlgProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
Definition: charmap.c:480
HINSTANCE hInstance
Definition: charmap.c:19
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
struct @1898 Msg[]
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:904
WORD ATOM
Definition: dimm.idl:113
_In_ D3DDDI_VIDEO_PRESENT_TARGET_ID _In_ ULONG _In_ ULONG Flags
Definition: dispmprt.h:245
#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 CALLBACK
Definition: compat.h:35
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define assert(_expr)
Definition: assert.h:32
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:164
#define L(x)
Definition: resources.c:13
#define PtrToUlong(u)
Definition: config.h:107
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
pKey DeleteObject()
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
unsigned int UINT
Definition: sysinfo.c:13
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define MOD_CONTROL
Definition: imm.h:185
char TCHAR
Definition: tchar.h:1402
#define _tWinMain
Definition: tchar.h:498
#define TEXT(s)
Definition: k32.h:28
_In_ PIRP _In_ PIO_COMPLETION_ROUTINE _In_ PVOID Context
Definition: kse.h:81
#define ZeroMemory
Definition: minwinbase.h:31
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
#define MIXERLINE_COMPONENTTYPE_DST_SPEAKERS
Definition: mmsystem.h:319
#define PlaySound
Definition: mmsystem.h:2844
#define SND_ALIAS_SYSTEMDEFAULT
Definition: mmsystem.h:175
#define MM_MIXM_CONTROL_CHANGE
Definition: mmsystem.h:83
#define MIXERCONTROL_CONTROLTYPE_VOLUME
Definition: mmsystem.h:398
#define MIXER_LONG_NAME_CHARS
Definition: mmsystem.h:294
#define MIXERLINE_COMPONENTTYPE_DST_WAVEIN
Definition: mmsystem.h:322
#define MM_MIXM_LINE_CHANGE
Definition: mmsystem.h:82
#define SND_ALIAS_ID
Definition: mmsystem.h:161
#define MAXPNAMELEN
Definition: mmsystem.h:24
#define SND_ASYNC
Definition: mmsystem.h:154
#define MIXERCONTROL_CONTROLTYPE_MUTE
Definition: mmsystem.h:384
static HICON
Definition: imagelist.c:80
LPSTR LPTSTR
Definition: ms-dtyp.idl:131
LPCSTR LPCTSTR
Definition: ms-dtyp.idl:130
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int * PUINT
Definition: ndis.h:50
int Count
Definition: noreturn.cpp:7
#define DWORD
Definition: nt_native.h:44
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
#define MAKEINTRESOURCE(i)
Definition: ntverrsrc.c:25
#define LOWORD(l)
Definition: pedump.c:82
#define WS_CHILD
Definition: pedump.c:617
#define WS_CAPTION
Definition: pedump.c:624
#define WS_SYSMENU
Definition: pedump.c:629
short WCHAR
Definition: pedump.c:58
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_DLGFRAME
Definition: pedump.c:626
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define WS_MINIMIZEBOX
Definition: pedump.c:631
#define TB_TOP
Definition: commctrl.h:2084
#define TB_ENDTRACK
Definition: commctrl.h:2086
struct tagINITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
#define TB_PAGEUP
Definition: commctrl.h:2080
#define TB_BOTTOM
Definition: commctrl.h:2085
#define CreateStatusWindow
Definition: commctrl.h:1938
#define ListView_SetCheckState(hwndLV, i, fCheck)
Definition: commctrl.h:2679
#define ListView_GetItemText(hwndLV, i, iSubItem_, pszText_, cchTextMax_)
Definition: commctrl.h:2689
#define TBM_GETPOS
Definition: commctrl.h:2036
#define LVM_INSERTITEM
Definition: commctrl.h:2411
#define LVCF_WIDTH
Definition: commctrl.h:2592
#define LVS_EX_CHECKBOXES
Definition: commctrl.h:2736
#define LVM_INSERTCOLUMN
Definition: commctrl.h:2639
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2312
#define ListView_SetExtendedListViewStyle(hwndLV, dw)
Definition: commctrl.h:2730
#define TB_PAGEDOWN
Definition: commctrl.h:2081
#define ICC_STANDARD_CLASSES
Definition: commctrl.h:73
#define TB_THUMBTRACK
Definition: commctrl.h:2083
#define LVITEM
Definition: commctrl.h:2380
#define TB_LINEUP
Definition: commctrl.h:2078
#define LVIF_PARAM
Definition: commctrl.h:2316
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2419
#define LVIF_TEXT
Definition: commctrl.h:2314
#define TB_LINEDOWN
Definition: commctrl.h:2079
#define ListView_GetCheckState(hwndLV, i)
Definition: commctrl.h:2682
#define ICC_BAR_CLASSES
Definition: commctrl.h:60
#define LVCF_TEXT
Definition: commctrl.h:2593
#define LVCOLUMN
Definition: commctrl.h:2586
#define CS_VREDRAW
Definition: winuser.h:666
#define CreateWindowEx
Definition: winuser.h:5921
#define CB_SETITEMDATA
Definition: winuser.h:1995
#define WM_CLOSE
Definition: winuser.h:1649
#define MF_BYCOMMAND
Definition: winuser.h:202
#define DWLP_USER
Definition: winuser.h:883
#define GWL_USERDATA
Definition: winuser.h:872
CREATESTRUCTA * LPCREATESTRUCT
Definition: winuser.h:5892
#define WM_HSCROLL
Definition: winuser.h:1771
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define IDCANCEL
Definition: winuser.h:842
#define BST_UNCHECKED
Definition: winuser.h:199
#define WM_VSCROLL
Definition: winuser.h:1772
#define GCLP_HICON
Definition: winuser.h:682
#define WM_CREATE
Definition: winuser.h:1636
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define WS_EX_CONTROLPARENT
Definition: winuser.h:387
BOOL WINAPI UnregisterHotKey(_In_opt_ HWND, _In_ int)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_COMMAND
Definition: winuser.h:1768
#define CS_HREDRAW
Definition: winuser.h:661
#define CB_ERR
Definition: winuser.h:2471
#define IDC_ARROW
Definition: winuser.h:695
#define CB_SETCURSEL
Definition: winuser.h:1990
#define UnregisterClass
Definition: winuser.h:6027
#define MF_CHECKED
Definition: winuser.h:132
#define SWP_NOSIZE
Definition: winuser.h:1256
#define DialogBoxParam
Definition: winuser.h:5930
#define WM_INITDIALOG
Definition: winuser.h:1767
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1654
#define MF_UNCHECKED
Definition: winuser.h:204
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:841
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define CBN_SELCHANGE
Definition: winuser.h:2008
#define BM_SETCHECK
Definition: winuser.h:1950
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SETTEXT
Definition: winuser.h:1645
#define GetMessage
Definition: winuser.h:5956
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define RegisterClassEx
Definition: winuser.h:6003
BOOL WINAPI RegisterHotKey(_In_opt_ HWND, _In_ int, _In_ UINT, _In_ UINT)
#define CB_ADDSTRING
Definition: winuser.h:1965
#define LoadIcon
Definition: winuser.h:5979
#define CB_GETITEMDATA
Definition: winuser.h:1979
#define SendMessage
Definition: winuser.h:6009
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define LoadCursor
Definition: winuser.h:5978
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5885
#define LoadMenu
Definition: winuser.h:5983
#define GetClassLongPtrW
Definition: winuser.h:4718
#define MessageBox
Definition: winuser.h:5988
#define MB_ICONINFORMATION
Definition: winuser.h:813
#define WM_HOTKEY
Definition: winuser.h:1907
int WINAPI GetDlgCtrlID(_In_ HWND)
#define BN_CLICKED
Definition: winuser.h:1954
#define WM_DESTROY
Definition: winuser.h:1637
#define DispatchMessage
Definition: winuser.h:5931
#define SWP_NOZORDER
Definition: winuser.h:1258
#define CB_GETCURSEL
Definition: winuser.h:1972
#define SendDlgItemMessage
Definition: winuser.h:6008
BOOL WINAPI DestroyWindow(_In_ HWND)
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define BST_CHECKED
Definition: winuser.h:197
HMENU WINAPI GetMenu(_In_ HWND)
#define COLOR_BTNFACE
Definition: winuser.h:939
#define BM_GETCHECK
Definition: winuser.h:1947
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define MF_GRAYED
Definition: winuser.h:129
#define DefWindowProc
Definition: ros2win.h:31
wcscpy
#define UINT
Definition: utils.c:29
#define ShellAbout
Definition: shellapi.h:748
LPTSTR lpAppTitle
Definition: sndvol32.c:18
static BOOL RebuildMixerWindowControls(PPREFERENCES_CONTEXT PrefContext)
Definition: sndvol32.c:600
static VOID UpdatePrefDlgControls(PPREFERENCES_CONTEXT Context, DWORD LineID)
Definition: sndvol32.c:214
static BOOL HandleCommandLine(LPTSTR cmdline, DWORD dwStyle, PWINDOW_MODE pMode, PUINT pMixerId)
Definition: sndvol32.c:1360
static HWND CreateApplicationWindow(WINDOW_MODE WindowMode, UINT MixerId)
Definition: sndvol32.c:1297
struct _PREFERENCES_FILL_DEVICES * PPREFERENCES_FILL_DEVICES
HWND hMainWnd
Definition: sndvol32.c:16
static BOOL RegisterApplicationClasses(VOID)
Definition: sndvol32.c:1266
static VOID UnregisterApplicationClasses(VOID)
Definition: sndvol32.c:1290
static VOID DeleteMixerWindowControls(PMIXER_WINDOW MixerWindow)
Definition: sndvol32.c:581
ATOM MainWindowClass
Definition: sndvol32.c:15
static INT_PTR CALLBACK DlgPreferencesProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: sndvol32.c:391
HANDLE hAppHeap
Definition: sndvol32.c:17
HINSTANCE hAppInstance
Definition: sndvol32.c:14
#define GetWindowData(hwnd, type)
Definition: sndvol32.c:23
struct _PREFERENCES_FILL_DEVICES PREFERENCES_FILL_DEVICES
static LRESULT CALLBACK MainWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: sndvol32.c:860
static BOOL CALLBACK SetVolumeCallback(PSND_MIXER Mixer, DWORD LineID, LPMIXERLINE Line, PVOID Ctx)
Definition: sndvol32.c:614
static BOOL CALLBACK PrefDlgAddConnection(PSND_MIXER Mixer, DWORD LineID, LPMIXERLINE Line, PVOID Context)
Definition: sndvol32.c:150
static BOOL CALLBACK MixerControlChangeCallback(PSND_MIXER Mixer, DWORD LineID, LPMIXERLINE Line, PVOID Context)
Definition: sndvol32.c:739
static BOOL CALLBACK FillDeviceComboBox(PSND_MIXER Mixer, UINT Id, LPCTSTR ProductName, PVOID Context)
Definition: sndvol32.c:38
PREFERENCES_CONTEXT Preferences
Definition: sndvol32.c:19
static VOID WriteLineSettings(PPREFERENCES_CONTEXT Context, HWND hwndDlg)
Definition: sndvol32.c:329
#define GetDialogData(hwndDlg, type)
Definition: sndvol32.c:21
static BOOL CALLBACK PrefDlgAddLine(PSND_MIXER Mixer, LPMIXERLINE Line, UINT DisplayControls, PVOID Context)
Definition: sndvol32.c:73
enum _WINDOW_MODE WINDOW_MODE
#define VOLUME_MAX
Definition: sndvol32.h:19
#define DPRINT
Definition: sndvol32.h:73
#define BALANCE_RIGHT
Definition: sndvol32.h:24
#define SZ_APP_CLASS
Definition: sndvol32.h:69
#define PLAY_MIXER
Definition: sndvol32.h:29
struct _SET_VOLUME_CONTEXT * PSET_VOLUME_CONTEXT
#define VOLUME_MIN
Definition: sndvol32.h:18
#define RECORD_MIXER
Definition: sndvol32.h:30
enum _WINDOW_MODE * PWINDOW_MODE
#define BALANCE_STEPS
Definition: sndvol32.h:25
#define BALANCE_CENTER
Definition: sndvol32.h:23
struct _MIXER_WINDOW * PMIXER_WINDOW
#define BALANCE_LEFT
Definition: sndvol32.h:22
struct _PREFERENCES_CONTEXT * PPREFERENCES_CONTEXT
#define HOTKEY_CTRL_S
Definition: sndvol32.h:34
@ SMALL_MODE
Definition: sndvol32.h:39
@ NORMAL_MODE
Definition: sndvol32.h:38
@ TRAY_MODE
Definition: sndvol32.h:40
INT_PTR CALLBACK TrayDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: tray.c:324
TCHAR * cmdline
Definition: stretchblt.cpp:32
Definition: ncftp.h:79
Definition: dcommon.idl:28
long right
Definition: dcommon.idl:29
PMIXER_WINDOW MixerWindow
Definition: sndvol32.h:135
PSND_MIXER Mixer
Definition: sndvol32.h:136
WCHAR LineName[MIXER_LONG_NAME_CHARS]
Definition: sndvol32.h:134
LPMIXERLINE Line
Definition: sndvol32.h:137
HFONT hFont
Definition: sndvol32.h:58
BOOL bShowExtendedControls
Definition: sndvol32.h:56
WINDOW_MODE Mode
Definition: sndvol32.h:53
struct _SND_MIXER * Mixer
Definition: sndvol32.h:47
UINT MixerId
Definition: sndvol32.h:54
UINT DialogCount
Definition: sndvol32.h:51
HWND hStatusBar
Definition: sndvol32.h:46
HWND * Window
Definition: sndvol32.h:50
UINT WindowCount
Definition: sndvol32.h:49
TCHAR DeviceName[128]
Definition: sndvol32.h:119
PSND_MIXER Mixer
Definition: sndvol32.h:111
PMIXER_WINDOW MixerWindow
Definition: sndvol32.h:110
PPREFERENCES_CONTEXT PrefContext
Definition: sndvol32.c:32
int cbClsExtra
Definition: winuser.h:3312
HINSTANCE hInstance
Definition: winuser.h:3314
HCURSOR hCursor
Definition: winuser.h:3316
LPCSTR lpszMenuName
Definition: winuser.h:3318
HICON hIconSm
Definition: winuser.h:3320
UINT style
Definition: winuser.h:3310
int cbWndExtra
Definition: winuser.h:3313
UINT cbSize
Definition: winuser.h:3309
WNDPROC lpfnWndProc
Definition: winuser.h:3311
LPCSTR lpszClassName
Definition: winuser.h:3319
HICON hIcon
Definition: winuser.h:3315
HBRUSH hbrBackground
Definition: winuser.h:3317
Definition: getopt.h:109
#define SetWindowLongPtr
Definition: treelist.c:70
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
int32_t INT_PTR
Definition: typedefs.h:64
int32_t INT
Definition: typedefs.h:58
#define HIWORD(l)
Definition: typedefs.h:247
#define _T(x)
Definition: vfdio.h:22
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ WDF_WMI_PROVIDER_CONTROL Control
Definition: wdfwmi.h:166
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2283
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define WINAPI
Definition: msvc.h:6
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