Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


soundcard.h
0001: #ifndef SOUNDCARD_H
0002: #define SOUNDCARD_H
0003: /*
0004:  * Copyright by Hannu Savolainen 1993-1997
0005:  *
0006:  * Redistribution and use in source and binary forms, with or without
0007:  * modification, are permitted provided that the following conditions are
0008:  * met: 1. Redistributions of source code must retain the above copyright
0009:  * notice, this list of conditions and the following disclaimer. 2.
0010:  * Redistributions in binary form must reproduce the above copyright notice,
0011:  * this list of conditions and the following disclaimer in the documentation
0012:  * and/or other materials provided with the distribution.
0013:  *
0014:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
0015:  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
0016:  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
0017:  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
0018:  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0019:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
0020:  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
0021:  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0022:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
0023:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0024:  * SUCH DAMAGE.
0025:  */
0026: 
0027: 
0028: /*
0029:  * OSS interface version. With versions earlier than 3.6 this value is
0030:  * an integer with value less than 361. In versions 3.6 and later
0031:  * it's a six digit hexadecimal value. For example value
0032:  * of 0x030600 represents OSS version 3.6.0.
0033:  * Use ioctl(fd, OSS_GETVERSION, &int) to get the version number of
0034:  * the currently active driver.
0035:  */
0036: #define SOUND_VERSION   0x030802
0037: #define OPEN_SOUND_SYSTEM
0038: 
0039: /* In Linux we need to be prepared for cross compiling */
0040: #include <linux/ioctl.h>
0041: 
0042: /* Endian macros. */
0043: #  include <endian.h>
0044: 
0045: /*
0046:  *      Supported card ID numbers (Should be somewhere else?)
0047:  */
0048: 
0049: #define SNDCARD_ADLIB           1
0050: #define SNDCARD_SB              2
0051: #define SNDCARD_PAS             3
0052: #define SNDCARD_GUS             4
0053: #define SNDCARD_MPU401          5
0054: #define SNDCARD_SB16            6
0055: #define SNDCARD_SB16MIDI        7
0056: #define SNDCARD_UART6850        8
0057: #define SNDCARD_GUS16           9
0058: #define SNDCARD_MSS             10
0059: #define SNDCARD_PSS             11
0060: #define SNDCARD_SSCAPE          12
0061: #define SNDCARD_PSS_MPU         13
0062: #define SNDCARD_PSS_MSS         14
0063: #define SNDCARD_SSCAPE_MSS      15
0064: #define SNDCARD_TRXPRO          16
0065: #define SNDCARD_TRXPRO_SB       17
0066: #define SNDCARD_TRXPRO_MPU      18
0067: #define SNDCARD_MAD16           19
0068: #define SNDCARD_MAD16_MPU       20
0069: #define SNDCARD_CS4232          21
0070: #define SNDCARD_CS4232_MPU      22
0071: #define SNDCARD_MAUI            23
0072: #define SNDCARD_PSEUDO_MSS      24
0073: #define SNDCARD_GUSPNP          25
0074: #define SNDCARD_UART401         26
0075: /* Sound card numbers 27 to N are reserved. Don't add more numbers here. */
0076: 
0077: /***********************************
0078:  * IOCTL Commands for /dev/sequencer
0079:  */
0080: 
0081: #ifndef _SIOWR
0082: #if defined(_IOWR) && (defined(_AIX) || (!defined(sun) && !defined(sparc) && !defined(__sparc__) && !defined(__INCioctlh) && !defined(__Lynx__)))
0083: /* Use already defined ioctl defines if they exist (except with Sun or Sparc) */
0084: #define SIOCPARM_MASK   IOCPARM_MASK
0085: #define SIOC_VOID       IOC_VOID
0086: #define SIOC_OUT        IOC_OUT
0087: #define SIOC_IN         IOC_IN
0088: #define SIOC_INOUT      IOC_INOUT
0089: #define _SIOC_SIZE      _IOC_SIZE
0090: #define _SIOC_DIR       _IOC_DIR
0091: #define _SIOC_NONE      _IOC_NONE
0092: #define _SIOC_READ      _IOC_READ
0093: #define _SIOC_WRITE     _IOC_WRITE
0094: #define _SIO            _IO
0095: #define _SIOR           _IOR
0096: #define _SIOW           _IOW
0097: #define _SIOWR          _IOWR
0098: #else
0099: 
0100: /* Ioctl's have the command encoded in the lower word,
0101:  * and the size of any in or out parameters in the upper
0102:  * word.  The high 2 bits of the upper word are used
0103:  * to encode the in/out status of the parameter; for now
0104:  * we restrict parameters to at most 8191 bytes.
0105:  */
0106: /* #define      SIOCTYPE                (0xff<<8) */
0107: #define SIOCPARM_MASK   0x1fff          /* parameters must be < 8192 bytes */
0108: #define SIOC_VOID       0x00000000      /* no parameters */
0109: #define SIOC_OUT        0x20000000      /* copy out parameters */
0110: #define SIOC_IN         0x40000000      /* copy in parameters */
0111: #define SIOC_INOUT      (SIOC_IN|SIOC_OUT)
0112: /* the 0x20000000 is so we can distinguish new ioctl's from old */
0113: #define _SIO(x,y)       ((int)(SIOC_VOID|(x<<8)|y))
0114: #define _SIOR(x,y,t)    ((int)(SIOC_OUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
0115: #define _SIOW(x,y,t)    ((int)(SIOC_IN|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
0116: /* this should be _SIORW, but stdio got there first */
0117: #define _SIOWR(x,y,t)   ((int)(SIOC_INOUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
0118: #define _SIOC_SIZE(x)   ((x>>16)&SIOCPARM_MASK) 
0119: #define _SIOC_DIR(x)    (x & 0xf0000000)
0120: #define _SIOC_NONE      SIOC_VOID
0121: #define _SIOC_READ      SIOC_OUT
0122: #define _SIOC_WRITE     SIOC_IN
0123: #  endif /* _IOWR */
0124: #endif  /* !_SIOWR */
0125: 
0126: #define SNDCTL_SEQ_RESET                _SIO  ('Q', 0)
0127: #define SNDCTL_SEQ_SYNC                 _SIO  ('Q', 1)
0128: #define SNDCTL_SYNTH_INFO               _SIOWR('Q', 2, struct synth_info)
0129: #define SNDCTL_SEQ_CTRLRATE             _SIOWR('Q', 3, int)     /* Set/get timer resolution (HZ) */
0130: #define SNDCTL_SEQ_GETOUTCOUNT          _SIOR ('Q', 4, int)
0131: #define SNDCTL_SEQ_GETINCOUNT           _SIOR ('Q', 5, int)
0132: #define SNDCTL_SEQ_PERCMODE             _SIOW ('Q', 6, int)
0133: #define SNDCTL_FM_LOAD_INSTR            _SIOW ('Q', 7, struct sbi_instrument)   /* Obsolete. Don't use!!!!!! */
0134: #define SNDCTL_SEQ_TESTMIDI             _SIOW ('Q', 8, int)
0135: #define SNDCTL_SEQ_RESETSAMPLES         _SIOW ('Q', 9, int)
0136: #define SNDCTL_SEQ_NRSYNTHS             _SIOR ('Q',10, int)
0137: #define SNDCTL_SEQ_NRMIDIS              _SIOR ('Q',11, int)
0138: #define SNDCTL_MIDI_INFO                _SIOWR('Q',12, struct midi_info)
0139: #define SNDCTL_SEQ_THRESHOLD            _SIOW ('Q',13, int)
0140: #define SNDCTL_SYNTH_MEMAVL             _SIOWR('Q',14, int)     /* in=dev#, out=memsize */
0141: #define SNDCTL_FM_4OP_ENABLE            _SIOW ('Q',15, int)     /* in=dev# */
0142: #define SNDCTL_SEQ_PANIC                _SIO  ('Q',17)
0143: #define SNDCTL_SEQ_OUTOFBAND            _SIOW ('Q',18, struct seq_event_rec)
0144: #define SNDCTL_SEQ_GETTIME              _SIOR ('Q',19, int)
0145: #define SNDCTL_SYNTH_ID                 _SIOWR('Q',20, struct synth_info)
0146: #define SNDCTL_SYNTH_CONTROL            _SIOWR('Q',21, struct synth_control)
0147: #define SNDCTL_SYNTH_REMOVESAMPLE       _SIOWR('Q',22, struct remove_sample)
0148: 
0149: typedef struct synth_control
0150: {
0151:         int devno;      /* Synthesizer # */
0152:         char data[4000]; /* Device spesific command/data record */
0153: }synth_control;
0154: 
0155: typedef struct remove_sample
0156: {
0157:         int devno;      /* Synthesizer # */
0158:         int bankno;     /* MIDI bank # (0=General MIDI) */
0159:         int instrno;    /* MIDI instrument number */
0160: } remove_sample;
0161: 
0162: typedef struct seq_event_rec {
0163:                 unsigned char arr[8];
0164: } seq_event_rec;
0165: 
0166: #define SNDCTL_TMR_TIMEBASE             _SIOWR('T', 1, int)
0167: #define SNDCTL_TMR_START                _SIO  ('T', 2)
0168: #define SNDCTL_TMR_STOP                 _SIO  ('T', 3)
0169: #define SNDCTL_TMR_CONTINUE             _SIO  ('T', 4)
0170: #define SNDCTL_TMR_TEMPO                _SIOWR('T', 5, int)
0171: #define SNDCTL_TMR_SOURCE               _SIOWR('T', 6, int)
0172: #       define TMR_INTERNAL             0x00000001
0173: #       define TMR_EXTERNAL             0x00000002
0174: #               define TMR_MODE_MIDI    0x00000010
0175: #               define TMR_MODE_FSK     0x00000020
0176: #               define TMR_MODE_CLS     0x00000040
0177: #               define TMR_MODE_SMPTE   0x00000080
0178: #define SNDCTL_TMR_METRONOME            _SIOW ('T', 7, int)
0179: #define SNDCTL_TMR_SELECT               _SIOW ('T', 8, int)
0180: 
0181: /*
0182:  * Some big endian/little endian handling macros
0183:  */
0184: 
0185: #define _LINUX_PATCHKEY_H_INDIRECT
0186: #include <linux/patchkey.h>
0187: #undef _LINUX_PATCHKEY_H_INDIRECT
0188: 
0189: #if   defined(__BYTE_ORDER)
0190: #  if __BYTE_ORDER == __BIG_ENDIAN
0191: #    define AFMT_S16_NE AFMT_S16_BE
0192: #  elif __BYTE_ORDER == __LITTLE_ENDIAN
0193: #    define AFMT_S16_NE AFMT_S16_LE
0194: #  else
0195: #    error "could not determine byte order"
0196: #  endif
0197: #endif
0198: 
0199: /*
0200:  *      Sample loading mechanism for internal synthesizers (/dev/sequencer)
0201:  *      The following patch_info structure has been designed to support
0202:  *      Gravis UltraSound. It tries to be universal format for uploading
0203:  *      sample based patches but is probably too limited.
0204:  *
0205:  *      (PBD) As Hannu guessed, the GUS structure is too limited for 
0206:  *      the WaveFront, but this is the right place for a constant definition.
0207:  */
0208: 
0209: struct patch_info {
0210:                 unsigned short key;             /* Use WAVE_PATCH here */
0211: #define WAVE_PATCH         _PATCHKEY(0x04)
0212: #define GUS_PATCH          WAVE_PATCH
0213: #define WAVEFRONT_PATCH    _PATCHKEY(0x06)
0214: 
0215:                 short device_no;        /* Synthesizer number */
0216:                 short instr_no;         /* Midi pgm# */
0217: 
0218:                 unsigned int mode;
0219: /*
0220:  * The least significant byte has the same format than the GUS .PAT
0221:  * files
0222:  */
0223: #define WAVE_16_BITS    0x01    /* bit 0 = 8 or 16 bit wave data. */
0224: #define WAVE_UNSIGNED   0x02    /* bit 1 = Signed - Unsigned data. */
0225: #define WAVE_LOOPING    0x04    /* bit 2 = looping enabled-1. */
0226: #define WAVE_BIDIR_LOOP 0x08    /* bit 3 = Set is bidirectional looping. */
0227: #define WAVE_LOOP_BACK  0x10    /* bit 4 = Set is looping backward. */
0228: #define WAVE_SUSTAIN_ON 0x20    /* bit 5 = Turn sustaining on. (Env. pts. 3)*/
0229: #define WAVE_ENVELOPES  0x40    /* bit 6 = Enable envelopes - 1 */
0230: #define WAVE_FAST_RELEASE 0x80  /* bit 7 = Shut off immediately after note off */
0231:                                 /*      (use the env_rate/env_offs fields). */
0232: /* Linux specific bits */
0233: #define WAVE_VIBRATO    0x00010000      /* The vibrato info is valid */
0234: #define WAVE_TREMOLO    0x00020000      /* The tremolo info is valid */
0235: #define WAVE_SCALE      0x00040000      /* The scaling info is valid */
0236: #define WAVE_FRACTIONS  0x00080000      /* Fraction information is valid */
0237: /* Reserved bits */
0238: #define WAVE_ROM        0x40000000      /* For future use */
0239: #define WAVE_MULAW      0x20000000      /* For future use */
0240: /* Other bits must be zeroed */
0241: 
0242:                 int len;        /* Size of the wave data in bytes */
0243:                 int loop_start, loop_end; /* Byte offsets from the beginning */
0244: 
0245: /* 
0246:  * The base_freq and base_note fields are used when computing the
0247:  * playback speed for a note. The base_note defines the tone frequency
0248:  * which is heard if the sample is played using the base_freq as the
0249:  * playback speed.
0250:  *
0251:  * The low_note and high_note fields define the minimum and maximum note
0252:  * frequencies for which this sample is valid. It is possible to define
0253:  * more than one samples for an instrument number at the same time. The
0254:  * low_note and high_note fields are used to select the most suitable one.
0255:  *
0256:  * The fields base_note, high_note and low_note should contain
0257:  * the note frequency multiplied by 1000. For example value for the
0258:  * middle A is 440*1000.
0259:  */
0260: 
0261:                 unsigned int base_freq;
0262:                 unsigned int base_note;
0263:                 unsigned int high_note;
0264:                 unsigned int low_note;
0265:                 int panning;    /* -128=left, 127=right */
0266:                 int detuning;
0267: 
0268: /*      New fields introduced in version 1.99.5 */
0269: 
0270:        /* Envelope. Enabled by mode bit WAVE_ENVELOPES  */
0271:                 unsigned char   env_rate[ 6 ];   /* GUS HW ramping rate */
0272:                 unsigned char   env_offset[ 6 ]; /* 255 == 100% */
0273: 
0274:         /* 
0275:          * The tremolo, vibrato and scale info are not supported yet.
0276:          * Enable by setting the mode bits WAVE_TREMOLO, WAVE_VIBRATO or
0277:          * WAVE_SCALE
0278:          */
0279: 
0280:                 unsigned char   tremolo_sweep;
0281:                 unsigned char   tremolo_rate;
0282:                 unsigned char   tremolo_depth;
0283:         
0284:                 unsigned char   vibrato_sweep;
0285:                 unsigned char   vibrato_rate;
0286:                 unsigned char   vibrato_depth;
0287: 
0288:                 int             scale_frequency;
0289:                 unsigned int    scale_factor;           /* from 0 to 2048 or 0 to 2 */
0290:         
0291:                 int             volume;
0292:                 int             fractions;
0293:                 int             reserved1;
0294:                 int             spare[2];
0295:                 char data[1];   /* The waveform data starts here */
0296:         };
0297: 
0298: struct sysex_info {
0299:                 short key;              /* Use SYSEX_PATCH or MAUI_PATCH here */
0300: #define SYSEX_PATCH     _PATCHKEY(0x05)
0301: #define MAUI_PATCH      _PATCHKEY(0x06)
0302:                 short device_no;        /* Synthesizer number */
0303:                 int len;        /* Size of the sysex data in bytes */
0304:                 unsigned char data[1];  /* Sysex data starts here */
0305:         };
0306: 
0307: /*
0308:  * /dev/sequencer input events.
0309:  *
0310:  * The data written to the /dev/sequencer is a stream of events. Events
0311:  * are records of 4 or 8 bytes. The first byte defines the size. 
0312:  * Any number of events can be written with a write call. There
0313:  * is a set of macros for sending these events. Use these macros if you
0314:  * want to maximize portability of your program.
0315:  *
0316:  * Events SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO. Are also input events.
0317:  * (All input events are currently 4 bytes long. Be prepared to support
0318:  * 8 byte events also. If you receive any event having first byte >= 128,
0319:  * it's a 8 byte event.
0320:  *
0321:  * The events are documented at the end of this file.
0322:  *
0323:  * Normal events (4 bytes)
0324:  * There is also a 8 byte version of most of the 4 byte events. The
0325:  * 8 byte one is recommended.
0326:  */
0327: #define SEQ_NOTEOFF             0
0328: #define SEQ_FMNOTEOFF           SEQ_NOTEOFF     /* Just old name */
0329: #define SEQ_NOTEON              1
0330: #define SEQ_FMNOTEON            SEQ_NOTEON
0331: #define SEQ_WAIT                TMR_WAIT_ABS
0332: #define SEQ_PGMCHANGE           3
0333: #define SEQ_FMPGMCHANGE         SEQ_PGMCHANGE
0334: #define SEQ_SYNCTIMER           TMR_START
0335: #define SEQ_MIDIPUTC            5
0336: #define SEQ_DRUMON              6       /*** OBSOLETE ***/
0337: #define SEQ_DRUMOFF             7       /*** OBSOLETE ***/
0338: #define SEQ_ECHO                TMR_ECHO        /* For synching programs with output */
0339: #define SEQ_AFTERTOUCH          9
0340: #define SEQ_CONTROLLER          10
0341: 
0342: /*******************************************
0343:  *      Midi controller numbers
0344:  *******************************************
0345:  * Controllers 0 to 31 (0x00 to 0x1f) and
0346:  * 32 to 63 (0x20 to 0x3f) are continuous
0347:  * controllers.
0348:  * In the MIDI 1.0 these controllers are sent using
0349:  * two messages. Controller numbers 0 to 31 are used
0350:  * to send the MSB and the controller numbers 32 to 63
0351:  * are for the LSB. Note that just 7 bits are used in MIDI bytes.
0352:  */
0353: 
0354: #define    CTL_BANK_SELECT              0x00
0355: #define    CTL_MODWHEEL                 0x01
0356: #define    CTL_BREATH                   0x02
0357: /*              undefined               0x03 */
0358: #define    CTL_FOOT                     0x04
0359: #define    CTL_PORTAMENTO_TIME          0x05
0360: #define    CTL_DATA_ENTRY               0x06
0361: #define    CTL_MAIN_VOLUME              0x07
0362: #define    CTL_BALANCE                  0x08
0363: /*              undefined               0x09 */
0364: #define    CTL_PAN                      0x0a
0365: #define    CTL_EXPRESSION               0x0b
0366: /*              undefined               0x0c */
0367: /*              undefined               0x0d */
0368: /*              undefined               0x0e */
0369: /*              undefined               0x0f */
0370: #define    CTL_GENERAL_PURPOSE1 0x10
0371: #define    CTL_GENERAL_PURPOSE2 0x11
0372: #define    CTL_GENERAL_PURPOSE3 0x12
0373: #define    CTL_GENERAL_PURPOSE4 0x13
0374: /*              undefined               0x14 - 0x1f */
0375: 
0376: /*              undefined               0x20 */
0377: /* The controller numbers 0x21 to 0x3f are reserved for the */
0378: /* least significant bytes of the controllers 0x00 to 0x1f. */
0379: /* These controllers are not recognised by the driver. */
0380: 
0381: /* Controllers 64 to 69 (0x40 to 0x45) are on/off switches. */
0382: /* 0=OFF and 127=ON (intermediate values are possible) */
0383: #define    CTL_DAMPER_PEDAL             0x40
0384: #define    CTL_SUSTAIN                  0x40    /* Alias */
0385: #define    CTL_HOLD                     0x40    /* Alias */
0386: #define    CTL_PORTAMENTO               0x41
0387: #define    CTL_SOSTENUTO                0x42
0388: #define    CTL_SOFT_PEDAL               0x43
0389: /*              undefined               0x44 */
0390: #define    CTL_HOLD2                    0x45
0391: /*              undefined               0x46 - 0x4f */
0392: 
0393: #define    CTL_GENERAL_PURPOSE5 0x50
0394: #define    CTL_GENERAL_PURPOSE6 0x51
0395: #define    CTL_GENERAL_PURPOSE7 0x52
0396: #define    CTL_GENERAL_PURPOSE8 0x53
0397: /*              undefined               0x54 - 0x5a */
0398: #define    CTL_EXT_EFF_DEPTH            0x5b
0399: #define    CTL_TREMOLO_DEPTH            0x5c
0400: #define    CTL_CHORUS_DEPTH             0x5d
0401: #define    CTL_DETUNE_DEPTH             0x5e
0402: #define    CTL_CELESTE_DEPTH            0x5e    /* Alias for the above one */
0403: #define    CTL_PHASER_DEPTH             0x5f
0404: #define    CTL_DATA_INCREMENT           0x60
0405: #define    CTL_DATA_DECREMENT           0x61
0406: #define    CTL_NONREG_PARM_NUM_LSB      0x62
0407: #define    CTL_NONREG_PARM_NUM_MSB      0x63
0408: #define    CTL_REGIST_PARM_NUM_LSB      0x64
0409: #define    CTL_REGIST_PARM_NUM_MSB      0x65
0410: /*              undefined               0x66 - 0x78 */
0411: /*              reserved                0x79 - 0x7f */
0412: 
0413: /* Pseudo controllers (not midi compatible) */
0414: #define    CTRL_PITCH_BENDER            255
0415: #define    CTRL_PITCH_BENDER_RANGE      254
0416: #define    CTRL_EXPRESSION              253     /* Obsolete */
0417: #define    CTRL_MAIN_VOLUME             252     /* Obsolete */
0418: #define SEQ_BALANCE             11
0419: #define SEQ_VOLMODE             12
0420: 
0421: /*
0422:  * Volume mode decides how volumes are used
0423:  */
0424: 
0425: #define VOL_METHOD_ADAGIO       1
0426: #define VOL_METHOD_LINEAR       2
0427: 
0428: /*
0429:  * Note! SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO are used also as
0430:  *       input events.
0431:  */
0432: 
0433: /*
0434:  * Event codes 0xf0 to 0xfc are reserved for future extensions.
0435:  */
0436: 
0437: #define SEQ_FULLSIZE            0xfd    /* Long events */
0438: /*
0439:  *      SEQ_FULLSIZE events are used for loading patches/samples to the
0440:  *      synthesizer devices. These events are passed directly to the driver
0441:  *      of the associated synthesizer device. There is no limit to the size
0442:  *      of the extended events. These events are not queued but executed
0443:  *      immediately when the write() is called (execution can take several
0444:  *      seconds of time). 
0445:  *
0446:  *      When a SEQ_FULLSIZE message is written to the device, it must
0447:  *      be written using exactly one write() call. Other events cannot
0448:  *      be mixed to the same write.
0449:  *      
0450:  *      For FM synths (YM3812/OPL3) use struct sbi_instrument and write it to the 
0451:  *      /dev/sequencer. Don't write other data together with the instrument structure
0452:  *      Set the key field of the structure to FM_PATCH. The device field is used to
0453:  *      route the patch to the corresponding device.
0454:  *
0455:  *      For wave table use struct patch_info. Initialize the key field
0456:  *      to WAVE_PATCH.
0457:  */
0458: #define SEQ_PRIVATE             0xfe    /* Low level HW dependent events (8 bytes) */
0459: #define SEQ_EXTENDED            0xff    /* Extended events (8 bytes) OBSOLETE */
0460: 
0461: /*
0462:  * Record for FM patches
0463:  */
0464: 
0465: typedef unsigned char sbi_instr_data[32];
0466: 
0467: struct sbi_instrument {
0468:                 unsigned short  key;    /* FM_PATCH or OPL3_PATCH */
0469: #define FM_PATCH        _PATCHKEY(0x01)
0470: #define OPL3_PATCH      _PATCHKEY(0x03)
0471:                 short           device;         /*      Synth# (0-4)    */
0472:                 int             channel;        /*      Program# to be initialized      */
0473:                 sbi_instr_data  operators;      /*      Register settings for operator cells (.SBI format)      */
0474:         };
0475: 
0476: struct synth_info {     /* Read only */
0477:                 char    name[30];
0478:                 int     device;         /* 0-N. INITIALIZE BEFORE CALLING */
0479:                 int     synth_type;
0480: #define SYNTH_TYPE_FM                   0
0481: #define SYNTH_TYPE_SAMPLE               1
0482: #define SYNTH_TYPE_MIDI                 2       /* Midi interface */
0483: 
0484:                 int     synth_subtype;
0485: #define FM_TYPE_ADLIB                   0x00
0486: #define FM_TYPE_OPL3                    0x01
0487: #define MIDI_TYPE_MPU401                0x401
0488: 
0489: #define SAMPLE_TYPE_BASIC               0x10
0490: #define SAMPLE_TYPE_GUS                 SAMPLE_TYPE_BASIC
0491: #define SAMPLE_TYPE_WAVEFRONT           0x11
0492: 
0493:                 int     perc_mode;      /* No longer supported */
0494:                 int     nr_voices;
0495:                 int     nr_drums;       /* Obsolete field */
0496:                 int     instr_bank_size;
0497:                 unsigned int    capabilities;   
0498: #define SYNTH_CAP_PERCMODE              0x00000001 /* No longer used */
0499: #define SYNTH_CAP_OPL3                  0x00000002 /* Set if OPL3 supported */
0500: #define SYNTH_CAP_INPUT                 0x00000004 /* Input (MIDI) device */
0501:                 int     dummies[19];    /* Reserve space */
0502:         };
0503: 
0504: struct sound_timer_info {
0505:                 char name[32];
0506:                 int caps;
0507:         };
0508: 
0509: #define MIDI_CAP_MPU401         1               /* MPU-401 intelligent mode */
0510: 
0511: struct midi_info {
0512:                 char            name[30];
0513:                 int             device;         /* 0-N. INITIALIZE BEFORE CALLING */
0514:                 unsigned int    capabilities;   /* To be defined later */
0515:                 int             dev_type;
0516:                 int             dummies[18];    /* Reserve space */
0517:         };
0518: 
0519: /********************************************
0520:  * ioctl commands for the /dev/midi##
0521:  */
0522: typedef struct {
0523:                 unsigned char cmd;
0524:                 char nr_args, nr_returns;
0525:                 unsigned char data[30];
0526:         } mpu_command_rec;
0527: 
0528: #define SNDCTL_MIDI_PRETIME             _SIOWR('m', 0, int)
0529: #define SNDCTL_MIDI_MPUMODE             _SIOWR('m', 1, int)
0530: #define SNDCTL_MIDI_MPUCMD              _SIOWR('m', 2, mpu_command_rec)
0531: 
0532: /********************************************
0533:  * IOCTL commands for /dev/dsp and /dev/audio
0534:  */
0535: 
0536: #define SNDCTL_DSP_RESET                _SIO  ('P', 0)
0537: #define SNDCTL_DSP_SYNC                 _SIO  ('P', 1)
0538: #define SNDCTL_DSP_SPEED                _SIOWR('P', 2, int)
0539: #define SNDCTL_DSP_STEREO               _SIOWR('P', 3, int)
0540: #define SNDCTL_DSP_GETBLKSIZE           _SIOWR('P', 4, int)
0541: #define SNDCTL_DSP_SAMPLESIZE           SNDCTL_DSP_SETFMT
0542: #define SNDCTL_DSP_CHANNELS             _SIOWR('P', 6, int)
0543: #define SOUND_PCM_WRITE_CHANNELS        SNDCTL_DSP_CHANNELS
0544: #define SOUND_PCM_WRITE_FILTER          _SIOWR('P', 7, int)
0545: #define SNDCTL_DSP_POST                 _SIO  ('P', 8)
0546: #define SNDCTL_DSP_SUBDIVIDE            _SIOWR('P', 9, int)
0547: #define SNDCTL_DSP_SETFRAGMENT          _SIOWR('P',10, int)
0548: 
0549: /*      Audio data formats (Note! U8=8 and S16_LE=16 for compatibility) */
0550: #define SNDCTL_DSP_GETFMTS              _SIOR ('P',11, int) /* Returns a mask */
0551: #define SNDCTL_DSP_SETFMT               _SIOWR('P',5, int) /* Selects ONE fmt*/
0552: #       define AFMT_QUERY               0x00000000      /* Return current fmt */
0553: #       define AFMT_MU_LAW              0x00000001
0554: #       define AFMT_A_LAW               0x00000002
0555: #       define AFMT_IMA_ADPCM           0x00000004
0556: #       define AFMT_U8                  0x00000008
0557: #       define AFMT_S16_LE              0x00000010      /* Little endian signed 16*/
0558: #       define AFMT_S16_BE              0x00000020      /* Big endian signed 16 */
0559: #       define AFMT_S8                  0x00000040
0560: #       define AFMT_U16_LE              0x00000080      /* Little endian U16 */
0561: #       define AFMT_U16_BE              0x00000100      /* Big endian U16 */
0562: #       define AFMT_MPEG                0x00000200      /* MPEG (2) audio */
0563: #       define AFMT_AC3         0x00000400      /* Dolby Digital AC3 */
0564: 
0565: /*
0566:  * Buffer status queries.
0567:  */
0568: typedef struct audio_buf_info {
0569:                         int fragments;  /* # of available fragments (partially usend ones not counted) */
0570:                         int fragstotal; /* Total # of fragments allocated */
0571:                         int fragsize;   /* Size of a fragment in bytes */
0572: 
0573:                         int bytes;      /* Available space in bytes (includes partially used fragments) */
0574:                         /* Note! 'bytes' could be more than fragments*fragsize */
0575:                 } audio_buf_info;
0576: 
0577: #define SNDCTL_DSP_GETOSPACE            _SIOR ('P',12, audio_buf_info)
0578: #define SNDCTL_DSP_GETISPACE            _SIOR ('P',13, audio_buf_info)
0579: #define SNDCTL_DSP_NONBLOCK             _SIO  ('P',14)
0580: #define SNDCTL_DSP_GETCAPS              _SIOR ('P',15, int)
0581: #       define DSP_CAP_REVISION         0x000000ff      /* Bits for revision level (0 to 255) */
0582: #       define DSP_CAP_DUPLEX           0x00000100      /* Full duplex record/playback */
0583: #       define DSP_CAP_REALTIME         0x00000200      /* Real time capability */
0584: #       define DSP_CAP_BATCH            0x00000400      /* Device has some kind of */
0585:                                                         /* internal buffers which may */
0586:                                                         /* cause some delays and */
0587:                                                         /* decrease precision of timing */
0588: #       define DSP_CAP_COPROC           0x00000800      /* Has a coprocessor */
0589:                                                         /* Sometimes it's a DSP */
0590:                                                         /* but usually not */
0591: #       define DSP_CAP_TRIGGER          0x00001000      /* Supports SETTRIGGER */
0592: #       define DSP_CAP_MMAP             0x00002000      /* Supports mmap() */
0593: #       define DSP_CAP_MULTI            0x00004000      /* support multiple open */
0594: #       define DSP_CAP_BIND             0x00008000      /* channel binding to front/rear/cneter/lfe */
0595: 
0596: 
0597: #define SNDCTL_DSP_GETTRIGGER           _SIOR ('P',16, int)
0598: #define SNDCTL_DSP_SETTRIGGER           _SIOW ('P',16, int)
0599: #       define PCM_ENABLE_INPUT         0x00000001
0600: #       define PCM_ENABLE_OUTPUT                0x00000002
0601: 
0602: typedef struct count_info {
0603:                 int bytes;      /* Total # of bytes processed */
0604:                 int blocks;     /* # of fragment transitions since last time */
0605:                 int ptr;        /* Current DMA pointer value */
0606:         } count_info;
0607: 
0608: #define SNDCTL_DSP_GETIPTR              _SIOR ('P',17, count_info)
0609: #define SNDCTL_DSP_GETOPTR              _SIOR ('P',18, count_info)
0610: 
0611: typedef struct buffmem_desc {
0612:                 unsigned *buffer;
0613:                 int size;
0614:         } buffmem_desc;
0615: #define SNDCTL_DSP_MAPINBUF             _SIOR ('P', 19, buffmem_desc)
0616: #define SNDCTL_DSP_MAPOUTBUF            _SIOR ('P', 20, buffmem_desc)
0617: #define SNDCTL_DSP_SETSYNCRO            _SIO  ('P', 21)
0618: #define SNDCTL_DSP_SETDUPLEX            _SIO  ('P', 22)
0619: #define SNDCTL_DSP_GETODELAY            _SIOR ('P', 23, int)
0620: 
0621: #define SNDCTL_DSP_GETCHANNELMASK               _SIOWR('P', 64, int)
0622: #define SNDCTL_DSP_BIND_CHANNEL         _SIOWR('P', 65, int)
0623: #       define DSP_BIND_QUERY           0x00000000
0624: #       define DSP_BIND_FRONT           0x00000001
0625: #       define DSP_BIND_SURR            0x00000002
0626: #       define DSP_BIND_CENTER_LFE      0x00000004
0627: #       define DSP_BIND_HANDSET         0x00000008
0628: #       define DSP_BIND_MIC             0x00000010
0629: #       define DSP_BIND_MODEM1          0x00000020
0630: #       define DSP_BIND_MODEM2          0x00000040
0631: #       define DSP_BIND_I2S             0x00000080
0632: #       define DSP_BIND_SPDIF           0x00000100
0633: 
0634: #define SNDCTL_DSP_SETSPDIF             _SIOW ('P', 66, int)
0635: #define SNDCTL_DSP_GETSPDIF             _SIOR ('P', 67, int)
0636: #       define SPDIF_PRO        0x0001
0637: #       define SPDIF_N_AUD      0x0002
0638: #       define SPDIF_COPY       0x0004
0639: #       define SPDIF_PRE        0x0008
0640: #       define SPDIF_CC         0x07f0
0641: #       define SPDIF_L          0x0800
0642: #       define SPDIF_DRS        0x4000
0643: #       define SPDIF_V          0x8000
0644: 
0645: /*
0646:  * Application's profile defines the way how playback underrun situations should be handled.
0647:  * 
0648:  *      APF_NORMAL (the default) and APF_NETWORK make the driver to cleanup the
0649:  *      playback buffer whenever an underrun occurs. This consumes some time
0650:  *      prevents looping the existing buffer.
0651:  *      APF_CPUINTENS is intended to be set by CPU intensive applications which
0652:  *      are likely to run out of time occasionally. In this mode the buffer cleanup is
0653:  *      disabled which saves CPU time but also let's the previous buffer content to
0654:  *      be played during the "pause" after the underrun.
0655:  */
0656: #define SNDCTL_DSP_PROFILE              _SIOW ('P', 23, int)
0657: #define   APF_NORMAL    0       /* Normal applications */
0658: #define   APF_NETWORK   1       /* Underruns probably caused by an "external" delay */
0659: #define   APF_CPUINTENS 2       /* Underruns probably caused by "overheating" the CPU */
0660: 
0661: #define SOUND_PCM_READ_RATE             _SIOR ('P', 2, int)
0662: #define SOUND_PCM_READ_CHANNELS         _SIOR ('P', 6, int)
0663: #define SOUND_PCM_READ_BITS             _SIOR ('P', 5, int)
0664: #define SOUND_PCM_READ_FILTER           _SIOR ('P', 7, int)
0665: 
0666: /* Some alias names */
0667: #define SOUND_PCM_WRITE_BITS            SNDCTL_DSP_SETFMT
0668: #define SOUND_PCM_WRITE_RATE            SNDCTL_DSP_SPEED
0669: #define SOUND_PCM_POST                  SNDCTL_DSP_POST
0670: #define SOUND_PCM_RESET                 SNDCTL_DSP_RESET
0671: #define SOUND_PCM_SYNC                  SNDCTL_DSP_SYNC
0672: #define SOUND_PCM_SUBDIVIDE             SNDCTL_DSP_SUBDIVIDE
0673: #define SOUND_PCM_SETFRAGMENT           SNDCTL_DSP_SETFRAGMENT
0674: #define SOUND_PCM_GETFMTS               SNDCTL_DSP_GETFMTS
0675: #define SOUND_PCM_SETFMT                SNDCTL_DSP_SETFMT
0676: #define SOUND_PCM_GETOSPACE             SNDCTL_DSP_GETOSPACE
0677: #define SOUND_PCM_GETISPACE             SNDCTL_DSP_GETISPACE
0678: #define SOUND_PCM_NONBLOCK              SNDCTL_DSP_NONBLOCK
0679: #define SOUND_PCM_GETCAPS               SNDCTL_DSP_GETCAPS
0680: #define SOUND_PCM_GETTRIGGER            SNDCTL_DSP_GETTRIGGER
0681: #define SOUND_PCM_SETTRIGGER            SNDCTL_DSP_SETTRIGGER
0682: #define SOUND_PCM_SETSYNCRO             SNDCTL_DSP_SETSYNCRO
0683: #define SOUND_PCM_GETIPTR               SNDCTL_DSP_GETIPTR
0684: #define SOUND_PCM_GETOPTR               SNDCTL_DSP_GETOPTR
0685: #define SOUND_PCM_MAPINBUF              SNDCTL_DSP_MAPINBUF
0686: #define SOUND_PCM_MAPOUTBUF             SNDCTL_DSP_MAPOUTBUF
0687: 
0688: /*
0689:  * ioctl calls to be used in communication with coprocessors and
0690:  * DSP chips.
0691:  */
0692: 
0693: typedef struct copr_buffer {
0694:                 int command;    /* Set to 0 if not used */
0695:                 int flags;
0696: #define CPF_NONE                0x0000
0697: #define CPF_FIRST               0x0001  /* First block */
0698: #define CPF_LAST                0x0002  /* Last block */
0699:                 int len;
0700:                 int offs;       /* If required by the device (0 if not used) */
0701: 
0702:                 unsigned char data[4000]; /* NOTE! 4000 is not 4k */
0703:         } copr_buffer;
0704: 
0705: typedef struct copr_debug_buf {
0706:                 int command;    /* Used internally. Set to 0 */
0707:                 int parm1;
0708:                 int parm2;
0709:                 int flags;      
0710:                 int len;        /* Length of data in bytes */
0711:         } copr_debug_buf;
0712: 
0713: typedef struct copr_msg {
0714:                 int len;
0715:                 unsigned char data[4000];
0716:         } copr_msg;
0717: 
0718: #define SNDCTL_COPR_RESET             _SIO  ('C',  0)
0719: #define SNDCTL_COPR_LOAD              _SIOWR('C',  1, copr_buffer)
0720: #define SNDCTL_COPR_RDATA             _SIOWR('C',  2, copr_debug_buf)
0721: #define SNDCTL_COPR_RCODE             _SIOWR('C',  3, copr_debug_buf)
0722: #define SNDCTL_COPR_WDATA             _SIOW ('C',  4, copr_debug_buf)
0723: #define SNDCTL_COPR_WCODE             _SIOW ('C',  5, copr_debug_buf)
0724: #define SNDCTL_COPR_RUN               _SIOWR('C',  6, copr_debug_buf)
0725: #define SNDCTL_COPR_HALT              _SIOWR('C',  7, copr_debug_buf)
0726: #define SNDCTL_COPR_SENDMSG           _SIOWR('C',  8, copr_msg)
0727: #define SNDCTL_COPR_RCVMSG            _SIOR ('C',  9, copr_msg)
0728: 
0729: /*********************************************
0730:  * IOCTL commands for /dev/mixer
0731:  */
0732:         
0733: /* 
0734:  * Mixer devices
0735:  *
0736:  * There can be up to 20 different analog mixer channels. The
0737:  * SOUND_MIXER_NRDEVICES gives the currently supported maximum. 
0738:  * The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells
0739:  * the devices supported by the particular mixer.
0740:  */
0741: 
0742: #define SOUND_MIXER_NRDEVICES   25
0743: #define SOUND_MIXER_VOLUME      0
0744: #define SOUND_MIXER_BASS        1
0745: #define SOUND_MIXER_TREBLE      2
0746: #define SOUND_MIXER_SYNTH       3
0747: #define SOUND_MIXER_PCM         4
0748: #define SOUND_MIXER_SPEAKER     5
0749: #define SOUND_MIXER_LINE        6
0750: #define SOUND_MIXER_MIC         7
0751: #define SOUND_MIXER_CD          8
0752: #define SOUND_MIXER_IMIX        9       /*  Recording monitor  */
0753: #define SOUND_MIXER_ALTPCM      10
0754: #define SOUND_MIXER_RECLEV      11      /* Recording level */
0755: #define SOUND_MIXER_IGAIN       12      /* Input gain */
0756: #define SOUND_MIXER_OGAIN       13      /* Output gain */
0757: /* 
0758:  * The AD1848 codec and compatibles have three line level inputs
0759:  * (line, aux1 and aux2). Since each card manufacturer have assigned
0760:  * different meanings to these inputs, it's inpractical to assign
0761:  * specific meanings (line, cd, synth etc.) to them.
0762:  */
0763: #define SOUND_MIXER_LINE1       14      /* Input source 1  (aux1) */
0764: #define SOUND_MIXER_LINE2       15      /* Input source 2  (aux2) */
0765: #define SOUND_MIXER_LINE3       16      /* Input source 3  (line) */
0766: #define SOUND_MIXER_DIGITAL1    17      /* Digital (input) 1 */
0767: #define SOUND_MIXER_DIGITAL2    18      /* Digital (input) 2 */
0768: #define SOUND_MIXER_DIGITAL3    19      /* Digital (input) 3 */
0769: #define SOUND_MIXER_PHONEIN     20      /* Phone input */
0770: #define SOUND_MIXER_PHONEOUT    21      /* Phone output */
0771: #define SOUND_MIXER_VIDEO       22      /* Video/TV (audio) in */
0772: #define SOUND_MIXER_RADIO       23      /* Radio in */
0773: #define SOUND_MIXER_MONITOR     24      /* Monitor (usually mic) volume */
0774: 
0775: /* Some on/off settings (SOUND_SPECIAL_MIN - SOUND_SPECIAL_MAX) */
0776: /* Not counted to SOUND_MIXER_NRDEVICES, but use the same number space */
0777: #define SOUND_ONOFF_MIN         28
0778: #define SOUND_ONOFF_MAX         30
0779: 
0780: /* Note!        Number 31 cannot be used since the sign bit is reserved */
0781: #define SOUND_MIXER_NONE        31
0782: 
0783: /*
0784:  * The following unsupported macros are no longer functional.
0785:  * Use SOUND_MIXER_PRIVATE# macros in future.
0786:  */
0787: #define SOUND_MIXER_ENHANCE     SOUND_MIXER_NONE
0788: #define SOUND_MIXER_MUTE        SOUND_MIXER_NONE
0789: #define SOUND_MIXER_LOUD        SOUND_MIXER_NONE
0790: 
0791: 
0792: #define SOUND_DEVICE_LABELS     {"Vol  ", "Bass ", "Trebl", "Synth", "Pcm  ", "Spkr ", "Line ", \
0793:                                  "Mic  ", "CD   ", "Mix  ", "Pcm2 ", "Rec  ", "IGain", "OGain", \
0794:                                  "Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", \
0795:                                  "PhoneIn", "PhoneOut", "Video", "Radio", "Monitor"}
0796: 
0797: #define SOUND_DEVICE_NAMES      {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \
0798:                                  "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \
0799:                                  "line1", "line2", "line3", "dig1", "dig2", "dig3", \
0800:                                  "phin", "phout", "video", "radio", "monitor"}
0801: 
0802: /*      Device bitmask identifiers      */
0803: 
0804: #define SOUND_MIXER_RECSRC      0xff    /* Arg contains a bit for each recording source */
0805: #define SOUND_MIXER_DEVMASK     0xfe    /* Arg contains a bit for each supported device */
0806: #define SOUND_MIXER_RECMASK     0xfd    /* Arg contains a bit for each supported recording source */
0807: #define SOUND_MIXER_CAPS        0xfc
0808: #       define SOUND_CAP_EXCL_INPUT     0x00000001      /* Only one recording source at a time */
0809: #define SOUND_MIXER_STEREODEVS  0xfb    /* Mixer channels supporting stereo */
0810: #define SOUND_MIXER_OUTSRC      0xfa    /* Arg contains a bit for each input source to output */
0811: #define SOUND_MIXER_OUTMASK     0xf9    /* Arg contains a bit for each supported input source to output */
0812: 
0813: /*      Device mask bits        */
0814: 
0815: #define SOUND_MASK_VOLUME       (1 << SOUND_MIXER_VOLUME)
0816: #define SOUND_MASK_BASS         (1 << SOUND_MIXER_BASS)
0817: #define SOUND_MASK_TREBLE       (1 << SOUND_MIXER_TREBLE)
0818: #define SOUND_MASK_SYNTH        (1 << SOUND_MIXER_SYNTH)
0819: #define SOUND_MASK_PCM          (1 << SOUND_MIXER_PCM)
0820: #define SOUND_MASK_SPEAKER      (1 << SOUND_MIXER_SPEAKER)
0821: #define SOUND_MASK_LINE         (1 << SOUND_MIXER_LINE)
0822: #define SOUND_MASK_MIC          (1 << SOUND_MIXER_MIC)
0823: #define SOUND_MASK_CD           (1 << SOUND_MIXER_CD)
0824: #define SOUND_MASK_IMIX         (1 << SOUND_MIXER_IMIX)
0825: #define SOUND_MASK_ALTPCM       (1 << SOUND_MIXER_ALTPCM)
0826: #define SOUND_MASK_RECLEV       (1 << SOUND_MIXER_RECLEV)
0827: #define SOUND_MASK_IGAIN        (1 << SOUND_MIXER_IGAIN)
0828: #define SOUND_MASK_OGAIN        (1 << SOUND_MIXER_OGAIN)
0829: #define SOUND_MASK_LINE1        (1 << SOUND_MIXER_LINE1)
0830: #define SOUND_MASK_LINE2        (1 << SOUND_MIXER_LINE2)
0831: #define SOUND_MASK_LINE3        (1 << SOUND_MIXER_LINE3)
0832: #define SOUND_MASK_DIGITAL1     (1 << SOUND_MIXER_DIGITAL1)
0833: #define SOUND_MASK_DIGITAL2     (1 << SOUND_MIXER_DIGITAL2)
0834: #define SOUND_MASK_DIGITAL3     (1 << SOUND_MIXER_DIGITAL3)
0835: #define SOUND_MASK_PHONEIN      (1 << SOUND_MIXER_PHONEIN)
0836: #define SOUND_MASK_PHONEOUT     (1 << SOUND_MIXER_PHONEOUT)
0837: #define SOUND_MASK_RADIO        (1 << SOUND_MIXER_RADIO)
0838: #define SOUND_MASK_VIDEO        (1 << SOUND_MIXER_VIDEO)
0839: #define SOUND_MASK_MONITOR      (1 << SOUND_MIXER_MONITOR)
0840: 
0841: /* Obsolete macros */
0842: #define SOUND_MASK_MUTE         (1 << SOUND_MIXER_MUTE)
0843: #define SOUND_MASK_ENHANCE      (1 << SOUND_MIXER_ENHANCE)
0844: #define SOUND_MASK_LOUD         (1 << SOUND_MIXER_LOUD)
0845: 
0846: #define MIXER_READ(dev)         _SIOR('M', dev, int)
0847: #define SOUND_MIXER_READ_VOLUME         MIXER_READ(SOUND_MIXER_VOLUME)
0848: #define SOUND_MIXER_READ_BASS           MIXER_READ(SOUND_MIXER_BASS)
0849: #define SOUND_MIXER_READ_TREBLE         MIXER_READ(SOUND_MIXER_TREBLE)
0850: #define SOUND_MIXER_READ_SYNTH          MIXER_READ(SOUND_MIXER_SYNTH)
0851: #define SOUND_MIXER_READ_PCM            MIXER_READ(SOUND_MIXER_PCM)
0852: #define SOUND_MIXER_READ_SPEAKER        MIXER_READ(SOUND_MIXER_SPEAKER)
0853: #define SOUND_MIXER_READ_LINE           MIXER_READ(SOUND_MIXER_LINE)
0854: #define SOUND_MIXER_READ_MIC            MIXER_READ(SOUND_MIXER_MIC)
0855: #define SOUND_MIXER_READ_CD             MIXER_READ(SOUND_MIXER_CD)
0856: #define SOUND_MIXER_READ_IMIX           MIXER_READ(SOUND_MIXER_IMIX)
0857: #define SOUND_MIXER_READ_ALTPCM         MIXER_READ(SOUND_MIXER_ALTPCM)
0858: #define SOUND_MIXER_READ_RECLEV         MIXER_READ(SOUND_MIXER_RECLEV)
0859: #define SOUND_MIXER_READ_IGAIN          MIXER_READ(SOUND_MIXER_IGAIN)
0860: #define SOUND_MIXER_READ_OGAIN          MIXER_READ(SOUND_MIXER_OGAIN)
0861: #define SOUND_MIXER_READ_LINE1          MIXER_READ(SOUND_MIXER_LINE1)
0862: #define SOUND_MIXER_READ_LINE2          MIXER_READ(SOUND_MIXER_LINE2)
0863: #define SOUND_MIXER_READ_LINE3          MIXER_READ(SOUND_MIXER_LINE3)
0864: 
0865: /* Obsolete macros */
0866: #define SOUND_MIXER_READ_MUTE           MIXER_READ(SOUND_MIXER_MUTE)
0867: #define SOUND_MIXER_READ_ENHANCE        MIXER_READ(SOUND_MIXER_ENHANCE)
0868: #define SOUND_MIXER_READ_LOUD           MIXER_READ(SOUND_MIXER_LOUD)
0869: 
0870: #define SOUND_MIXER_READ_RECSRC         MIXER_READ(SOUND_MIXER_RECSRC)
0871: #define SOUND_MIXER_READ_DEVMASK        MIXER_READ(SOUND_MIXER_DEVMASK)
0872: #define SOUND_MIXER_READ_RECMASK        MIXER_READ(SOUND_MIXER_RECMASK)
0873: #define SOUND_MIXER_READ_STEREODEVS     MIXER_READ(SOUND_MIXER_STEREODEVS)
0874: #define SOUND_MIXER_READ_CAPS           MIXER_READ(SOUND_MIXER_CAPS)
0875: 
0876: #define MIXER_WRITE(dev)                _SIOWR('M', dev, int)
0877: #define SOUND_MIXER_WRITE_VOLUME        MIXER_WRITE(SOUND_MIXER_VOLUME)
0878: #define SOUND_MIXER_WRITE_BASS          MIXER_WRITE(SOUND_MIXER_BASS)
0879: #define SOUND_MIXER_WRITE_TREBLE        MIXER_WRITE(SOUND_MIXER_TREBLE)
0880: #define SOUND_MIXER_WRITE_SYNTH         MIXER_WRITE(SOUND_MIXER_SYNTH)
0881: #define SOUND_MIXER_WRITE_PCM           MIXER_WRITE(SOUND_MIXER_PCM)
0882: #define SOUND_MIXER_WRITE_SPEAKER       MIXER_WRITE(SOUND_MIXER_SPEAKER)
0883: #define SOUND_MIXER_WRITE_LINE          MIXER_WRITE(SOUND_MIXER_LINE)
0884: #define SOUND_MIXER_WRITE_MIC           MIXER_WRITE(SOUND_MIXER_MIC)
0885: #define SOUND_MIXER_WRITE_CD            MIXER_WRITE(SOUND_MIXER_CD)
0886: #define SOUND_MIXER_WRITE_IMIX          MIXER_WRITE(SOUND_MIXER_IMIX)
0887: #define SOUND_MIXER_WRITE_ALTPCM        MIXER_WRITE(SOUND_MIXER_ALTPCM)
0888: #define SOUND_MIXER_WRITE_RECLEV        MIXER_WRITE(SOUND_MIXER_RECLEV)
0889: #define SOUND_MIXER_WRITE_IGAIN         MIXER_WRITE(SOUND_MIXER_IGAIN)
0890: #define SOUND_MIXER_WRITE_OGAIN         MIXER_WRITE(SOUND_MIXER_OGAIN)
0891: #define SOUND_MIXER_WRITE_LINE1         MIXER_WRITE(SOUND_MIXER_LINE1)
0892: #define SOUND_MIXER_WRITE_LINE2         MIXER_WRITE(SOUND_MIXER_LINE2)
0893: #define SOUND_MIXER_WRITE_LINE3         MIXER_WRITE(SOUND_MIXER_LINE3)
0894: 
0895: /* Obsolete macros */
0896: #define SOUND_MIXER_WRITE_MUTE          MIXER_WRITE(SOUND_MIXER_MUTE)
0897: #define SOUND_MIXER_WRITE_ENHANCE       MIXER_WRITE(SOUND_MIXER_ENHANCE)
0898: #define SOUND_MIXER_WRITE_LOUD          MIXER_WRITE(SOUND_MIXER_LOUD)
0899: 
0900: #define SOUND_MIXER_WRITE_RECSRC        MIXER_WRITE(SOUND_MIXER_RECSRC)
0901: 
0902: typedef struct mixer_info
0903: {
0904:   char id[16];
0905:   char name[32];
0906:   int  modify_counter;
0907:   int fillers[10];
0908: } mixer_info;
0909: 
0910: typedef struct _old_mixer_info /* Obsolete */
0911: {
0912:   char id[16];
0913:   char name[32];
0914: } _old_mixer_info;
0915: 
0916: #define SOUND_MIXER_INFO                _SIOR ('M', 101, mixer_info)
0917: #define SOUND_OLD_MIXER_INFO            _SIOR ('M', 101, _old_mixer_info)
0918: 
0919: /*
0920:  * A mechanism for accessing "proprietary" mixer features. This method
0921:  * permits passing 128 bytes of arbitrary data between a mixer application
0922:  * and the mixer driver. Interpretation of the record is defined by
0923:  * the particular mixer driver.
0924:  */
0925: typedef unsigned char mixer_record[128];
0926: 
0927: #define SOUND_MIXER_ACCESS              _SIOWR('M', 102, mixer_record)
0928: 
0929: /*
0930:  * Two ioctls for special souncard function
0931:  */
0932: #define SOUND_MIXER_AGC  _SIOWR('M', 103, int)
0933: #define SOUND_MIXER_3DSE  _SIOWR('M', 104, int)
0934: 
0935: /*
0936:  * The SOUND_MIXER_PRIVATE# commands can be redefined by low level drivers.
0937:  * These features can be used when accessing device specific features.
0938:  */
0939: #define SOUND_MIXER_PRIVATE1            _SIOWR('M', 111, int)
0940: #define SOUND_MIXER_PRIVATE2            _SIOWR('M', 112, int)
0941: #define SOUND_MIXER_PRIVATE3            _SIOWR('M', 113, int)
0942: #define SOUND_MIXER_PRIVATE4            _SIOWR('M', 114, int)
0943: #define SOUND_MIXER_PRIVATE5            _SIOWR('M', 115, int)
0944: 
0945: /*
0946:  * SOUND_MIXER_GETLEVELS and SOUND_MIXER_SETLEVELS calls can be used
0947:  * for querying current mixer settings from the driver and for loading
0948:  * default volume settings _prior_ activating the mixer (loading
0949:  * doesn't affect current state of the mixer hardware). These calls
0950:  * are for internal use only.
0951:  */
0952: 
0953: typedef struct mixer_vol_table {
0954:   int num;      /* Index to volume table */
0955:   char name[32];
0956:   int levels[32];
0957: } mixer_vol_table;
0958: 
0959: #define SOUND_MIXER_GETLEVELS           _SIOWR('M', 116, mixer_vol_table)
0960: #define SOUND_MIXER_SETLEVELS           _SIOWR('M', 117, mixer_vol_table)
0961: 
0962: /* 
0963:  * An ioctl for identifying the driver version. It will return value
0964:  * of the SOUND_VERSION macro used when compiling the driver.
0965:  * This call was introduced in OSS version 3.6 and it will not work
0966:  * with earlier versions (returns EINVAL).
0967:  */
0968: #define OSS_GETVERSION                  _SIOR ('M', 118, int)
0969: 
0970: /*
0971:  * Level 2 event types for /dev/sequencer
0972:  */
0973: 
0974: /*
0975:  * The 4 most significant bits of byte 0 specify the class of
0976:  * the event: 
0977:  *
0978:  *      0x8X = system level events,
0979:  *      0x9X = device/port specific events, event[1] = device/port,
0980:  *              The last 4 bits give the subtype:
0981:  *                      0x02    = Channel event (event[3] = chn).
0982:  *                      0x01    = note event (event[4] = note).
0983:  *                      (0x01 is not used alone but always with bit 0x02).
0984:  *             event[2] = MIDI message code (0x80=note off etc.)
0985:  *
0986:  */
0987: 
0988: #define EV_SEQ_LOCAL            0x80
0989: #define EV_TIMING               0x81
0990: #define EV_CHN_COMMON           0x92
0991: #define EV_CHN_VOICE            0x93
0992: #define EV_SYSEX                0x94
0993: /*
0994:  * Event types 200 to 220 are reserved for application use.
0995:  * These numbers will not be used by the driver.
0996:  */
0997: 
0998: /*
0999:  * Events for event type EV_CHN_VOICE
1000:  */
1001: 
1002: #define MIDI_NOTEOFF            0x80
1003: #define MIDI_NOTEON             0x90
1004: #define MIDI_KEY_PRESSURE       0xA0
1005: 
1006: /*
1007:  * Events for event type EV_CHN_COMMON
1008:  */
1009: 
1010: #define MIDI_CTL_CHANGE         0xB0
1011: #define MIDI_PGM_CHANGE         0xC0
1012: #define MIDI_CHN_PRESSURE       0xD0
1013: #define MIDI_PITCH_BEND         0xE0
1014: 
1015: #define MIDI_SYSTEM_PREFIX      0xF0
1016: 
1017: /*
1018:  * Timer event types
1019:  */
1020: #define TMR_WAIT_REL            1       /* Time relative to the prev time */
1021: #define TMR_WAIT_ABS            2       /* Absolute time since TMR_START */
1022: #define TMR_STOP                3
1023: #define TMR_START               4
1024: #define TMR_CONTINUE            5
1025: #define TMR_TEMPO               6
1026: #define TMR_ECHO                8
1027: #define TMR_CLOCK               9       /* MIDI clock */
1028: #define TMR_SPP                 10      /* Song position pointer */
1029: #define TMR_TIMESIG             11      /* Time signature */
1030: 
1031: /*
1032:  *      Local event types
1033:  */
1034: #define LOCL_STARTAUDIO         1
1035: 
1036: /*
1037:  *      Some convenience macros to simplify programming of the
1038:  *      /dev/sequencer interface
1039:  *
1040:  *      This is a legacy interface for applications written against
1041:  *      the OSSlib-3.8 style interface. It is no longer possible
1042:  *      to actually link against OSSlib with this header, but we
1043:  *      still provide these macros for programs using them.
1044:  *
1045:  *      If you want to use OSSlib, it is recommended that you get
1046:  *      the GPL version of OSS-4.x and build against that version
1047:  *      of the header.
1048:  *
1049:  *      We redefine the extern keyword so that make headers_check
1050:  *      does not complain about SEQ_USE_EXTBUF.
1051:  */
1052: #define SEQ_DECLAREBUF()                SEQ_USE_EXTBUF()
1053: 
1054: void seqbuf_dump(void); /* This function must be provided by programs */
1055: 
1056: #define SEQ_PM_DEFINES int __foo_bar___
1057: 
1058: #define SEQ_LOAD_GMINSTR(dev, instr)
1059: #define SEQ_LOAD_GMDRUM(dev, drum)
1060: 
1061: #define _SEQ_EXTERN extern
1062: #define SEQ_USE_EXTBUF() \
1063:                 _SEQ_EXTERN unsigned char _seqbuf[]; \
1064:                 _SEQ_EXTERN int _seqbuflen; _SEQ_EXTERN int _seqbufptr
1065: 
1066: #ifndef USE_SIMPLE_MACROS
1067: /* Sample seqbuf_dump() implementation:
1068:  *
1069:  *      SEQ_DEFINEBUF (2048);   -- Defines a buffer for 2048 bytes
1070:  *
1071:  *      int seqfd;              -- The file descriptor for /dev/sequencer.
1072:  *
1073:  *      void
1074:  *      seqbuf_dump ()
1075:  *      {
1076:  *        if (_seqbufptr)
1077:  *          if (write (seqfd, _seqbuf, _seqbufptr) == -1)
1078:  *            {
1079:  *              perror ("write /dev/sequencer");
1080:  *              exit (-1);
1081:  *            }
1082:  *        _seqbufptr = 0;
1083:  *      }
1084:  */
1085: 
1086: #define SEQ_DEFINEBUF(len)              unsigned char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0
1087: #define _SEQ_NEEDBUF(len)               if ((_seqbufptr+(len)) > _seqbuflen) seqbuf_dump()
1088: #define _SEQ_ADVBUF(len)                _seqbufptr += len
1089: #define SEQ_DUMPBUF                     seqbuf_dump
1090: #else
1091: /*
1092:  * This variation of the sequencer macros is used just to format one event
1093:  * using fixed buffer.
1094:  * 
1095:  * The program using the macro library must define the following macros before
1096:  * using this library.
1097:  *
1098:  * #define _seqbuf               name of the buffer (unsigned char[]) 
1099:  * #define _SEQ_ADVBUF(len)      If the applic needs to know the exact
1100:  *                               size of the event, this macro can be used.
1101:  *                               Otherwise this must be defined as empty.
1102:  * #define _seqbufptr            Define the name of index variable or 0 if
1103:  *                               not required. 
1104:  */
1105: #define _SEQ_NEEDBUF(len)       /* empty */
1106: #endif
1107: 
1108: #define SEQ_VOLUME_MODE(dev, mode)      {_SEQ_NEEDBUF(8);\
1109:                                         _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
1110:                                         _seqbuf[_seqbufptr+1] = SEQ_VOLMODE;\
1111:                                         _seqbuf[_seqbufptr+2] = (dev);\
1112:                                         _seqbuf[_seqbufptr+3] = (mode);\
1113:                                         _seqbuf[_seqbufptr+4] = 0;\
1114:                                         _seqbuf[_seqbufptr+5] = 0;\
1115:                                         _seqbuf[_seqbufptr+6] = 0;\
1116:                                         _seqbuf[_seqbufptr+7] = 0;\
1117:                                         _SEQ_ADVBUF(8);}
1118: 
1119: /*
1120:  * Midi voice messages
1121:  */
1122: 
1123: #define _CHN_VOICE(dev, event, chn, note, parm) \
1124:                                         {_SEQ_NEEDBUF(8);\
1125:                                         _seqbuf[_seqbufptr] = EV_CHN_VOICE;\
1126:                                         _seqbuf[_seqbufptr+1] = (dev);\
1127:                                         _seqbuf[_seqbufptr+2] = (event);\
1128:                                         _seqbuf[_seqbufptr+3] = (chn);\
1129:                                         _seqbuf[_seqbufptr+4] = (note);\
1130:                                         _seqbuf[_seqbufptr+5] = (parm);\
1131:                                         _seqbuf[_seqbufptr+6] = (0);\
1132:                                         _seqbuf[_seqbufptr+7] = 0;\
1133:                                         _SEQ_ADVBUF(8);}
1134: 
1135: #define SEQ_START_NOTE(dev, chn, note, vol) \
1136:                 _CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol)
1137: 
1138: #define SEQ_STOP_NOTE(dev, chn, note, vol) \
1139:                 _CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol)
1140: 
1141: #define SEQ_KEY_PRESSURE(dev, chn, note, pressure) \
1142:                 _CHN_VOICE(dev, MIDI_KEY_PRESSURE, chn, note, pressure)
1143: 
1144: /*
1145:  * Midi channel messages
1146:  */
1147: 
1148: #define _CHN_COMMON(dev, event, chn, p1, p2, w14) \
1149:                                         {_SEQ_NEEDBUF(8);\
1150:                                         _seqbuf[_seqbufptr] = EV_CHN_COMMON;\
1151:                                         _seqbuf[_seqbufptr+1] = (dev);\
1152:                                         _seqbuf[_seqbufptr+2] = (event);\
1153:                                         _seqbuf[_seqbufptr+3] = (chn);\
1154:                                         _seqbuf[_seqbufptr+4] = (p1);\
1155:                                         _seqbuf[_seqbufptr+5] = (p2);\
1156:                                         *(short *)&_seqbuf[_seqbufptr+6] = (w14);\
1157:                                         _SEQ_ADVBUF(8);}
1158: /*
1159:  * SEQ_SYSEX permits sending of sysex messages. (It may look that it permits
1160:  * sending any MIDI bytes but it's absolutely not possible. Trying to do
1161:  * so _will_ cause problems with MPU401 intelligent mode).
1162:  *
1163:  * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be 
1164:  * sent by calling SEQ_SYSEX() several times (there must be no other events
1165:  * between them). First sysex fragment must have 0xf0 in the first byte
1166:  * and the last byte (buf[len-1] of the last fragment must be 0xf7. No byte
1167:  * between these sysex start and end markers cannot be larger than 0x7f. Also
1168:  * lengths of each fragments (except the last one) must be 6.
1169:  *
1170:  * Breaking the above rules may work with some MIDI ports but is likely to
1171:  * cause fatal problems with some other devices (such as MPU401).
1172:  */
1173: #define SEQ_SYSEX(dev, buf, len) \
1174:                                         {int ii, ll=(len); \
1175:                                          unsigned char *bufp=buf;\
1176:                                          if (ll>6)ll=6;\
1177:                                         _SEQ_NEEDBUF(8);\
1178:                                         _seqbuf[_seqbufptr] = EV_SYSEX;\
1179:                                         _seqbuf[_seqbufptr+1] = (dev);\
1180:                                         for(ii=0;ii<ll;ii++)\
1181:                                            _seqbuf[_seqbufptr+ii+2] = bufp[ii];\
1182:                                         for(ii=ll;ii<6;ii++)\
1183:                                            _seqbuf[_seqbufptr+ii+2] = 0xff;\
1184:                                         _SEQ_ADVBUF(8);}
1185: 
1186: #define SEQ_CHN_PRESSURE(dev, chn, pressure) \
1187:                 _CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0)
1188: 
1189: #define SEQ_SET_PATCH SEQ_PGM_CHANGE
1190: #define SEQ_PGM_CHANGE(dev, chn, patch) \
1191:                 _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0)
1192: 
1193: #define SEQ_CONTROL(dev, chn, controller, value) \
1194:                 _CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value)
1195: 
1196: #define SEQ_BENDER(dev, chn, value) \
1197:                 _CHN_COMMON(dev, MIDI_PITCH_BEND, chn, 0, 0, value)
1198: 
1199: 
1200: #define SEQ_V2_X_CONTROL(dev, voice, controller, value) {_SEQ_NEEDBUF(8);\
1201:                                         _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
1202:                                         _seqbuf[_seqbufptr+1] = SEQ_CONTROLLER;\
1203:                                         _seqbuf[_seqbufptr+2] = (dev);\
1204:                                         _seqbuf[_seqbufptr+3] = (voice);\
1205:                                         _seqbuf[_seqbufptr+4] = (controller);\
1206:                                         _seqbuf[_seqbufptr+5] = ((value)&0xff);\
1207:                                         _seqbuf[_seqbufptr+6] = ((value>>8)&0xff);\
1208:                                         _seqbuf[_seqbufptr+7] = 0;\
1209:                                         _SEQ_ADVBUF(8);}
1210: /*
1211:  * The following 5 macros are incorrectly implemented and obsolete.
1212:  * Use SEQ_BENDER and SEQ_CONTROL (with proper controller) instead.
1213:  */
1214: #define SEQ_PITCHBEND(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER, value)
1215: #define SEQ_BENDER_RANGE(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value)
1216: #define SEQ_EXPRESSION(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128)
1217: #define SEQ_MAIN_VOLUME(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100)
1218: #define SEQ_PANNING(dev, voice, pos) SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2)
1219: 
1220: /*
1221:  * Timing and synchronization macros
1222:  */
1223: 
1224: #define _TIMER_EVENT(ev, parm)          {_SEQ_NEEDBUF(8);\
1225:                                         _seqbuf[_seqbufptr+0] = EV_TIMING; \
1226:                                         _seqbuf[_seqbufptr+1] = (ev); \
1227:                                         _seqbuf[_seqbufptr+2] = 0;\
1228:                                         _seqbuf[_seqbufptr+3] = 0;\
1229:                                         *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
1230:                                         _SEQ_ADVBUF(8);}
1231: 
1232: #define SEQ_START_TIMER()               _TIMER_EVENT(TMR_START, 0)
1233: #define SEQ_STOP_TIMER()                _TIMER_EVENT(TMR_STOP, 0)
1234: #define SEQ_CONTINUE_TIMER()            _TIMER_EVENT(TMR_CONTINUE, 0)
1235: #define SEQ_WAIT_TIME(ticks)            _TIMER_EVENT(TMR_WAIT_ABS, ticks)
1236: #define SEQ_DELTA_TIME(ticks)           _TIMER_EVENT(TMR_WAIT_REL, ticks)
1237: #define SEQ_ECHO_BACK(key)              _TIMER_EVENT(TMR_ECHO, key)
1238: #define SEQ_SET_TEMPO(value)            _TIMER_EVENT(TMR_TEMPO, value)
1239: #define SEQ_SONGPOS(pos)                _TIMER_EVENT(TMR_SPP, pos)
1240: #define SEQ_TIME_SIGNATURE(sig)         _TIMER_EVENT(TMR_TIMESIG, sig)
1241: 
1242: /*
1243:  * Local control events
1244:  */
1245: 
1246: #define _LOCAL_EVENT(ev, parm)          {_SEQ_NEEDBUF(8);\
1247:                                         _seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; \
1248:                                         _seqbuf[_seqbufptr+1] = (ev); \
1249:                                         _seqbuf[_seqbufptr+2] = 0;\
1250:                                         _seqbuf[_seqbufptr+3] = 0;\
1251:                                         *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
1252:                                         _SEQ_ADVBUF(8);}
1253: 
1254: #define SEQ_PLAYAUDIO(devmask)          _LOCAL_EVENT(LOCL_STARTAUDIO, devmask)
1255: /*
1256:  * Events for the level 1 interface only 
1257:  */
1258: 
1259: #define SEQ_MIDIOUT(device, byte)       {_SEQ_NEEDBUF(4);\
1260:                                         _seqbuf[_seqbufptr] = SEQ_MIDIPUTC;\
1261:                                         _seqbuf[_seqbufptr+1] = (byte);\
1262:                                         _seqbuf[_seqbufptr+2] = (device);\
1263:                                         _seqbuf[_seqbufptr+3] = 0;\
1264:                                         _SEQ_ADVBUF(4);}
1265: 
1266: /*
1267:  * Patch loading.
1268:  */
1269: #define SEQ_WRPATCH(patchx, len) \
1270:                 {if (_seqbufptr) SEQ_DUMPBUF();\
1271:                  if (write(seqfd, (char*)(patchx), len)==-1) \
1272:                     perror("Write patch: /dev/sequencer");}
1273: #define SEQ_WRPATCH2(patchx, len) \
1274:                 (SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len))
1275: 
1276: #endif
1277: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/