Some code cleanups.
[wine] / dlls / winmm / wineaudioio / audioio.c
1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
2 /*
3  * Wine Driver for Libaudioio
4  * Derived From WineOSS
5  * Copyright    1999 Eric Pouech
6  * Modifications by Robert Lunnon 2002
7  *
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.
12  *
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.
17  *
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
21  */
22
23 #include "config.h"
24
25 #include "windef.h"
26 #include "winbase.h"
27 #include "wingdi.h"
28 #include "winuser.h"
29 #include "mmddk.h"
30
31 #ifdef HAVE_LIBAUDIOIO
32
33 static  struct WINE_LIBAUDIOIO* audioio = NULL;
34
35 extern LONG LIBAUDIOIO_WaveInit(void);
36 extern BOOL LIBAUDIOIO_MidiInit(void);
37
38 /**************************************************************************
39  *                              LIBAUDIOIO_drvOpen                      [internal]
40  */
41 static  DWORD   LIBAUDIOIO_drvOpen(LPSTR str)
42 {
43     if (audioio)
44         return 0;
45
46     /* I know, this is ugly, but who cares... */
47     audioio = (struct WINE_LIBAUDIOIO*)1;
48     return 1;
49 }
50
51 /**************************************************************************
52  *                              LIBAUDIOIO_drvClose                     [internal]
53  */
54 static  DWORD   LIBAUDIOIO_drvClose(DWORD dwDevID)
55 {
56     if (audioio) {
57         audioio = NULL;
58         return 1;
59     }
60     return 0;
61 }
62
63 #endif
64
65
66 /**************************************************************************
67  *                              DriverProc
68  */
69 LONG CALLBACK   LIBAUDIOIO_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
70                                DWORD dwParam1, DWORD dwParam2)
71 {
72 /* EPP     TRACE("(%08lX, %04X, %08lX, %08lX, %08lX)\n",  */
73 /* EPP    dwDevID, hDriv, wMsg, dwParam1, dwParam2); */
74
75     switch(wMsg) {
76 #ifdef HAVE_LIBAUDIOIO
77     case DRV_LOAD:              LIBAUDIOIO_WaveInit();
78 #ifdef HAVE_LIBAUDIOIO_MIDI
79                                 LIBAUDIOIO_MidiInit();
80 #endif
81                                 return 1;
82     case DRV_FREE:              return 1;
83     case DRV_OPEN:              return LIBAUDIOIO_drvOpen((LPSTR)dwParam1);
84     case DRV_CLOSE:             return LIBAUDIOIO_drvClose(dwDevID);
85     case DRV_ENABLE:            return 1;
86     case DRV_DISABLE:           return 1;
87     case DRV_QUERYCONFIGURE:    return 1;
88     case DRV_CONFIGURE:         MessageBoxA(0, "Libaudioio MultiMedia Driver !", "Libaudioio Driver", MB_OK);   return 1;
89     case DRV_INSTALL:           return DRVCNF_RESTART;
90     case DRV_REMOVE:            return DRVCNF_RESTART;
91 #endif
92     default:
93         return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
94     }
95 }