Commit 82e4c76d authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Alexandre Julliard

winejack.drv: Clean up loading.

parent c0a602c2
...@@ -834,15 +834,19 @@ static void JACK_CloseWaveInDevice(WINE_WAVEIN* wwi) ...@@ -834,15 +834,19 @@ static void JACK_CloseWaveInDevice(WINE_WAVEIN* wwi)
#endif #endif
} }
static int WAVE_loadcount;
/****************************************************************** /******************************************************************
* JACK_WaveRelease * JACK_WaveRelease
* *
* *
*/ */
LONG JACK_WaveRelease(void) static LONG JACK_WaveRelease(void)
{ {
int iDevice; int iDevice;
if (--WAVE_loadcount)
return 1;
TRACE("closing all open waveout devices\n"); TRACE("closing all open waveout devices\n");
/* close all open output devices */ /* close all open output devices */
...@@ -887,12 +891,14 @@ LONG JACK_WaveRelease(void) ...@@ -887,12 +891,14 @@ LONG JACK_WaveRelease(void)
* *
* Initialize internal structures from JACK server info * Initialize internal structures from JACK server info
*/ */
LONG JACK_WaveInit(void) static LONG JACK_WaveInit(void)
{ {
int i; int i;
CHAR szPname[MAXPNAMELEN]; CHAR szPname[MAXPNAMELEN];
TRACE("called\n"); TRACE("called\n");
if (WAVE_loadcount++)
return 1;
/* setup function pointers */ /* setup function pointers */
#define LOAD_FUNCPTR(f) if((fp_##f = wine_dlsym(jackhandle, #f, NULL, 0)) == NULL) goto sym_not_found; #define LOAD_FUNCPTR(f) if((fp_##f = wine_dlsym(jackhandle, #f, NULL, 0)) == NULL) goto sym_not_found;
...@@ -1665,7 +1671,9 @@ DWORD WINAPI JACK_wodMessage(UINT wDevID, UINT wMsg, DWORD dwUser, ...@@ -1665,7 +1671,9 @@ DWORD WINAPI JACK_wodMessage(UINT wDevID, UINT wMsg, DWORD dwUser,
switch (wMsg) { switch (wMsg) {
case DRVM_INIT: case DRVM_INIT:
return JACK_WaveInit();
case DRVM_EXIT: case DRVM_EXIT:
return JACK_WaveRelease();
case DRVM_ENABLE: case DRVM_ENABLE:
case DRVM_DISABLE: case DRVM_DISABLE:
/* FIXME: Pretend this is supported */ /* FIXME: Pretend this is supported */
...@@ -2362,7 +2370,9 @@ DWORD WINAPI JACK_widMessage(WORD wDevID, WORD wMsg, DWORD dwUser, ...@@ -2362,7 +2370,9 @@ DWORD WINAPI JACK_widMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
switch (wMsg) { switch (wMsg) {
case DRVM_INIT: case DRVM_INIT:
return JACK_WaveInit();
case DRVM_EXIT: case DRVM_EXIT:
return JACK_WaveRelease();
case DRVM_ENABLE: case DRVM_ENABLE:
case DRVM_DISABLE: case DRVM_DISABLE:
/* FIXME: Pretend this is supported */ /* FIXME: Pretend this is supported */
......
...@@ -49,20 +49,17 @@ static LRESULT JACK_drvLoad(void) ...@@ -49,20 +49,17 @@ static LRESULT JACK_drvLoad(void)
TRACE("()\n"); TRACE("()\n");
/* dynamically load the jack library if not already loaded */ /* dynamically load the jack library if not already loaded */
jackhandle = wine_dlopen(SONAME_LIBJACK, RTLD_NOW, NULL, 0);
TRACE("SONAME_LIBJACK == %s\n", SONAME_LIBJACK);
TRACE("jackhandle == %p\n", jackhandle);
if(!jackhandle) if(!jackhandle)
{ {
jackhandle = wine_dlopen(SONAME_LIBJACK, RTLD_NOW, NULL, 0); FIXME("error loading the jack library %s, please install this library to use jack\n",
TRACE("SONAME_LIBJACK == %s\n", SONAME_LIBJACK); SONAME_LIBJACK);
TRACE("jackhandle == %p\n", jackhandle); return 0;
if(!jackhandle)
{
FIXME("error loading the jack library %s, please install this library to use jack\n", SONAME_LIBJACK);
jackhandle = (void*)-1;
return 0;
}
} }
return JACK_WaveInit(); return 1;
} }
/************************************************************************** /**************************************************************************
...@@ -73,10 +70,8 @@ static LRESULT JACK_drvFree(void) ...@@ -73,10 +70,8 @@ static LRESULT JACK_drvFree(void)
{ {
TRACE("()\n"); TRACE("()\n");
if(jackhandle && (jackhandle != (void*)-1)) if(jackhandle)
{ {
JACK_WaveRelease();
TRACE("calling wine_dlclose() on jackhandle\n"); TRACE("calling wine_dlclose() on jackhandle\n");
wine_dlclose(jackhandle, NULL, 0); wine_dlclose(jackhandle, NULL, 0);
jackhandle = NULL; jackhandle = NULL;
...@@ -85,31 +80,6 @@ static LRESULT JACK_drvFree(void) ...@@ -85,31 +80,6 @@ static LRESULT JACK_drvFree(void)
return 1; return 1;
} }
/**************************************************************************
* JACK_drvOpen [internal]
*/
static LRESULT JACK_drvOpen(LPSTR str)
{
TRACE("(%s)\n", str);
/* if we were unable to load the jack library then fail the */
/* driver open */
if(!jackhandle)
{
FIXME("unable to open the jack library, returning 0\n");
return 0;
}
return 1;
}
/**************************************************************************
* JACK_drvClose [internal]
*/
static LRESULT JACK_drvClose(DWORD_PTR dwDevID)
{
TRACE("(%08lx)\n", dwDevID);
return 1;
}
#endif /* #ifdef SONAME_LIBJACK */ #endif /* #ifdef SONAME_LIBJACK */
...@@ -136,16 +106,17 @@ LRESULT CALLBACK JACK_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg, ...@@ -136,16 +106,17 @@ LRESULT CALLBACK JACK_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg,
#ifdef SONAME_LIBJACK #ifdef SONAME_LIBJACK
case DRV_LOAD: return JACK_drvLoad(); case DRV_LOAD: return JACK_drvLoad();
case DRV_FREE: return JACK_drvFree(); case DRV_FREE: return JACK_drvFree();
case DRV_OPEN: return JACK_drvOpen((LPSTR)dwParam1); case DRV_OPEN:
case DRV_CLOSE: return JACK_drvClose(dwDevID); case DRV_CLOSE:
case DRV_ENABLE: return 1; case DRV_INSTALL:
case DRV_DISABLE: return 1; case DRV_REMOVE:
case DRV_QUERYCONFIGURE: return 1; case DRV_ENABLE:
case DRV_DISABLE:
case DRV_QUERYCONFIGURE:
return 1;
case DRV_CONFIGURE: MessageBoxA(0, "jack audio driver!", "jack driver", MB_OK); return 1; case DRV_CONFIGURE: MessageBoxA(0, "jack audio driver!", "jack driver", MB_OK); return 1;
case DRV_INSTALL: return DRVCNF_RESTART;
case DRV_REMOVE: return DRVCNF_RESTART;
#endif #endif
default: default:
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2); return 0;
} }
} }
...@@ -22,7 +22,4 @@ ...@@ -22,7 +22,4 @@
extern void *jackhandle; /* pointer to the libjack library */ extern void *jackhandle; /* pointer to the libjack library */
extern LONG JACK_WaveInit(void);
extern LONG JACK_WaveRelease(void);
#endif /* __WINE_JACK_H */ #endif /* __WINE_JACK_H */
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