#ifndef SOUNDCARD_H
#define SOUNDCARD_H
/*
* Copyright by Hannu Savolainen 1993-1997
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. 2.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* OSS interface version. With versions earlier than 3.6 this value is
* an integer with value less than 361. In versions 3.6 and later
* it's a six digit hexadecimal value. For example value
* of 0x030600 represents OSS version 3.6.0.
* Use ioctl(fd, OSS_GETVERSION, &int) to get the version number of
* the currently active driver.
*/
#define SOUND_VERSION 0x030802
#define OPEN_SOUND_SYSTEM
/* In Linux we need to be prepared for cross compiling */
#include <linux/ioctl.h>
/*
* Supported card ID numbers (Should be somewhere else?)
*/
#define SNDCARD_ADLIB 1
#define SNDCARD_SB 2
#define SNDCARD_PAS 3
#define SNDCARD_GUS 4
#define SNDCARD_MPU401 5
#define SNDCARD_SB16 6
#define SNDCARD_SB16MIDI 7
#define SNDCARD_UART6850 8
#define SNDCARD_GUS16 9
#define SNDCARD_MSS 10
#define SNDCARD_PSS 11
#define SNDCARD_SSCAPE 12
#define SNDCARD_PSS_MPU 13
#define SNDCARD_PSS_MSS 14
#define SNDCARD_SSCAPE_MSS 15
#define SNDCARD_TRXPRO 16
#define SNDCARD_TRXPRO_SB 17
#define SNDCARD_TRXPRO_MPU 18
#define SNDCARD_MAD16 19
#define SNDCARD_MAD16_MPU 20
#define SNDCARD_CS4232 21
#define SNDCARD_CS4232_MPU 22
#define SNDCARD_MAUI 23
#define SNDCARD_PSEUDO_MSS 24
#define SNDCARD_GUSPNP 25
#define SNDCARD_UART401 26
/* Sound card numbers 27 to N are reserved. Don't add more numbers here. */
/***********************************
* IOCTL Commands for /dev/sequencer
*/
#ifndef _SIOWR
#if defined(_IOWR) && (defined(_AIX) || (!defined(sun) && !defined(sparc) && !defined(__sparc__) && !defined(__INCioctlh) && !defined(__Lynx__)))
/* Use already defined ioctl defines if they exist (except with Sun or Sparc) */
#define SIOCPARM_MASK IOCPARM_MASK
#define SIOC_VOID IOC_VOID
#define SIOC_OUT IOC_OUT
#define SIOC_IN IOC_IN
#define SIOC_INOUT IOC_INOUT
#define _SIOC_SIZE _IOC_SIZE
#define _SIOC_DIR _IOC_DIR
#define _SIOC_NONE _IOC_NONE
#define _SIOC_READ _IOC_READ
#define _SIOC_WRITE _IOC_WRITE
#define _SIO _IO
#define _SIOR _IOR
#define _SIOW _IOW
#define _SIOWR _IOWR
#else
/* Ioctl's have the command encoded in the lower word,
* and the size of any in or out parameters in the upper
* word. The high 2 bits of the upper word are used
* to encode the in/out status of the parameter; for now
* we restrict parameters to at most 8191 bytes.
*/
/* #define SIOCTYPE (0xff<<8) */
#define SIOCPARM_MASK 0x1fff /* parameters must be < 8192 bytes */
#define SIOC_VOID 0x00000000 /* no parameters */
#define SIOC_OUT 0x20000000 /* copy out parameters */
#define SIOC_IN 0x40000000 /* copy in parameters */
#define SIOC_INOUT (SIOC_IN|SIOC_OUT)
/* the 0x20000000 is so we can distinguish new ioctl's from old */
#define _SIO(x,y) ((int)(SIOC_VOID|(x<<8)|y))
#define _SIOR(x,y,t) ((int)(SIOC_OUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
#define _SIOW(x,y,t) ((int)(SIOC_IN|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
/* this should be _SIORW, but stdio got there first */
#define _SIOWR(x,y,t) ((int)(SIOC_INOUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
#define _SIOC_SIZE(x) ((x>>16)&SIOCPARM_MASK)
#define _SIOC_DIR(x) (x & 0xf0000000)
#define _SIOC_NONE SIOC_VOID
#define _SIOC_READ SIOC_OUT
#define _SIOC_WRITE SIOC_IN
# endif /* _IOWR */
#endif /* !_SIOWR */
#define SNDCTL_SEQ_RESET _SIO ('Q', 0)
#define SNDCTL_SEQ_SYNC _SIO ('Q', 1)
#define SNDCTL_SYNTH_INFO _SIOWR('Q', 2, struct synth_info)
#define SNDCTL_SEQ_CTRLRATE _SIOWR('Q', 3, int) /* Set/get timer resolution (HZ) */
#define SNDCTL_SEQ_GETOUTCOUNT _SIOR ('Q', 4, int)
#define SNDCTL_SEQ_GETINCOUNT _SIOR ('Q', 5, int)
#define SNDCTL_SEQ_PERCMODE _SIOW ('Q', 6, int)
#define SNDCTL_FM_LOAD_INSTR _SIOW ('Q', 7, struct sbi_instrument) /* Obsolete. Don't use!!!!!! */
#define SNDCTL_SEQ_TESTMIDI _SIOW ('Q', 8, int)
#define SNDCTL_SEQ_RESETSAMPLES _SIOW ('Q', 9, int)
#define SNDCTL_SEQ_NRSYNTHS _SIOR ('Q',10, int)
#define SNDCTL_SEQ_NRMIDIS _SIOR ('Q',11, int)
#define SNDCTL_MIDI_INFO _SIOWR('Q',12, struct midi_info)
#define SNDCTL_SEQ_THRESHOLD _SIOW ('Q',13, int)
#define SNDCTL_SYNTH_MEMAVL _SIOWR('Q',14, int) /* in=dev#, out=memsize */
#define SNDCTL_FM_4OP_ENABLE _SIOW ('Q',15, int) /* in=dev# */
#define SNDCTL_SEQ_PANIC _SIO ('Q',17)
#define SNDCTL_SEQ_OUTOFBAND _SIOW ('Q',18, struct seq_event_rec)
#define SNDCTL_SEQ_GETTIME _SIOR ('Q',19, int)
#define SNDCTL_SYNTH_ID _SIOWR('Q',20, struct synth_info)
#define SNDCTL_SYNTH_CONTROL _SIOWR('Q',21, struct synth_control)
#define SNDCTL_SYNTH_REMOVESAMPLE _SIOWR('Q',22, struct remove_sample)
typedef struct synth_control
{
int devno; /* Synthesizer # */
char data[4000]; /* Device spesific command/data record */
}synth_control;
typedef struct remove_sample
{
int devno; /* Synthesizer # */
int bankno; /* MIDI bank # (0=General MIDI) */
int instrno; /* MIDI instrument number */
} remove_sample;
typedef struct seq_event_rec {
unsigned char arr[8];
} seq_event_rec;
#define SNDCTL_TMR_TIMEBASE _SIOWR(