2 * Sample AUXILARY Wine Driver for Linux
4 * Copyright 1994 Martin Ayotte
6 static char Copyright
[] = "Copyright Martin Ayotte, 1994";
9 #define BUILTIN_MMSYSTEM
12 #ifdef BUILTIN_MMSYSTEM
20 #include <sys/ioctl.h>
27 #include <linux/soundcard.h>
30 #define SOUND_DEV "/dev/dsp"
31 #define MIXER_DEV "/dev/mixer"
34 #define IOCTL(a,b,c) ioctl(a,b,&c)
36 #define IOCTL(a,b,c) (c = ioctl(a,b,c) )
40 /*-----------------------------------------------------------------------*/
43 /**************************************************************************
44 * AUX_GetDevCaps [internal]
46 DWORD
AUX_GetDevCaps(WORD wDevID
, LPAUXCAPS lpCaps
, DWORD dwSize
)
51 printf("AUX_GetDevCaps(%u, %08X, %u);\n", wDevID
, lpCaps
, dwSize
);
52 if (lpCaps
== NULL
) return MMSYSERR_NOTENABLED
;
53 if ((mixer
= open(MIXER_DEV
, O_RDWR
)) < 0) {
54 printf("AUX_GetDevCaps // mixer device not available !\n");
55 return MMSYSERR_NOTENABLED
;
57 if (ioctl(mixer
, SOUND_MIXER_READ_LINE
, &volume
) == -1) {
59 printf("AUX_GetDevCaps // unable read mixer !\n");
60 return MMSYSERR_NOTENABLED
;
64 lpCaps
->wMid
= 0x0002;
65 lpCaps
->vDriverVersion
= 0x0200;
66 lpCaps
->dwSupport
= AUXCAPS_VOLUME
| AUXCAPS_LRVOLUME
;
69 lpCaps
->wPid
= 0x0196;
70 strcpy(lpCaps
->szPname
, "SB16 Aux: Wave");
71 lpCaps
->wTechnology
= AUXCAPS_AUXIN
;
74 lpCaps
->wPid
= 0x0197;
75 strcpy(lpCaps
->szPname
, "SB16 Aux: Midi Synth");
76 lpCaps
->wTechnology
= AUXCAPS_AUXIN
;
79 lpCaps
->wPid
= 0x0191;
80 strcpy(lpCaps
->szPname
, "SB16 Aux: CD");
81 lpCaps
->wTechnology
= AUXCAPS_CDAUDIO
;
84 lpCaps
->wPid
= 0x0192;
85 strcpy(lpCaps
->szPname
, "SB16 Aux: Line-In");
86 lpCaps
->wTechnology
= AUXCAPS_AUXIN
;
89 lpCaps
->wPid
= 0x0193;
90 strcpy(lpCaps
->szPname
, "SB16 Aux: Mic");
91 lpCaps
->wTechnology
= AUXCAPS_AUXIN
;
94 lpCaps
->wPid
= 0x0194;
95 strcpy(lpCaps
->szPname
, "SB16 Aux: Master");
96 lpCaps
->wTechnology
= AUXCAPS_AUXIN
;
102 lpCaps
->vDriverVersion
= 0x0100;
103 strcpy(lpCaps
->szPname
, "Generic Linux Auxiliary Driver");
104 lpCaps
->wTechnology
= AUXCAPS_CDAUDIO
;
105 lpCaps
->dwSupport
= AUXCAPS_VOLUME
| AUXCAPS_LRVOLUME
;
107 return MMSYSERR_NOERROR
;
109 return MMSYSERR_NOTENABLED
;
114 /**************************************************************************
115 * AUX_GetVolume [internal]
117 DWORD
AUX_GetVolume(WORD wDevID
, LPDWORD lpdwVol
)
123 printf("AUX_GetVolume(%u, %08X);\n", wDevID
, lpdwVol
);
124 if (lpdwVol
== NULL
) return MMSYSERR_NOTENABLED
;
125 if ((mixer
= open(MIXER_DEV
, O_RDWR
)) < 0) {
126 printf("Linux 'AUX_GetVolume' // mixer device not available !\n");
127 return MMSYSERR_NOTENABLED
;
131 printf("Linux 'AUX_GetVolume' // SOUND_MIXER_READ_PCM !\n");
132 cmd
= SOUND_MIXER_READ_PCM
;
135 printf("Linux 'AUX_GetVolume' // SOUND_MIXER_READ_SYNTH !\n");
136 cmd
= SOUND_MIXER_READ_SYNTH
;
139 printf("Linux 'AUX_GetVolume' // SOUND_MIXER_READ_CD !\n");
140 cmd
= SOUND_MIXER_READ_CD
;
143 printf("Linux 'AUX_GetVolume' // SOUND_MIXER_READ_LINE !\n");
144 cmd
= SOUND_MIXER_READ_LINE
;
147 printf("Linux 'AUX_GetVolume' // SOUND_MIXER_READ_MIC !\n");
148 cmd
= SOUND_MIXER_READ_MIC
;
152 printf("Linux 'AUX_GetVolume' // SOUND_MIXER_READ_VOLUME !\n");
153 cmd
= SOUND_MIXER_READ_VOLUME
;
156 if (ioctl(mixer
, cmd
, &volume
) == -1) {
157 printf("Linux 'AUX_GetVolume' // unable read mixer !\n");
158 return MMSYSERR_NOTENABLED
;
161 *lpdwVol
= MAKELONG(volume
, volume
);
162 return MMSYSERR_NOERROR
;
164 return MMSYSERR_NOTENABLED
;
168 /**************************************************************************
169 * AUX_SetVolume [internal]
171 DWORD
AUX_SetVolume(WORD wDevID
, DWORD dwParam
)
177 printf("AUX_SetVolume(%u, %08X);\n", wDevID
, dwParam
);
178 volume
= LOWORD(dwParam
);
179 if ((mixer
= open(MIXER_DEV
, O_RDWR
)) < 0) {
180 printf("Linux 'AUX_SetVolume' // mixer device not available !\n");
181 return MMSYSERR_NOTENABLED
;
185 printf("Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_PCM !\n");
186 cmd
= SOUND_MIXER_WRITE_PCM
;
189 printf("Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_SYNTH !\n");
190 cmd
= SOUND_MIXER_WRITE_SYNTH
;
193 printf("Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_CD !\n");
194 cmd
= SOUND_MIXER_WRITE_CD
;
197 printf("Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_LINE !\n");
198 cmd
= SOUND_MIXER_WRITE_LINE
;
201 printf("Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_MIC !\n");
202 cmd
= SOUND_MIXER_WRITE_MIC
;
206 printf("Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_VOLUME !\n");
207 cmd
= SOUND_MIXER_WRITE_VOLUME
;
210 if (ioctl(mixer
, cmd
, &volume
) == -1) {
211 printf("Linux 'AUX_SetVolume' // unable set mixer !\n");
212 return MMSYSERR_NOTENABLED
;
215 return MMSYSERR_NOERROR
;
217 return MMSYSERR_NOTENABLED
;
222 /**************************************************************************
223 * auxMessage [sample driver]
225 DWORD
auxMessage(WORD wDevID
, WORD wMsg
, DWORD dwUser
,
226 DWORD dwParam1
, DWORD dwParam2
)
228 printf("auxMessage(%u, %04X, %08X, %08X, %08X);\n",
229 wDevID
, wMsg
, dwUser
, dwParam1
, dwParam2
);
231 case AUXDM_GETDEVCAPS
:
232 return AUX_GetDevCaps(wDevID
, (LPAUXCAPS
)dwParam1
, dwParam2
);
233 case AUXDM_GETNUMDEVS
:
234 printf("AUX_GetNumDevs();\n");
236 case AUXDM_GETVOLUME
:
237 return AUX_GetVolume(wDevID
, (LPDWORD
)dwParam1
);
238 case AUXDM_SETVOLUME
:
239 return AUX_SetVolume(wDevID
, dwParam1
);
241 return MMSYSERR_NOTSUPPORTED
;
245 #endif /* #ifdef BUILTIN_MMSYSTEM */