3 * PROJECT: ReactOS Multimedia Control Panel
4 * FILE: lib/cpl/mmsys/mmsys.c
5 * PURPOSE: ReactOS Multimedia Control Panel
6 * PROGRAMMER: Thomas Weidenmueller <w3seek@reactos.com>
7 * Johannes Anderwald <janderwald@reactos.com>
8 * Dmitry Chapyshev <dmitry@reactos.org>
21 InitAudioDlg(HWND hwnd
)
23 WAVEOUTCAPS waveOutputPaps
;
24 WAVEINCAPS waveInputPaps
;
25 MIDIOUTCAPS midiOutCaps
;
31 // Init sound playback devices list
32 hCB
= GetDlgItem(hwnd
, IDC_DEVICE_PLAY_LIST
);
34 DevsNum
= waveOutGetNumDevs();
35 if (DevsNum
< 1) return;
37 for (uIndex
= 0; uIndex
< DevsNum
; uIndex
++)
39 if (waveOutGetDevCaps(uIndex
, &waveOutputPaps
, sizeof(waveOutputPaps
)))
42 Res
= SendMessage(hCB
, CB_ADDSTRING
, 0, (LPARAM
) waveOutputPaps
.szPname
);
46 SendMessage(hCB
, CB_SETITEMDATA
, Res
, (LPARAM
) uIndex
);
47 // TODO: Getting default device
48 SendMessage(hCB
, CB_SETCURSEL
, (WPARAM
) Res
, 0);
52 // Init sound recording devices list
53 hCB
= GetDlgItem(hwnd
, IDC_DEVICE_REC_LIST
);
55 DevsNum
= waveInGetNumDevs();
56 if (DevsNum
< 1) return;
58 for (uIndex
= 0; uIndex
< DevsNum
; uIndex
++)
60 if (waveInGetDevCaps(uIndex
, &waveInputPaps
, sizeof(waveInputPaps
)))
63 Res
= SendMessage(hCB
, CB_ADDSTRING
, 0, (LPARAM
) waveInputPaps
.szPname
);
67 SendMessage(hCB
, CB_SETITEMDATA
, Res
, (LPARAM
) uIndex
);
68 // TODO: Getting default device
69 SendMessage(hCB
, CB_SETCURSEL
, (WPARAM
) Res
, 0);
73 // Init MIDI devices list
74 hCB
= GetDlgItem(hwnd
, IDC_DEVICE_MIDI_LIST
);
76 DevsNum
= midiOutGetNumDevs();
77 if (DevsNum
< 1) return;
79 for (uIndex
= 0; uIndex
< DevsNum
; uIndex
++)
81 if (midiOutGetDevCaps(uIndex
, &midiOutCaps
, sizeof(midiOutCaps
)))
84 Res
= SendMessage(hCB
, CB_ADDSTRING
, 0, (LPARAM
) midiOutCaps
.szPname
);
88 SendMessage(hCB
, CB_SETITEMDATA
, Res
, (LPARAM
) uIndex
);
89 // TODO: Getting default device
90 SendMessage(hCB
, CB_SETCURSEL
, (WPARAM
) Res
, 0);
96 GetDevNum(HWND hControl
, DWORD Id
)
101 iCurSel
= SendMessage(hControl
, CB_GETCURSEL
, 0, 0);
103 if (iCurSel
== CB_ERR
)
106 DevNum
= (UINT
) SendMessage(hControl
, CB_GETITEMDATA
, iCurSel
, 0);
107 if (DevNum
== (UINT
) CB_ERR
)
110 if (mixerGetID((HMIXEROBJ
)IntToPtr(DevNum
), &DevNum
, Id
) != MMSYSERR_NOERROR
)
116 /* Audio property page dialog callback */
118 AudioDlgProc(HWND hwndDlg
,
123 UNREFERENCED_PARAMETER(lParam
);
124 UNREFERENCED_PARAMETER(wParam
);
125 UNREFERENCED_PARAMETER(hwndDlg
);
133 NumWavOut
= waveOutGetNumDevs();
136 EnableWindow(GetDlgItem(hwndDlg
, IDC_DEVICE_PLAY_LIST
), FALSE
);
137 EnableWindow(GetDlgItem(hwndDlg
, IDC_DEVICE_REC_LIST
), FALSE
);
138 EnableWindow(GetDlgItem(hwndDlg
, IDC_DEVICE_MIDI_LIST
), FALSE
);
139 EnableWindow(GetDlgItem(hwndDlg
, IDC_DEFAULT_DEV_CHECKBOX
), FALSE
);
140 EnableWindow(GetDlgItem(hwndDlg
, IDC_VOLUME1_BTN
), FALSE
);
141 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADV2_BTN
), FALSE
);
142 EnableWindow(GetDlgItem(hwndDlg
, IDC_VOLUME2_BTN
), FALSE
);
143 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADV1_BTN
), FALSE
);
144 EnableWindow(GetDlgItem(hwndDlg
, IDC_VOLUME3_BTN
), FALSE
);
145 EnableWindow(GetDlgItem(hwndDlg
, IDC_ADV3_BTN
), FALSE
);
149 InitAudioDlg(hwndDlg
);
157 PROCESS_INFORMATION pi
;
158 WCHAR szPath
[MAX_PATH
];
160 switch(LOWORD(wParam
))
162 case IDC_VOLUME1_BTN
:
164 wsprintf(szPath
, L
"sndvol32.exe -d %d",
165 GetDevNum(GetDlgItem(hwndDlg
, IDC_DEVICE_PLAY_LIST
), MIXER_OBJECTF_WAVEOUT
));
167 ZeroMemory(&si
, sizeof(si
));
169 si
.wShowWindow
= SW_SHOW
;
171 CreateProcess(NULL
, szPath
, NULL
, NULL
, FALSE
, 0, NULL
, NULL
, &si
, &pi
);
181 case IDC_VOLUME2_BTN
:
183 wsprintf(szPath
, L
"sndvol32.exe -r -d %d",
184 GetDevNum(GetDlgItem(hwndDlg
, IDC_DEVICE_REC_LIST
), MIXER_OBJECTF_WAVEIN
));
186 ZeroMemory(&si
, sizeof(si
));
188 si
.wShowWindow
= SW_SHOW
;
190 CreateProcess(NULL
, szPath
, NULL
, NULL
, FALSE
, 0, NULL
, NULL
, &si
, &pi
);
200 case IDC_VOLUME3_BTN
:
202 wsprintf(szPath
, L
"sndvol32.exe -d %d",
203 GetDevNum(GetDlgItem(hwndDlg
, IDC_DEVICE_MIDI_LIST
), MIXER_OBJECTF_MIDIOUT
));
205 ZeroMemory(&si
, sizeof(si
));
207 si
.wShowWindow
= SW_SHOW
;
209 CreateProcess(NULL
, szPath
, NULL
, NULL
, FALSE
, 0, NULL
, NULL
, &si
, &pi
);