[142] | 1 | /* $Id: ossidc.h 194 2001-09-28 12:13:06Z sandervl $ */
|
---|
| 2 |
|
---|
| 3 | //******************************************************************************
|
---|
| 4 | // Header for idc definitions & declarations
|
---|
| 5 | //
|
---|
| 6 | // Copyright 2000 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
| 7 | //
|
---|
| 8 | // This program is free software; you can redistribute it and/or
|
---|
| 9 | // modify it under the terms of the GNU General Public License as
|
---|
| 10 | // published by the Free Software Foundation; either version 2 of
|
---|
| 11 | // the License, or (at your option) any later version.
|
---|
| 12 | //
|
---|
| 13 | // This program 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
|
---|
| 16 | // GNU General Public License for more details.
|
---|
| 17 | //
|
---|
| 18 | // You should have received a copy of the GNU General Public
|
---|
| 19 | // License along with this program; if not, write to the Free
|
---|
| 20 | // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
|
---|
| 21 | // USA.
|
---|
| 22 | //
|
---|
| 23 | //******************************************************************************
|
---|
| 24 | #ifndef __OSSIDC_H__
|
---|
| 25 | #define __OSSIDC_H__
|
---|
| 26 |
|
---|
| 27 | #include <ossdefos2.h>
|
---|
| 28 | #include <osssound.h>
|
---|
| 29 |
|
---|
| 30 | typedef BOOL (FAR48 __cdecl *IDC16_HANDLER)(ULONG cmd, ULONG param);
|
---|
| 31 |
|
---|
| 32 | extern IDC16_HANDLER idc16_PddHandler;
|
---|
| 33 |
|
---|
| 34 | //IDC communication packet
|
---|
| 35 | typedef struct
|
---|
| 36 | {
|
---|
| 37 | union {
|
---|
| 38 | struct {
|
---|
| 39 | ULONG handler16; //16:16 address of pdd idc handler
|
---|
| 40 | } init;
|
---|
| 41 | struct {
|
---|
| 42 | ULONG irqnr;
|
---|
| 43 | } irq;
|
---|
| 44 | struct {
|
---|
| 45 | ULONG streamtype;
|
---|
| 46 | } open;
|
---|
| 47 | struct {
|
---|
| 48 | ULONG streamtype;
|
---|
| 49 | ULONG streamid;
|
---|
| 50 | } close;
|
---|
| 51 | struct {
|
---|
| 52 | ULONG streamtype;
|
---|
| 53 | ULONG streamid;
|
---|
| 54 | ULONG cmd;
|
---|
| 55 | ULONG ioctl_param;
|
---|
| 56 | } ioctl;
|
---|
| 57 | struct {
|
---|
| 58 | ULONG streamtype;
|
---|
| 59 | ULONG streamid;
|
---|
| 60 | } startstop;
|
---|
| 61 | struct {
|
---|
| 62 | ULONG streamtype;
|
---|
| 63 | ULONG streamid;
|
---|
| 64 | ULONG buffer; //0:32 address of mmpm/2 buffer
|
---|
| 65 | ULONG size;
|
---|
| 66 | } buffer;
|
---|
| 67 | struct {
|
---|
| 68 | ULONG streamtype;
|
---|
| 69 | ULONG streamid;
|
---|
| 70 | ULONG cmd;
|
---|
| 71 | ULONG volume;
|
---|
| 72 | } mixer;
|
---|
| 73 | struct {
|
---|
[151] | 74 | ULONG streamtype;
|
---|
| 75 | ULONG streamid;
|
---|
| 76 | ULONG midiByte;
|
---|
| 77 | } midiwrite;
|
---|
| 78 | struct {
|
---|
| 79 | ULONG streamtype;
|
---|
| 80 | ULONG streamid;
|
---|
| 81 | ULONG buffer;
|
---|
| 82 | ULONG bufsize;
|
---|
| 83 | } midiread;
|
---|
| 84 | struct {
|
---|
[153] | 85 | ULONG streamtype;
|
---|
| 86 | ULONG streamid;
|
---|
| 87 | } getspace;
|
---|
| 88 | struct {
|
---|
[142] | 89 | ULONG param1;
|
---|
| 90 | ULONG param2;
|
---|
| 91 | ULONG param3;
|
---|
| 92 | ULONG param4;
|
---|
| 93 | ULONG fileid;
|
---|
| 94 | };
|
---|
| 95 | };
|
---|
| 96 | } IDC32_PACKET, NEAR *PIDC32_PACKET;
|
---|
| 97 |
|
---|
| 98 | typedef struct
|
---|
| 99 | {
|
---|
| 100 | union {
|
---|
| 101 | struct {
|
---|
| 102 | ULONG devid;
|
---|
| 103 | ULONG pResource; //16:16 resource structure pointer
|
---|
| 104 | } finddev;
|
---|
| 105 | struct {
|
---|
| 106 | ULONG irqnr;
|
---|
| 107 | } irq;
|
---|
| 108 | struct {
|
---|
| 109 | ULONG size;
|
---|
| 110 | } malloc;
|
---|
| 111 | struct {
|
---|
| 112 | ULONG addr; //16:16 address returned by malloc at start of memory block
|
---|
| 113 | } free;
|
---|
| 114 | struct {
|
---|
| 115 | ULONG type;
|
---|
| 116 | ULONG streamid;
|
---|
| 117 | } process;
|
---|
| 118 | struct {
|
---|
| 119 | ULONG param1;
|
---|
| 120 | ULONG param2;
|
---|
| 121 | };
|
---|
| 122 | };
|
---|
| 123 | } IDC16_PACKET;
|
---|
| 124 |
|
---|
| 125 | //IDC commands (16->32 bits)
|
---|
| 126 | #define IDC32_INIT 0
|
---|
| 127 | #define IDC32_EXIT 1
|
---|
| 128 | #define IDC32_IRQ 2
|
---|
| 129 | #define IDC32_STREAM_OPEN 3
|
---|
| 130 | #define IDC32_STREAM_CLOSE 4
|
---|
| 131 | #define IDC32_STREAM_ADDBUFFER 5
|
---|
| 132 | #define IDC32_STREAM_START 6
|
---|
| 133 | #define IDC32_STREAM_STOP 7
|
---|
| 134 | #define IDC32_STREAM_RESET 8
|
---|
| 135 | #define IDC32_STREAM_PAUSE 9
|
---|
| 136 | #define IDC32_STREAM_IOCTL 10
|
---|
| 137 | #define IDC32_STREAM_MIXER 11
|
---|
[151] | 138 | #define IDC32_MIDI_WRITE 12
|
---|
| 139 | #define IDC32_MIDI_READ 13
|
---|
[153] | 140 | #define IDC32_STREAM_GETSPACE 14
|
---|
[142] | 141 |
|
---|
| 142 | #define MIX_SETMASTERVOL 0
|
---|
| 143 | #define MIX_SETWAVEVOL 1
|
---|
| 144 | #define MIX_SETMIDIVOL 2
|
---|
| 145 | #define MIX_SETINPUTSRC 3
|
---|
| 146 | #define MIX_SETINPUTGAIN 4
|
---|
| 147 | #define MIX_SETLINEINVOL 5
|
---|
| 148 | #define MIX_SETLINEINMUTE 6
|
---|
| 149 | #define MIX_SETMICVOL 7
|
---|
| 150 | #define MIX_SETMICMUTE 8
|
---|
| 151 | #define MIX_SETCDVOL 9
|
---|
| 152 | #define MIX_SETCDMUTE 10
|
---|
| 153 | #define MIX_SETSPDIFVOL 11
|
---|
| 154 | #define MIX_SETSPDIFMUTE 12
|
---|
| 155 | #define MIX_SETBASS 13
|
---|
| 156 | #define MIX_SETTREBLE 14
|
---|
| 157 | #define MIX_SETVIDEOVOL 15
|
---|
| 158 | #define MIX_SETVIDEOMUTE 16
|
---|
| 159 | #define MIX_SETAUXVOL 17
|
---|
| 160 | #define MIX_SETAUXMUTE 18
|
---|
[194] | 161 | #define MIX_SETPCMVOL 19
|
---|
| 162 | #define MIX_SETPCMMUTE 20
|
---|
[142] | 163 |
|
---|
[148] | 164 | #define MAKE_VOLUME_LR(l, r) ((r << 8) | l)
|
---|
[142] | 165 |
|
---|
[171] | 166 | #define GET_VOLUME_R(vol) (vol >> 8)
|
---|
| 167 | #define GET_VOLUME_L(vol) (vol & 0xff)
|
---|
| 168 |
|
---|
[142] | 169 | #define MIX_RECSRC_MIC 0
|
---|
| 170 | #define MIX_RECSRC_CD 1
|
---|
| 171 | #define MIX_RECSRC_LINE 2
|
---|
| 172 | #define MIX_RECSRC_VIDEO 3
|
---|
| 173 | #define MIX_RECSRC_MIXER 4
|
---|
| 174 | #define MIX_RECSRC_AUX 5
|
---|
| 175 |
|
---|
| 176 | #define IDC16_INIT 0
|
---|
| 177 | #define IDC16_EXIT 1
|
---|
| 178 | #define IDC16_SETIRQ 2
|
---|
| 179 | #define IDC16_FREEIRQ 3
|
---|
| 180 | #define IDC16_WAVEOUT_BUFFER_DONE 4
|
---|
| 181 | #define IDC16_WAVEIN_BUFFER_DONE 5
|
---|
| 182 | #define IDC16_FIND_PCIDEVICE 6
|
---|
| 183 | #define IDC16_FIND_PNPDEVICE 7
|
---|
| 184 | #define IDC16_MALLOC 8
|
---|
| 185 | #define IDC16_FREE 9
|
---|
| 186 | #define IDC16_VMALLOC 10
|
---|
| 187 | #define IDC16_VMFREE 11
|
---|
| 188 | #define IDC16_PROCESS 12
|
---|
| 189 |
|
---|
[151] | 190 | #define IDC16_WAVEIN_IRQ 0
|
---|
| 191 | #define IDC16_WAVEOUT_IRQ 1
|
---|
| 192 | #define IDC16_MIDI_IRQ 2
|
---|
| 193 |
|
---|
[142] | 194 | #define MAX_RES_IRQ 2
|
---|
| 195 | #define MAX_RES_DMA 2
|
---|
| 196 | #define MAX_RES_IO 8
|
---|
| 197 | #define MAX_RES_MEM 4
|
---|
| 198 |
|
---|
| 199 | #define SOUND_MIXER_VOLUME 0
|
---|
| 200 | #define SOUND_MIXER_BASS 1
|
---|
| 201 | #define SOUND_MIXER_TREBLE 2
|
---|
| 202 | #define SOUND_MIXER_SYNTH 3
|
---|
| 203 | #define SOUND_MIXER_PCM 4
|
---|
| 204 | #define SOUND_MIXER_SPEAKER 5
|
---|
| 205 | #define SOUND_MIXER_LINE 6
|
---|
| 206 | #define SOUND_MIXER_MIC 7
|
---|
| 207 | #define SOUND_MIXER_CD 8
|
---|
| 208 | #define SOUND_MIXER_IMIX 9 /* Recording monitor */
|
---|
| 209 | #define SOUND_MIXER_ALTPCM 10
|
---|
| 210 | #define SOUND_MIXER_RECLEV 11 /* Recording level */
|
---|
| 211 | #define SOUND_MIXER_IGAIN 12 /* Input gain */
|
---|
| 212 | #define SOUND_MIXER_OGAIN 13 /* Output gain */
|
---|
| 213 | #define SOUND_MIXER_LINE1 14 /* Input source 1 (aux1) */
|
---|
| 214 | #define SOUND_MIXER_LINE2 15 /* Input source 2 (aux2) */
|
---|
| 215 | #define SOUND_MIXER_LINE3 16 /* Input source 3 (line) */
|
---|
| 216 | #define SOUND_MIXER_DIGITAL1 17 /* Digital (input) 1 */
|
---|
| 217 | #define SOUND_MIXER_DIGITAL2 18 /* Digital (input) 2 */
|
---|
| 218 | #define SOUND_MIXER_DIGITAL3 19 /* Digital (input) 3 */
|
---|
| 219 | #define SOUND_MIXER_PHONEIN 20 /* Phone input */
|
---|
| 220 | #define SOUND_MIXER_PHONEOUT 21 /* Phone output */
|
---|
| 221 | #define SOUND_MIXER_VIDEO 22 /* Video/TV (audio) in */
|
---|
| 222 | #define SOUND_MIXER_RADIO 23 /* Radio in */
|
---|
| 223 | #define SOUND_MIXER_MONITOR 24 /* Monitor (usually mic) volume */
|
---|
| 224 | #define SOUND_MIXER_NRDEVICES 25
|
---|
| 225 |
|
---|
| 226 | typedef struct
|
---|
| 227 | {
|
---|
| 228 | USHORT irq[MAX_RES_IRQ];
|
---|
| 229 | USHORT dma[MAX_RES_DMA];
|
---|
| 230 | USHORT io[MAX_RES_IO];
|
---|
| 231 | USHORT iolength[MAX_RES_IO];
|
---|
| 232 | ULONG mem[MAX_RES_MEM];
|
---|
| 233 | ULONG memlength[MAX_RES_MEM];
|
---|
| 234 | } IDC_RESOURCE;
|
---|
| 235 |
|
---|
| 236 | typedef struct {
|
---|
| 237 | ULONG ulSampleRate;
|
---|
| 238 | ULONG ulBitsPerSample;
|
---|
| 239 | ULONG ulNumChannels;
|
---|
| 240 | ULONG ulDataType;
|
---|
| 241 | } FORMAT_INFO;
|
---|
| 242 |
|
---|
| 243 | #define IOCTL_SETFORMAT 0
|
---|
| 244 | #define IOCTL_GETPOS 1
|
---|
| 245 | #define IOCTL_SETFRAGMENT 2
|
---|
| 246 |
|
---|
| 247 | #ifdef __cplusplus
|
---|
| 248 | extern "C" {
|
---|
| 249 | #endif
|
---|
| 250 |
|
---|
| 251 | //32 bits IDC procedures
|
---|
| 252 | //16 bits pdd calls this during init. OSS_InitDriver calls init_module
|
---|
| 253 | BOOL OSS32_InitDriver();
|
---|
| 254 | void OSS32_RemoveDriver();
|
---|
| 255 | BOOL OSS32_SetIrq(int irq, ULONG handler);
|
---|
| 256 | BOOL OSS32_FreeIrq(int irq);
|
---|
| 257 |
|
---|
| 258 | ULONG OSS32_StreamOpen(ULONG streamtype);
|
---|
| 259 | ULONG OSS32_StreamClose(ULONG streamtype, ULONG streamid);
|
---|
| 260 | ULONG OSS32_StreamTrigger(ULONG streamtype, ULONG streamid, ULONG __near *fStart);
|
---|
| 261 | ULONG OSS32_StreamReset(ULONG streamtype, ULONG streamid);
|
---|
| 262 | ULONG OSS32_StreamIOCtl(ULONG streamtype, ULONG streamid, ULONG cmd, char __near *buffer);
|
---|
| 263 | ULONG OSS32_StreamSetFormat(ULONG streamtype, ULONG streamid, ULONG cmd, FORMAT_INFO __near *pFormatInfo);
|
---|
| 264 | ULONG OSS32_StreamAddBuffer(ULONG streamtype, ULONG streamid, ULONG buffer, ULONG size);
|
---|
| 265 | ULONG OSS32_SetVolume(ULONG streamtype, ULONG streamid, ULONG cmd, ULONG volume);
|
---|
[151] | 266 | ULONG OSS32_StreamMidiWrite(ULONG streamid, ULONG midiByte);
|
---|
| 267 | ULONG OSS32_StreamMidiRead(ULONG streamid, char NEAR *buffer, ULONG bufsize);
|
---|
[153] | 268 | ULONG OSS32_StreamGetSpace(ULONG streamtype, ULONG streamid);
|
---|
[142] | 269 |
|
---|
| 270 | //Sets file id in current task structure
|
---|
| 271 | ULONG OSS32_SetFileId(ULONG fileid);
|
---|
| 272 |
|
---|
| 273 | #ifdef TARGET_OS216
|
---|
| 274 | BOOL OSS16_StartStream(STREAM *stream);
|
---|
| 275 | BOOL OSS16_PauseStream(STREAM *stream);
|
---|
| 276 | BOOL OSS16_StopStream(STREAM *stream);
|
---|
| 277 | BOOL OSS16_StreamReset(STREAM *stream);
|
---|
| 278 | BOOL OSS16_StreamSetFormat(STREAM *stream, ULONG param1);
|
---|
| 279 | ULONG OSS16_StreamAddBuffer(STREAM *stream, ULONG buffer, ULONG size);
|
---|
| 280 | BOOL OSS16_StreamGetPos(STREAM *stream, ULONG FAR *pos);
|
---|
| 281 | BOOL OSS16_SetMasterVol(STREAM *stream, ULONG volume);
|
---|
| 282 | BOOL OSS16_SetWaveOutVol(STREAM *stream, ULONG volume);
|
---|
| 283 | BOOL OSS16_SetVolume(STREAM *stream, USHORT line, ULONG volume);
|
---|
| 284 | BOOL OSS16_SetGlobalVol(ULONG ulSysFileNum, USHORT line, ULONG volume);
|
---|
| 285 | BOOL OSS16_StreamSetFragment(STREAM *stream, ULONG fragsize);
|
---|
[153] | 286 | ULONG OSS16_StreamGetSpace(STREAM *stream);
|
---|
[142] | 287 | BOOL OSS16_AttachToPdd();
|
---|
| 288 | void OSS16_DetachFromPdd();
|
---|
| 289 | ULONG OSS16_OpenStream(STREAM *stream);
|
---|
| 290 | void OSS16_CloseStream(STREAM *stream);
|
---|
[148] | 291 | typedef enum {
|
---|
| 292 | MIDI_RECEIVE = 0,
|
---|
| 293 | MIDI_SEND
|
---|
| 294 | } MIDITYPE;
|
---|
| 295 | ULONG OSS16_OpenMidiStream(MIDITYPE midiType);
|
---|
[151] | 296 | void OSS16_CloseMidiStream(MIDITYPE midiType, ULONG streamid);
|
---|
| 297 | BOOL OSS16_WriteMidiByte(ULONG streamid, BYTE midiByte);
|
---|
| 298 | int OSS16_ReadMidiBytes(ULONG streamid, char far *buffer, int bufsize);
|
---|
[142] | 299 |
|
---|
| 300 | #endif //TARGET_OS216
|
---|
| 301 |
|
---|
| 302 | //16 bits IDC procedures
|
---|
| 303 | BOOL CallOSS16(ULONG cmd, ULONG param1, ULONG param2);
|
---|
| 304 |
|
---|
| 305 | //Used to call into the 32 bits OSS driver
|
---|
| 306 | ULONG CallOSS32(USHORT cmd, ULONG fileid, ULONG param1, ULONG param2, ULONG param3, ULONG param4);
|
---|
| 307 |
|
---|
| 308 | #ifdef __cplusplus
|
---|
| 309 | }
|
---|
| 310 | #endif
|
---|
| 311 |
|
---|
| 312 | #endif
|
---|