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
21 #include <sys/ioctl.h>
23 #include <linux/soundcard.h>
26 #define SOUND_DEV "/dev/dsp"
27 #define MIXER_DEV "/dev/mixer"
30 #define IOCTL(a,b,c) ioctl(a,b,&c)
32 #define IOCTL(a,b,c) (c = ioctl(a,b,c) )
36 /*-----------------------------------------------------------------------*/
39 /**************************************************************************
40 * AUX_GetDevCaps [internal]
42 DWORD
AUX_GetDevCaps(WORD wDevID
, LPAUXCAPS lpCaps
, DWORD dwSize
)
47 printf("AUX_GetDevCaps(%u, %08X, %u);\n", wDevID
, lpCaps
, dwSize
);
48 if (lpCaps
== NULL
) return MMSYSERR_NOTENABLED
;
49 if ((mixer
= open(MIXER_DEV
, O_RDWR
)) < 0) {
50 printf("AUX_GetDevCaps // mixer device not available !\n");
51 return MMSYSERR_NOTENABLED
;
53 if (ioctl(mixer
, SOUND_MIXER_READ_LINE
, &volume
) == -1) {
54 printf("AUX_GetDevCaps // unable read mixer !\n");
55 return MMSYSERR_NOTENABLED
;
58 return MMSYSERR_NOERROR
;
60 return MMSYSERR_NOTENABLED
;
65 /**************************************************************************
66 * AUX_GetVolume [internal]
68 DWORD
AUX_GetVolume(WORD wDevID
, DWORD dwParam
)
73 printf("AUX_GetVolume(%u, %08X);\n", wDevID
, dwParam
);
74 if ((mixer
= open(MIXER_DEV
, O_RDWR
)) < 0) {
75 printf("Linux 'AUX_GetVolume' // mixer device not available !\n");
76 return MMSYSERR_NOTENABLED
;
78 if (ioctl(mixer
, SOUND_MIXER_READ_LINE
, &volume
) == -1) {
79 printf("Linux 'AUX_GetVolume' // unable read mixer !\n");
80 return MMSYSERR_NOTENABLED
;
83 return MMSYSERR_NOERROR
;
85 return MMSYSERR_NOTENABLED
;
89 /**************************************************************************
90 * AUX_SetVolume [internal]
92 DWORD
AUX_SetVolume(WORD wDevID
, DWORD dwParam
)
97 printf("AUX_SetVolume(%u, %08X);\n", wDevID
, dwParam
);
98 if ((mixer
= open(MIXER_DEV
, O_RDWR
)) < 0) {
99 printf("Linux 'AUX_SetVolume' // mixer device not available !\n");
100 return MMSYSERR_NOTENABLED
;
102 if (ioctl(mixer
, SOUND_MIXER_WRITE_LINE
, &volume
) == -1) {
103 printf("Linux 'AUX_SetVolume' // unable set mixer !\n");
104 return MMSYSERR_NOTENABLED
;
107 return MMSYSERR_NOERROR
;
109 return MMSYSERR_NOTENABLED
;
114 /**************************************************************************
115 * auxMessage [sample driver]
117 DWORD
auxMessage(WORD wDevID
, WORD wMsg
, DWORD dwUser
,
118 DWORD dwParam1
, DWORD dwParam2
)
120 printf("auxMessage(%u, %04X, %08X, %08X, %08X);\n",
121 wDevID
, wMsg
, dwUser
, dwParam1
, dwParam2
);
123 case AUXDM_GETDEVCAPS
:
124 return AUX_GetDevCaps(wDevID
, (LPAUXCAPS
)dwParam1
, dwParam2
);
125 case AUXDM_GETNUMDEVS
:
127 case AUXDM_GETVOLUME
:
128 return AUX_GetVolume(wDevID
, dwParam1
);
129 case AUXDM_SETVOLUME
:
130 return AUX_SetVolume(wDevID
, dwParam1
);
132 return MMSYSERR_NOTSUPPORTED
;
136 #endif /* #ifdef BUILTIN_MMSYSTEM */