ReactOS  0.4.14-dev-77-gd9e7c48
main.cpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions
7 are met:
8 1. Redistributions of source code must retain the above copyright
9  notice, this list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright
11  notice, this list of conditions and the following disclaimer in the
12  documentation and/or other materials provided with the distribution.
13 3. The name of the author may not be used to endorse or promote products
14  derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #include "main.h"
29 
30 
31 void PrintLastError(LPCSTR function)
32 {
33  LPVOID lpMsgBuf;
34  DWORD errorid = GetLastError();
35 
37  MessageBox(NULL, (LPCSTR)lpMsgBuf, function, MB_ICONEXCLAMATION | MB_OK);
38  LocalFree(lpMsgBuf);
39 }
40 
41 BOOL generateTestSignal(double amplitude, int Channels, int SamplesPerSec, SHORT** buffer)
42 {
43  int i, o2, o3, o4, o5;
44  bool Left,Right,BackLeft,BackRight,Center,Sub, CenterLeft, CenterRight;
45  short value;
46  double x = SPEAKER_FREQUENCY*2*3.141592654/SamplesPerSec;
47  double y = BASS_FREQUENCY*2*3.141592654/SamplesPerSec;
48 
56  CenterRight = (SendMessage(GetDlgItem(hWndChild[0], IDC_CRIGHT), BM_GETCHECK, 0, 0) == BST_CHECKED) && (currentChannelCount > 6);
57 
58  if (!(Left || Right || BackLeft || BackRight || Center || Sub || CenterLeft || CenterRight)) {
59  return FALSE;
60  }
61 
62  if (currentChannelCount > 4) {
63  o2 = 4; o3 = 5;
64  o4 = 2; o5 = 3;
65  } else {
66  o2 = 2; o3 = 3;
67  o4 = 4; o5 = 5;
68  }
69 
70  (*buffer) = (SHORT*)LocalAlloc(LPTR, SamplesPerSec*sizeof(SHORT)*Channels);
71  ZeroMemory((*buffer), SamplesPerSec*sizeof(SHORT)*Channels);
72 
73  for (i=0;i<SamplesPerSec;i++) {
74  value = (SHORT)(cos(i*x)*amplitude*32767.0);
75  if (Left) {
76  (*buffer)[(i*Channels)+0] = value;
77  }
78  if (Right) {
79  (*buffer)[(i*Channels)+1] = value;
80  }
81  if (BackLeft) {
82  (*buffer)[(i*Channels)+o2] = value;
83  }
84  if (BackRight) {
85  (*buffer)[(i*Channels)+o3] = value;
86  }
87  if (Center) {
88  (*buffer)[(i*Channels)+o4] = value;
89  }
90  if (Sub) {
91  (*buffer)[(i*Channels)+o5] = (SHORT)(cos(i*y)*amplitude*32767.0);
92  }
93  if (CenterLeft) {
94  (*buffer)[(i*Channels)+6] = value;
95  }
96  if (CenterRight) {
97  (*buffer)[(i*Channels)+7] = value;
98  }
99  }
100  return TRUE;
101 }
102 
104 {
105  if (hWave == NULL) {
106  return FALSE;
107  }
108 
110  PrintLastError("waveOutReset()");
111  return FALSE;
112  }
114  PrintLastError("waveOutClose()");
115  return FALSE;
116  }
117  hWave = NULL;
119  return TRUE;
120 }
121 
123 {
124  WAVEOUTCAPS woc;
125  UINT i, numDev;
126 
127  numDev = waveOutGetNumDevs();
128  for (i=0;i<numDev;i++) {
129  if (!waveOutGetDevCaps(i, &woc, sizeof(WAVEOUTCAPS))) {
131  (CompareString(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT), NORM_IGNORECASE, woc.szPname, -1, TEXT("Speakers (CMI8738/8768 Audio De"), -1) == CSTR_EQUAL)) {
132  return i;
133  }
134  }
135  }
136  return WAVE_MAPPER;
137 }
138 
140 {
141  SHORT* buffer;
142  BOOL isChannelChecked;
143 #if 1
145 
146  ZeroMemory(&wfx, sizeof(WAVEFORMATEXTENSIBLE));
150  wfx.Format.wBitsPerSample = 16;
151  wfx.Format.nBlockAlign = (wfx.Format.wBitsPerSample >> 3) * wfx.Format.nChannels;
153  wfx.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
156 #else
157  WAVEFORMATEX wfx;
159  wfx.wBitsPerSample = 16;
162  wfx.nAvgBytesPerSec = SAMPLE_RATE * (wfx.wBitsPerSample >> 3) * wfx.nChannels;
163  wfx.nBlockAlign = (wfx.wBitsPerSample >> 3) * wfx.nChannels;
164  wfx.cbSize = 0;
165 #endif
166 
167  isChannelChecked = (SendMessage(GetDlgItem(hWndChild[0], IDC_LEFT), BM_GETCHECK, 0, 0) == BST_CHECKED);
168  isChannelChecked |= (SendMessage(GetDlgItem(hWndChild[0], IDC_RIGHT), BM_GETCHECK, 0, 0) == BST_CHECKED);
169  isChannelChecked |= (SendMessage(GetDlgItem(hWndChild[0], IDC_BLEFT), BM_GETCHECK, 0, 0) == BST_CHECKED) && (currentChannelCount > 2);
170  isChannelChecked |= (SendMessage(GetDlgItem(hWndChild[0], IDC_BRIGHT), BM_GETCHECK, 0, 0) == BST_CHECKED) && (currentChannelCount > 2);
171  isChannelChecked |= (SendMessage(GetDlgItem(hWndChild[0], IDC_CENTER), BM_GETCHECK, 0, 0) == BST_CHECKED) && (currentChannelCount > 4);
172  isChannelChecked |= (SendMessage(GetDlgItem(hWndChild[0], IDC_SUB), BM_GETCHECK, 0, 0) == BST_CHECKED) && (currentChannelCount > 4);
173  isChannelChecked |= (SendMessage(GetDlgItem(hWndChild[0], IDC_CLEFT), BM_GETCHECK, 0, 0) == BST_CHECKED) && (currentChannelCount > 6);
174  isChannelChecked |= (SendMessage(GetDlgItem(hWndChild[0], IDC_CRIGHT), BM_GETCHECK, 0, 0) == BST_CHECKED) && (currentChannelCount > 6);
175 
176  if (!isChannelChecked)
177  return FALSE;
178 
180  PrintLastError("waveOutOpen()");
181  return FALSE;
182  }
183 
185  return FALSE;
186  }
187 
188  ZeroMemory(&pwh, sizeof(pwh));
189  pwh.lpData = (LPSTR)buffer;
192  pwh.dwLoops = 0xFFFFFFFF;
193  if (waveOutPrepareHeader(hWave, &pwh, sizeof(pwh)) != MMSYSERR_NOERROR) {
194  LocalFree(buffer);
195  PrintLastError("waveOutPrepareHeader()");
196  return FALSE;
197  }
198 
200  LocalFree(buffer);
201  PrintLastError("waveOutReset()");
202  return FALSE;
203  }
204  if (waveOutWrite(hWave, &pwh, sizeof(WAVEHDR)) != MMSYSERR_NOERROR) {
205  LocalFree(buffer);
206  PrintLastError("waveOutWrite()");
207  return FALSE;
208  }
209 
210  return TRUE;
211 }
212 
213 
214 BOOL CALLBACK DSEnumProc(LPGUID lpGUID, LPCTSTR lpszDesc, LPCTSTR lpszDrvName, LPVOID lpContext)
215 {
216  LPGUID* pGUID = (LPGUID*)lpContext;
217 
218  if (pGUID == NULL) {
219  return FALSE;
220  }
221  if ((*pGUID) != NULL) {
222  return TRUE;
223  }
224 
225  if (lpGUID != NULL) {
226  // XP, 2k
227  if ((CompareString(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT), NORM_IGNORECASE, lpszDrvName, -1, TEXT("cmipci.sys"), -1) == CSTR_EQUAL) &&
228  (CompareString(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT), NORM_IGNORECASE, lpszDesc, -1, TEXT("CMI8738/8768 Wave"), -1) == CSTR_EQUAL)) {
229  (*pGUID) = (LPGUID)LocalAlloc(LPTR, sizeof(GUID));
230  memcpy((*pGUID), lpGUID, sizeof(GUID));
231  return TRUE;
232  }
233  // Vista
234  if (CompareString(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT), NORM_IGNORECASE, lpszDesc, -1, TEXT("Speakers (CMI8738/8768 Audio Device)"), -1) == CSTR_EQUAL) {
235  (*pGUID) = (LPGUID)LocalAlloc(LPTR, sizeof(GUID));
236  memcpy((*pGUID), lpGUID, sizeof(GUID));
237  return TRUE;
238  }
239  }
240  return TRUE;
241 }
242 
244 {
245  IDirectSound8* ds;
246  DWORD speakerConfig;
247  LPGUID guid = NULL;
248 
249  DirectSoundEnumerate((LPDSENUMCALLBACK)DSEnumProc, (VOID*)&guid);
250 
251  if (DirectSoundCreate8(guid, &ds, NULL) != S_OK) {
252  return FALSE;
253  }
254 
255  ds->Initialize(NULL);
256 
257  if (ds->GetSpeakerConfig(&speakerConfig) != S_OK) {
258  PrintLastError("GetSpeakerConfig()");
259  return FALSE;
260  }
261 
262  if (ds) {
263  ds->Release();
264  }
265  if (guid) {
266  LocalFree(guid);
267  }
268 
269  switch (DSSPEAKER_CONFIG(speakerConfig)) {
270  case DSSPEAKER_STEREO: currentChannelCount = 2; return TRUE;
271  case DSSPEAKER_QUAD: currentChannelCount = 4; return TRUE;
272  case DSSPEAKER_5POINT1: currentChannelCount = 6; return TRUE;
273  case DSSPEAKER_7POINT1: currentChannelCount = 8; return TRUE;
274  }
275 
276  return FALSE;
277 }
278 
280 {
281  IDirectSound8* ds;
282  DWORD speakerConfig;
283  LPGUID guid = NULL;
284 
285  DirectSoundEnumerate((LPDSENUMCALLBACK)DSEnumProc, (VOID*)&guid);
286 
287  if (DirectSoundCreate8(guid, &ds, NULL) != S_OK) {
288  PrintLastError("DirectSoundCreate8()");
289  return FALSE;
290  }
291 
292 
293  ds->Initialize(NULL);
294 
295  switch (currentChannelCount) {
296  case 2: speakerConfig = DSSPEAKER_STEREO; break;
297  case 4: speakerConfig = DSSPEAKER_QUAD; break;
298  case 6: speakerConfig = DSSPEAKER_5POINT1; break;
299  case 8: speakerConfig = DSSPEAKER_7POINT1; break;
300  default: speakerConfig = DSSPEAKER_STEREO; break;
301  }
302 
303  if (ds->SetSpeakerConfig(speakerConfig) != S_OK) {
304  PrintLastError("SetSpeakerConfig()");
305  return FALSE;
306  }
307 
308  if (ds) {
309  ds->Release();
310  }
311  if (guid) {
312  LocalFree(guid);
313  }
314 
315 
316  return FALSE;
317 }
318 
320 {
321  TCHAR szServiceName[128];
322  int nIndex = 0;
323 
325  if (pDev->Info == INVALID_HANDLE_VALUE) {
326  PrintLastError("SetupDiGetClassDevs()");
327  return FALSE;
328  }
329 
330  pDev->InfoData.cbSize = sizeof(SP_DEVINFO_DATA);
331 
332  while (SetupDiEnumDeviceInfo(pDev->Info, nIndex, &(pDev->InfoData))) {
333  if (!SetupDiGetDeviceRegistryProperty(pDev->Info, &(pDev->InfoData), SPDRP_SERVICE, NULL, (PBYTE)szServiceName, sizeof(szServiceName), NULL)) {
334  PrintLastError("SetupDiGetDeviceRegistryProperty()");
336  pDev->Info = NULL;
337  return FALSE;
338  }
339 
341  return TRUE;
342  }
343  nIndex++;
344  }
345 
347  pDev->Info = NULL;
348  return FALSE;
349 }
350 
352 {
353  DWORD dataSize = 0;
354  BOOL result;
355  PTSTR pnpStr = NULL;
356  HDEVINFO hDevInfoWithInterface;
357  SP_DEVICE_INTERFACE_DATA DeviceInterfaceData;
358 
359  // get the PnP string
360  SetupDiGetDeviceInstanceId(pDev->Info, &(pDev->InfoData), NULL, 0, &dataSize);
362  PrintLastError("SetupDiGetDeviceInstanceId()");
363  return FALSE;
364  }
365  pnpStr = (PTSTR)LocalAlloc(LPTR, dataSize * sizeof(TCHAR));
366  if (!pnpStr) {
367  PrintLastError("LocalAlloc()");
368  return FALSE;
369  }
370  result = SetupDiGetDeviceInstanceId(pDev->Info, &(pDev->InfoData), pnpStr, dataSize, NULL);
371  if (!result) {
372  PrintLastError("SetupDiGetDeviceInstanceId()");
373  LocalFree(pnpStr);
374  return FALSE;
375  }
376  hDevInfoWithInterface = SetupDiGetClassDevs(&KSCATEGORY_TOPOLOGY, pnpStr, NULL, DIGCF_DEVICEINTERFACE);
377  LocalFree(pnpStr);
378  if (hDevInfoWithInterface == INVALID_HANDLE_VALUE) {
379  PrintLastError("SetupDiGetClassDevs()");
380  return FALSE;
381  }
382 
383  // get the device interface data
384  DeviceInterfaceData.cbSize = sizeof(DeviceInterfaceData);
385  result = SetupDiEnumDeviceInterfaces(hDevInfoWithInterface, NULL, &KSCATEGORY_TOPOLOGY, 0, &DeviceInterfaceData);
386  if (!result) {
387  PrintLastError("SetupDiEnumDeviceInterfaces()");
388  SetupDiDestroyDeviceInfoList(hDevInfoWithInterface);
389  return FALSE;
390  }
391 
392  // get the device interface detail data
393  dataSize = 0;
394  SetupDiGetDeviceInterfaceDetail(hDevInfoWithInterface, &DeviceInterfaceData, NULL, 0, &dataSize, NULL);
396  PrintLastError("SetupDiGetDeviceInterfaceDetail()");
397  SetupDiDestroyDeviceInfoList(hDevInfoWithInterface);
398  return FALSE;
399  }
401  if (!pDev->InterfaceDetailData) {
402  PrintLastError("LocalAlloc()");
403  SetupDiDestroyDeviceInfoList(hDevInfoWithInterface);
404  return FALSE;
405  }
407  result = SetupDiGetDeviceInterfaceDetail(hDevInfoWithInterface, &DeviceInterfaceData, pDev->InterfaceDetailData, dataSize, NULL, NULL);
408  SetupDiDestroyDeviceInfoList(hDevInfoWithInterface);
409  if (!result) {
410  PrintLastError("SetupDiGetDeviceInterfaceDetail()");
412  pDev->InterfaceDetailData = NULL;
413  return FALSE;
414  }
415 
416  return TRUE;
417 
418 }
419 
421 {
422  BOOL result;
423  HANDLE hDevice;
424  KSPROPERTY KSProp;
425  DWORD dataSize;
426 
428  if (hDevice == INVALID_HANDLE_VALUE) {
429  PrintLastError("CreateFile()");
430  return FALSE;
431  }
432  KSProp.Set = KSPROPSETID_CMI;
433  KSProp.Flags = KSPROPERTY_TYPE_GET;
434  KSProp.Id = KSPROPERTY_CMI_GET;
435  result = DeviceIoControl(hDevice, IOCTL_KS_PROPERTY, &KSProp, sizeof(KSProp), &cmiData, sizeof(cmiData), &dataSize, NULL);
436  CloseHandle(hDevice);
437 
438  if (!result) {
439  PrintLastError("DeviceIoControl()");
440  return FALSE;
441  }
442 
443  return TRUE;
444 }
445 
447 {
448  BOOL result;
449  HANDLE hDevice;
450  KSPROPERTY KSProp;
451  DWORD dataSize;
452 
454  if (hDevice == INVALID_HANDLE_VALUE) {
455  PrintLastError("CreateFile()");
456  return FALSE;
457  }
458  KSProp.Set = KSPROPSETID_CMI;
459  KSProp.Flags = KSPROPERTY_TYPE_SET;
460  KSProp.Id = KSPROPERTY_CMI_SET;
461  result = DeviceIoControl(hDevice, IOCTL_KS_PROPERTY, &KSProp, sizeof(KSProp), &cmiData, sizeof(cmiData), &dataSize, NULL);
462  CloseHandle(hDevice);
463 
464  if (!result) {
465  PrintLastError("DeviceIoControl()");
466  return FALSE;
467  }
468 
469  return TRUE;
470 }
471 
472 void cleanUp()
473 {
474  stopTestTone();
475  if (cmiTopologyDev.Info) {
478  }
482  }
483  if (hURLFont) {
484  DeleteObject(hURLFont); //hm?
485  hURLFont = NULL;
486  }
487 }
488 
489 BOOL openDevice(bool handleError)
490 {
492  if (handleError)
493  PrintLastError("getDeviceInfo()");
494  return FALSE;
495  }
496 
498  if (handleError)
499  PrintLastError("getDeviceInterfaceDetail()");
500  return FALSE;
501  }
502 
503  return TRUE;
504 }
505 
507 {
509  case 0: // stereo
517  break;
518  case 1: // quad
526  break;
527  case 2: // 5.1
534  SetDlgItemText(hWnd, IDT_SWAPJACKS, "BL/BR and C/LFE jacks are swapped!");
535  break;
536  case 3: // 7.1
543  SetDlgItemText(hWnd, IDT_SWAPJACKS, "BL/BR and C/LFE jacks are swapped!");
544  break;
545  }
546 }
547 
548 
550 {
551  HWND hWndItem;
552  char buffer[127];
553 
554  if (!getDriverData(&cmiTopologyDev)) {
555  PrintLastError("getDriverData()");
556  return FALSE;
557  }
558 
559  // 'About' tab
565  wsprintf(buffer, "%04X", cmiData.IOBase);
567  wsprintf(buffer, "%04X", cmiData.MPUBase);
569 
570  // channel config combobox
571  hWndItem = GetDlgItem(hWndChild[0], IDCB_CHANNELCONFIG);
572  SendMessage(hWndItem, CB_RESETCONTENT, 0, 0);
573  if (cmiData.maxChannels >= 2) {
574  SendMessage(hWndItem, CB_ADDSTRING, 0, (LPARAM)"Stereo (2.0)");
575  }
576  if (cmiData.maxChannels >= 4) {
577  SendMessage(hWndItem, CB_ADDSTRING, 0, (LPARAM)"Quadrophonic (4.0)");
578  }
579  if (cmiData.maxChannels >= 6) {
580  SendMessage(hWndItem, CB_ADDSTRING, 0, (LPARAM)"5.1 Surround");
581  }
582  if (cmiData.maxChannels >= 8) {
583  SendMessage(hWndItem, CB_ADDSTRING, 0, (LPARAM)"7.1 Surround");
584  }
585  if (getCurrentChannelConfig()) {
588  SendMessage(hWndItem, CB_SETCURSEL, (currentChannelCount/2)-1, 0);
590  } else {
593  }
594 
595  // checkboxes
598 
607 
620 
621  // radioboxes
625 
628 
629 
630  return TRUE;
631 }
632 
634 {
641 
650 
651  cmiData.formatMask = 0;
664 
666 
668 }
669 
671 {
672  HICON hIcon;
673  TC_ITEM tci;
674  int i;
675 
677  SendMessage(hWnd, WM_SETICON, (LPARAM) ICON_BIG, (WPARAM) hIcon);
678  hURLFont = 0;
679 
681 
682  ZeroMemory(&tci, sizeof(TC_ITEM));
683  tci.mask = TCIF_TEXT;
684  for (i=0;i<NUM_TABS;i++) {
685  tci.pszText = tabsName[i];
686  if (TabCtrl_InsertItem(hWndTab, i, &tci) == -1) {
687  PrintLastError("TabCtrl_InsertItem()");
688  return FALSE;
689  }
691  }
692 
693  hURLFont = CreateFont(20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, VARIABLE_PITCH | FF_SWISS, "MS Shell Dlg");
695 
696  currentTab = 0;
698 
699  if (!openDevice(TRUE)) {
700  PrintLastError("openDevice()");
701  return FALSE;
702  }
703  return setDlgItems(hWnd);
704 }
705 
707 {
708  if (lpnmhdr->code != TCN_SELCHANGE) {
709  return FALSE;
710  }
714  return TRUE;
715 }
716 
718 {
719  switch(msg) {
720  case WM_INITDIALOG:
721  if (!initDialog(hWnd)) {
722  PostQuitMessage(0);
723  }
724  return TRUE;
725  case WM_CLOSE:
727  return TRUE;
728  case WM_NOTIFY:
729  return changeTab((LPNMHDR)lParam);
730  case WM_DESTROY:
731  cleanUp();
732  PostQuitMessage(0);
733  return TRUE;
734  case WM_COMMAND:
735  if (LOWORD(wParam) == IDB_CLOSE) {
736  PostQuitMessage(0);
737  return TRUE;
738  }
739  if (LOWORD(wParam) == IDB_APPLY) {
740  applySettings();
741  setDlgItems(hWnd);
742  return TRUE;
743  }
744  break;
745  }
746  return 0;
747 }
748 
749 void openURL(int control)
750 {
751  char buffer[127];
752  GetWindowText(GetDlgItem(hWndChild[3], control), buffer, sizeof(buffer));
754 }
755 
757 {
758  switch(msg) {
759  case WM_COMMAND:
760  switch (LOWORD(wParam)) {
761  case IDB_STARTSTOP:
762  if (stopTestTone()) {
763  SetDlgItemText(hWndChild[0], IDB_STARTSTOP, "&Play test tone");
764  return TRUE;
765  }
766  if (playTestTone()) {
767  SetDlgItemText(hWndChild[0], IDB_STARTSTOP, "&Stop");
768  return TRUE;
769  }
770  break;
771  case IDC_URL1:
772  case IDC_URL2:
774  break;
775  }
776  case WM_CTLCOLORSTATIC:
778  SetTextColor((HDC)wParam, 0xFF0000);
781  }
782  }
783 
784  return 0;
785 }
786 
788 {
789  unsigned char usage[] = "/h - print this help message\r\n" \
790  "/enable71Mode - change channel configuration to 7.1\r\n" \
791  "/enable51Mode - change channel configuration to 5.1\r\n" \
792  "/enable40Mode - change channel configuration to 4.0 (Quad)\r\n" \
793  "/enable20Mode - change channel configuration to 2.0 (Stereo)\r\n" \
794  "/enableSPDIFo - enable SPDIF-out\r\n" \
795  "/disableSPDIFo - disable SPDIF-out\r\n"\
796  "/enableSPDIFi - enable SPDIF-in recording\r\n" \
797  "/disableSPDIFi - disable SPDIF-in recording\r\n" \
798  "/enableLoopThru - enable loop-through from SPDIF-in to SPDIF-out\r\n" \
799  "/disableLoopThru - disable loop-through from SPDIF-in to SPDIF-out\r\n";
800 
801  MessageBox(NULL, (LPCSTR)usage, TEXT("Usage Help"), MB_ICONINFORMATION | MB_OK);
802  return;
803 }
804 
806  TCHAR SysDir[MAX_PATH];
807  unsigned int len;
808  if (GetSystemDirectory(SysDir, sizeof(SysDir))==0) {
809  PrintLastError("GetSystemDirectory()");
810  return;
811  }
812  len = strlen(SysDir);
813 
814  strcat(SysDir, "\\cmicpl.cpl");
815  if (!DeleteFile(SysDir)) {
817  }
818  SysDir[len] = 0;
819 
820  strcat(SysDir, "\\cmicontrol.exe");
821  if (!DeleteFile(SysDir)) {
823  }
824 }
825 
826 
829  RegDeleteKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\CMIDriver");
830  MessageBox(NULL, "The CMI driver applications have been successfully removed from your computer!", "CMIDriver", MB_ICONINFORMATION);
831  ExitProcess(0);
832 }
833 
834 bool checkToken(char* token) {
835  if ((strcmp(token, "?")==0) || (strcmp(token, "H")==0)) {
836  printUsage();
837  return TRUE;
838  } else
839  if (strcmp(token, "ENABLE71MODE")==0) {
841  } else
842  if (strcmp(token, "ENABLE51MODE")==0) {
844  } else
845  if ((strcmp(token, "ENABLE40MODE")==0) || (strcmp(token, "ENABLEQUADMODE")==0) || (strcmp(token, "QUAD")==0) ) {
847  } else
848  if ((strcmp(token, "ENABLE20MODE")==0) || (strcmp(token, "ENABLESTEREOMODE")==0) || (strcmp(token, "STEREO")==0) ) {
850  } else
851  if (strcmp(token, "ENABLESPDIFO")==0) {
853  } else
854  if (strcmp(token, "DISABLESPDIFO")==0) {
856  } else
857  if (strcmp(token, "ENABLESPDIFI")==0) {
859  } else
860  if (strcmp(token, "DISABLESPDIFI")==0) {
862  } else
863  if ((strcmp(token, "ENABLELOOPTHRU")==0) || (strcmp(token, "ENABLELOOPTHROUGH")==0) || (strcmp(token, "ENABLELOOP")==0) ) {
865  } else
866  if ((strcmp(token, "DISABLELOOPTHRU")==0) || (strcmp(token, "DISABLELOOPTHROUGH")==0) || (strcmp(token, "DISABLELOOP")==0) ) {
868  } else
869  if (strcmp(token, "UNINSTALL")==0) {
871  }
872  return FALSE;
873 }
874 
875 int parseArguments(LPSTR szCmdLine) {
876  BOOL inToken = false, result;
877  int i = 0, j=0;
878  char token[MAX_TOKEN_SIZE];
879 
880  if (openDevice(FALSE)) {
882  currentChannelCount = -1;
883  }
884 
885  while (szCmdLine[i]) {
886  if (inToken) {
887  if (szCmdLine[i] == ' ') {
888  inToken = false;
889  token[j] = 0;
890  if (checkToken(token)) {
891  return TRUE;
892  }
893  } else {
894  token[j] = (char)toupper(szCmdLine[i]);
895  if (j < MAX_TOKEN_SIZE-1) {
896  j++;
897  }
898  }
899  } else {
900  if ((szCmdLine[i] == '-') || (szCmdLine[i] == '/')) {
901  j = 0;
902  inToken = true;
903  }
904  }
905 
906  i++;
907  }
908  token[j] = 0;
909  checkToken(token);
910 
912  if (currentChannelCount != -1)
914  return result;
915 }
916 
918 {
919  WNDCLASSEX wce;
920 
921  ZeroMemory(&wce, sizeof(wce));
922  wce.cbSize = sizeof(WNDCLASSEX);
923  if (GetClassInfoEx(hInst, "Static", &wce)==0) {
924  PrintLastError("GetClassInfoEx()");
925  return;
926  }
927 
929  wce.hInstance = hInst;
930  wce.lpszClassName = "URLLink";
931  if (RegisterClassEx(&wce) == 0) {
932  PrintLastError("RegisterClassEx()");
933  }
934 
935 }
936 
937 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
938 {
939  WNDCLASSEX wce;
940  MSG msg;
941 
942  ZeroMemory(&cmiData, sizeof(CMIDATA));
943  ZeroMemory(&cmiTopologyDev, sizeof(CMIDEV));
944  hWave = NULL;
945 
946  if (szCmdLine && szCmdLine[0] != 0) {
947  int result = parseArguments(szCmdLine);
948  cleanUp();
949  return result;
950  }
951 
952  if ((hWndMain = FindWindow("cmiControlPanel", NULL))) {
954  return FALSE;
955  }
956 
957  hInst = hInstance;
960 
961  ZeroMemory(&wce, sizeof(WNDCLASSEX));
962  wce.cbSize = sizeof(WNDCLASSEX);
963  wce.lpfnWndProc = DefDlgProc;
964  wce.style = 0;
966  wce.hInstance = hInstance;
968  wce.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
969  wce.lpszClassName = "cmiControlPanel";
970  wce.lpszMenuName = NULL;
973  if(!RegisterClassEx(&wce)) {
974  PrintLastError("RegisterClassEx()");
975  return -1;
976  }
977  InitURLControl();
978 
980  if (!hWndMain) {
981  PrintLastError("CreateDialogParam()");
982  return -1;
983  }
984 
985  while (GetMessage(&msg, (HWND) NULL, 0, 0)) {
988  }
989  return 0;
990 }
#define IDC_FMT_441_MULTI_PCM
Definition: resource.h:75
UInt32 invertPhaseSPDI
Definition: property.h:79
UInt32 maxChannels
Definition: property.h:68
#define IDC_MAXCHAN
Definition: resource.h:87
#define FMT_882_DOLBY
Definition: property.h:52
#define IDC_FMT_480_PCM
Definition: resource.h:72
#define TCM_GETCURSEL
Definition: commctrl.h:4034
BOOL WINAPI SetupDiEnumDeviceInfo(HDEVINFO devinfo, DWORD index, PSP_DEVINFO_DATA info)
Definition: devinst.c:1792
BOOL getDeviceInterfaceDetail(const GUID *category, CMIDEV *pDev)
Definition: main.cpp:351
bool checkToken(char *token)
Definition: main.cpp:834
UINT style
Definition: winuser.h:3176
#define IOCTL_KS_PROPERTY
Definition: ks.h:127
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define SW_SHOWDEFAULT
Definition: winuser.h:774
UInt32 enableSPDIMonitor
Definition: property.h:69
#define MAKELCID(lgid, srtid)
#define DispatchMessage
Definition: winuser.h:5666
BOOL WINAPI TranslateMessage(_In_ const MSG *)
static HICON
Definition: imagelist.c:84
LPCSTR lpszMenuName
Definition: winuser.h:3184
#define TRUE
Definition: types.h:120
HRESULT WINAPI DirectSoundCreate8(LPCGUID lpcGUID, LPDIRECTSOUND8 *ppDS, IUnknown *pUnkOuter)
Definition: directsound.c:504
UInt32 enableSPDI
Definition: property.h:83
#define IDC_NOROUTE_LINE
Definition: resource.h:44
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
int hardwareRevision
Definition: property.h:65
#define IDC_FMT_441_PCM
Definition: resource.h:71
#define CloseHandle
Definition: compat.h:398
#define KSDATAFORMAT_SUBTYPE_PCM
Definition: ksmedia.h:921
#define RegisterClassEx
Definition: winuser.h:5738
#define VARIABLE_PITCH
Definition: wingdi.h:444
#define FindWindow
Definition: winuser.h:5678
PSP_DEVICE_INTERFACE_DETAIL_DATA InterfaceDetailData
Definition: main.h:66
#define DSSPEAKER_STEREO
Definition: dsound.h:308
HCURSOR hCursor
Definition: winuser.h:3182
WNDPROC lpfnWndProc
Definition: winuser.h:3177
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
#define FMT_480_MULTI_PCM
Definition: property.h:47
#define IDC_TAB
Definition: resource.h:12
SP_DEVICE_INTERFACE_DETAIL_DATA_A * PSP_DEVICE_INTERFACE_DETAIL_DATA
Definition: setupapi.h:1144
#define IDC_HWREV
Definition: resource.h:86
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
LPCSTR lpszClassName
Definition: winuser.h:3185
#define IDC_FMT_882_PCM
Definition: resource.h:73
UInt32 formatMask
Definition: property.h:82
#define SW_HIDE
Definition: winuser.h:762
#define DSSPEAKER_7POINT1
Definition: dsound.h:312
#define LANG_NEUTRAL
Definition: nls.h:22
#define IDC_NOROUTE_MIC
Definition: resource.h:46
#define WHDR_BEGINLOOP
Definition: mmsystem.h:195
#define KSPROPERTY_CMI_GET
Definition: property.h:39
#define TC_ITEM
Definition: commctrl.h:3979
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1754
void PrintLastError(LPCSTR function)
Definition: main.cpp:31
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define SUBLANG_DEFAULT
Definition: nls.h:168
#define SPEAKER_FREQUENCY
Definition: main.h:58
#define WHDR_ENDLOOP
Definition: mmsystem.h:196
static HDC
Definition: imagelist.c:92
#define CALLBACK
Definition: compat.h:27
HWND hWnd
Definition: settings.c:17
#define IDC_CLEFT
Definition: resource.h:49
#define IDB_APPLY
Definition: resource.h:36
#define ds
Definition: i386-dis.c:434
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1487
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
GLuint buffer
Definition: glext.h:5915
UInt32 loopSPDI
Definition: property.h:81
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define SetupDiGetDeviceRegistryProperty
Definition: setupapi.h:2598
UInt32 invertValidBitSPDI
Definition: property.h:80
#define FMT_480_PCM
Definition: property.h:43
char driverVersion[32]
Definition: property.h:64
#define MoveFileEx
Definition: winbase.h:3695
UINT_PTR WPARAM
Definition: windef.h:207
LRESULT CALLBACK TabDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: main.cpp:756
LPSTR lpData
Definition: mmsystem.h:1014
#define NORM_IGNORECASE
Definition: winnls.h:173
void performUninstall()
Definition: main.cpp:827
#define TCIF_TEXT
Definition: commctrl.h:3943
HICON hIconSm
Definition: winuser.h:3186
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
BOOL setDriverData(CMIDEV *pDev)
Definition: main.cpp:446
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDC_URL1
Definition: resource.h:90
#define DeleteFile
Definition: winbase.h:3581
char * LPSTR
Definition: xmlstorage.h:182
#define IDC_EN_CENTER2MIC
Definition: resource.h:45
BOOL openDevice(bool handleError)
Definition: main.cpp:489
BOOL WINAPI DestroyWindow(_In_ HWND)
#define IDC_RIGHT
Definition: resource.h:52
#define COLOR_WINDOW
Definition: winuser.h:908
#define KSPROPERTY_TYPE_GET
Definition: dmksctrl.h:42
#define CB_GETCURSEL
Definition: winuser.h:1925
WPARAM wParam
Definition: combotst.c:138
GUID Set
Definition: dmksctrl.h:76
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define IDD_MAIN
Definition: resource.h:106
#define FILE_SHARE_READ
Definition: compat.h:125
#define IDB_STARTSTOP
Definition: resource.h:56
#define SUBLANG_ENGLISH_US
Definition: nls.h:222
UINT WINAPI waveOutPrepareHeader(HWAVEOUT hWaveOut, WAVEHDR *lpWaveOutHdr, UINT uSize)
Definition: winmm.c:2280
#define GetWindowText
Definition: winuser.h:5699
union WAVEFORMATEXTENSIBLE::@2897 Samples
#define IDC_LOOP_SPDF
Definition: resource.h:66
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
DWORD dwLoops
Definition: mmsystem.h:1019
UINT code
Definition: winuser.h:3133
UInt32 enableCenter2Mic
Definition: property.h:74
#define SAMPLE_RATE
Definition: main.h:53
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
#define FMT_441_PCM
Definition: property.h:42
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
HINSTANCE hInstance
Definition: charmap.c:20
const GUID * guid
BOOL playTestTone()
Definition: main.cpp:139
#define WAVE_FORMAT_PCM
Definition: constants.h:425
#define IDC_FMT_480_DOLBY
Definition: resource.h:80
UInt32 enableSPDOCopyright
Definition: property.h:77
UInt32 enableCenter2Line
Definition: property.h:72
HINSTANCE hInstance
Definition: winuser.h:3180
#define IDC_BLEFT
Definition: resource.h:53
#define IDC_BASEADR
Definition: resource.h:88
void printUsage()
Definition: main.cpp:787
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL applySettings()
Definition: main.cpp:633
short SHORT
Definition: pedump.c:59
UInt16 MPUBase
Definition: property.h:67
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 token
Definition: glfuncs.h:210
DWORD dwFlags
Definition: mmsystem.h:1018
#define FMT_441_DOLBY
Definition: property.h:50
#define ShellExecute
Definition: shellapi.h:689
CMIDEV cmiTopologyDev
Definition: main.h:77
CMIDATA cmiData
Definition: main.h:78
WORD wBitsPerSample
Definition: audioclient.idl:45
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
#define TRANSPARENT
Definition: wingdi.h:949
UInt32 enableSPDO5V
Definition: property.h:76
#define CreateFont
Definition: wingdi.h:4438
HFONT hURLFont
Definition: main.h:82
#define CB_ADDSTRING
Definition: winuser.h:1918
#define IDC_FMT_480_MULTI_PCM
Definition: resource.h:76
#define IDC_EN_SPDO
Definition: resource.h:59
BOOL setDlgItems(HWND hWnd)
Definition: main.cpp:549
_STLP_DECLSPEC complex< float > _STLP_CALL cos(const complex< float > &)
smooth NULL
Definition: ftsmooth.c:416
#define KSPROPSETID_CMI
Definition: property.h:36
HWAVEOUT hWave
Definition: main.h:79
unsigned char
Definition: typeof.h:29
#define MAX_TOKEN_SIZE
Definition: main.h:61
#define IDC_CENTER
Definition: resource.h:50
LONG_PTR LPARAM
Definition: windef.h:208
#define MOVEFILE_DELAY_UNTIL_REBOOT
Definition: winbase.h:381
UINT cbSize
Definition: winuser.h:3175
#define IDC_FMT_960_PCM
Definition: resource.h:74
#define BM_GETCHECK
Definition: winuser.h:1900
BOOL getDriverData(CMIDEV *pDev)
Definition: main.cpp:420
const char * LPCSTR
Definition: xmlstorage.h:183
UINT WINAPI waveOutGetNumDevs(void)
Definition: winmm.c:2140
#define SW_SHOW
Definition: winuser.h:769
#define CB_RESETCONTENT
Definition: winuser.h:1941
CHAR * PTSTR
Definition: xmlstorage.h:191
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
#define SetupDiGetDeviceInterfaceDetail
Definition: setupapi.h:2596
void InitURLControl()
Definition: main.cpp:917
#define IDC_MPUADR
Definition: resource.h:89
#define OPEN_EXISTING
Definition: compat.h:426
HBRUSH hbrBackground
Definition: winuser.h:3183
UInt32 enableSPDO
Definition: property.h:75
#define WM_DESTROY
Definition: winuser.h:1591
#define IDC_EN_SPDIMONITOR
Definition: resource.h:68
DWORD nSamplesPerSec
Definition: audioclient.idl:42
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
struct _SP_DEVINFO_DATA SP_DEVINFO_DATA
#define FMT_960_MULTI_PCM
Definition: property.h:49
BOOL initDialog(HWND hWnd)
Definition: main.cpp:670
char TCHAR
Definition: xmlstorage.h:189
#define IDC_VERSION
Definition: resource.h:291
#define KSPROPERTY_CMI_SET
Definition: property.h:40
#define TCN_SELCHANGE
Definition: commctrl.h:4104
#define SPEAKER_AMPLITUDE
Definition: main.h:59
#define IDC_HAND
Definition: winuser.h:693
#define IDC_LEFT
Definition: resource.h:48
#define IDC_FMT_882_MULTI_PCM
Definition: resource.h:77
#define BM_SETCHECK
Definition: winuser.h:1903
int toupper(int c)
Definition: utclib.c:881
BOOL setCurrentChannelConfig()
Definition: main.cpp:279
#define GetClassInfoEx
Definition: winuser.h:5681
#define IDC_SUB
Definition: resource.h:55
#define CompareString
Definition: winnls.h:1171
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define WAVE_MAPPER
Definition: mmsystem.h:187
ULONG Id
Definition: dmksctrl.h:77
UInt32 exchangeFrontBack
Definition: property.h:70
int tabsResource[]
Definition: resource.h:94
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
WAVEFORMATEX Format
Definition: ksmedia.h:538
#define SORT_DEFAULT
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
#define WM_CLOSE
Definition: winuser.h:1603
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:8
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
Definition: main.cpp:937
int cbWndExtra
Definition: winuser.h:3179
#define IDCB_CHANNELCONFIG
Definition: resource.h:47
UInt32 enableRear2Line
Definition: property.h:73
#define IDC_SEL_SPDIFI
Definition: resource.h:63
#define FMT_960_PCM
Definition: property.h:45
#define SetDlgItemText
Definition: winuser.h:5750
#define BASS_FREQUENCY
Definition: main.h:55
#define IDC_FMT_960_MULTI_PCM
Definition: resource.h:78
#define IDC_BRIGHT
Definition: resource.h:54
#define LANG_ENGLISH
Definition: nls.h:52
UINT WINAPI waveOutWrite(HWAVEOUT hWaveOut, LPWAVEHDR lpWaveOutHdr, UINT uSize)
Definition: winmm.c:2344
#define FormatMessage
Definition: winbase.h:3612
#define MB_ICONINFORMATION
Definition: winuser.h:796
#define IDC_FMT_882_DOLBY
Definition: resource.h:81
UInt16 IOBase
Definition: property.h:66
ULONG Flags
Definition: dmksctrl.h:78
HICON hIcon
Definition: winuser.h:3181
#define SetupDiGetDeviceInstanceId
Definition: setupapi.h:2595
#define DLGWINDOWEXTRA
Definition: winuser.h:2540
#define IDC_URL2
Definition: resource.h:91
#define COLOR_BTNFACE
Definition: winuser.h:918
HWND hWndMain
Definition: welcome.c:60
#define DirectSoundEnumerate
Definition: dsound.h:411
#define IDC_EN_CLFE2LINE
Definition: resource.h:43
#define DSSPEAKER_CONFIG(a)
Definition: dsound.h:323
DWORD dwBufferLength
Definition: mmsystem.h:1015
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
UInt32 enableBass2Line
Definition: property.h:71
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define IDC_EXCH_FB
Definition: resource.h:41
GLenum GLsizei len
Definition: glext.h:6722
void openURL(int control)
Definition: main.cpp:749
CHAR DevicePath[ANYSIZE_ARRAY]
Definition: setupapi.h:846
#define SPDRP_SERVICE
Definition: setupapi.h:506
#define CSTR_EQUAL
Definition: winnls.h:453
#define SetupDiGetClassDevs
Definition: setupapi.h:2588
#define MessageBox
Definition: winuser.h:5723
#define GENERIC_READ
Definition: compat.h:124
#define CB_SETCURSEL
Definition: winuser.h:1943
#define WM_COMMAND
Definition: winuser.h:1722
UINT findWaveDeviceID()
Definition: main.cpp:122
#define IDC_CRIGHT
Definition: resource.h:51
void deleteDriverFiles()
Definition: main.cpp:805
#define BST_UNCHECKED
Definition: winuser.h:199
#define GetSystemDirectory
Definition: winbase.h:3659
GLsizei const GLfloat * value
Definition: glext.h:6069
#define LoadCursor
Definition: winuser.h:5713
LRESULT currentTab
Definition: main.h:76
#define IDC_INV_SPDIFI
Definition: resource.h:64
INT_PTR(CALLBACK * DLGPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2870
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define DefDlgProc
Definition: ros2win.h:34
WAVEHDR pwh
Definition: main.h:80
#define IDC_FMT_960_DOLBY
Definition: resource.h:82
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
#define DSSPEAKER_5POINT1
Definition: dsound.h:310
char * tabsName[]
Definition: resource.h:93
WORD wValidBitsPerSample
Definition: ksmedia.h:541
#define FF_SWISS
Definition: wingdi.h:451
#define S_OK
Definition: intsafe.h:59
#define SW_SHOWNORMAL
Definition: winuser.h:764
HINSTANCE hInst
Definition: dxdiag.c:13
#define TEXT(s)
Definition: k32.h:26
#define CALLBACK_NULL
Definition: mmsystem.h:147
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
MMRESULT WINAPI waveOutOpen(LPHWAVEOUT lphWaveOut, UINT uDeviceID, LPCWAVEFORMATEX lpFormat, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD dwFlags)
Definition: winmm.c:2249
IN OUT PVCB OUT PDIRENT OUT PBCB IN BOOLEAN CreateFile
Definition: fatprocs.h:904
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: main.cpp:717
HICON hIcon
Definition: msconfig.c:44
#define waveOutGetDevCaps
Definition: mmsystem.h:2833
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
SP_DEVINFO_DATA InfoData
Definition: main.h:65
DWORD nAvgBytesPerSec
Definition: audioclient.idl:43
BOOL WINAPI SetupDiEnumDeviceInterfaces(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, CONST GUID *InterfaceClassGuid, DWORD MemberIndex, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
Definition: devinst.c:2785
signed char * PSTR
Definition: retypes.h:7
Definition: main.h:63
#define IDC_EN_REAR2LINE
Definition: resource.h:42
BOOL changeTab(LPNMHDR lpnmhdr)
Definition: main.cpp:706
#define SetWindowText
Definition: winuser.h:5758
UINT WINAPI waveOutClose(HWAVEOUT hWaveOut)
Definition: winmm.c:2260
unsigned int UINT
Definition: ndis.h:50
#define MB_OK
Definition: winuser.h:784
#define GetMessage
Definition: winuser.h:5691
#define RegDeleteKey
Definition: winreg.h:502
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
SP_DEVICE_INTERFACE_DETAIL_DATA_A SP_DEVICE_INTERFACE_DETAIL_DATA
Definition: setupapi.h:1144
#define WM_SETFONT
Definition: winuser.h:1632
#define BST_CHECKED
Definition: winuser.h:197
GLenum GLsizei dataSize
Definition: glext.h:11123
#define FMT_480_DOLBY
Definition: property.h:51
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1897
#define msg(x)
Definition: auth_time.c:54
#define IDC_ARROW
Definition: winuser.h:682
#define DIGCF_DEVICEINTERFACE
Definition: setupapi.h:174
void updateChannelBoxes(HWND hWnd)
Definition: main.cpp:506
#define TabCtrl_InsertItem(hwnd, iItem, pitem)
Definition: commctrl.h:4023
#define SendMessage
Definition: winuser.h:5744
BOOL getDeviceInfo(const GUID *category, CMIDEV *pDev)
Definition: main.cpp:319
BOOL generateTestSignal(double amplitude, int Channels, int SamplesPerSec, SHORT **buffer)
Definition: main.cpp:41
#define FMT_882_MULTI_PCM
Definition: property.h:48
#define IDT_SWAPJACKS
Definition: resource.h:38
#define LPTR
Definition: winbase.h:362
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define MAKELANGID(p, s)
Definition: nls.h:15
BOOL WINAPI SetForegroundWindow(_In_ HWND)
#define FMT_960_DOLBY
Definition: property.h:53
#define IDC_POLVALID
Definition: resource.h:65
HDEVINFO Info
Definition: main.h:64
#define FMT_882_PCM
Definition: property.h:44
VOID WINAPI InitCommonControls(void)
Definition: commctrl.c:863
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
#define KSCATEGORY_TOPOLOGY
Definition: ksmedia.h:199
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5620
HWND hWndTab
Definition: main.h:74
#define LoadIcon
Definition: winuser.h:5714
BOOL getCurrentChannelConfig()
Definition: main.cpp:243
CHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1028
#define IDC_EN_SPDO5V
Definition: resource.h:60
LONG_PTR LRESULT
Definition: windef.h:209
#define wsprintf
Definition: winuser.h:5766
HWND hWndChild[NUM_TABS]
Definition: main.h:75
void cleanUp()
Definition: main.cpp:472
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define FMT_441_MULTI_PCM
Definition: property.h:46
GLuint64EXT * result
Definition: glext.h:11304
#define KSPROPERTY_TYPE_SET
Definition: dmksctrl.h:43
#define NUM_TABS
Definition: resource.h:95
#define IDB_CLOSE
Definition: resource.h:35
BYTE * PBYTE
Definition: pedump.c:66
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
UINT WINAPI waveOutReset(HWAVEOUT hWaveOut)
Definition: winmm.c:2388
#define LOWORD(l)
Definition: pedump.c:82
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define IDC_EN_SPDCOPYRHT
Definition: resource.h:61
int parseArguments(LPSTR szCmdLine)
Definition: main.cpp:875
#define WM_NOTIFY
Definition: richedit.h:61
#define WAVE_FORMAT_EXTENSIBLE
Definition: ksmedia.h:551
#define ICON_BIG
Definition: tnclass.cpp:51
BOOL CALLBACK DSEnumProc(LPGUID lpGUID, LPCTSTR lpszDesc, LPCTSTR lpszDrvName, LPVOID lpContext)
Definition: main.cpp:214
#define DSSPEAKER_QUAD
Definition: dsound.h:307
#define IDC_EN_SPDI
Definition: resource.h:67
#define DIGCF_PRESENT
Definition: setupapi.h:171
BOOL stopTestTone(void)
Definition: main.cpp:103
int currentChannelCount
Definition: main.h:81
#define IDC_FMT_441_DOLBY
Definition: resource.h:79
#define IDI_APP_ICON
Definition: resource.h:31
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
GUID * LPGUID
Definition: guiddef.h:81
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
UInt32 select2ndSPDI
Definition: property.h:78
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define CreateDialogParam
Definition: winuser.h:5653