Evilly merge tag 'wine-1.5.11' into dsoal
[wine/multimedia.git] / dlls / dsound / dsp / 0034_Remove_audio_tab.patch
blob4629b39e2bde2f2ff43bf1d775923bfa313bb4f1
1 commit 636ea627410d738f948e7c26bfe22c56177f5a72
2 Author: Maarten Lankhorst <m.b.lankhorst@gmail.com>
3 Date: Thu Aug 4 14:43:52 2011 +0200
5 Remove audio tab
7 diff --git a/programs/winecfg/Makefile.in b/programs/winecfg/Makefile.in
8 index 9aafe32..3de7ccc 100644
9 --- a/programs/winecfg/Makefile.in
10 +++ b/programs/winecfg/Makefile.in
11 @@ -5,7 +5,6 @@ IMPORTS = uuid comdlg32 comctl32 shell32 ole32 winmm shlwapi uxtheme user32 gd
12 C_SRCS = \
13 about.c \
14 appdefaults.c \
15 - audio.c \
16 drive.c \
17 drivedetect.c \
18 driveui.c \
19 diff --git a/programs/winecfg/audio.c b/programs/winecfg/audio.c
20 deleted file mode 100644
21 index eacfa6f..0000000
22 --- a/programs/winecfg/audio.c
23 +++ /dev/null
24 @@ -1,873 +0,0 @@
25 -/*
26 - * Audio management UI code
27 - *
28 - * Copyright 2004 Chris Morgan
29 - *
30 - * This library is free software; you can redistribute it and/or
31 - * modify it under the terms of the GNU Lesser General Public
32 - * License as published by the Free Software Foundation; either
33 - * version 2.1 of the License, or (at your option) any later version.
34 - *
35 - * This library is distributed in the hope that it will be useful,
36 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
37 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
38 - * Lesser General Public License for more details.
39 - *
40 - * You should have received a copy of the GNU Lesser General Public
41 - * License along with this library; if not, write to the Free Software
42 - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
43 - *
44 - */
46 -#define WIN32_LEAN_AND_MEAN
47 -#define NONAMELESSSTRUCT
48 -#define NONAMELESSUNION
50 -#include "config.h"
51 -#include "wine/port.h"
53 -#include <assert.h>
54 -#include <stdlib.h>
55 -#include <stdio.h>
56 -#include <string.h>
58 -#include <windows.h>
59 -#include <wine/debug.h>
60 -#include <shellapi.h>
61 -#include <objbase.h>
62 -#include <shlguid.h>
63 -#include <shlwapi.h>
64 -#include <shlobj.h>
65 -#include <mmsystem.h>
66 -#include <mmreg.h>
67 -#include <mmddk.h>
69 -#include "winecfg.h"
70 -#include "resource.h"
72 -WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
74 -#define DRIVER_MASK 0x80000000
75 -#define DEVICE_MASK 0x40000000
76 -#define MAX_NAME_LENGTH 64
78 -typedef DWORD (WINAPI * MessagePtr)(UINT, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR);
80 -static struct DSOUNDACCEL
82 - UINT displayID;
83 - UINT visible;
84 - const char* settingStr;
85 -} DSound_HW_Accels[] = {
86 - {IDS_ACCEL_FULL, 1, "Full"},
87 - {IDS_ACCEL_STANDARD, 0, "Standard"},
88 - {IDS_ACCEL_BASIC, 0, "Basic"},
89 - {IDS_ACCEL_EMULATION, 1, "Emulation"},
90 - {0, 0, 0}
91 -};
93 -static const char* DSound_Rates[] = {
94 - "48000",
95 - "44100",
96 - "22050",
97 - "16000",
98 - "11025",
99 - "8000",
100 - NULL
103 -static const char* DSound_Bits[] = {
104 - "8",
105 - "16",
106 - NULL
109 -typedef struct
111 - UINT nameID;
112 - const char *szDriver;
113 - HDRVR hDriver;
114 -} AUDIO_DRIVER;
116 -static AUDIO_DRIVER sAudioDrivers[] = {
117 - {IDS_DRIVER_ALSA, "alsa"},
118 - {IDS_DRIVER_OSS, "oss"},
119 - {IDS_DRIVER_COREAUDIO, "coreaudio"},
120 - {0, ""}
123 -/* list of available drivers */
124 -static AUDIO_DRIVER * loadedAudioDrv;
126 -/* local copy of registry setting */
127 -static char curAudioDriver[1024];
129 -/* driver index to configure */
130 -static int toConfigure;
132 -/* display a driver specific configuration dialog */
133 -static void configureAudioDriver(HWND hDlg)
135 - const AUDIO_DRIVER *pAudioDrv = &loadedAudioDrv[toConfigure];
137 - if (strlen(pAudioDrv->szDriver) != 0)
139 - HDRVR hdrvr;
140 - char wine_driver[MAX_NAME_LENGTH + 9];
141 - sprintf(wine_driver, "wine%s.drv", pAudioDrv->szDriver);
142 - hdrvr = pAudioDrv->hDriver;
143 - if (hdrvr != 0)
145 - if (SendDriverMessage(hdrvr, DRV_QUERYCONFIGURE, 0, 0) != 0)
147 - DRVCONFIGINFO dci;
148 - dci.dwDCISize = sizeof (dci);
149 - dci.lpszDCISectionName = NULL;
150 - dci.lpszDCIAliasName = NULL;
151 - SendDriverMessage(hdrvr, DRV_CONFIGURE, 0, (LONG_PTR)&dci);
154 - else
156 - WCHAR wine_driverW[MAX_NAME_LENGTH+9];
157 - WCHAR messageStr[256];
158 - WCHAR str[1024];
160 - MultiByteToWideChar (CP_ACP, 0, wine_driver, -1, wine_driverW,
161 - sizeof (wine_driverW)/sizeof(wine_driverW[0]));
163 - LoadStringW (GetModuleHandle (NULL), IDS_OPEN_DRIVER_ERROR, messageStr,
164 - sizeof(messageStr)/sizeof(messageStr[0]));
165 - wsprintfW (str, messageStr, wine_driverW);
166 - MessageBoxW (hDlg, str, NULL, MB_OK | MB_ICONERROR);
171 -/* is driver in local copy of driver registry string */
172 -static BOOL isDriverSet(const char * driver)
174 - WINE_TRACE("driver = %s, curAudioDriver = %s\n", driver, curAudioDriver);
176 - if (strstr(curAudioDriver, driver))
177 - return TRUE;
179 - return FALSE;
182 -/* add driver to local copy of driver registry string */
183 -static void addDriver(const char * driver)
185 - if (!isDriverSet(driver))
187 - if (strlen(curAudioDriver))
188 - strcat(curAudioDriver, ",");
189 - strcat(curAudioDriver, driver);
193 -/* remove driver from local copy of driver registry string */
194 -static void removeDriver(const char * driver)
196 - char pattern[32], *p;
197 - int drvlen, listlen;
199 - strcpy(pattern, ",");
200 - strcat(pattern, driver);
201 - strcat(pattern, ",");
202 - drvlen = strlen(driver);
203 - listlen = strlen(curAudioDriver);
205 - p = strstr(curAudioDriver, pattern);
206 - if (p) /* somewhere in the middle */
207 - memmove(p, p+drvlen+1, strlen(p+drvlen+1)+1);
208 - else if (!strncmp(curAudioDriver, pattern+1, drvlen+1)) /* the head */
209 - memmove(curAudioDriver, curAudioDriver+drvlen+1, listlen-drvlen);
210 - else if (!strncmp(curAudioDriver+listlen-drvlen-1, pattern, drvlen+1)) /* the tail */
211 - curAudioDriver[listlen-drvlen-1] = 0;
212 - else if (!strcmp(curAudioDriver, driver)) /* only one entry (head&tail) */
213 - curAudioDriver[0] = 0;
214 - else
215 - WINE_FIXME("driver '%s' is not in the list, please report!\n", driver);
218 -static void initAudioDeviceTree(HWND hDlg)
220 - AUDIO_DRIVER *pAudioDrv = NULL;
221 - int i, j;
222 - TVINSERTSTRUCTW insert;
223 - HTREEITEM root, driver[10];
224 - HWND tree = NULL;
225 - HIMAGELIST hImageList;
226 - HBITMAP hBitMap;
227 - HCURSOR old_cursor;
228 - WCHAR driver_type[64], dev_type[64];
230 - tree = GetDlgItem(hDlg, IDC_AUDIO_TREE);
232 - if (!tree)
233 - return;
235 - /* set tree view style */
236 - SetWindowLong(tree, GWL_STYLE, GetWindowLong(tree, GWL_STYLE) | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT);
238 - /* state checkbox */
239 - hImageList = ImageList_Create(16, 16, FALSE, 3, 0);
240 - hBitMap = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_CHECKBOX));
241 - ImageList_Add(hImageList, hBitMap, NULL);
242 - DeleteObject(hBitMap);
243 - SendMessageW( tree, TVM_SETIMAGELIST, TVSIL_STATE, (LPARAM)hImageList );
245 - /* root item */
246 - LoadStringW (GetModuleHandle (NULL), IDS_SOUNDDRIVERS, driver_type,
247 - sizeof(driver_type)/sizeof(driver_type[0]));
248 - insert.hParent = TVI_ROOT;
249 - insert.hInsertAfter = TVI_LAST;
250 - insert.u.item.mask = TVIF_TEXT | TVIF_CHILDREN;
251 - insert.u.item.pszText = driver_type;
252 - insert.u.item.cChildren = 1;
253 - root = (HTREEITEM)SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
255 - /* change to the wait cursor because this can take a while if there is a
256 - * misbehaving driver that takes a long time to open
257 - */
258 - old_cursor = SetCursor(LoadCursor(0, IDC_WAIT));
260 - /* iterate over list of loaded drivers */
261 - for (pAudioDrv = loadedAudioDrv, i = 0; pAudioDrv->nameID; i++, pAudioDrv++) {
262 - HDRVR hdrv;
263 - char name[MAX_PATH];
264 - WCHAR text[MAX_PATH];
266 - sprintf(name, "wine%s.drv", pAudioDrv->szDriver);
267 - LoadStringW (GetModuleHandle (NULL), pAudioDrv->nameID, text,
268 - sizeof(text)/sizeof(text[0]));
270 - if ((hdrv = pAudioDrv->hDriver))
272 - HMODULE lib;
273 - if ((lib = GetDriverModuleHandle(hdrv)))
275 - int num_wod = 0, num_wid = 0, num_mod = 0, num_mid = 0, num_aux = 0, num_mxd = 0;
276 - MessagePtr wodMessagePtr = (MessagePtr)GetProcAddress(lib, "wodMessage");
277 - MessagePtr widMessagePtr = (MessagePtr)GetProcAddress(lib, "widMessage");
278 - MessagePtr modMessagePtr = (MessagePtr)GetProcAddress(lib, "modMessage");
279 - MessagePtr midMessagePtr = (MessagePtr)GetProcAddress(lib, "midMessage");
280 - MessagePtr auxMessagePtr = (MessagePtr)GetProcAddress(lib, "auxMessage");
281 - MessagePtr mxdMessagePtr = (MessagePtr)GetProcAddress(lib, "mxdMessage");
283 - if (wodMessagePtr)
284 - num_wod = wodMessagePtr(0, WODM_GETNUMDEVS, 0, 0, 0);
286 - if (widMessagePtr)
287 - num_wid = widMessagePtr(0, WIDM_GETNUMDEVS, 0, 0, 0);
289 - if (modMessagePtr)
290 - num_mod = modMessagePtr(0, MODM_GETNUMDEVS, 0, 0, 0);
292 - if (midMessagePtr)
293 - num_mid = midMessagePtr(0, MIDM_GETNUMDEVS, 0, 0, 0);
295 - if (auxMessagePtr)
296 - num_aux = auxMessagePtr(0, AUXDM_GETNUMDEVS, 0, 0, 0);
298 - if (mxdMessagePtr)
299 - num_mxd = mxdMessagePtr(0, MXDM_GETNUMDEVS, 0, 0, 0);
301 - if (num_wod == 0 && num_wid == 0 && num_mod == 0 && num_mid == 0 && num_aux == 0 && num_mxd == 0)
303 - insert.hParent = root;
304 - insert.u.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_PARAM;
305 - insert.u.item.pszText = text;
306 - insert.u.item.stateMask = TVIS_STATEIMAGEMASK;
307 - insert.u.item.lParam = i + DRIVER_MASK;
308 - if (isDriverSet(pAudioDrv->szDriver))
309 - insert.u.item.state = INDEXTOSTATEIMAGEMASK(2);
310 - else
311 - insert.u.item.state = INDEXTOSTATEIMAGEMASK(1);
313 - driver[i] = (HTREEITEM)SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
315 - else
317 - HTREEITEM type;
319 - insert.hParent = root;
320 - insert.u.item.mask = TVIF_TEXT | TVIF_CHILDREN | TVIF_STATE | TVIF_PARAM;
321 - insert.u.item.pszText = text;
322 - insert.u.item.cChildren = 1;
323 - insert.u.item.stateMask = TVIS_STATEIMAGEMASK;
324 - insert.u.item.lParam = i + DRIVER_MASK;
326 - if (isDriverSet(pAudioDrv->szDriver))
327 - insert.u.item.state = INDEXTOSTATEIMAGEMASK(2);
328 - else
329 - insert.u.item.state = INDEXTOSTATEIMAGEMASK(1);
331 - driver[i] = (HTREEITEM)SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
333 - if (num_wod)
335 - LoadStringW (GetModuleHandle (NULL), IDS_DEVICES_WAVEOUT, dev_type,
336 - sizeof(dev_type)/sizeof(dev_type[0]));
338 - insert.hParent = driver[i];
339 - insert.u.item.mask = TVIF_TEXT | TVIF_CHILDREN;
340 - insert.u.item.pszText = dev_type;
341 - insert.u.item.cChildren = 1;
343 - type = (HTREEITEM)SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
345 - for (j = 0; j < num_wod; j++)
347 - WAVEOUTCAPSW caps;
349 - wodMessagePtr(j, WODM_GETDEVCAPS, 0, (DWORD_PTR)&caps, sizeof(caps));
351 - insert.hParent = type;
352 - insert.u.item.mask = TVIF_TEXT | TVIF_PARAM;
353 - insert.u.item.pszText = caps.szPname;
354 - insert.u.item.lParam = j + DEVICE_MASK;
356 - SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
360 - if (num_wid)
362 - LoadStringW (GetModuleHandle (NULL), IDS_DEVICES_WAVEIN, dev_type,
363 - sizeof(dev_type)/sizeof(dev_type[0]));
365 - insert.hParent = driver[i];
366 - insert.u.item.mask = TVIF_TEXT | TVIF_CHILDREN;
367 - insert.u.item.pszText = dev_type;
368 - insert.u.item.cChildren = 1;
370 - type = (HTREEITEM)SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
372 - for (j = 0; j < num_wid; j++)
374 - WAVEINCAPSW caps;
376 - widMessagePtr(j, WIDM_GETDEVCAPS, 0, (DWORD_PTR)&caps, sizeof(caps));
378 - insert.hParent = type;
379 - insert.u.item.mask = TVIF_TEXT | TVIF_PARAM;
380 - insert.u.item.pszText = caps.szPname;
381 - insert.u.item.lParam = j + DEVICE_MASK;
383 - SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
387 - if (num_mod)
389 - LoadStringW (GetModuleHandle (NULL), IDS_DEVICES_MIDIOUT, dev_type,
390 - sizeof(dev_type)/sizeof(dev_type[0]));
392 - insert.hParent = driver[i];
393 - insert.u.item.mask = TVIF_TEXT | TVIF_CHILDREN;
394 - insert.u.item.pszText = dev_type;
395 - insert.u.item.cChildren = 1;
397 - type = (HTREEITEM)SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
399 - for (j = 0; j < num_mod; j++)
401 - MIDIOUTCAPSW caps;
403 - modMessagePtr(j, MODM_GETDEVCAPS, 0, (DWORD_PTR)&caps, sizeof(caps));
405 - insert.hParent = type;
406 - insert.u.item.mask = TVIF_TEXT | TVIF_PARAM;
407 - insert.u.item.pszText = caps.szPname;
408 - insert.u.item.lParam = j + DEVICE_MASK;
410 - SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
414 - if (num_mid)
416 - LoadStringW (GetModuleHandle (NULL), IDS_DEVICES_MIDIIN, dev_type,
417 - sizeof(dev_type)/sizeof(dev_type[0]));
419 - insert.hParent = driver[i];
420 - insert.u.item.mask = TVIF_TEXT | TVIF_CHILDREN;
421 - insert.u.item.pszText = dev_type;
422 - insert.u.item.cChildren = 1;
424 - type = (HTREEITEM)SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
426 - for (j = 0; j < num_mid; j++)
428 - MIDIINCAPSW caps;
430 - midMessagePtr(j, MIDM_GETDEVCAPS, 0, (DWORD_PTR)&caps, sizeof(caps));
432 - insert.hParent = type;
433 - insert.u.item.mask = TVIF_TEXT | TVIF_PARAM;
434 - insert.u.item.pszText = caps.szPname;
435 - insert.u.item.lParam = j + DEVICE_MASK;
437 - SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
441 - if (num_aux)
443 - LoadStringW (GetModuleHandle (NULL), IDS_DEVICES_AUX, dev_type,
444 - sizeof(dev_type)/sizeof(dev_type[0]));
446 - insert.hParent = driver[i];
447 - insert.u.item.mask = TVIF_TEXT | TVIF_CHILDREN;
448 - insert.u.item.pszText = dev_type;
449 - insert.u.item.cChildren = 1;
451 - type = (HTREEITEM)SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
453 - for (j = 0; j < num_aux; j++)
455 - AUXCAPSW caps;
457 - auxMessagePtr(j, AUXDM_GETDEVCAPS, 0, (DWORD_PTR)&caps, sizeof(caps));
459 - insert.hParent = type;
460 - insert.u.item.mask = TVIF_TEXT | TVIF_PARAM;
461 - insert.u.item.pszText = caps.szPname;
462 - insert.u.item.lParam = j + DEVICE_MASK;
464 - SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
468 - if (num_mxd)
470 - LoadStringW (GetModuleHandle (NULL), IDS_DEVICES_MIXER, dev_type,
471 - sizeof(dev_type)/sizeof(dev_type[0]));
473 - insert.hParent = driver[i];
474 - insert.u.item.mask = TVIF_TEXT | TVIF_CHILDREN;
475 - insert.u.item.pszText = dev_type;
476 - insert.u.item.cChildren = 1;
478 - type = (HTREEITEM)SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
480 - for (j = 0; j < num_mxd; j++)
482 - MIXERCAPSW caps;
484 - mxdMessagePtr(j, MXDM_GETDEVCAPS, 0, (DWORD_PTR)&caps, sizeof(caps));
486 - insert.hParent = type;
487 - insert.u.item.mask = TVIF_TEXT | TVIF_PARAM;
488 - insert.u.item.pszText = caps.szPname;
489 - insert.u.item.lParam = j + DEVICE_MASK;
491 - SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
499 - /* restore the original cursor */
500 - SetCursor(old_cursor);
502 - SendDlgItemMessage(hDlg, IDC_AUDIO_TREE, TVM_SELECTITEM, 0, 0);
503 - SendDlgItemMessage(hDlg, IDC_AUDIO_TREE, TVM_EXPAND, TVE_EXPAND, (LPARAM)root);
504 - for (j = 0; j < i; j++)
505 - SendDlgItemMessage(hDlg, IDC_AUDIO_TREE, TVM_EXPAND, TVE_EXPAND, (LPARAM)driver[j]);
508 -/* find all drivers that can be loaded */
509 -static void findAudioDrivers(void)
511 - int numFound = 0;
512 - AUDIO_DRIVER *pAudioDrv = NULL;
513 - HCURSOR old_cursor;
515 - /* delete an existing list */
516 - HeapFree(GetProcessHeap(), 0, loadedAudioDrv);
517 - loadedAudioDrv = 0;
519 - /* change to the wait cursor because this can take a while if there is a
520 - * misbehaving driver that takes a long time to open
521 - */
522 - old_cursor = SetCursor(LoadCursor(0, IDC_WAIT));
524 - for (pAudioDrv = sAudioDrivers; pAudioDrv->nameID; pAudioDrv++)
526 - if (strlen(pAudioDrv->szDriver))
528 - HDRVR hdrv;
529 - char driver[MAX_PATH];
531 - sprintf(driver, "wine%s.drv", pAudioDrv->szDriver);
533 - hdrv = pAudioDrv->hDriver;
534 - if (!pAudioDrv->hDriver && (hdrv = OpenDriverA(driver, 0, 0))) {
535 - HMODULE lib = GetDriverModuleHandle(hdrv);
536 - MessagePtr wodMessagePtr = (MessagePtr)GetProcAddress(lib, "wodMessage");
537 - MessagePtr widMessagePtr = (MessagePtr)GetProcAddress(lib, "widMessage");
538 - MessagePtr modMessagePtr = (MessagePtr)GetProcAddress(lib, "modMessage");
539 - MessagePtr midMessagePtr = (MessagePtr)GetProcAddress(lib, "midMessage");
540 - MessagePtr auxMessagePtr = (MessagePtr)GetProcAddress(lib, "auxMessage");
541 - MessagePtr mxdMessagePtr = (MessagePtr)GetProcAddress(lib, "mxdMessage");
543 - pAudioDrv->hDriver = hdrv;
545 - if (wodMessagePtr)
546 - wodMessagePtr(0, DRVM_INIT, 0, 0, 0);
548 - if (widMessagePtr)
549 - widMessagePtr(0, DRVM_INIT, 0, 0, 0);
551 - if (modMessagePtr)
552 - modMessagePtr(0, DRVM_INIT, 0, 0, 0);
554 - if (midMessagePtr)
555 - midMessagePtr(0, DRVM_INIT, 0, 0, 0);
557 - if (auxMessagePtr)
558 - auxMessagePtr(0, DRVM_INIT, 0, 0, 0);
560 - if (mxdMessagePtr)
561 - mxdMessagePtr(0, DRVM_INIT, 0, 0, 0);
563 - if (hdrv)
565 - if (loadedAudioDrv)
566 - loadedAudioDrv = HeapReAlloc(GetProcessHeap(), 0, loadedAudioDrv, (numFound + 1) * sizeof(AUDIO_DRIVER));
567 - else
568 - loadedAudioDrv = HeapAlloc(GetProcessHeap(), 0, sizeof(AUDIO_DRIVER));
570 - CopyMemory(&loadedAudioDrv[numFound], pAudioDrv, sizeof(AUDIO_DRIVER));
571 - numFound++;
576 - /* restore the original cursor */
577 - SetCursor(old_cursor);
579 - /* terminate list with empty driver */
580 - if (numFound) {
581 - loadedAudioDrv = HeapReAlloc(GetProcessHeap(), 0, loadedAudioDrv, (numFound + 1) * sizeof(AUDIO_DRIVER));
582 - CopyMemory(&loadedAudioDrv[numFound], pAudioDrv, sizeof(AUDIO_DRIVER));
583 - } else {
584 - loadedAudioDrv = HeapAlloc(GetProcessHeap(), 0, sizeof(AUDIO_DRIVER));
585 - CopyMemory(&loadedAudioDrv[0], pAudioDrv, sizeof(AUDIO_DRIVER));
589 -/* check local copy of registry string for unloadable drivers */
590 -static void checkRegistrySetting(HWND hDlg)
592 - const AUDIO_DRIVER *pAudioDrv;
593 - char * token, * tokens;
595 - tokens = HeapAlloc(GetProcessHeap(), 0, strlen(curAudioDriver)+1);
596 - strcpy(tokens, curAudioDriver);
598 -start_over:
599 - token = strtok(tokens, ",");
600 - while (token != NULL)
602 - BOOL found = FALSE;
603 - for (pAudioDrv = loadedAudioDrv; pAudioDrv->nameID; pAudioDrv++)
605 - if (strcmp(token, pAudioDrv->szDriver) == 0)
607 - found = TRUE;
608 - break;
611 - if (found == FALSE)
613 - WCHAR tokenW[MAX_NAME_LENGTH+1];
614 - WCHAR messageStr[256];
615 - WCHAR str[1024];
616 - WCHAR caption[64];
618 - MultiByteToWideChar (CP_ACP, 0, token, -1, tokenW, sizeof(tokenW)/sizeof(tokenW[0]));
620 - LoadStringW (GetModuleHandle (NULL), IDS_UNAVAILABLE_DRIVER, messageStr,
621 - sizeof(messageStr)/sizeof(messageStr[0]));
622 - wsprintfW (str, messageStr, tokenW);
623 - LoadStringW (GetModuleHandle (NULL), IDS_WARNING, caption,
624 - sizeof(caption)/sizeof(caption[0]));
625 - if (MessageBoxW (hDlg, str, caption, MB_ICONWARNING | MB_YESNOCANCEL) == IDYES)
627 - removeDriver(token);
628 - strcpy(tokens, curAudioDriver);
629 - goto start_over;
632 - token = strtok(NULL, ",");
634 - HeapFree(GetProcessHeap(), 0, tokens);
637 -static void selectDriver(HWND hDlg, const char * driver)
639 - WCHAR text[1024];
640 - WCHAR caption[64];
642 - strcpy(curAudioDriver, driver);
643 - set_reg_key(config_key, "Drivers", "Audio", curAudioDriver);
645 - if (LoadStringW(GetModuleHandle(NULL), IDS_AUDIO_MISSING, text, sizeof(text)/sizeof(text[0])))
647 - if (LoadStringW(GetModuleHandle(NULL), IDS_WINECFG_TITLE, caption, sizeof(caption)/sizeof(caption[0])))
648 - MessageBoxW(hDlg, text, caption, MB_OK | MB_ICONINFORMATION);
651 - SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM) hDlg, 0); /* enable apply button */
654 -static void initAudioDlg (HWND hDlg)
656 - int i, j, found;
657 - char* buf = NULL;
659 - WINE_TRACE("\n");
661 - /* make a list of all drivers that can be loaded */
662 - findAudioDrivers();
664 - /* get current registry setting if available */
665 - buf = get_reg_key(config_key, "Drivers", "Audio", NULL);
667 - /* check for first time install and set a default driver
668 - * select first available driver, and if that fails: none
669 - */
670 - if (buf == NULL)
672 - /* select first available driver */
673 - if (*loadedAudioDrv->szDriver)
674 - selectDriver(hDlg, loadedAudioDrv->szDriver);
676 - else /* make a local copy of the current registry setting */
677 - strcpy(curAudioDriver, buf);
679 - WINE_TRACE("curAudioDriver = %s\n", curAudioDriver);
681 - /* check for drivers that can't be loaded */
682 - checkRegistrySetting(hDlg);
684 - initAudioDeviceTree(hDlg);
686 - SendDlgItemMessage(hDlg, IDC_DSOUND_HW_ACCEL, CB_RESETCONTENT, 0, 0);
687 - buf = get_reg_key(config_key, keypath("DirectSound"), "HardwareAcceleration", "Full");
689 - j = found = 0;
690 - for (i = 0; 0 != DSound_HW_Accels[i].displayID; ++i) {
691 - WCHAR accelStr[64];
692 - int match;
694 - match = (strcmp(buf, DSound_HW_Accels[i].settingStr) == 0);
695 - if (match)
697 - DSound_HW_Accels[i].visible = 1;
698 - found = 1;
701 - if (DSound_HW_Accels[i].visible)
703 - LoadStringW (GetModuleHandle (NULL), DSound_HW_Accels[i].displayID,
704 - accelStr, sizeof(accelStr)/sizeof(accelStr[0]));
705 - SendDlgItemMessageW (hDlg, IDC_DSOUND_HW_ACCEL, CB_ADDSTRING, 0, (LPARAM)accelStr);
706 - if (match)
707 - SendDlgItemMessage(hDlg, IDC_DSOUND_HW_ACCEL, CB_SETCURSEL, j, 0);
708 - j++;
711 - if (!found) {
712 - WINE_ERR("Invalid Direct Sound HW Accel read from registry (%s)\n", buf);
714 - HeapFree(GetProcessHeap(), 0, buf);
716 - SendDlgItemMessage(hDlg, IDC_DSOUND_RATES, CB_RESETCONTENT, 0, 0);
717 - for (i = 0; NULL != DSound_Rates[i]; ++i) {
718 - SendDlgItemMessage(hDlg, IDC_DSOUND_RATES, CB_ADDSTRING, 0, (LPARAM) DSound_Rates[i]);
720 - buf = get_reg_key(config_key, keypath("DirectSound"), "DefaultSampleRate", "44100");
721 - for (i = 0; NULL != DSound_Rates[i]; ++i) {
722 - if (strcmp(buf, DSound_Rates[i]) == 0) {
723 - SendDlgItemMessage(hDlg, IDC_DSOUND_RATES, CB_SETCURSEL, i, 0);
724 - break ;
728 - SendDlgItemMessage(hDlg, IDC_DSOUND_BITS, CB_RESETCONTENT, 0, 0);
729 - for (i = 0; NULL != DSound_Bits[i]; ++i) {
730 - SendDlgItemMessage(hDlg, IDC_DSOUND_BITS, CB_ADDSTRING, 0, (LPARAM) DSound_Bits[i]);
732 - buf = get_reg_key(config_key, keypath("DirectSound"), "DefaultBitsPerSample", "16");
733 - for (i = 0; NULL != DSound_Bits[i]; ++i) {
734 - if (strcmp(buf, DSound_Bits[i]) == 0) {
735 - SendDlgItemMessage(hDlg, IDC_DSOUND_BITS, CB_SETCURSEL, i, 0);
736 - break ;
739 - HeapFree(GetProcessHeap(), 0, buf);
742 -INT_PTR CALLBACK
743 -AudioDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
745 - switch (uMsg) {
746 - case WM_COMMAND:
747 - switch (LOWORD(wParam)) {
748 - case IDC_AUDIO_CONFIGURE:
749 - configureAudioDriver(hDlg);
750 - break;
751 - case IDC_AUDIO_TEST:
752 - if(!PlaySound(MAKEINTRESOURCE(IDW_TESTSOUND), NULL, SND_RESOURCE | SND_SYNC))
753 - MessageBox(NULL, "Audio test failed!", "Error", MB_OK | MB_ICONERROR);
754 - break;
755 - case IDC_AUDIO_CONTROL_PANEL:
756 - MessageBox(NULL, "Launching audio control panel not implemented yet!", "Fixme", MB_OK | MB_ICONERROR);
757 - break;
758 - case IDC_DSOUND_HW_ACCEL:
759 - if (HIWORD(wParam) == CBN_SELCHANGE) {
760 - int selected_dsound_accel;
761 - int i, j = 0;
763 - SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
764 - selected_dsound_accel = SendDlgItemMessage(hDlg, IDC_DSOUND_HW_ACCEL, CB_GETCURSEL, 0, 0);
765 - for (i = 0; DSound_HW_Accels[i].settingStr; ++i)
767 - if (DSound_HW_Accels[i].visible)
769 - if (j == selected_dsound_accel)
771 - set_reg_key(config_key, keypath("DirectSound"), "HardwareAcceleration",
772 - DSound_HW_Accels[i].settingStr);
773 - break;
775 - j++;
779 - break;
780 - case IDC_DSOUND_RATES:
781 - if (HIWORD(wParam) == CBN_SELCHANGE) {
782 - int selected_dsound_rate;
783 - SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
784 - selected_dsound_rate = SendDlgItemMessage(hDlg, IDC_DSOUND_RATES, CB_GETCURSEL, 0, 0);
785 - set_reg_key(config_key, keypath("DirectSound"), "DefaultSampleRate", DSound_Rates[selected_dsound_rate]);
787 - break;
788 - case IDC_DSOUND_BITS:
789 - if (HIWORD(wParam) == CBN_SELCHANGE) {
790 - int selected_dsound_bits;
791 - SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
792 - selected_dsound_bits = SendDlgItemMessage(hDlg, IDC_DSOUND_BITS, CB_GETCURSEL, 0, 0);
793 - set_reg_key(config_key, keypath("DirectSound"), "DefaultBitsPerSample", DSound_Bits[selected_dsound_bits]);
795 - break;
797 - break;
799 - case WM_SHOWWINDOW:
800 - set_window_title(hDlg);
801 - break;
803 - case WM_NOTIFY:
804 - switch(((LPNMHDR)lParam)->code) {
805 - case PSN_KILLACTIVE:
806 - SetWindowLongPtr(hDlg, DWLP_MSGRESULT, FALSE);
807 - break;
808 - case PSN_APPLY:
809 - set_reg_key(config_key, "Drivers", "Audio", curAudioDriver);
810 - apply();
811 - SetWindowLongPtr(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
812 - break;
813 - case PSN_SETACTIVE:
814 - break;
815 - case NM_CLICK:
816 - if (((LPNMHDR)lParam)->idFrom == IDC_AUDIO_TREE)
818 - TVHITTESTINFO ht;
819 - DWORD dwPos = GetMessagePos();
820 - HWND tree = ((LPNMHDR)lParam)->hwndFrom;
821 - ZeroMemory(&ht, sizeof(ht));
822 - ht.pt.x = (short)LOWORD(dwPos);
823 - ht.pt.y = (short)HIWORD(dwPos);
824 - MapWindowPoints(HWND_DESKTOP, tree, &ht.pt, 1);
825 - SendMessageW( tree, TVM_HITTEST, 0, (LPARAM)&ht );
826 - if (TVHT_ONITEMSTATEICON & ht.flags)
828 - TVITEM tvItem;
829 - int index;
830 - ZeroMemory(&tvItem, sizeof(tvItem));
831 - tvItem.hItem = ht.hItem;
832 - SendMessageW( tree, TVM_GETITEMW, 0, (LPARAM) &tvItem );
834 - index = TreeView_GetItemState(tree, ht.hItem, TVIS_STATEIMAGEMASK);
835 - if (index == INDEXTOSTATEIMAGEMASK(1))
837 - TreeView_SetItemState(tree, ht.hItem, INDEXTOSTATEIMAGEMASK(2), TVIS_STATEIMAGEMASK);
838 - addDriver(loadedAudioDrv[tvItem.lParam & 0xff].szDriver);
839 - SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM) hDlg, 0); /* enable apply button */
841 - else if (index == INDEXTOSTATEIMAGEMASK(2))
843 - TreeView_SetItemState(tree, ht.hItem, INDEXTOSTATEIMAGEMASK(1), TVIS_STATEIMAGEMASK);
844 - removeDriver(loadedAudioDrv[tvItem.lParam & 0xff].szDriver);
845 - SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM) hDlg, 0); /* enable apply button */
849 - break;
850 - case NM_RCLICK:
851 - if (((LPNMHDR)lParam)->idFrom == IDC_AUDIO_TREE)
853 - TVHITTESTINFO ht;
854 - DWORD dwPos = GetMessagePos();
855 - HWND tree = ((LPNMHDR)lParam)->hwndFrom;
856 - POINT pt;
857 - ZeroMemory(&ht, sizeof(ht));
858 - pt.x = (short)LOWORD(dwPos);
859 - pt.y = (short)HIWORD(dwPos);
860 - ht.pt = pt;
861 - MapWindowPoints(HWND_DESKTOP, tree, &ht.pt, 1);
862 - SendMessageW( tree, TVM_HITTEST, 0, (LPARAM)&ht );
863 - if (TVHT_ONITEMLABEL & ht.flags)
865 - TVITEM tvItem;
866 - ZeroMemory(&tvItem, sizeof(tvItem));
867 - tvItem.hItem = ht.hItem;
868 - tvItem.mask = TVIF_PARAM;
869 - tvItem.lParam = -1;
870 - if (TreeView_GetItem(tree, &tvItem))
872 - if (tvItem.lParam & DRIVER_MASK)
874 - if (hPopupMenus)
876 - TrackPopupMenu(GetSubMenu(hPopupMenus, 0), TPM_RIGHTBUTTON, pt.x, pt.y, 0, tree, NULL);
877 - toConfigure = tvItem.lParam & ~DRIVER_MASK;
880 - else if (tvItem.lParam & DEVICE_MASK)
882 - /* FIXME TBD */
889 - break;
891 - case WM_INITDIALOG:
892 - initAudioDlg(hDlg);
893 - break;
896 - return FALSE;
898 diff --git a/programs/winecfg/main.c b/programs/winecfg/main.c
899 index 7376309..020364b 100644
900 --- a/programs/winecfg/main.c
901 +++ b/programs/winecfg/main.c
902 @@ -60,7 +60,7 @@ PropSheetCallback (HWND hWnd, UINT uMsg, LPARAM lParam)
903 return 0;
906 -#define NUM_PROPERTY_PAGES 7
907 +#define NUM_PROPERTY_PAGES 6
909 static INT_PTR
910 doPropertySheet (HINSTANCE hInstance, HWND hOwner)
911 @@ -131,16 +131,6 @@ doPropertySheet (HINSTANCE hInstance, HWND hOwner)
912 psp[pg].lParam = 0;
913 pg++;
915 - psp[pg].dwSize = sizeof (PROPSHEETPAGEW);
916 - psp[pg].dwFlags = PSP_USETITLE;
917 - psp[pg].hInstance = hInstance;
918 - psp[pg].u.pszTemplate = MAKEINTRESOURCEW (IDD_AUDIOCFG);
919 - psp[pg].u2.pszIcon = NULL;
920 - psp[pg].pfnDlgProc = AudioDlgProc;
921 - psp[pg].pszTitle = load_string (IDS_TAB_AUDIO);
922 - psp[pg].lParam = 0;
923 - pg++;
926 * Fill out the (General) PROPSHEETPAGE data structure
927 * for the property sheet
928 diff --git a/programs/winecfg/winecfg.h b/programs/winecfg/winecfg.h
929 index 1959409..9248edf 100644
930 --- a/programs/winecfg/winecfg.h
931 +++ b/programs/winecfg/winecfg.h
932 @@ -85,7 +85,6 @@ INT_PTR CALLBACK DriveDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
933 INT_PTR CALLBACK DriveEditDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
934 INT_PTR CALLBACK AppDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
935 INT_PTR CALLBACK LibrariesDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
936 -INT_PTR CALLBACK AudioDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
937 INT_PTR CALLBACK ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
938 INT_PTR CALLBACK AboutDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);