[PATCH 6/7] winejack.drv: Clean up too
Maarten Lankhorst
m.b.lankhorst at gmail.com
Wed Apr 21 06:45:32 CDT 2010
---
dlls/winejack.drv/audio.c | 14 ++++++++-
dlls/winejack.drv/jack.c | 63 ++++++++++++--------------------------------
dlls/winejack.drv/jack.h | 3 --
3 files changed, 29 insertions(+), 51 deletions(-)
diff --git a/dlls/winejack.drv/audio.c b/dlls/winejack.drv/audio.c
index 512bc01..ffaffae 100644
--- a/dlls/winejack.drv/audio.c
+++ b/dlls/winejack.drv/audio.c
@@ -834,15 +834,19 @@ static void JACK_CloseWaveInDevice(WINE_WAVEIN* wwi)
#endif
}
+static int WAVE_loadcount;
+
/******************************************************************
* JACK_WaveRelease
*
*
*/
-LONG JACK_WaveRelease(void)
+static LONG JACK_WaveRelease(void)
{
int iDevice;
+ if (--WAVE_loadcount)
+ return 1;
TRACE("closing all open waveout devices\n");
/* close all open output devices */
@@ -887,12 +891,14 @@ LONG JACK_WaveRelease(void)
*
* Initialize internal structures from JACK server info
*/
-LONG JACK_WaveInit(void)
+static LONG JACK_WaveInit(void)
{
int i;
CHAR szPname[MAXPNAMELEN];
TRACE("called\n");
+ if (WAVE_loadcount++)
+ return 1;
/* setup function pointers */
#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,
switch (wMsg) {
case DRVM_INIT:
+ return JACK_WaveInit();
case DRVM_EXIT:
+ return JACK_WaveRelease();
case DRVM_ENABLE:
case DRVM_DISABLE:
/* FIXME: Pretend this is supported */
@@ -2362,7 +2370,9 @@ DWORD WINAPI JACK_widMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
switch (wMsg) {
case DRVM_INIT:
+ return JACK_WaveInit();
case DRVM_EXIT:
+ return JACK_WaveRelease();
case DRVM_ENABLE:
case DRVM_DISABLE:
/* FIXME: Pretend this is supported */
diff --git a/dlls/winejack.drv/jack.c b/dlls/winejack.drv/jack.c
index 80794ae..ebcb6c7 100644
--- a/dlls/winejack.drv/jack.c
+++ b/dlls/winejack.drv/jack.c
@@ -49,20 +49,17 @@ static LRESULT JACK_drvLoad(void)
TRACE("()\n");
/* 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)
{
- jackhandle = wine_dlopen(SONAME_LIBJACK, RTLD_NOW, NULL, 0);
- TRACE("SONAME_LIBJACK == %s\n", SONAME_LIBJACK);
- TRACE("jackhandle == %p\n", jackhandle);
- if(!jackhandle)
- {
- FIXME("error loading the jack library %s, please install this library to use jack\n", SONAME_LIBJACK);
- jackhandle = (void*)-1;
- return 0;
- }
+ FIXME("error loading the jack library %s, please install this library to use jack\n",
+ SONAME_LIBJACK);
+ return 0;
}
- return JACK_WaveInit();
+ return 1;
}
/**************************************************************************
@@ -73,10 +70,8 @@ static LRESULT JACK_drvFree(void)
{
TRACE("()\n");
- if(jackhandle && (jackhandle != (void*)-1))
+ if(jackhandle)
{
- JACK_WaveRelease();
-
TRACE("calling wine_dlclose() on jackhandle\n");
wine_dlclose(jackhandle, NULL, 0);
jackhandle = NULL;
@@ -85,31 +80,6 @@ static LRESULT JACK_drvFree(void)
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 */
@@ -136,16 +106,17 @@ LRESULT CALLBACK JACK_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg,
#ifdef SONAME_LIBJACK
case DRV_LOAD: return JACK_drvLoad();
case DRV_FREE: return JACK_drvFree();
- case DRV_OPEN: return JACK_drvOpen((LPSTR)dwParam1);
- case DRV_CLOSE: return JACK_drvClose(dwDevID);
- case DRV_ENABLE: return 1;
- case DRV_DISABLE: return 1;
- case DRV_QUERYCONFIGURE: return 1;
+ case DRV_OPEN:
+ case DRV_CLOSE:
+ case DRV_INSTALL:
+ case DRV_REMOVE:
+ 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_INSTALL: return DRVCNF_RESTART;
- case DRV_REMOVE: return DRVCNF_RESTART;
#endif
default:
- return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
+ return 0;
}
}
diff --git a/dlls/winejack.drv/jack.h b/dlls/winejack.drv/jack.h
index c53041d..5545f24 100644
--- a/dlls/winejack.drv/jack.h
+++ b/dlls/winejack.drv/jack.h
@@ -22,7 +22,4 @@
extern void *jackhandle; /* pointer to the libjack library */
-extern LONG JACK_WaveInit(void);
-extern LONG JACK_WaveRelease(void);
-
#endif /* __WINE_JACK_H */
--
1.7.0.4
More information about the wine-patches
mailing list