winealsa.drv: Clean up initialisation.

This commit is contained in:
Maarten Lankhorst 2010-04-22 22:52:19 +02:00 committed by Alexandre Julliard
parent 3beb1b6a11
commit 755c25d84e
6 changed files with 15 additions and 15 deletions

View File

@ -725,8 +725,7 @@ LRESULT CALLBACK ALSA_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg,
switch(wMsg) { switch(wMsg) {
#ifdef HAVE_ALSA #ifdef HAVE_ALSA
case DRV_LOAD: ALSA_WaveInit(); case DRV_LOAD:
ALSA_MidiInit();
case DRV_FREE: case DRV_FREE:
case DRV_OPEN: case DRV_OPEN:
case DRV_CLOSE: case DRV_CLOSE:

View File

@ -199,10 +199,7 @@ DWORD widDsDesc(UINT wDevID, PDSDRIVERDESC desc);
DWORD wodDsCreate(UINT wDevID, PIDSDRIVER* drv); DWORD wodDsCreate(UINT wDevID, PIDSDRIVER* drv);
DWORD wodDsDesc(UINT wDevID, PDSDRIVERDESC desc); DWORD wodDsDesc(UINT wDevID, PDSDRIVERDESC desc);
/* midi.c */
extern LONG ALSA_MidiInit(void);
/* waveinit.c */ /* waveinit.c */
extern LONG ALSA_WaveInit(void); extern void ALSA_WaveInit(void);
#endif /* __ALSA_H */ #endif /* __ALSA_H */

View File

@ -1222,8 +1222,6 @@ static void ALSA_AddMidiPort(snd_seq_client_info_t* cinfo, snd_seq_port_info_t*
} }
} }
#endif /* HAVE_ALSA */
/*======================================================================* /*======================================================================*
* MIDI entry points * * MIDI entry points *
@ -1234,9 +1232,8 @@ static void ALSA_AddMidiPort(snd_seq_client_info_t* cinfo, snd_seq_port_info_t*
* *
* Initializes the MIDI devices information variables * Initializes the MIDI devices information variables
*/ */
LONG ALSA_MidiInit(void) static LONG ALSA_MidiInit(void)
{ {
#ifdef HAVE_ALSA
static BOOL bInitDone = FALSE; static BOOL bInitDone = FALSE;
snd_seq_client_info_t *cinfo; snd_seq_client_info_t *cinfo;
snd_seq_port_info_t *pinfo; snd_seq_port_info_t *pinfo;
@ -1290,10 +1287,11 @@ LONG ALSA_MidiInit(void)
HeapFree( GetProcessHeap(), 0, pinfo ); HeapFree( GetProcessHeap(), 0, pinfo );
TRACE("End\n"); TRACE("End\n");
#endif
return TRUE; return TRUE;
} }
#endif
/************************************************************************** /**************************************************************************
* midMessage (WINEALSA.@) * midMessage (WINEALSA.@)
*/ */
@ -1305,6 +1303,7 @@ DWORD WINAPI ALSA_midMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
switch (wMsg) { switch (wMsg) {
#ifdef HAVE_ALSA #ifdef HAVE_ALSA
case DRVM_INIT: case DRVM_INIT:
ALSA_MidiInit();
case DRVM_EXIT: case DRVM_EXIT:
case DRVM_ENABLE: case DRVM_ENABLE:
case DRVM_DISABLE: case DRVM_DISABLE:
@ -1349,6 +1348,7 @@ DWORD WINAPI ALSA_modMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
switch (wMsg) { switch (wMsg) {
#ifdef HAVE_ALSA #ifdef HAVE_ALSA
case DRVM_INIT: case DRVM_INIT:
ALSA_MidiInit();
case DRVM_EXIT: case DRVM_EXIT:
case DRVM_ENABLE: case DRVM_ENABLE:
case DRVM_DISABLE: case DRVM_DISABLE:

View File

@ -750,6 +750,7 @@ DWORD WINAPI ALSA_widMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
switch (wMsg) { switch (wMsg) {
case DRVM_INIT: case DRVM_INIT:
ALSA_WaveInit();
case DRVM_EXIT: case DRVM_EXIT:
case DRVM_ENABLE: case DRVM_ENABLE:
case DRVM_DISABLE: case DRVM_DISABLE:

View File

@ -962,7 +962,7 @@ static int ALSA_AddUserSpecifiedDevice(const char *ctlname, const char *pcmname)
** is a way to exactly specify the devices used by Wine. ** is a way to exactly specify the devices used by Wine.
** **
*/ */
LONG ALSA_WaveInit(void) void ALSA_WaveInit(void)
{ {
DWORD rc; DWORD rc;
BOOL AutoScanCards = TRUE; BOOL AutoScanCards = TRUE;
@ -971,6 +971,10 @@ LONG ALSA_WaveInit(void)
DWORD DeviceCount = 0; DWORD DeviceCount = 0;
HKEY key = 0; HKEY key = 0;
int i; int i;
static int loaded;
if (loaded++)
return;
/* @@ Wine registry key: HKCU\Software\Wine\Alsa Driver */ /* @@ Wine registry key: HKCU\Software\Wine\Alsa Driver */
rc = RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Wine\\Alsa Driver", 0, KEY_QUERY_VALUE, &key); rc = RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Wine\\Alsa Driver", 0, KEY_QUERY_VALUE, &key);
@ -983,7 +987,7 @@ LONG ALSA_WaveInit(void)
} }
if (AutoScanCards) if (AutoScanCards)
rc = ALSA_PerformDefaultScan(UseDirectHW, AutoScanDevices); ALSA_PerformDefaultScan(UseDirectHW, AutoScanDevices);
for (i = 0; i < DeviceCount; i++) for (i = 0; i < DeviceCount; i++)
{ {
@ -1005,8 +1009,6 @@ LONG ALSA_WaveInit(void)
if (key) if (key)
RegCloseKey(key); RegCloseKey(key);
return (rc);
} }
#endif /* HAVE_ALSA */ #endif /* HAVE_ALSA */

View File

@ -1169,6 +1169,7 @@ DWORD WINAPI ALSA_wodMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
switch (wMsg) { switch (wMsg) {
case DRVM_INIT: case DRVM_INIT:
ALSA_WaveInit();
case DRVM_EXIT: case DRVM_EXIT:
case DRVM_ENABLE: case DRVM_ENABLE:
case DRVM_DISABLE: case DRVM_DISABLE: