1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
3 * Wine Driver for jack Sound Server
4 * http://jackit.sourceforge.net
6 * Copyright 2002 Chris Morgan
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "wine/port.h"
35 #include "wine/library.h"
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(jack);
40 #ifdef HAVE_JACK_JACK_H
43 /* set this to zero or one to enable or disable tracing in here */
45 #ifndef SONAME_LIBJACK
46 #define SONAME_LIBJACK "libjack.so"
49 void *jackhandle = NULL;
51 /**************************************************************************
52 * JACK_drvLoad [internal]
54 static DWORD JACK_drvLoad(void)
56 TRACE("JACK_drvLoad()\n");
58 /* dynamically load the jack library if not already loaded */
61 jackhandle = wine_dlopen(SONAME_LIBJACK, RTLD_NOW, NULL, 0);
62 TRACE("JACK_drvLoad: SONAME_LIBJACK == %s\n", SONAME_LIBJACK);
63 TRACE("JACK_drvLoad: jackhandle == 0x%x\n", jackhandle);
66 FIXME("JACK_drvLoad: error loading the jack library %s, please install this library to use jack\n", SONAME_LIBJACK);
67 jackhandle = (void*)-1;
75 /**************************************************************************
76 * JACK_drvFree [internal]
78 /* unload the jack library on driver free */
79 static DWORD JACK_drvFree(void)
81 TRACE("JACK_drvFree()\n");
83 if(jackhandle && (jackhandle != (void*)-1))
85 TRACE("JACK_drvFree: calling wine_dlclose() on jackhandle\n");
86 wine_dlclose(jackhandle, NULL, 0);
93 /**************************************************************************
94 * JACK_drvOpen [internal]
96 static DWORD JACK_drvOpen(LPSTR str)
98 /* if we were unable to load the jack library then fail the */
102 FIXME("JACK_drvOpen: unable to open the jack library, returning 0\n");
108 FIXME("JACK_drvOpen: jack != 0 (already open), returning 0\n");
112 /* I know, this is ugly, but who cares... */
113 TRACE("JACK_drvOpen: opened jack(set jack = 1), returning 1\n");
118 /**************************************************************************
119 * JACK_drvClose [internal]
121 static DWORD JACK_drvClose(DWORD dwDevID)
125 TRACE("JACK_drvClose: jack is nonzero, setting jack to 0 and returning 1\n");
130 TRACE("JACK_drvClose: jack is zero(closed), returning 0\n");
133 #endif /* #ifdef HAVE_JACK_JACK_H */
136 /**************************************************************************
137 * DriverProc (WINEJACK.1)
139 LONG CALLBACK JACK_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
140 DWORD dwParam1, DWORD dwParam2)
142 /* EPP TRACE("(%08lX, %04X, %08lX, %08lX, %08lX)\n", */
143 /* EPP dwDevID, hDriv, wMsg, dwParam1, dwParam2); */
146 #ifdef HAVE_JACK_JACK_H
148 TRACE("JACK_DriverProc: DRV_LOAD\n");
149 return JACK_drvLoad();
151 TRACE("JACK_DriverProc: DRV_FREE\n");
152 return JACK_drvFree();
154 TRACE("JACK_DriverProc: DRV_OPEN\n");
155 return JACK_drvOpen((LPSTR)dwParam1);
157 TRACE("JACK_DriverProc: DRV_CLOSE\n");
158 return JACK_drvClose(dwDevID);
160 TRACE("JACK_DriverProc: DRV_ENABLE\n");
163 TRACE("JACK_DriverProc: DRV_DISABLE\n");
165 case DRV_QUERYCONFIGURE: return 1;
166 case DRV_CONFIGURE: MessageBoxA(0, "jack audio driver!", "jack driver", MB_OK); return 1;
168 TRACE("JACK_DriverProc: DRV_INSTALL\n");
169 return DRVCNF_RESTART;
171 TRACE("JACK_DriverProc: DRV_REMOVE\n");
172 return DRVCNF_RESTART;
175 return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);