📄 soundcard.h
字号:
* The data written to the /dev/sequencer is a stream of events. Events * are records of 4 or 8 bytes. The first byte defines the size. * Any number of events can be written with a write call. There * is a set of macros for sending these events. Use these macros if you * want to maximize portability of your program. * * Events SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO. Are also input events. * (All input events are currently 4 bytes long. Be prepared to support * 8 byte events also. If you receive any event having first byte >= 128, * it's a 8 byte event. * * The events are documented at the end of this file. * * Normal events (4 bytes) * There is also a 8 byte version of most of the 4 byte events. The * 8 byte one is recommended. * * NOTE! All 4 byte events are now obsolete. Applications should not write * them. However 4 byte events are still used as inputs from * /dev/sequencer (/dev/music uses only 8 byte ones). */#define SEQ_NOTEOFF 0#define SEQ_FMNOTEOFF SEQ_NOTEOFF /* Just old name */#define SEQ_NOTEON 1#define SEQ_FMNOTEON SEQ_NOTEON#define SEQ_WAIT TMR_WAIT_ABS#define SEQ_PGMCHANGE 3#define SEQ_FMPGMCHANGE SEQ_PGMCHANGE#define SEQ_SYNCTIMER TMR_START#define SEQ_MIDIPUTC 5#define SEQ_DRUMON 6 /*** OBSOLETE ***/#define SEQ_DRUMOFF 7 /*** OBSOLETE ***/#define SEQ_ECHO TMR_ECHO /* For synching programs with output */#define SEQ_AFTERTOUCH 9#define SEQ_CONTROLLER 10/******************************************* * Midi controller numbers ******************************************* * Controllers 0 to 31 (0x00 to 0x1f) and * 32 to 63 (0x20 to 0x3f) are continuous * controllers. * In the MIDI 1.0 these controllers are sent using * two messages. Controller numbers 0 to 31 are used * to send the MSB and the controller numbers 32 to 63 * are for the LSB. Note that just 7 bits are used in MIDI bytes. */#define CTL_BANK_SELECT 0x00#define CTL_MODWHEEL 0x01#define CTL_BREATH 0x02/* undefined 0x03 */#define CTL_FOOT 0x04#define CTL_PORTAMENTO_TIME 0x05#define CTL_DATA_ENTRY 0x06#define CTL_MAIN_VOLUME 0x07#define CTL_BALANCE 0x08/* undefined 0x09 */#define CTL_PAN 0x0a#define CTL_EXPRESSION 0x0b/* undefined 0x0c *//* undefined 0x0d *//* undefined 0x0e *//* undefined 0x0f */#define CTL_GENERAL_PURPOSE1 0x10#define CTL_GENERAL_PURPOSE2 0x11#define CTL_GENERAL_PURPOSE3 0x12#define CTL_GENERAL_PURPOSE4 0x13/* undefined 0x14 - 0x1f *//* undefined 0x20 *//* The controller numbers 0x21 to 0x3f are reserved for the *//* least significant bytes of the controllers 0x00 to 0x1f. *//* These controllers are not recognised by the driver. *//* Controllers 64 to 69 (0x40 to 0x45) are on/off switches. *//* 0=OFF and 127=ON (intermediate values are possible) */#define CTL_DAMPER_PEDAL 0x40#define CTL_SUSTAIN 0x40 /* Alias */#define CTL_HOLD 0x40 /* Alias */#define CTL_PORTAMENTO 0x41#define CTL_SOSTENUTO 0x42#define CTL_SOFT_PEDAL 0x43/* undefined 0x44 */#define CTL_HOLD2 0x45/* undefined 0x46 - 0x4f */#define CTL_GENERAL_PURPOSE5 0x50#define CTL_GENERAL_PURPOSE6 0x51#define CTL_GENERAL_PURPOSE7 0x52#define CTL_GENERAL_PURPOSE8 0x53/* undefined 0x54 - 0x5a */#define CTL_EXT_EFF_DEPTH 0x5b#define CTL_TREMOLO_DEPTH 0x5c#define CTL_CHORUS_DEPTH 0x5d#define CTL_DETUNE_DEPTH 0x5e#define CTL_CELESTE_DEPTH 0x5e /* Alias for the above one */#define CTL_PHASER_DEPTH 0x5f#define CTL_DATA_INCREMENT 0x60#define CTL_DATA_DECREMENT 0x61#define CTL_NONREG_PARM_NUM_LSB 0x62#define CTL_NONREG_PARM_NUM_MSB 0x63#define CTL_REGIST_PARM_NUM_LSB 0x64#define CTL_REGIST_PARM_NUM_MSB 0x65/* undefined 0x66 - 0x78 *//* reserved 0x79 - 0x7f *//* Pseudo controllers (not midi compatible) */#define CTRL_PITCH_BENDER 255#define CTRL_PITCH_BENDER_RANGE 254#define CTRL_EXPRESSION 253 /* Obsolete */#define CTRL_MAIN_VOLUME 252 /* Obsolete */#define SEQ_BALANCE 11#define SEQ_VOLMODE 12/* * Volume mode defines how volumes are used */#define VOL_METHOD_ADAGIO 1#define VOL_METHOD_LINEAR 2/* * Note! SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO are used also as * input events. *//* * Event codes 0xf0 to 0xfc are reserved for future extensions. */#define SEQ_FULLSIZE 0xfd /* Long events *//* * SEQ_FULLSIZE events are used for loading patches/samples to the * synthesizer devices. These events are passed directly to the driver * of the associated synthesizer device. There is no limit to the size * of the extended events. These events are not queued but executed * immediately when the write() is called (execution can take several * seconds of time). * * When a SEQ_FULLSIZE message is written to the device, it must * be written using exactly one write() call. Other events cannot * be mixed to the same write. * * For FM synths (YM3812/OPL3) use struct sbi_instrument and write it to the * /dev/sequencer. Don't write other data together with the instrument structure * Set the key field of the structure to FM_PATCH. The device field is used to * route the patch to the corresponding device. * * For wave table use struct patch_info. Initialize the key field * to WAVE_PATCH. */#define SEQ_PRIVATE 0xfe /* Low level HW dependent events (8 bytes) */#define SEQ_EXTENDED 0xff /* Extended events (8 bytes) OBSOLETE *//* * Record for FM patches */typedef unsigned char sbi_instr_data[32];struct sbi_instrument{ unsigned short key; /* FM_PATCH or OPL3_PATCH */#define FM_PATCH _PATCHKEY(0x01)#define OPL3_PATCH _PATCHKEY(0x03) short device; /* Synth# (0-4) */ int channel; /* Program# to be initialized */ sbi_instr_data operators; /* Register settings for operator cells (.SBI format) */};struct synth_info{ /* Read only */ char name[30]; int device; /* 0-N. INITIALIZE BEFORE CALLING */ int synth_type;#define SYNTH_TYPE_FM 0#define SYNTH_TYPE_SAMPLE 1#define SYNTH_TYPE_MIDI 2 /* Midi interface */ int synth_subtype;#define FM_TYPE_ADLIB 0x00#define FM_TYPE_OPL3 0x01#define MIDI_TYPE_MPU401 0x401#define SAMPLE_TYPE_BASIC 0x10#define SAMPLE_TYPE_GUS SAMPLE_TYPE_BASIC#define SAMPLE_TYPE_WAVEFRONT 0x11 int perc_mode; /* No longer supported */ int nr_voices; int nr_drums; /* Obsolete field */ int instr_bank_size; unsigned int capabilities;#define SYNTH_CAP_PERCMODE 0x00000001 /* No longer used */#define SYNTH_CAP_OPL3 0x00000002 /* Set if OPL3 supported */#define SYNTH_CAP_INPUT 0x00000004 /* Input (MIDI) device */ int dummies[19]; /* Reserve space */};struct sound_timer_info{ char name[32]; int caps;};#define MIDI_CAP_MPU401 1 /* MPU-401 intelligent mode */struct midi_info{ char name[30]; int device; /* 0-N. INITIALIZE BEFORE CALLING */ unsigned int capabilities; /* To be defined later */ int dev_type; int dummies[18]; /* Reserve space */};/******************************************** * ioctl commands for the /dev/midi## */typedef struct{ unsigned char cmd; char nr_args, nr_returns; unsigned char data[30];}mpu_command_rec;#define SNDCTL_MIDI_PRETIME __SIOWR('m', 0, int)#define SNDCTL_MIDI_MPUMODE __SIOWR('m', 1, int)#define SNDCTL_MIDI_MPUCMD __SIOWR('m', 2, mpu_command_rec)/******************************************** * IOCTL commands for /dev/dsp and /dev/audio */#define SNDCTL_DSP_RESET __SIO ('P', 0)#define SNDCTL_DSP_SYNC __SIO ('P', 1)#define SNDCTL_DSP_SPEED __SIOWR('P', 2, int)#define SNDCTL_DSP_STEREO __SIOWR('P', 3, int)#define SNDCTL_DSP_GETBLKSIZE __SIOWR('P', 4, int)#define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT#define SNDCTL_DSP_CHANNELS __SIOWR('P', 6, int)#define SOUND_PCM_WRITE_CHANNELS SNDCTL_DSP_CHANNELS#define SOUND_PCM_WRITE_FILTER __SIOWR('P', 7, int)#define SNDCTL_DSP_POST __SIO ('P', 8)#define SNDCTL_DSP_SUBDIVIDE __SIOWR('P', 9, int)#define SNDCTL_DSP_SETFRAGMENT __SIOWR('P',10, int)/* Audio data formats (Note! U8=8 and S16_LE=16 for compatibility) */#define SNDCTL_DSP_GETFMTS __SIOR ('P',11, int) /* Returns a mask */#define SNDCTL_DSP_SETFMT __SIOWR('P',5, int) /* Selects ONE fmt */# define AFMT_QUERY 0x00000000 /* Return current fmt */# define AFMT_MU_LAW 0x00000001# define AFMT_A_LAW 0x00000002# define AFMT_IMA_ADPCM 0x00000004# define AFMT_U8 0x00000008# define AFMT_S16_LE 0x00000010 /* Little endian signed 16 */# define AFMT_S16_BE 0x00000020 /* Big endian signed 16 */# define AFMT_S8 0x00000040# define AFMT_U16_LE 0x00000080 /* Little endian U16 */# define AFMT_U16_BE 0x00000100 /* Big endian U16 */# define AFMT_MPEG 0x00000200 /* MPEG (2) audio *//* AC3 _compressed_ bitstreams (See Programmer's Guide for details). */# define AFMT_AC3 0x00000400/* Ogg Vorbis _compressed_ bit streams */# define AFMT_VORBIS 0x00000800/* 32 bit formats (MSB aligned) formats */# define AFMT_S32_LE 0x00001000# define AFMT_S32_BE 0x00002000/* Reserved for _native_ endian double precision IEEE floating point */# define AFMT_FLOAT 0x00004000/* 24 bit formats (LSB aligned in 32 bit word) formats */# define AFMT_S24_LE 0x00008000# define AFMT_S24_BE 0x00010000/* * S/PDIF raw format. In this format the S/PDIF frames (including all * control and user bits) are included in the data stream. Each sample * is stored in a 32 bit frame (see IEC-958 for more info). This format * is supported by very few devices and it's only usable for purposes * where full access to the control/user bits is required (real time control). */# define AFMT_SPDIF_RAW 0x00020000/* * Buffer status queries. */typedef struct audio_buf_info{ int fragments; /* # of available fragments (partially usend ones not counted) */ int fragstotal; /* Total # of fragments allocated */ int fragsize; /* Size of a fragment in bytes */ int bytes; /* Available space in bytes (includes partially used fragments) */ /* Note! 'bytes' could be more than fragments*fragsize */}audio_buf_info;#define SNDCTL_DSP_GETOSPACE __SIOR ('P',12, audio_buf_info)#define SNDCTL_DSP_GETISPACE __SIOR ('P',13, audio_buf_info)#define SNDCTL_DSP_NONBLOCK __SIO ('P',14) /* Obsolete. Not supported */#define SNDCTL_DSP_GETCAPS __SIOR ('P',15, int)# define DSP_CAP_REVISION 0x000000ff /* Bits for revision level (0 to 255) */# define DSP_CAP_DUPLEX 0x00000100 /* Full duplex record/playback */# define DSP_CAP_REALTIME 0x00000200 /* Not in use */# define DSP_CAP_BATCH 0x00000400 /* Device has some kind of */ /* internal buffers which may */ /* cause some delays and */ /* decrease precision of timing */# define DSP_CAP_COPROC 0x00000800 /* Has a coprocessor */ /* Sometimes it's a DSP */ /* but usually not */# define DSP_CAP_TRIGGER 0x00001000 /* Supports SETTRIGGER */# define DSP_CAP_MMAP 0x00002000 /* Supports mmap() */# define DSP_CAP_MULTI 0x00004000 /* Supports multiple open */# define DSP_CAP_BIND 0x00008000 /* Supports binding to front/rear/center/lfe */# define DSP_CAP_INPUT 0x00010000 /* Supports recording */# define DSP_CAP_OUTPUT 0x00020000 /* Supports playback */#define DSP_CAP_VIRTUAL 0x00040000 /* Virtuial device *//* 0x00040000 and 0x00080000 reserved for future use *//* Analog/digital control capabilities */# define DSP_CAP_ANALOGOUT 0x00100000# define DSP_CAP_ANALOGIN 0x00200000# define DSP_CAP_DIGITALOUT 0x00400000# define DSP_CAP_DIGITALIN 0x00800000# define DSP_CAP_ADMASK 0x00f00000/* * NOTE! (capabilities & DSP_CAP_ADMASK)==0 means just that the * digital/analog interface control features are not supported by the * device/driver. However the device still supports analog, digital or * both inputs/outputs (depending on the device). See the OSS Programmer's * Guide for full details. */# define DSP_CAP_SHADOW 0x01000000 /* "Shadow" device *//* * Preferred channel usage. These bits can be used to * give recommendations to the application. Used by few drivers. * For example if ((caps & DSP_CH_MASK) == DSP_CH_MONO) means that * the device works best in mono mode. However it doesn't necessarily mean * that the device cannot be used in stereo. These bits should only be used
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -