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"
25 #include "wine/library.h"
34 #ifdef HAVE_JACK_JACK_H
37 /* set this to zero or one to enable or disable tracing in here */
41 #define PRINTF(...) printf(...)
47 #define JACK_SONAME "libjack.so"
50 void *jackhandle = NULL;
52 /**************************************************************************
53 * JACK_drvLoad [internal]
55 static DWORD JACK_drvLoad(void)
57 PRINTF("JACK_drvLoad()\n");
59 /* dynamically load the jack library if not already loaded */
62 jackhandle = wine_dlopen(JACK_SONAME, RTLD_NOW, NULL, 0);
63 PRINTF("JACK_drvLoad: JACK_SONAME == %s\n", JACK_SONAME);
64 PRINTF("JACK_drvLoad: jackhandle == 0x%x\n", jackhandle);
67 PRINTF("JACK_drvLoad: error loading the jack library %s, please install this library to use jack\n", JACK_SONAME);
68 jackhandle = (void*)-1;
76 /**************************************************************************
77 * JACK_drvFree [internal]
79 /* unload the jack library on driver free */
80 static DWORD JACK_drvFree(void)
82 PRINTF("JACK_drvFree()\n");
84 if(jackhandle && (jackhandle != (void*)-1))
86 PRINTF("JACK_drvFree: calling wine_dlclose() on jackhandle\n");
87 wine_dlclose(jackhandle, NULL, 0);
94 /**************************************************************************
95 * JACK_drvOpen [internal]
97 static DWORD JACK_drvOpen(LPSTR str)
99 /* if we were unable to load the jack library then fail the */
103 PRINTF("JACK_drvOpen: unable to open the jack library, returning 0\n");
109 PRINTF("JACK_drvOpen: jack != 0 (already open), returning 0\n");
113 /* I know, this is ugly, but who cares... */
114 PRINTF("JACK_drvOpen: opened jack(set jack = 1), returning 1\n");
119 /**************************************************************************
120 * JACK_drvClose [internal]
122 static DWORD JACK_drvClose(DWORD dwDevID)
126 PRINTF("JACK_drvClose: jack is nonzero, setting jack to 0 and returning 1\n");
131 PRINTF("JACK_drvClose: jack is zero(closed), returning 0\n");
134 #endif /* #ifdef HAVE_JACK_JACK_H */
137 /**************************************************************************
138 * DriverProc (WINEJACK.1)
140 LONG CALLBACK JACK_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
141 DWORD dwParam1, DWORD dwParam2)
143 /* EPP TRACE("(%08lX, %04X, %08lX, %08lX, %08lX)\n", */
144 /* EPP dwDevID, hDriv, wMsg, dwParam1, dwParam2); */
147 #ifdef HAVE_JACK_JACK_H
149 PRINTF("JACK_DriverProc: DRV_LOAD\n");
150 return JACK_drvLoad();
152 PRINTF("JACK_DriverProc: DRV_FREE\n");
153 return JACK_drvFree();
155 PRINTF("JACK_DriverProc: DRV_OPEN\n");
156 return JACK_drvOpen((LPSTR)dwParam1);
158 PRINTF("JACK_DriverProc: DRV_CLOSE\n");
159 return JACK_drvClose(dwDevID);
161 PRINTF("JACK_DriverProc: DRV_ENABLE\n");
164 PRINTF("JACK_DriverProc: DRV_DISABLE\n");
166 case DRV_QUERYCONFIGURE: return 1;
167 case DRV_CONFIGURE: MessageBoxA(0, "jack audio driver!", "jack driver", MB_OK); return 1;
169 PRINTF("JACK_DriverProc: DRV_INSTALL\n");
170 return DRVCNF_RESTART;
172 PRINTF("JACK_DriverProc: DRV_REMOVE\n");
173 return DRVCNF_RESTART;
176 return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);