Commit 9f34fd37 authored by Robert Reif's avatar Robert Reif Committed by Alexandre Julliard

winecfg: Select an audio driver on fresh install.

parent 975ffe8a
...@@ -201,6 +201,7 @@ BEGIN ...@@ -201,6 +201,7 @@ BEGIN
IDS_WINECFG_TITLE "Wine configuration" IDS_WINECFG_TITLE "Wine configuration"
IDS_THEMEFILE "Theme files" IDS_THEMEFILE "Theme files"
IDS_THEMEFILE_SELECT "Select a theme file" IDS_THEMEFILE_SELECT "Select a theme file"
IDS_AUDIO_MISSING "There is no audio driver currently specified in the registry.\n\nA recommended driver has been selected for you.\nYou can use this driver or select another driver if available.\n\nYou must click Apply for the selection to take effect."
END END
......
...@@ -516,6 +516,23 @@ start_over: ...@@ -516,6 +516,23 @@ start_over:
free(tokens); free(tokens);
} }
static void selectDriver(HWND hDlg, const char * driver)
{
WCHAR text[1024];
WCHAR caption[64];
strcpy(curAudioDriver, driver);
set_reg_key(config_key, "Drivers", "Audio", curAudioDriver);
if (LoadStringW(GetModuleHandle(NULL), IDS_AUDIO_MISSING, text, sizeof(text)/sizeof(text[0])))
{
if (LoadStringW(GetModuleHandle(NULL), IDS_WINECFG_TITLE, caption, sizeof(caption)/sizeof(caption[0])))
MessageBoxW(hDlg, text, caption, MB_OK | MB_ICONINFORMATION);
}
SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM) hDlg, 0); /* enable apply button */
}
static void initAudioDlg (HWND hDlg) static void initAudioDlg (HWND hDlg)
{ {
int i; int i;
...@@ -523,14 +540,54 @@ static void initAudioDlg (HWND hDlg) ...@@ -523,14 +540,54 @@ static void initAudioDlg (HWND hDlg)
WINE_TRACE("\n"); WINE_TRACE("\n");
/* make a local copy of the current registry setting */
strcpy(curAudioDriver, get_reg_key(config_key, "Drivers", "Audio", ""));
WINE_TRACE("curAudioDriver = %s\n", curAudioDriver);
/* make a list of all drivers that can be loaded */ /* make a list of all drivers that can be loaded */
findAudioDrivers(); findAudioDrivers();
/* get current registry setting if available */
buf = get_reg_key(config_key, "Drivers", "Audio", NULL);
/* check for first time install and set a default driver
* select in this order: oss, alsa, first available driver, none
*/
if (buf == NULL)
{
const AUDIO_DRIVER *pAudioDrv = NULL;
/* select oss if available */
for (pAudioDrv = loadedAudioDrv; *pAudioDrv->szName; pAudioDrv++)
{
if (strcmp(pAudioDrv->szDriver, "oss") == 0)
{
selectDriver(hDlg, "oss");
break;
}
}
if (strlen(curAudioDriver) == 0)
{
/* select alsa if available */
for (pAudioDrv = loadedAudioDrv; *pAudioDrv->szName; pAudioDrv++)
{
if (strcmp(pAudioDrv->szDriver, "alsa") == 0)
{
selectDriver(hDlg, "alsa");
break;
}
}
}
if (strlen(curAudioDriver) == 0)
{
/* select first available driver */
if (*loadedAudioDrv->szDriver)
selectDriver(hDlg, loadedAudioDrv->szDriver);
}
}
else /* make a local copy of the current registry setting */
strcpy(curAudioDriver, buf);
WINE_TRACE("curAudioDriver = %s\n", curAudioDriver);
/* check for drivers that can't be loaded */ /* check for drivers that can't be loaded */
checkRegistrySetting(hDlg); checkRegistrySetting(hDlg);
......
...@@ -141,6 +141,7 @@ ...@@ -141,6 +141,7 @@
#define IDR_WINECFG 1305 #define IDR_WINECFG 1305
#define IDB_CHECKBOX 1306 #define IDB_CHECKBOX 1306
#define IDB_DEVICE 1307 #define IDB_DEVICE 1307
#define IDS_AUDIO_MISSING 1308
/* appearance tab */ /* appearance tab */
#define IDC_THEME_COLORCOMBO 1401 #define IDC_THEME_COLORCOMBO 1401
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment