added the alsa-kernel header files into local tree.

This commit is contained in:
Takashi Iwai 2002-10-09 13:44:10 +00:00
parent 163ae5738d
commit 7b2f5fa7e1
8 changed files with 2831 additions and 1 deletions

View file

@ -8,7 +8,8 @@ alsainclude_HEADERS = asoundlib.h asoundef.h \
seq_event.h seq.h seqmid.h seq_midi_event.h \
conv.h instr.h iatomic.h
noinst_HEADERS = sys.h search.h list.h aserver.h local.h config.h alsa-symbols.h
noinst_HEADERS = sys.h search.h list.h aserver.h local.h alsa-symbols.h \
sound/asound.h sound/asoundef.h sound/asequencer.h
CLEANFILES = stamp-vh version.h

132
include/sound/ainstr_fm.h Normal file
View file

@ -0,0 +1,132 @@
/*
* Advanced Linux Sound Architecture
*
* FM (OPL2/3) Instrument Format
* Copyright (c) 2000 Uros Bizjak <uros@kss-loka.si>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __SOUND_AINSTR_FM_H
#define __SOUND_AINSTR_FM_H
#ifndef __KERNEL__
#include <asm/types.h>
#include <asm/byteorder.h>
#endif
/*
* share types (share ID 1)
*/
#define FM_SHARE_FILE 0
/*
* FM operator
*/
typedef struct fm_operator {
unsigned char am_vib;
unsigned char ksl_level;
unsigned char attack_decay;
unsigned char sustain_release;
unsigned char wave_select;
} fm_operator_t;
/*
* Instrument
*/
#define FM_PATCH_OPL2 0x01 /* OPL2 2 operators FM instrument */
#define FM_PATCH_OPL3 0x02 /* OPL3 4 operators FM instrument */
typedef struct {
unsigned int share_id[4]; /* share id - zero = no sharing */
unsigned char type; /* instrument type */
fm_operator_t op[4];
unsigned char feedback_connection[2];
unsigned char echo_delay;
unsigned char echo_atten;
unsigned char chorus_spread;
unsigned char trnsps;
unsigned char fix_dur;
unsigned char modes;
unsigned char fix_key;
} fm_instrument_t;
/*
*
* Kernel <-> user space
* Hardware (CPU) independent section
*
* * = zero or more
* + = one or more
*
* fm_xinstrument FM_STRU_INSTR
*
*/
#define FM_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
/*
* FM operator
*/
typedef struct fm_xoperator {
__u8 am_vib;
__u8 ksl_level;
__u8 attack_decay;
__u8 sustain_release;
__u8 wave_select;
} fm_xoperator_t;
/*
* Instrument
*/
typedef struct fm_xinstrument {
__u32 stype; /* structure type */
__u32 share_id[4]; /* share id - zero = no sharing */
__u8 type; /* instrument type */
fm_xoperator_t op[4]; /* fm operators */
__u8 feedback_connection[2];
__u8 echo_delay;
__u8 echo_atten;
__u8 chorus_spread;
__u8 trnsps;
__u8 fix_dur;
__u8 modes;
__u8 fix_key;
} fm_xinstrument_t;
#ifdef __KERNEL__
#include "seq_instr.h"
extern char *snd_seq_fm_id;
int snd_seq_fm_init(snd_seq_kinstr_ops_t * ops,
snd_seq_kinstr_ops_t * next);
#endif
#endif /* __SOUND_AINSTR_FM_H */

227
include/sound/ainstr_gf1.h Normal file
View file

@ -0,0 +1,227 @@
/*
* Advanced Linux Sound Architecture
*
* GF1 (GUS) Patch Instrument Format
* Copyright (c) 1994-99 by Jaroslav Kysela <perex@suse.cz>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __SOUND_AINSTR_GF1_H
#define __SOUND_AINSTR_GF1_H
#ifndef __KERNEL__
#include <asm/types.h>
#include <asm/byteorder.h>
#endif
/*
* share types (share ID 1)
*/
#define GF1_SHARE_FILE 0
/*
* wave formats
*/
#define GF1_WAVE_16BIT 0x0001 /* 16-bit wave */
#define GF1_WAVE_UNSIGNED 0x0002 /* unsigned wave */
#define GF1_WAVE_INVERT 0x0002 /* same as unsigned wave */
#define GF1_WAVE_BACKWARD 0x0004 /* backward mode (maybe used for reverb or ping-ping loop) */
#define GF1_WAVE_LOOP 0x0008 /* loop mode */
#define GF1_WAVE_BIDIR 0x0010 /* bidirectional mode */
#define GF1_WAVE_STEREO 0x0100 /* stereo mode */
#define GF1_WAVE_ULAW 0x0200 /* uLaw compression mode */
/*
* Wavetable definitions
*/
typedef struct gf1_wave {
unsigned int share_id[4]; /* share id - zero = no sharing */
unsigned int format; /* wave format */
struct {
unsigned int number; /* some other ID for this instrument */
unsigned int memory; /* begin of waveform in onboard memory */
unsigned char *ptr; /* pointer to waveform in system memory */
} address;
unsigned int size; /* size of waveform in samples */
unsigned int start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
unsigned int loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
unsigned int loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
unsigned short loop_repeat; /* loop repeat - 0 = forever */
unsigned char flags; /* GF1 patch flags */
unsigned char pad;
unsigned int sample_rate; /* sample rate in Hz */
unsigned int low_frequency; /* low frequency range */
unsigned int high_frequency; /* high frequency range */
unsigned int root_frequency; /* root frequency range */
signed short tune;
unsigned char balance;
unsigned char envelope_rate[6];
unsigned char envelope_offset[6];
unsigned char tremolo_sweep;
unsigned char tremolo_rate;
unsigned char tremolo_depth;
unsigned char vibrato_sweep;
unsigned char vibrato_rate;
unsigned char vibrato_depth;
unsigned short scale_frequency;
unsigned short scale_factor; /* 0-2048 or 0-2 */
struct gf1_wave *next;
} gf1_wave_t;
/*
* Instrument
*/
#define IWFFFF_EXCLUDE_NONE 0x0000 /* exclusion mode - none */
#define IWFFFF_EXCLUDE_SINGLE 0x0001 /* exclude single - single note from the instrument group */
#define IWFFFF_EXCLUDE_MULTIPLE 0x0002 /* exclude multiple - stop only same note from this instrument */
#define IWFFFF_EFFECT_NONE 0
#define IWFFFF_EFFECT_REVERB 1
#define IWFFFF_EFFECT_CHORUS 2
#define IWFFFF_EFFECT_ECHO 3
typedef struct {
unsigned short exclusion;
unsigned short exclusion_group; /* 0 - none, 1-65535 */
unsigned char effect1; /* effect 1 */
unsigned char effect1_depth; /* 0-127 */
unsigned char effect2; /* effect 2 */
unsigned char effect2_depth; /* 0-127 */
gf1_wave_t *wave; /* first waveform */
} gf1_instrument_t;
/*
*
* Kernel <-> user space
* Hardware (CPU) independent section
*
* * = zero or more
* + = one or more
*
* gf1_xinstrument IWFFFF_STRU_INSTR
* +gf1_xwave IWFFFF_STRU_WAVE
*
*/
#define GF1_STRU_WAVE __cpu_to_be32(('W'<<24)|('A'<<16)|('V'<<8)|'E')
#define GF1_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
/*
* Wavetable definitions
*/
typedef struct gf1_xwave {
__u32 stype; /* structure type */
__u32 share_id[4]; /* share id - zero = no sharing */
__u32 format; /* wave format */
__u32 size; /* size of waveform in samples */
__u32 start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
__u32 loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
__u32 loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
__u16 loop_repeat; /* loop repeat - 0 = forever */
__u8 flags; /* GF1 patch flags */
__u8 pad;
__u32 sample_rate; /* sample rate in Hz */
__u32 low_frequency; /* low frequency range */
__u32 high_frequency; /* high frequency range */
__u32 root_frequency; /* root frequency range */
__s16 tune;
__u8 balance;
__u8 envelope_rate[6];
__u8 envelope_offset[6];
__u8 tremolo_sweep;
__u8 tremolo_rate;
__u8 tremolo_depth;
__u8 vibrato_sweep;
__u8 vibrato_rate;
__u8 vibrato_depth;
__u16 scale_frequency;
__u16 scale_factor; /* 0-2048 or 0-2 */
} gf1_xwave_t;
/*
* Instrument
*/
typedef struct gf1_xinstrument {
__u32 stype;
__u16 exclusion;
__u16 exclusion_group; /* 0 - none, 1-65535 */
__u8 effect1; /* effect 1 */
__u8 effect1_depth; /* 0-127 */
__u8 effect2; /* effect 2 */
__u8 effect2_depth; /* 0-127 */
} gf1_xinstrument_t;
/*
* Instrument info
*/
#define GF1_INFO_ENVELOPE (1<<0)
#define GF1_INFO_TREMOLO (1<<1)
#define GF1_INFO_VIBRATO (1<<2)
typedef struct gf1_info {
unsigned char flags; /* supported wave flags */
unsigned char pad[3];
unsigned int features; /* supported features */
unsigned int max8_len; /* maximum 8-bit wave length */
unsigned int max16_len; /* maximum 16-bit wave length */
} gf1_info_t;
#ifdef __KERNEL__
#include "seq_instr.h"
extern char *snd_seq_gf1_id;
typedef struct {
void *private_data;
int (*info)(void *private_data, gf1_info_t *info);
int (*put_sample)(void *private_data, gf1_wave_t *wave,
char *data, long len, int atomic);
int (*get_sample)(void *private_data, gf1_wave_t *wave,
char *data, long len, int atomic);
int (*remove_sample)(void *private_data, gf1_wave_t *wave,
int atomic);
void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what);
snd_seq_kinstr_ops_t kops;
} snd_gf1_ops_t;
int snd_seq_gf1_init(snd_gf1_ops_t *ops,
void *private_data,
snd_seq_kinstr_ops_t *next);
#endif
#endif /* __SOUND_AINSTR_GF1_H */

375
include/sound/ainstr_iw.h Normal file
View file

@ -0,0 +1,375 @@
/*
* Advanced Linux Sound Architecture
*
* InterWave FFFF Instrument Format
* Copyright (c) 1994-99 by Jaroslav Kysela <perex@suse.cz>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __SOUND_AINSTR_IW_H
#define __SOUND_AINSTR_IW_H
#ifndef __KERNEL__
#include <asm/types.h>
#include <asm/byteorder.h>
#endif
/*
* share types (share ID 1)
*/
#define IWFFFF_SHARE_FILE 0
/*
* wave formats
*/
#define IWFFFF_WAVE_16BIT 0x0001 /* 16-bit wave */
#define IWFFFF_WAVE_UNSIGNED 0x0002 /* unsigned wave */
#define IWFFFF_WAVE_INVERT 0x0002 /* same as unsigned wave */
#define IWFFFF_WAVE_BACKWARD 0x0004 /* backward mode (maybe used for reverb or ping-ping loop) */
#define IWFFFF_WAVE_LOOP 0x0008 /* loop mode */
#define IWFFFF_WAVE_BIDIR 0x0010 /* bidirectional mode */
#define IWFFFF_WAVE_ULAW 0x0020 /* uLaw compressed wave */
#define IWFFFF_WAVE_RAM 0x0040 /* wave is _preloaded_ in RAM (it is used for ROM simulation) */
#define IWFFFF_WAVE_ROM 0x0080 /* wave is in ROM */
#define IWFFFF_WAVE_STEREO 0x0100 /* wave is stereo */
/*
* Wavetable definitions
*/
typedef struct iwffff_wave {
unsigned int share_id[4]; /* share id - zero = no sharing */
unsigned int format; /* wave format */
struct {
unsigned int number; /* some other ID for this wave */
unsigned int memory; /* begin of waveform in onboard memory */
unsigned char *ptr; /* pointer to waveform in system memory */
} address;
unsigned int size; /* size of waveform in samples */
unsigned int start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
unsigned int loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
unsigned int loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
unsigned short loop_repeat; /* loop repeat - 0 = forever */
unsigned int sample_ratio; /* sample ratio (44100 * 1024 / rate) */
unsigned char attenuation; /* 0 - 127 (no corresponding midi controller) */
unsigned char low_note; /* lower frequency range for this waveform */
unsigned char high_note; /* higher frequency range for this waveform */
unsigned char pad;
struct iwffff_wave *next;
} iwffff_wave_t;
/*
* Layer
*/
#define IWFFFF_LFO_SHAPE_TRIANGLE 0
#define IWFFFF_LFO_SHAPE_POSTRIANGLE 1
typedef struct iwffff_lfo {
unsigned short freq; /* (0-2047) 0.01Hz - 21.5Hz */
signed short depth; /* volume +- (0-255) 0.48675dB/step */
signed short sweep; /* 0 - 950 deciseconds */
unsigned char shape; /* see to IWFFFF_LFO_SHAPE_XXXX */
unsigned char delay; /* 0 - 255 deciseconds */
} iwffff_lfo_t;
#define IWFFFF_ENV_FLAG_RETRIGGER 0x0001 /* flag - retrigger */
#define IWFFFF_ENV_MODE_ONE_SHOT 0x0001 /* mode - one shot */
#define IWFFFF_ENV_MODE_SUSTAIN 0x0002 /* mode - sustain */
#define IWFFFF_ENV_MODE_NO_SUSTAIN 0x0003 /* mode - no sustain */
#define IWFFFF_ENV_INDEX_VELOCITY 0x0001 /* index - velocity */
#define IWFFFF_ENV_INDEX_FREQUENCY 0x0002 /* index - frequency */
typedef struct iwffff_env_point {
unsigned short offset;
unsigned short rate;
} iwffff_env_point_t;
typedef struct iwffff_env_record {
unsigned short nattack;
unsigned short nrelease;
unsigned short sustain_offset;
unsigned short sustain_rate;
unsigned short release_rate;
unsigned char hirange;
unsigned char pad;
struct iwffff_env_record *next;
/* points are stored here */
/* count of points = nattack + nrelease */
} iwffff_env_record_t;
typedef struct iwffff_env {
unsigned char flags;
unsigned char mode;
unsigned char index;
unsigned char pad;
struct iwffff_env_record *record;
} iwffff_env_t;
#define IWFFFF_LAYER_FLAG_RETRIGGER 0x0001 /* retrigger */
#define IWFFFF_LAYER_VELOCITY_TIME 0x0000 /* velocity mode = time */
#define IWFFFF_LAYER_VELOCITY_RATE 0x0001 /* velocity mode = rate */
#define IWFFFF_LAYER_EVENT_KUP 0x0000 /* layer event - key up */
#define IWFFFF_LAYER_EVENT_KDOWN 0x0001 /* layer event - key down */
#define IWFFFF_LAYER_EVENT_RETRIG 0x0002 /* layer event - retrigger */
#define IWFFFF_LAYER_EVENT_LEGATO 0x0003 /* layer event - legato */
typedef struct iwffff_layer {
unsigned char flags;
unsigned char velocity_mode;
unsigned char layer_event;
unsigned char low_range; /* range for layer based */
unsigned char high_range; /* on either velocity or frequency */
unsigned char pan; /* pan offset from CC1 (0 left - 127 right) */
unsigned char pan_freq_scale; /* position based on frequency (0-127) */
unsigned char attenuation; /* 0-127 (no corresponding midi controller) */
iwffff_lfo_t tremolo; /* tremolo effect */
iwffff_lfo_t vibrato; /* vibrato effect */
unsigned short freq_scale; /* 0-2048, 1024 is equal to semitone scaling */
unsigned char freq_center; /* center for keyboard frequency scaling */
unsigned char pad;
iwffff_env_t penv; /* pitch envelope */
iwffff_env_t venv; /* volume envelope */
iwffff_wave_t *wave;
struct iwffff_layer *next;
} iwffff_layer_t;
/*
* Instrument
*/
#define IWFFFF_EXCLUDE_NONE 0x0000 /* exclusion mode - none */
#define IWFFFF_EXCLUDE_SINGLE 0x0001 /* exclude single - single note from the instrument group */
#define IWFFFF_EXCLUDE_MULTIPLE 0x0002 /* exclude multiple - stop only same note from this instrument */
#define IWFFFF_LAYER_NONE 0x0000 /* not layered */
#define IWFFFF_LAYER_ON 0x0001 /* layered */
#define IWFFFF_LAYER_VELOCITY 0x0002 /* layered by velocity */
#define IWFFFF_LAYER_FREQUENCY 0x0003 /* layered by frequency */
#define IWFFFF_EFFECT_NONE 0
#define IWFFFF_EFFECT_REVERB 1
#define IWFFFF_EFFECT_CHORUS 2
#define IWFFFF_EFFECT_ECHO 3
typedef struct {
unsigned short exclusion;
unsigned short layer_type;
unsigned short exclusion_group; /* 0 - none, 1-65535 */
unsigned char effect1; /* effect 1 */
unsigned char effect1_depth; /* 0-127 */
unsigned char effect2; /* effect 2 */
unsigned char effect2_depth; /* 0-127 */
iwffff_layer_t *layer; /* first layer */
} iwffff_instrument_t;
/*
*
* Kernel <-> user space
* Hardware (CPU) independent section
*
* * = zero or more
* + = one or more
*
* iwffff_xinstrument IWFFFF_STRU_INSTR
* +iwffff_xlayer IWFFFF_STRU_LAYER
* *iwffff_xenv_record IWFFFF_STRU_ENV_RECT (tremolo)
* *iwffff_xenv_record IWFFFF_STRU_EVN_RECT (vibrato)
* +iwffff_xwave IWFFFF_STRU_WAVE
*
*/
#define IWFFFF_STRU_WAVE __cpu_to_be32(('W'<<24)|('A'<<16)|('V'<<8)|'E')
#define IWFFFF_STRU_ENV_RECP __cpu_to_be32(('E'<<24)|('N'<<16)|('R'<<8)|'P')
#define IWFFFF_STRU_ENV_RECV __cpu_to_be32(('E'<<24)|('N'<<16)|('R'<<8)|'V')
#define IWFFFF_STRU_LAYER __cpu_to_be32(('L'<<24)|('A'<<16)|('Y'<<8)|'R')
#define IWFFFF_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
/*
* Wavetable definitions
*/
typedef struct iwffff_xwave {
__u32 stype; /* structure type */
__u32 share_id[4]; /* share id - zero = no sharing */
__u32 format; /* wave format */
__u32 offset; /* offset to ROM (address) */
__u32 size; /* size of waveform in samples */
__u32 start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
__u32 loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
__u32 loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
__u16 loop_repeat; /* loop repeat - 0 = forever */
__u32 sample_ratio; /* sample ratio (44100 * 1024 / rate) */
__u8 attenuation; /* 0 - 127 (no corresponding midi controller) */
__u8 low_note; /* lower frequency range for this waveform */
__u8 high_note; /* higher frequency range for this waveform */
__u8 pad;
} iwffff_xwave_t;
/*
* Layer
*/
typedef struct iwffff_xlfo {
__u16 freq; /* (0-2047) 0.01Hz - 21.5Hz */
__s16 depth; /* volume +- (0-255) 0.48675dB/step */
__s16 sweep; /* 0 - 950 deciseconds */
__u8 shape; /* see to ULTRA_IW_LFO_SHAPE_XXXX */
__u8 delay; /* 0 - 255 deciseconds */
} iwffff_xlfo_t;
typedef struct iwffff_xenv_point {
__u16 offset;
__u16 rate;
} iwffff_xenv_point_t;
typedef struct iwffff_xenv_record {
__u32 stype;
__u16 nattack;
__u16 nrelease;
__u16 sustain_offset;
__u16 sustain_rate;
__u16 release_rate;
__u8 hirange;
__u8 pad;
/* points are stored here.. */
/* count of points = nattack + nrelease */
} iwffff_xenv_record_t;
typedef struct iwffff_xenv {
__u8 flags;
__u8 mode;
__u8 index;
__u8 pad;
} iwffff_xenv_t;
typedef struct iwffff_xlayer {
__u32 stype;
__u8 flags;
__u8 velocity_mode;
__u8 layer_event;
__u8 low_range; /* range for layer based */
__u8 high_range; /* on either velocity or frequency */
__u8 pan; /* pan offset from CC1 (0 left - 127 right) */
__u8 pan_freq_scale; /* position based on frequency (0-127) */
__u8 attenuation; /* 0-127 (no corresponding midi controller) */
iwffff_xlfo_t tremolo; /* tremolo effect */
iwffff_xlfo_t vibrato; /* vibrato effect */
__u16 freq_scale; /* 0-2048, 1024 is equal to semitone scaling */
__u8 freq_center; /* center for keyboard frequency scaling */
__u8 pad;
iwffff_xenv_t penv; /* pitch envelope */
iwffff_xenv_t venv; /* volume envelope */
} iwffff_xlayer_t;
/*
* Instrument
*/
typedef struct iwffff_xinstrument {
__u32 stype;
__u16 exclusion;
__u16 layer_type;
__u16 exclusion_group; /* 0 - none, 1-65535 */
__u8 effect1; /* effect 1 */
__u8 effect1_depth; /* 0-127 */
__u8 effect2; /* effect 2 */
__u8 effect2_depth; /* 0-127 */
} iwffff_xinstrument_t;
/*
* ROM support
* InterWave ROMs are Little-Endian (x86)
*/
#define IWFFFF_ROM_HDR_SIZE 512
typedef struct {
__u8 iwave[8];
__u8 revision;
__u8 series_number;
__u8 series_name[16];
__u8 date[10];
__u16 vendor_revision_major;
__u16 vendor_revision_minor;
__u32 rom_size;
__u8 copyright[128];
__u8 vendor_name[64];
__u8 description[128];
} iwffff_rom_header_t;
/*
* Instrument info
*/
#define IWFFFF_INFO_LFO_VIBRATO (1<<0)
#define IWFFFF_INFO_LFO_VIBRATO_SHAPE (1<<1)
#define IWFFFF_INFO_LFO_TREMOLO (1<<2)
#define IWFFFF_INFO_LFO_TREMOLO_SHAPE (1<<3)
typedef struct iwffff_info {
unsigned int format; /* supported format bits */
unsigned int effects; /* supported effects (1 << IWFFFF_EFFECT*) */
unsigned int lfos; /* LFO effects */
unsigned int max8_len; /* maximum 8-bit wave length */
unsigned int max16_len; /* maximum 16-bit wave length */
} iwffff_info_t;
#ifdef __KERNEL__
#include "seq_instr.h"
extern char *snd_seq_iwffff_id;
typedef struct {
void *private_data;
int (*info)(void *private_data, iwffff_info_t *info);
int (*put_sample)(void *private_data, iwffff_wave_t *wave,
char *data, long len, int atomic);
int (*get_sample)(void *private_data, iwffff_wave_t *wave,
char *data, long len, int atomic);
int (*remove_sample)(void *private_data, iwffff_wave_t *wave,
int atomic);
void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what);
snd_seq_kinstr_ops_t kops;
} snd_iwffff_ops_t;
int snd_seq_iwffff_init(snd_iwffff_ops_t *ops,
void *private_data,
snd_seq_kinstr_ops_t *next);
#endif
#endif /* __SOUND_AINSTR_IW_H */

View file

@ -0,0 +1,158 @@
/*
* Advanced Linux Sound Architecture
*
* Simple (MOD player) Instrument Format
* Copyright (c) 1994-99 by Jaroslav Kysela <perex@suse.cz>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __SOUND_AINSTR_SIMPLE_H
#define __SOUND_AINSTR_SIMPLE_H
#ifndef __KERNEL__
#include <asm/types.h>
#include <asm/byteorder.h>
#endif
/*
* share types (share ID 1)
*/
#define SIMPLE_SHARE_FILE 0
/*
* wave formats
*/
#define SIMPLE_WAVE_16BIT 0x0001 /* 16-bit wave */
#define SIMPLE_WAVE_UNSIGNED 0x0002 /* unsigned wave */
#define SIMPLE_WAVE_INVERT 0x0002 /* same as unsigned wave */
#define SIMPLE_WAVE_BACKWARD 0x0004 /* backward mode (maybe used for reverb or ping-ping loop) */
#define SIMPLE_WAVE_LOOP 0x0008 /* loop mode */
#define SIMPLE_WAVE_BIDIR 0x0010 /* bidirectional mode */
#define SIMPLE_WAVE_STEREO 0x0100 /* stereo wave */
#define SIMPLE_WAVE_ULAW 0x0200 /* uLaw compression mode */
/*
* instrument effects
*/
#define SIMPLE_EFFECT_NONE 0
#define SIMPLE_EFFECT_REVERB 1
#define SIMPLE_EFFECT_CHORUS 2
#define SIMPLE_EFFECT_ECHO 3
/*
* instrument info
*/
typedef struct simple_instrument_info {
unsigned int format; /* supported format bits */
unsigned int effects; /* supported effects (1 << SIMPLE_EFFECT_*) */
unsigned int max8_len; /* maximum 8-bit wave length */
unsigned int max16_len; /* maximum 16-bit wave length */
} simple_instrument_info_t;
/*
* Instrument
*/
typedef struct {
unsigned int share_id[4]; /* share id - zero = no sharing */
unsigned int format; /* wave format */
struct {
unsigned int number; /* some other ID for this instrument */
unsigned int memory; /* begin of waveform in onboard memory */
unsigned char *ptr; /* pointer to waveform in system memory */
} address;
unsigned int size; /* size of waveform in samples */
unsigned int start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
unsigned int loop_start; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
unsigned int loop_end; /* loop end offset in samples * 16 (lowest 4 bits - fraction) */
unsigned short loop_repeat; /* loop repeat - 0 = forever */
unsigned char effect1; /* effect 1 */
unsigned char effect1_depth; /* 0-127 */
unsigned char effect2; /* effect 2 */
unsigned char effect2_depth; /* 0-127 */
} simple_instrument_t;
/*
*
* Kernel <-> user space
* Hardware (CPU) independent section
*
* * = zero or more
* + = one or more
*
* simple_xinstrument SIMPLE_STRU_INSTR
*
*/
#define SIMPLE_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
/*
* Instrument
*/
typedef struct simple_xinstrument {
__u32 stype;
__u32 share_id[4]; /* share id - zero = no sharing */
__u32 format; /* wave format */
__u32 size; /* size of waveform in samples */
__u32 start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
__u32 loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
__u32 loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
__u16 loop_repeat; /* loop repeat - 0 = forever */
__u8 effect1; /* effect 1 */
__u8 effect1_depth; /* 0-127 */
__u8 effect2; /* effect 2 */
__u8 effect2_depth; /* 0-127 */
} simple_xinstrument_t;
#ifdef __KERNEL__
#include "seq_instr.h"
extern char *snd_seq_simple_id;
typedef struct {
void *private_data;
int (*info)(void *private_data, simple_instrument_info_t *info);
int (*put_sample)(void *private_data, simple_instrument_t *instr,
char *data, long len, int atomic);
int (*get_sample)(void *private_data, simple_instrument_t *instr,
char *data, long len, int atomic);
int (*remove_sample)(void *private_data, simple_instrument_t *instr,
int atomic);
void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what);
snd_seq_kinstr_ops_t kops;
} snd_simple_ops_t;
int snd_seq_simple_init(snd_simple_ops_t *ops,
void *private_data,
snd_seq_kinstr_ops_t *next);
#endif
#endif /* __SOUND_AINSTR_SIMPLE_H */

904
include/sound/asequencer.h Normal file
View file

@ -0,0 +1,904 @@
/*
* Main header file for the ALSA sequencer
* Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@home.nl>
* (c) 1998-1999 by Jaroslav Kysela <perex@suse.cz>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __SOUND_ASEQUENCER_H
#define __SOUND_ASEQUENCER_H
#ifndef __KERNEL__
#include <linux/ioctl.h>
#endif
#include <sound/asound.h>
/** version of the sequencer */
#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 0)
/**
* definition of sequencer event types
*/
/** system messages
* event data type = #sndrv_seq_result_t
*/
#define SNDRV_SEQ_EVENT_SYSTEM 0
#define SNDRV_SEQ_EVENT_RESULT 1
/** note messages (channel specific)
* event data type = #sndrv_seq_ev_note
*/
#define SNDRV_SEQ_EVENT_NOTE 5
#define SNDRV_SEQ_EVENT_NOTEON 6
#define SNDRV_SEQ_EVENT_NOTEOFF 7
#define SNDRV_SEQ_EVENT_KEYPRESS 8
/** control messages (channel specific)
* event data type = #sndrv_seq_ev_ctrl
*/
#define SNDRV_SEQ_EVENT_CONTROLLER 10
#define SNDRV_SEQ_EVENT_PGMCHANGE 11
#define SNDRV_SEQ_EVENT_CHANPRESS 12
#define SNDRV_SEQ_EVENT_PITCHBEND 13 /**< from -8192 to 8191 */
#define SNDRV_SEQ_EVENT_CONTROL14 14 /**< 14 bit controller value */
#define SNDRV_SEQ_EVENT_NONREGPARAM 15 /**< 14 bit NRPN */
#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN */
/** synchronisation messages
* event data type = #sndrv_seq_ev_ctrl
*/
#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */
#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */
#define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */
#define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */
#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */
/** timer messages
* event data type = sndrv_seq_ev_queue_control_t
*/
#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */
#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */
#define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */
#define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */
#define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */
#define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */
#define SNDRV_SEQ_EVENT_CLOCK 36 /* midi Real Time Clock message */
#define SNDRV_SEQ_EVENT_TICK 37 /* midi Real Time Tick message */
#define SNDRV_SEQ_EVENT_QUEUE_SKEW 38 /* skew queue tempo */
/** others
* event data type = none
*/
#define SNDRV_SEQ_EVENT_TUNE_REQUEST 40 /* tune request */
#define SNDRV_SEQ_EVENT_RESET 41 /* reset to power-on state */
#define SNDRV_SEQ_EVENT_SENSING 42 /* "active sensing" event */
/** echo back, kernel private messages
* event data type = any type
*/
#define SNDRV_SEQ_EVENT_ECHO 50 /* echo event */
#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */
/** system status messages (broadcast for subscribers)
* event data type = sndrv_seq_addr_t
*/
#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */
#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */
#define SNDRV_SEQ_EVENT_CLIENT_CHANGE 62 /* client status/info has changed */
#define SNDRV_SEQ_EVENT_PORT_START 63 /* new port was created */
#define SNDRV_SEQ_EVENT_PORT_EXIT 64 /* port was deleted from system */
#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */
/** port connection changes
* event data type = sndrv_seq_connect_t
*/
#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */
#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */
/** synthesizer events
* event data type = sndrv_seq_eve_sample_control_t
*/
#define SNDRV_SEQ_EVENT_SAMPLE 70 /* sample select */
#define SNDRV_SEQ_EVENT_SAMPLE_CLUSTER 71 /* sample cluster select */
#define SNDRV_SEQ_EVENT_SAMPLE_START 72 /* voice start */
#define SNDRV_SEQ_EVENT_SAMPLE_STOP 73 /* voice stop */
#define SNDRV_SEQ_EVENT_SAMPLE_FREQ 74 /* playback frequency */
#define SNDRV_SEQ_EVENT_SAMPLE_VOLUME 75 /* volume and balance */
#define SNDRV_SEQ_EVENT_SAMPLE_LOOP 76 /* sample loop */
#define SNDRV_SEQ_EVENT_SAMPLE_POSITION 77 /* sample position */
#define SNDRV_SEQ_EVENT_SAMPLE_PRIVATE1 78 /* private (hardware dependent) event */
/** user-defined events with fixed length
* event data type = any
*/
#define SNDRV_SEQ_EVENT_USR0 90
#define SNDRV_SEQ_EVENT_USR1 91
#define SNDRV_SEQ_EVENT_USR2 92
#define SNDRV_SEQ_EVENT_USR3 93
#define SNDRV_SEQ_EVENT_USR4 94
#define SNDRV_SEQ_EVENT_USR5 95
#define SNDRV_SEQ_EVENT_USR6 96
#define SNDRV_SEQ_EVENT_USR7 97
#define SNDRV_SEQ_EVENT_USR8 98
#define SNDRV_SEQ_EVENT_USR9 99
/** instrument layer
* variable length data can be passed directly to the driver
*/
#define SNDRV_SEQ_EVENT_INSTR_BEGIN 100 /* begin of instrument management */
#define SNDRV_SEQ_EVENT_INSTR_END 101 /* end of instrument management */
#define SNDRV_SEQ_EVENT_INSTR_INFO 102 /* instrument interface info */
#define SNDRV_SEQ_EVENT_INSTR_INFO_RESULT 103 /* result */
#define SNDRV_SEQ_EVENT_INSTR_FINFO 104 /* get format info */
#define SNDRV_SEQ_EVENT_INSTR_FINFO_RESULT 105 /* get format info */
#define SNDRV_SEQ_EVENT_INSTR_RESET 106 /* reset instrument memory */
#define SNDRV_SEQ_EVENT_INSTR_STATUS 107 /* instrument interface status */
#define SNDRV_SEQ_EVENT_INSTR_STATUS_RESULT 108 /* result */
#define SNDRV_SEQ_EVENT_INSTR_PUT 109 /* put instrument to port */
#define SNDRV_SEQ_EVENT_INSTR_GET 110 /* get instrument from port */
#define SNDRV_SEQ_EVENT_INSTR_GET_RESULT 111 /* result */
#define SNDRV_SEQ_EVENT_INSTR_FREE 112 /* free instrument(s) */
#define SNDRV_SEQ_EVENT_INSTR_LIST 113 /* instrument list */
#define SNDRV_SEQ_EVENT_INSTR_LIST_RESULT 114 /* result */
#define SNDRV_SEQ_EVENT_INSTR_CLUSTER 115 /* cluster parameters */
#define SNDRV_SEQ_EVENT_INSTR_CLUSTER_GET 116 /* get cluster parameters */
#define SNDRV_SEQ_EVENT_INSTR_CLUSTER_RESULT 117 /* result */
#define SNDRV_SEQ_EVENT_INSTR_CHANGE 118 /* instrument change */
/* 119-129: reserved */
/* 130-139: variable length events
* event data type = sndrv_seq_ev_ext
* (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set)
*/
#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */
#define SNDRV_SEQ_EVENT_BOUNCE 131 /* error event */
/* 132-134: reserved */
#define SNDRV_SEQ_EVENT_USR_VAR0 135
#define SNDRV_SEQ_EVENT_USR_VAR1 136
#define SNDRV_SEQ_EVENT_USR_VAR2 137
#define SNDRV_SEQ_EVENT_USR_VAR3 138
#define SNDRV_SEQ_EVENT_USR_VAR4 139
/* 150-151: kernel events with quote - DO NOT use in user clients */
#define SNDRV_SEQ_EVENT_KERNEL_ERROR 150
#define SNDRV_SEQ_EVENT_KERNEL_QUOTE 151
/* 152-191: reserved */
/* 192-254: hardware specific events */
/* 255: special event */
#define SNDRV_SEQ_EVENT_NONE 255
typedef unsigned char sndrv_seq_event_type_t;
/** event address */
struct sndrv_seq_addr {
unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */
unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */
};
/** port connection */
struct sndrv_seq_connect {
struct sndrv_seq_addr sender;
struct sndrv_seq_addr dest;
};
#define SNDRV_SEQ_ADDRESS_UNKNOWN 253 /* unknown source */
#define SNDRV_SEQ_ADDRESS_SUBSCRIBERS 254 /* send event to all subscribed ports */
#define SNDRV_SEQ_ADDRESS_BROADCAST 255 /* send event to all queues/clients/ports/channels */
#define SNDRV_SEQ_QUEUE_DIRECT 253 /* direct dispatch */
/* event mode flag - NOTE: only 8 bits available! */
#define SNDRV_SEQ_TIME_STAMP_TICK (0<<0) /* timestamp in clock ticks */
#define SNDRV_SEQ_TIME_STAMP_REAL (1<<0) /* timestamp in real time */
#define SNDRV_SEQ_TIME_STAMP_MASK (1<<0)
#define SNDRV_SEQ_TIME_MODE_ABS (0<<1) /* absolute timestamp */
#define SNDRV_SEQ_TIME_MODE_REL (1<<1) /* relative to current time */
#define SNDRV_SEQ_TIME_MODE_MASK (1<<1)
#define SNDRV_SEQ_EVENT_LENGTH_FIXED (0<<2) /* fixed event size */
#define SNDRV_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /* variable event size */
#define SNDRV_SEQ_EVENT_LENGTH_VARUSR (2<<2) /* variable event size - user memory space */
#define SNDRV_SEQ_EVENT_LENGTH_MASK (3<<2)
#define SNDRV_SEQ_PRIORITY_NORMAL (0<<4) /* normal priority */
#define SNDRV_SEQ_PRIORITY_HIGH (1<<4) /* event should be processed before others */
#define SNDRV_SEQ_PRIORITY_MASK (1<<4)
/* note event */
struct sndrv_seq_ev_note {
unsigned char channel;
unsigned char note;
unsigned char velocity;
unsigned char off_velocity; /* only for SNDRV_SEQ_EVENT_NOTE */
unsigned int duration; /* only for SNDRV_SEQ_EVENT_NOTE */
};
/* controller event */
struct sndrv_seq_ev_ctrl {
unsigned char channel;
unsigned char unused1, unused2, unused3; /* pad */
unsigned int param;
signed int value;
};
/* generic set of bytes (12x8 bit) */
struct sndrv_seq_ev_raw8 {
unsigned char d[12]; /* 8 bit value */
};
/* generic set of integers (3x32 bit) */
struct sndrv_seq_ev_raw32 {
unsigned int d[3]; /* 32 bit value */
};
/* external stored data */
struct sndrv_seq_ev_ext {
unsigned int len; /* length of data */
void *ptr; /* pointer to data (note: maybe 64-bit) */
} __attribute__((packed));
/* Instrument cluster type */
typedef unsigned int sndrv_seq_instr_cluster_t;
/* Instrument type */
struct sndrv_seq_instr {
sndrv_seq_instr_cluster_t cluster;
unsigned int std; /* the upper byte means a private instrument (owner - client #) */
unsigned short bank;
unsigned short prg;
};
/* sample number */
struct sndrv_seq_ev_sample {
unsigned int std;
unsigned short bank;
unsigned short prg;
};
/* sample cluster */
struct sndrv_seq_ev_cluster {
sndrv_seq_instr_cluster_t cluster;
};
/* sample position */
typedef unsigned int sndrv_seq_position_t; /* playback position (in samples) * 16 */
/* sample stop mode */
enum sndrv_seq_stop_mode {
SAMPLE_STOP_IMMEDIATELY = 0, /* terminate playing immediately */
SAMPLE_STOP_VENVELOPE = 1, /* finish volume envelope */
SAMPLE_STOP_LOOP = 2 /* terminate loop and finish wave */
};
/* sample frequency */
typedef int sndrv_seq_frequency_t; /* playback frequency in HZ * 16 */
/* sample volume control; if any value is set to -1 == do not change */
struct sndrv_seq_ev_volume {
signed short volume; /* range: 0-16383 */
signed short lr; /* left-right balance; range: 0-16383 */
signed short fr; /* front-rear balance; range: 0-16383 */
signed short du; /* down-up balance; range: 0-16383 */
};
/* simple loop redefinition */
struct sndrv_seq_ev_loop {
unsigned int start; /* loop start (in samples) * 16 */
unsigned int end; /* loop end (in samples) * 16 */
};
struct sndrv_seq_ev_sample_control {
unsigned char channel;
unsigned char unused1, unused2, unused3; /* pad */
union {
struct sndrv_seq_ev_sample sample;
struct sndrv_seq_ev_cluster cluster;
sndrv_seq_position_t position;
enum sndrv_seq_stop_mode stop_mode;
sndrv_seq_frequency_t frequency;
struct sndrv_seq_ev_volume volume;
struct sndrv_seq_ev_loop loop;
unsigned char raw8[8];
} param;
};
/* INSTR_BEGIN event */
struct sndrv_seq_ev_instr_begin {
int timeout; /* zero = forever, otherwise timeout in ms */
};
struct sndrv_seq_result {
int event; /* processed event type */
int result;
};
struct sndrv_seq_real_time {
unsigned int tv_sec; /* seconds */
unsigned int tv_nsec; /* nanoseconds */
};
typedef unsigned int sndrv_seq_tick_time_t; /* midi ticks */
union sndrv_seq_timestamp {
sndrv_seq_tick_time_t tick;
struct sndrv_seq_real_time time;
};
struct sndrv_seq_queue_skew {
unsigned int value;
unsigned int base;
};
/* queue timer control */
struct sndrv_seq_ev_queue_control {
unsigned char queue; /* affected queue */
unsigned char pad[3]; /* reserved */
union {
signed int value; /* affected value (e.g. tempo) */
union sndrv_seq_timestamp time; /* time */
unsigned int position; /* sync position */
struct sndrv_seq_queue_skew skew;
unsigned int d32[2];
unsigned char d8[8];
} param;
};
/* quoted event - inside the kernel only */
struct sndrv_seq_ev_quote {
struct sndrv_seq_addr origin; /* original sender */
unsigned short value; /* optional data */
struct sndrv_seq_event *event; /* quoted event */
} __attribute__((packed));
/* sequencer event */
struct sndrv_seq_event {
sndrv_seq_event_type_t type; /* event type */
unsigned char flags; /* event flags */
char tag;
unsigned char queue; /* schedule queue */
union sndrv_seq_timestamp time; /* schedule time */
struct sndrv_seq_addr source; /* source address */
struct sndrv_seq_addr dest; /* destination address */
union { /* event data... */
struct sndrv_seq_ev_note note;
struct sndrv_seq_ev_ctrl control;
struct sndrv_seq_ev_raw8 raw8;
struct sndrv_seq_ev_raw32 raw32;
struct sndrv_seq_ev_ext ext;
struct sndrv_seq_ev_queue_control queue;
union sndrv_seq_timestamp time;
struct sndrv_seq_addr addr;
struct sndrv_seq_connect connect;
struct sndrv_seq_result result;
struct sndrv_seq_ev_instr_begin instr_begin;
struct sndrv_seq_ev_sample_control sample;
struct sndrv_seq_ev_quote quote;
} data;
};
/*
* bounce event - stored as variable size data
*/
struct sndrv_seq_event_bounce {
int err;
struct sndrv_seq_event event;
/* external data follows here. */
};
#define sndrv_seq_event_bounce_ext_data(ev) ((void*)((char *)(ev)->data.ext.ptr + sizeof(sndrv_seq_event_bounce_t)))
/*
* type check macros
*/
/* result events: 0-4 */
#define sndrv_seq_ev_is_result_type(ev) ((ev)->type < 5)
/* channel specific events: 5-19 */
#define sndrv_seq_ev_is_channel_type(ev) ((ev)->type >= 5 && (ev)->type < 20)
/* note events: 5-9 */
#define sndrv_seq_ev_is_note_type(ev) ((ev)->type >= 5 && (ev)->type < 10)
/* control events: 10-19 */
#define sndrv_seq_ev_is_control_type(ev) ((ev)->type >= 10 && (ev)->type < 20)
/* queue control events: 30-39 */
#define sndrv_seq_ev_is_queue_type(ev) ((ev)->type >= 30 && (ev)->type < 40)
/* system status messages */
#define sndrv_seq_ev_is_message_type(ev) ((ev)->type >= 60 && (ev)->type < 69)
/* sample messages */
#define sndrv_seq_ev_is_sample_type(ev) ((ev)->type >= 70 && (ev)->type < 79)
/* user-defined messages */
#define sndrv_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99)
/* fixed length events: 0-99 */
#define sndrv_seq_ev_is_fixed_type(ev) ((ev)->type < 100)
/* instrument layer events: 100-129 */
#define sndrv_seq_ev_is_instr_type(ev) ((ev)->type >= 100 && (ev)->type < 130)
/* variable length events: 130-139 */
#define sndrv_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140)
/* reserved for kernel */
#define sndrv_seq_ev_is_reserved(ev) ((ev)->type >= 150)
/* direct dispatched events */
#define sndrv_seq_ev_is_direct(ev) ((ev)->queue == SNDRV_SEQ_QUEUE_DIRECT)
/*
* macros to check event flags
*/
/* prior events */
#define sndrv_seq_ev_is_prior(ev) (((ev)->flags & SNDRV_SEQ_PRIORITY_MASK) == SNDRV_SEQ_PRIORITY_HIGH)
/* event length type */
#define sndrv_seq_ev_length_type(ev) ((ev)->flags & SNDRV_SEQ_EVENT_LENGTH_MASK)
#define sndrv_seq_ev_is_fixed(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_FIXED)
#define sndrv_seq_ev_is_variable(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
#define sndrv_seq_ev_is_varusr(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARUSR)
/* time-stamp type */
#define sndrv_seq_ev_timestamp_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_STAMP_MASK)
#define sndrv_seq_ev_is_tick(ev) (sndrv_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_TICK)
#define sndrv_seq_ev_is_real(ev) (sndrv_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_REAL)
/* time-mode type */
#define sndrv_seq_ev_timemode_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_MODE_MASK)
#define sndrv_seq_ev_is_abstime(ev) (sndrv_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_ABS)
#define sndrv_seq_ev_is_reltime(ev) (sndrv_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_REL)
/* queue sync port */
#define sndrv_seq_queue_sync_port(q) ((q) + 16)
/* system information */
struct sndrv_seq_system_info {
int queues; /* maximum queues count */
int clients; /* maximum clients count */
int ports; /* maximum ports per client */
int channels; /* maximum channels per port */
int cur_clients; /* current clients */
int cur_queues; /* current queues */
char reserved[24];
};
/* system running information */
struct sndrv_seq_running_info {
unsigned char client; /* client id */
unsigned char big_endian; /* 1 = big-endian */
unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */
unsigned char pad; /* reserved */
unsigned char reserved[12];
};
/* known client numbers */
#define SNDRV_SEQ_CLIENT_SYSTEM 0
#define SNDRV_SEQ_CLIENT_DUMMY 62 /* dummy ports */
#define SNDRV_SEQ_CLIENT_OSS 63 /* oss sequencer emulator */
/* client types */
enum sndrv_seq_client_type {
NO_CLIENT = 0,
USER_CLIENT = 1,
KERNEL_CLIENT = 2
};
/* event filter flags */
#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */
#define SNDRV_SEQ_FILTER_MULTICAST (1<<1) /* accept multicast messages */
#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */
#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */
struct sndrv_seq_client_info {
int client; /* client number to inquire */
enum sndrv_seq_client_type type; /* client type */
char name[64]; /* client name */
unsigned int filter; /* filter flags */
unsigned char multicast_filter[8]; /* multicast filter bitmap */
unsigned char event_filter[32]; /* event filter bitmap */
int num_ports; /* RO: number of ports */
int event_lost; /* number of lost events */
char reserved[64]; /* for future use */
};
/* client pool size */
struct sndrv_seq_client_pool {
int client; /* client number to inquire */
int output_pool; /* outgoing (write) pool size */
int input_pool; /* incoming (read) pool size */
int output_room; /* minimum free pool size for select/blocking mode */
int output_free; /* unused size */
int input_free; /* unused size */
char reserved[64];
};
/* Remove events by specified criteria */
#define SNDRV_SEQ_REMOVE_INPUT (1<<0) /* Flush input queues */
#define SNDRV_SEQ_REMOVE_OUTPUT (1<<1) /* Flush output queues */
#define SNDRV_SEQ_REMOVE_DEST (1<<2) /* Restrict by destination q:client:port */
#define SNDRV_SEQ_REMOVE_DEST_CHANNEL (1<<3) /* Restrict by channel */
#define SNDRV_SEQ_REMOVE_TIME_BEFORE (1<<4) /* Restrict to before time */
#define SNDRV_SEQ_REMOVE_TIME_AFTER (1<<5) /* Restrict to time or after */
#define SNDRV_SEQ_REMOVE_TIME_TICK (1<<6) /* Time is in ticks */
#define SNDRV_SEQ_REMOVE_EVENT_TYPE (1<<7) /* Restrict to event type */
#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */
#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */
struct sndrv_seq_remove_events {
unsigned int remove_mode; /* Flags that determine what gets removed */
union sndrv_seq_timestamp time;
unsigned char queue; /* Queue for REMOVE_DEST */
struct sndrv_seq_addr dest; /* Address for REMOVE_DEST */
unsigned char channel; /* Channel for REMOVE_DEST */
int type; /* For REMOVE_EVENT_TYPE */
char tag; /* Tag for REMOVE_TAG */
int reserved[10]; /* To allow for future binary compatibility */
};
/* known port numbers */
#define SNDRV_SEQ_PORT_SYSTEM_TIMER 0
#define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1
/* port capabilities (32 bits) */
#define SNDRV_SEQ_PORT_CAP_READ (1<<0) /* readable from this port */
#define SNDRV_SEQ_PORT_CAP_WRITE (1<<1) /* writable to this port */
#define SNDRV_SEQ_PORT_CAP_SYNC_READ (1<<2)
#define SNDRV_SEQ_PORT_CAP_SYNC_WRITE (1<<3)
#define SNDRV_SEQ_PORT_CAP_DUPLEX (1<<4)
#define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5) /* allow read subscription */
#define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /* allow write subscription */
#define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7) /* routing not allowed */
/* port type */
#define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */
#define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /* generic MIDI device */
#define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2) /* General MIDI compatible device */
#define SNDRV_SEQ_PORT_TYPE_MIDI_GS (1<<3) /* GS compatible device */
#define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4) /* XG compatible device */
#define SNDRV_SEQ_PORT_TYPE_MIDI_MT32 (1<<5) /* MT-32 compatible device */
/* other standards...*/
#define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device */
#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */
#define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */
/*...*/
#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */
/* misc. conditioning flags */
#define SNDRV_SEQ_PORT_FLG_GIVEN_PORT (1<<0)
struct sndrv_seq_port_info {
struct sndrv_seq_addr addr; /* client/port numbers */
char name[64]; /* port name */
unsigned int capability; /* port capability bits */
unsigned int type; /* port type bits */
int midi_channels; /* channels per MIDI port */
int midi_voices; /* voices per MIDI port */
int synth_voices; /* voices per SYNTH port */
int read_use; /* R/O: subscribers for output (from this port) */
int write_use; /* R/O: subscribers for input (to this port) */
void *kernel; /* reserved for kernel use (must be NULL) */
unsigned int flags; /* misc. conditioning */
char reserved[60]; /* for future use */
};
/* queue flags */
#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */
/* queue information */
struct sndrv_seq_queue_info {
int queue; /* queue id */
/*
* security settings, only owner of this queue can start/stop timer
* etc. if the queue is locked for other clients
*/
int owner; /* client id for owner of the queue */
int locked:1; /* timing queue locked for other queues */
char name[64]; /* name of this queue */
unsigned int flags; /* flags */
char reserved[60]; /* for future use */
};
/* queue info/status */
struct sndrv_seq_queue_status {
int queue; /* queue id */
int events; /* read-only - queue size */
sndrv_seq_tick_time_t tick; /* current tick */
struct sndrv_seq_real_time time; /* current time */
int running; /* running state of queue */
int flags; /* various flags */
char reserved[64]; /* for the future */
};
/* queue tempo */
struct sndrv_seq_queue_tempo {
int queue; /* sequencer queue */
unsigned int tempo; /* current tempo, us/tick */
int ppq; /* time resolution, ticks/quarter */
unsigned int skew_value; /* queue skew */
unsigned int skew_base; /* queue skew base */
char reserved[24]; /* for the future */
};
/* sequencer timer sources */
#define SNDRV_SEQ_TIMER_ALSA 0 /* ALSA timer */
#define SNDRV_SEQ_TIMER_MIDI_CLOCK 1 /* Midi Clock (CLOCK event) */
#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */
/* queue timer info */
struct sndrv_seq_queue_timer {
int queue; /* sequencer queue */
int type; /* source timer type */
union {
struct {
struct sndrv_timer_id id; /* ALSA's timer ID */
unsigned int resolution; /* resolution in Hz */
} alsa;
} u;
char reserved[64]; /* for the future use */
};
struct sndrv_seq_queue_client {
int queue; /* sequencer queue */
int client; /* sequencer client */
int used; /* queue is used with this client
(must be set for accepting events) */
/* per client watermarks */
char reserved[64]; /* for future use */
};
#define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE (1<<0) /* exclusive connection */
#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1)
#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2)
struct sndrv_seq_port_subscribe {
struct sndrv_seq_addr sender; /* sender address */
struct sndrv_seq_addr dest; /* destination address */
unsigned int voices; /* number of voices to be allocated (0 = don't care) */
unsigned int flags; /* modes */
unsigned char queue; /* input time-stamp queue (optional) */
unsigned char pad[3]; /* reserved */
char reserved[64];
};
/* type of query subscription */
#define SNDRV_SEQ_QUERY_SUBS_READ 0
#define SNDRV_SEQ_QUERY_SUBS_WRITE 1
struct sndrv_seq_query_subs {
struct sndrv_seq_addr root; /* client/port id to be searched */
int type; /* READ or WRITE */
int index; /* 0..N-1 */
int num_subs; /* R/O: number of subscriptions on this port */
struct sndrv_seq_addr addr; /* R/O: result */
unsigned char queue; /* R/O: result */
unsigned int flags; /* R/O: result */
char reserved[64]; /* for future use */
};
/*
* Instrument abstraction layer
* - based on events
*/
/* instrument types */
#define SNDRV_SEQ_INSTR_ATYPE_DATA 0 /* instrument data */
#define SNDRV_SEQ_INSTR_ATYPE_ALIAS 1 /* instrument alias */
/* instrument ASCII identifiers */
#define SNDRV_SEQ_INSTR_ID_DLS1 "DLS1"
#define SNDRV_SEQ_INSTR_ID_DLS2 "DLS2"
#define SNDRV_SEQ_INSTR_ID_SIMPLE "Simple Wave"
#define SNDRV_SEQ_INSTR_ID_SOUNDFONT "SoundFont"
#define SNDRV_SEQ_INSTR_ID_GUS_PATCH "GUS Patch"
#define SNDRV_SEQ_INSTR_ID_INTERWAVE "InterWave FFFF"
#define SNDRV_SEQ_INSTR_ID_OPL2_3 "OPL2/3 FM"
#define SNDRV_SEQ_INSTR_ID_OPL4 "OPL4"
/* instrument types */
#define SNDRV_SEQ_INSTR_TYPE0_DLS1 (1<<0) /* MIDI DLS v1 */
#define SNDRV_SEQ_INSTR_TYPE0_DLS2 (1<<1) /* MIDI DLS v2 */
#define SNDRV_SEQ_INSTR_TYPE1_SIMPLE (1<<0) /* Simple Wave */
#define SNDRV_SEQ_INSTR_TYPE1_SOUNDFONT (1<<1) /* EMU SoundFont */
#define SNDRV_SEQ_INSTR_TYPE1_GUS_PATCH (1<<2) /* Gravis UltraSound Patch */
#define SNDRV_SEQ_INSTR_TYPE1_INTERWAVE (1<<3) /* InterWave FFFF */
#define SNDRV_SEQ_INSTR_TYPE2_OPL2_3 (1<<0) /* Yamaha OPL2/3 FM */
#define SNDRV_SEQ_INSTR_TYPE2_OPL4 (1<<1) /* Yamaha OPL4 */
/* put commands */
#define SNDRV_SEQ_INSTR_PUT_CMD_CREATE 0
#define SNDRV_SEQ_INSTR_PUT_CMD_REPLACE 1
#define SNDRV_SEQ_INSTR_PUT_CMD_MODIFY 2
#define SNDRV_SEQ_INSTR_PUT_CMD_ADD 3
#define SNDRV_SEQ_INSTR_PUT_CMD_REMOVE 4
/* get commands */
#define SNDRV_SEQ_INSTR_GET_CMD_FULL 0
#define SNDRV_SEQ_INSTR_GET_CMD_PARTIAL 1
/* query flags */
#define SNDRV_SEQ_INSTR_QUERY_FOLLOW_ALIAS (1<<0)
/* free commands */
#define SNDRV_SEQ_INSTR_FREE_CMD_ALL 0
#define SNDRV_SEQ_INSTR_FREE_CMD_PRIVATE 1
#define SNDRV_SEQ_INSTR_FREE_CMD_CLUSTER 2
#define SNDRV_SEQ_INSTR_FREE_CMD_SINGLE 3
/* size of ROM/RAM */
typedef unsigned int sndrv_seq_instr_size_t;
/* INSTR_INFO */
struct sndrv_seq_instr_info {
int result; /* operation result */
unsigned int formats[8]; /* bitmap of supported formats */
int ram_count; /* count of RAM banks */
sndrv_seq_instr_size_t ram_sizes[16]; /* size of RAM banks */
int rom_count; /* count of ROM banks */
sndrv_seq_instr_size_t rom_sizes[8]; /* size of ROM banks */
char reserved[128];
};
/* INSTR_STATUS */
struct sndrv_seq_instr_status {
int result; /* operation result */
sndrv_seq_instr_size_t free_ram[16]; /* free RAM in banks */
int instrument_count; /* count of downloaded instruments */
char reserved[128];
};
/* INSTR_FORMAT_INFO */
struct sndrv_seq_instr_format_info {
char format[16]; /* format identifier - SNDRV_SEQ_INSTR_ID_* */
unsigned int len; /* max data length (without this structure) */
};
struct sndrv_seq_instr_format_info_result {
int result; /* operation result */
char format[16]; /* format identifier */
unsigned int len; /* filled data length (without this structure) */
};
/* instrument data */
struct sndrv_seq_instr_data {
char name[32]; /* instrument name */
char reserved[16]; /* for the future use */
int type; /* instrument type */
union {
char format[16]; /* format identifier */
struct sndrv_seq_instr alias;
} data;
};
/* INSTR_PUT/GET, data are stored in one block (extended), header + data */
struct sndrv_seq_instr_header {
union {
struct sndrv_seq_instr instr;
sndrv_seq_instr_cluster_t cluster;
} id; /* instrument identifier */
unsigned int cmd; /* get/put/free command */
unsigned int flags; /* query flags (only for get) */
unsigned int len; /* real instrument data length (without header) */
int result; /* operation result */
char reserved[16]; /* for the future */
struct sndrv_seq_instr_data data; /* instrument data (for put/get result) */
};
/* INSTR_CLUSTER_SET */
struct sndrv_seq_instr_cluster_set {
sndrv_seq_instr_cluster_t cluster; /* cluster identifier */
char name[32]; /* cluster name */
int priority; /* cluster priority */
char reserved[64]; /* for the future use */
};
/* INSTR_CLUSTER_GET */
struct sndrv_seq_instr_cluster_get {
sndrv_seq_instr_cluster_t cluster; /* cluster identifier */
char name[32]; /* cluster name */
int priority; /* cluster priority */
char reserved[64]; /* for the future use */
};
/*
* IOCTL commands
*/
#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int)
#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int)
#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct sndrv_seq_system_info)
#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct sndrv_seq_running_info)
#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct sndrv_seq_client_info)
#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct sndrv_seq_client_info)
#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct sndrv_seq_port_info)
#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct sndrv_seq_port_info)
#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct sndrv_seq_port_info)
#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct sndrv_seq_port_info)
#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct sndrv_seq_port_subscribe)
#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct sndrv_seq_port_subscribe)
#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct sndrv_seq_queue_info)
#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct sndrv_seq_queue_info)
#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct sndrv_seq_queue_info)
#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct sndrv_seq_queue_info)
#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct sndrv_seq_queue_info)
#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct sndrv_seq_queue_status)
#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct sndrv_seq_queue_tempo)
#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct sndrv_seq_queue_tempo)
#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER _IOWR('S', 0x43, struct sndrv_seq_queue_owner)
#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER _IOW ('S', 0x44, struct sndrv_seq_queue_owner)
#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct sndrv_seq_queue_timer)
#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct sndrv_seq_queue_timer)
/* XXX
#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct sndrv_seq_queue_sync)
#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct sndrv_seq_queue_sync)
*/
#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct sndrv_seq_queue_client)
#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct sndrv_seq_queue_client)
#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct sndrv_seq_client_pool)
#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct sndrv_seq_client_pool)
#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct sndrv_seq_remove_events)
#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct sndrv_seq_query_subs)
#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct sndrv_seq_port_subscribe)
#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct sndrv_seq_client_info)
#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct sndrv_seq_port_info)
#endif /* __SOUND_ASEQUENCER_H */

806
include/sound/asound.h Normal file
View file

@ -0,0 +1,806 @@
/*
* Advanced Linux Sound Architecture - ALSA - Driver
* Copyright (c) 1994-2000 by Jaroslav Kysela <perex@suse.cz>,
* Abramo Bagnara <abramo@alsa-project.org>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __SOUND_ASOUND_H
#define __SOUND_ASOUND_H
#if defined(LINUX) || defined(__LINUX__) || defined(__linux__)
#include <linux/ioctl.h>
#ifdef __KERNEL__
#include <linux/types.h>
#include <linux/time.h>
#include <asm/byteorder.h>
#if __LITTLE_ENDIAN == 1234
#define SNDRV_LITTLE_ENDIAN
#elif __BIG_ENDIAN == 4321
#define SNDRV_BIG_ENDIAN
#else
#error "Unsupported endian..."
#endif
#else /* !__KERNEL__ */
#include <endian.h>
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define SNDRV_LITTLE_ENDIAN
#elif __BYTE_ORDER == __BIG_ENDIAN
#define SNDRV_BIG_ENDIAN
#else
#error "Unsupported endian..."
#endif
#endif /* __KERNEL **/
#endif /* LINUX */
#ifndef __KERNEL__
#include <sys/time.h>
#include <sys/types.h>
#endif
/*
* protocol version
*/
#define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor))
#define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff)
#define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff)
#define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff)
#define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion) \
(SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) || \
(SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) && \
SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion)))
/****************************************************************************
* *
* Digital audio interface *
* *
****************************************************************************/
struct sndrv_aes_iec958 {
unsigned char status[24]; /* AES/IEC958 channel status bits */
unsigned char subcode[147]; /* AES/IEC958 subcode bits */
unsigned char pad; /* nothing */
unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */
};
/****************************************************************************
* *
* Section for driver hardware dependent interface - /dev/snd/hw? *
* *
****************************************************************************/
#define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 0)
enum sndrv_hwdep_iface {
SNDRV_HWDEP_IFACE_OPL2 = 0,
SNDRV_HWDEP_IFACE_OPL3,
SNDRV_HWDEP_IFACE_OPL4,
SNDRV_HWDEP_IFACE_SB16CSP, /* Creative Signal Processor */
SNDRV_HWDEP_IFACE_EMU10K1, /* FX8010 processor in EMU10K1 chip */
SNDRV_HWDEP_IFACE_YSS225, /* Yamaha FX processor */
SNDRV_HWDEP_IFACE_ICS2115, /* Wavetable synth */
SNDRV_HWDEP_IFACE_SSCAPE, /* Ensoniq SoundScape ISA card (MC68EC000) */
/* Don't forget to change the following: */
SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_SSCAPE,
};
struct sndrv_hwdep_info {
unsigned int device; /* WR: device number */
int card; /* R: card number */
unsigned char id[64]; /* ID (user selectable) */
unsigned char name[80]; /* hwdep name */
enum sndrv_hwdep_iface iface; /* hwdep interface */
unsigned char reserved[64]; /* reserved for future */
};
enum {
SNDRV_HWDEP_IOCTL_PVERSION = _IOR ('H', 0x00, int),
SNDRV_HWDEP_IOCTL_INFO = _IOR ('H', 0x01, struct sndrv_hwdep_info),
};
/*****************************************************************************
* *
* Digital Audio (PCM) interface - /dev/snd/pcm?? *
* *
*****************************************************************************/
#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 2)
typedef unsigned long sndrv_pcm_uframes_t;
typedef long sndrv_pcm_sframes_t;
enum sndrv_pcm_class {
SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */
SNDRV_PCM_CLASS_MULTI, /* multichannel device */
SNDRV_PCM_CLASS_MODEM, /* software modem class */
SNDRV_PCM_CLASS_DIGITIZER, /* digitizer class */
/* Don't forget to change the following: */
SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER,
};
enum sndrv_pcm_subclass {
SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */
SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */
/* Don't forget to change the following: */
SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX,
};
enum sndrv_pcm_stream {
SNDRV_PCM_STREAM_PLAYBACK = 0,
SNDRV_PCM_STREAM_CAPTURE,
SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE,
};
enum sndrv_pcm_access {
SNDRV_PCM_ACCESS_MMAP_INTERLEAVED = 0, /* interleaved mmap */
SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED, /* noninterleaved mmap */
SNDRV_PCM_ACCESS_MMAP_COMPLEX, /* complex mmap */
SNDRV_PCM_ACCESS_RW_INTERLEAVED, /* readi/writei */
SNDRV_PCM_ACCESS_RW_NONINTERLEAVED, /* readn/writen */
SNDRV_PCM_ACCESS_LAST = SNDRV_PCM_ACCESS_RW_NONINTERLEAVED,
};
enum sndrv_pcm_format {
SNDRV_PCM_FORMAT_S8 = 0,
SNDRV_PCM_FORMAT_U8,
SNDRV_PCM_FORMAT_S16_LE,
SNDRV_PCM_FORMAT_S16_BE,
SNDRV_PCM_FORMAT_U16_LE,
SNDRV_PCM_FORMAT_U16_BE,
SNDRV_PCM_FORMAT_S24_LE, /* low three bytes */
SNDRV_PCM_FORMAT_S24_BE, /* low three bytes */
SNDRV_PCM_FORMAT_U24_LE, /* low three bytes */
SNDRV_PCM_FORMAT_U24_BE, /* low three bytes */
SNDRV_PCM_FORMAT_S32_LE,
SNDRV_PCM_FORMAT_S32_BE,
SNDRV_PCM_FORMAT_U32_LE,
SNDRV_PCM_FORMAT_U32_BE,
SNDRV_PCM_FORMAT_FLOAT_LE, /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
SNDRV_PCM_FORMAT_FLOAT_BE, /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
SNDRV_PCM_FORMAT_FLOAT64_LE, /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
SNDRV_PCM_FORMAT_FLOAT64_BE, /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE, /* IEC-958 subframe, Little Endian */
SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE, /* IEC-958 subframe, Big Endian */
SNDRV_PCM_FORMAT_MU_LAW,
SNDRV_PCM_FORMAT_A_LAW,
SNDRV_PCM_FORMAT_IMA_ADPCM,
SNDRV_PCM_FORMAT_MPEG,
SNDRV_PCM_FORMAT_GSM,
SNDRV_PCM_FORMAT_SPECIAL = 31,
SNDRV_PCM_FORMAT_S24_3LE = 32, /* in three bytes */
SNDRV_PCM_FORMAT_S24_3BE, /* in three bytes */
SNDRV_PCM_FORMAT_U24_3LE, /* in three bytes */
SNDRV_PCM_FORMAT_U24_3BE, /* in three bytes */
SNDRV_PCM_FORMAT_S20_3LE, /* in three bytes */
SNDRV_PCM_FORMAT_S20_3BE, /* in three bytes */
SNDRV_PCM_FORMAT_U20_3LE, /* in three bytes */
SNDRV_PCM_FORMAT_U20_3BE, /* in three bytes */
SNDRV_PCM_FORMAT_S18_3LE, /* in three bytes */
SNDRV_PCM_FORMAT_S18_3BE, /* in three bytes */
SNDRV_PCM_FORMAT_U18_3LE, /* in three bytes */
SNDRV_PCM_FORMAT_U18_3BE, /* in three bytes */
SNDRV_PCM_FORMAT_LAST = SNDRV_PCM_FORMAT_U18_3BE,
#ifdef SNDRV_LITTLE_ENDIAN
SNDRV_PCM_FORMAT_S16 = SNDRV_PCM_FORMAT_S16_LE,
SNDRV_PCM_FORMAT_U16 = SNDRV_PCM_FORMAT_U16_LE,
SNDRV_PCM_FORMAT_S24 = SNDRV_PCM_FORMAT_S24_LE,
SNDRV_PCM_FORMAT_U24 = SNDRV_PCM_FORMAT_U24_LE,
SNDRV_PCM_FORMAT_S32 = SNDRV_PCM_FORMAT_S32_LE,
SNDRV_PCM_FORMAT_U32 = SNDRV_PCM_FORMAT_U32_LE,
SNDRV_PCM_FORMAT_FLOAT = SNDRV_PCM_FORMAT_FLOAT_LE,
SNDRV_PCM_FORMAT_FLOAT64 = SNDRV_PCM_FORMAT_FLOAT64_LE,
SNDRV_PCM_FORMAT_IEC958_SUBFRAME = SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE,
#endif
#ifdef SNDRV_BIG_ENDIAN
SNDRV_PCM_FORMAT_S16 = SNDRV_PCM_FORMAT_S16_BE,
SNDRV_PCM_FORMAT_U16 = SNDRV_PCM_FORMAT_U16_BE,
SNDRV_PCM_FORMAT_S24 = SNDRV_PCM_FORMAT_S24_BE,
SNDRV_PCM_FORMAT_U24 = SNDRV_PCM_FORMAT_U24_BE,
SNDRV_PCM_FORMAT_S32 = SNDRV_PCM_FORMAT_S32_BE,
SNDRV_PCM_FORMAT_U32 = SNDRV_PCM_FORMAT_U32_BE,
SNDRV_PCM_FORMAT_FLOAT = SNDRV_PCM_FORMAT_FLOAT_BE,
SNDRV_PCM_FORMAT_FLOAT64 = SNDRV_PCM_FORMAT_FLOAT64_BE,
SNDRV_PCM_FORMAT_IEC958_SUBFRAME = SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE,
#endif
};
enum sndrv_pcm_subformat {
SNDRV_PCM_SUBFORMAT_STD = 0,
SNDRV_PCM_SUBFORMAT_LAST = SNDRV_PCM_SUBFORMAT_STD,
};
#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */
#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */
#define SNDRV_PCM_INFO_DOUBLE 0x00000004 /* Double buffering needed for PCM start/stop */
#define SNDRV_PCM_INFO_BATCH 0x00000010 /* double buffering */
#define SNDRV_PCM_INFO_INTERLEAVED 0x00000100 /* channels are interleaved */
#define SNDRV_PCM_INFO_NONINTERLEAVED 0x00000200 /* channels are not interleaved */
#define SNDRV_PCM_INFO_COMPLEX 0x00000400 /* complex frame organization (mmap only) */
#define SNDRV_PCM_INFO_BLOCK_TRANSFER 0x00010000 /* hardware transfer block of samples */
#define SNDRV_PCM_INFO_OVERRANGE 0x00020000 /* hardware supports ADC (capture) overrange detection */
#define SNDRV_PCM_INFO_RESUME 0x00040000 /* hardware supports stream resume after suspend */
#define SNDRV_PCM_INFO_PAUSE 0x00080000 /* pause ioctl is supported */
#define SNDRV_PCM_INFO_HALF_DUPLEX 0x00100000 /* only half duplex */
#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */
#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */
enum sndrv_pcm_state {
SNDRV_PCM_STATE_OPEN = 0, /* stream is open */
SNDRV_PCM_STATE_SETUP, /* stream has a setup */
SNDRV_PCM_STATE_PREPARED, /* stream is ready to start */
SNDRV_PCM_STATE_RUNNING, /* stream is running */
SNDRV_PCM_STATE_XRUN, /* stream reached an xrun */
SNDRV_PCM_STATE_DRAINING, /* stream is draining */
SNDRV_PCM_STATE_PAUSED, /* stream is paused */
SNDRV_PCM_STATE_SUSPENDED, /* hardware is suspended */
SNDRV_PCM_STATE_LAST = SNDRV_PCM_STATE_SUSPENDED,
};
enum {
SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000,
SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000,
};
union sndrv_pcm_sync_id {
unsigned char id[16];
unsigned short id16[8];
unsigned int id32[4];
};
struct sndrv_pcm_info {
unsigned int device; /* RO/WR (control): device number */
unsigned int subdevice; /* RO/WR (control): subdevice number */
enum sndrv_pcm_stream stream; /* RO/WR (control): stream number */
int card; /* R: card number */
unsigned char id[64]; /* ID (user selectable) */
unsigned char name[80]; /* name of this device */
unsigned char subname[32]; /* subdevice name */
enum sndrv_pcm_class dev_class; /* SNDRV_PCM_CLASS_* */
enum sndrv_pcm_subclass dev_subclass; /* SNDRV_PCM_SUBCLASS_* */
unsigned int subdevices_count;
unsigned int subdevices_avail;
union sndrv_pcm_sync_id sync; /* hardware synchronization ID */
unsigned char reserved[64]; /* reserved for future... */
};
enum sndrv_pcm_hw_param {
SNDRV_PCM_HW_PARAM_ACCESS = 0, /* Access type */
SNDRV_PCM_HW_PARAM_FIRST_MASK = SNDRV_PCM_HW_PARAM_ACCESS,
SNDRV_PCM_HW_PARAM_FORMAT, /* Format */
SNDRV_PCM_HW_PARAM_SUBFORMAT, /* Subformat */
SNDRV_PCM_HW_PARAM_LAST_MASK = SNDRV_PCM_HW_PARAM_SUBFORMAT,
SNDRV_PCM_HW_PARAM_SAMPLE_BITS = 8, /* Bits per sample */
SNDRV_PCM_HW_PARAM_FIRST_INTERVAL = SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
SNDRV_PCM_HW_PARAM_FRAME_BITS, /* Bits per frame */
SNDRV_PCM_HW_PARAM_CHANNELS, /* Channels */
SNDRV_PCM_HW_PARAM_RATE, /* Approx rate */
SNDRV_PCM_HW_PARAM_PERIOD_TIME, /* Approx distance between interrupts
in us */
SNDRV_PCM_HW_PARAM_PERIOD_SIZE, /* Approx frames between interrupts */
SNDRV_PCM_HW_PARAM_PERIOD_BYTES, /* Approx bytes between interrupts */
SNDRV_PCM_HW_PARAM_PERIODS, /* Approx interrupts per buffer */
SNDRV_PCM_HW_PARAM_BUFFER_TIME, /* Approx duration of buffer in us */
SNDRV_PCM_HW_PARAM_BUFFER_SIZE, /* Size of buffer in frames */
SNDRV_PCM_HW_PARAM_BUFFER_BYTES, /* Size of buffer in bytes */
SNDRV_PCM_HW_PARAM_TICK_TIME, /* Approx tick duration in us */
SNDRV_PCM_HW_PARAM_LAST_INTERVAL = SNDRV_PCM_HW_PARAM_TICK_TIME
};
#define SNDRV_PCM_HW_PARAMS_RUNTIME (1<<0)
struct sndrv_interval {
unsigned int min, max;
unsigned int openmin:1,
openmax:1,
integer:1,
empty:1;
};
#define SNDRV_MASK_MAX 256
struct sndrv_mask {
u_int32_t bits[(SNDRV_MASK_MAX+31)/32];
};
struct sndrv_pcm_hw_params {
unsigned int flags;
struct sndrv_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
struct sndrv_mask mres[5]; /* reserved masks */
struct sndrv_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
struct sndrv_interval ires[9]; /* reserved intervals */
unsigned int rmask; /* W: requested masks */
unsigned int cmask; /* R: changed masks */
unsigned int info; /* R: Info flags for returned setup */
unsigned int msbits; /* R: used most significant bits */
unsigned int rate_num; /* R: rate numerator */
unsigned int rate_den; /* R: rate denominator */
sndrv_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */
unsigned char reserved[64]; /* reserved for future */
};
enum sndrv_pcm_tstamp {
SNDRV_PCM_TSTAMP_NONE = 0,
SNDRV_PCM_TSTAMP_MMAP,
SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_MMAP,
};
struct sndrv_pcm_sw_params {
enum sndrv_pcm_tstamp tstamp_mode; /* timestamp mode */
unsigned int period_step;
unsigned int sleep_min; /* min ticks to sleep */
sndrv_pcm_uframes_t avail_min; /* min avail frames for wakeup */
sndrv_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */
sndrv_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */
sndrv_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */
sndrv_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */
sndrv_pcm_uframes_t silence_size; /* silence block size */
sndrv_pcm_uframes_t boundary; /* pointers wrap point */
unsigned char reserved[64]; /* reserved for future */
};
struct sndrv_pcm_channel_info {
unsigned int channel;
off_t offset; /* mmap offset */
unsigned int first; /* offset to first sample in bits */
unsigned int step; /* samples distance in bits */
};
struct sndrv_pcm_status {
enum sndrv_pcm_state state; /* stream state */
struct timeval trigger_tstamp; /* time when stream was started/stopped/paused */
struct timeval tstamp; /* reference timestamp */
sndrv_pcm_uframes_t appl_ptr; /* appl ptr */
sndrv_pcm_uframes_t hw_ptr; /* hw ptr */
sndrv_pcm_sframes_t delay; /* current delay in frames */
sndrv_pcm_uframes_t avail; /* number of frames available */
sndrv_pcm_uframes_t avail_max; /* max frames available on hw since last status */
sndrv_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */
enum sndrv_pcm_state suspended_state; /* suspended stream state */
unsigned char reserved[60]; /* must be filled with zero */
};
struct sndrv_pcm_mmap_status {
enum sndrv_pcm_state state; /* RO: state - SNDRV_PCM_STATE_XXXX */
int pad1; /* Needed for 64 bit alignment */
sndrv_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */
struct timeval tstamp; /* Timestamp */
enum sndrv_pcm_state suspended_state; /* RO: suspended stream state */
};
struct sndrv_pcm_mmap_control {
sndrv_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */
sndrv_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */
};
struct sndrv_xferi {
sndrv_pcm_sframes_t result;
void *buf;
sndrv_pcm_uframes_t frames;
};
struct sndrv_xfern {
sndrv_pcm_sframes_t result;
void **bufs;
sndrv_pcm_uframes_t frames;
};
enum {
SNDRV_PCM_IOCTL_PVERSION = _IOR('A', 0x00, int),
SNDRV_PCM_IOCTL_INFO = _IOR('A', 0x01, struct sndrv_pcm_info),
SNDRV_PCM_IOCTL_HW_REFINE = _IOWR('A', 0x10, struct sndrv_pcm_hw_params),
SNDRV_PCM_IOCTL_HW_PARAMS = _IOWR('A', 0x11, struct sndrv_pcm_hw_params),
SNDRV_PCM_IOCTL_HW_FREE = _IO('A', 0x12),
SNDRV_PCM_IOCTL_SW_PARAMS = _IOWR('A', 0x13, struct sndrv_pcm_sw_params),
SNDRV_PCM_IOCTL_STATUS = _IOR('A', 0x20, struct sndrv_pcm_status),
SNDRV_PCM_IOCTL_DELAY = _IOR('A', 0x21, sndrv_pcm_sframes_t),
SNDRV_PCM_IOCTL_CHANNEL_INFO = _IOR('A', 0x32, struct sndrv_pcm_channel_info),
SNDRV_PCM_IOCTL_PREPARE = _IO('A', 0x40),
SNDRV_PCM_IOCTL_RESET = _IO('A', 0x41),
SNDRV_PCM_IOCTL_START = _IO('A', 0x42),
SNDRV_PCM_IOCTL_DROP = _IO('A', 0x43),
SNDRV_PCM_IOCTL_DRAIN = _IO('A', 0x44),
SNDRV_PCM_IOCTL_PAUSE = _IOW('A', 0x45, int),
SNDRV_PCM_IOCTL_REWIND = _IOW('A', 0x46, sndrv_pcm_uframes_t),
SNDRV_PCM_IOCTL_RESUME = _IO('A', 0x47),
SNDRV_PCM_IOCTL_XRUN = _IO('A', 0x48),
SNDRV_PCM_IOCTL_WRITEI_FRAMES = _IOW('A', 0x50, struct sndrv_xferi),
SNDRV_PCM_IOCTL_READI_FRAMES = _IOR('A', 0x51, struct sndrv_xferi),
SNDRV_PCM_IOCTL_WRITEN_FRAMES = _IOW('A', 0x52, struct sndrv_xfern),
SNDRV_PCM_IOCTL_READN_FRAMES = _IOR('A', 0x53, struct sndrv_xfern),
SNDRV_PCM_IOCTL_LINK = _IOW('A', 0x60, int),
SNDRV_PCM_IOCTL_UNLINK = _IO('A', 0x61),
};
/* Trick to make alsa-lib/acinclude.m4 happy */
#define SNDRV_PCM_IOCTL_REWIND SNDRV_PCM_IOCTL_REWIND
/*****************************************************************************
* *
* MIDI v1.0 interface *
* *
*****************************************************************************/
/*
* Raw MIDI section - /dev/snd/midi??
*/
#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0)
enum sndrv_rawmidi_stream {
SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
SNDRV_RAWMIDI_STREAM_INPUT,
SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT,
};
#define SNDRV_RAWMIDI_INFO_OUTPUT 0x00000001
#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002
#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004
struct sndrv_rawmidi_info {
unsigned int device; /* RO/WR (control): device number */
unsigned int subdevice; /* RO/WR (control): subdevice number */
enum sndrv_rawmidi_stream stream; /* WR: stream */
int card; /* R: card number */
unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */
unsigned char id[64]; /* ID (user selectable) */
unsigned char name[80]; /* name of device */
unsigned char subname[32]; /* name of active or selected subdevice */
unsigned int subdevices_count;
unsigned int subdevices_avail;
unsigned char reserved[64]; /* reserved for future use */
};
struct sndrv_rawmidi_params {
enum sndrv_rawmidi_stream stream;
size_t buffer_size; /* queue size in bytes */
size_t avail_min; /* minimum avail bytes for wakeup */
unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */
unsigned char reserved[16]; /* reserved for future use */
};
struct sndrv_rawmidi_status {
enum sndrv_rawmidi_stream stream;
struct timeval tstamp; /* Timestamp */
size_t avail; /* available bytes */
size_t xruns; /* count of overruns since last status (in bytes) */
unsigned char reserved[16]; /* reserved for future use */
};
enum {
SNDRV_RAWMIDI_IOCTL_PVERSION = _IOR('W', 0x00, int),
SNDRV_RAWMIDI_IOCTL_INFO = _IOR('W', 0x01, struct sndrv_rawmidi_info),
SNDRV_RAWMIDI_IOCTL_PARAMS = _IOWR('W', 0x10, struct sndrv_rawmidi_params),
SNDRV_RAWMIDI_IOCTL_STATUS = _IOWR('W', 0x20, struct sndrv_rawmidi_status),
SNDRV_RAWMIDI_IOCTL_DROP = _IOW('W', 0x30, int),
SNDRV_RAWMIDI_IOCTL_DRAIN = _IOW('W', 0x31, int),
};
/*
* Timer section - /dev/snd/timer
*/
#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0)
enum sndrv_timer_class {
SNDRV_TIMER_CLASS_NONE = -1,
SNDRV_TIMER_CLASS_SLAVE = 0,
SNDRV_TIMER_CLASS_GLOBAL,
SNDRV_TIMER_CLASS_CARD,
SNDRV_TIMER_CLASS_PCM,
SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM,
};
/* slave timer classes */
enum sndrv_timer_slave_class {
SNDRV_TIMER_SCLASS_NONE = 0,
SNDRV_TIMER_SCLASS_APPLICATION,
SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */
SNDRV_TIMER_SCLASS_OSS_SEQUENCER, /* alias */
SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER,
};
/* global timers (device member) */
#define SNDRV_TIMER_GLOBAL_SYSTEM 0
#define SNDRV_TIMER_GLOBAL_RTC 1
struct sndrv_timer_id {
enum sndrv_timer_class dev_class;
enum sndrv_timer_slave_class dev_sclass;
int card;
int device;
int subdevice;
};
struct sndrv_timer_select {
struct sndrv_timer_id id; /* bind to timer ID */
unsigned char reserved[32]; /* reserved */
};
#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */
struct sndrv_timer_info {
unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */
int card; /* R: card number */
unsigned char id[64]; /* timer identificator */
unsigned char name[80]; /* timer name */
unsigned long ticks; /* maximum ticks */
unsigned long resolution; /* average resolution */
unsigned char reserved[64]; /* reserved */
};
#define SNDRV_TIMER_PSFLG_AUTO (1<<0) /* supports auto start */
struct sndrv_timer_params {
unsigned int flags; /* flags - SNDRV_MIXER_PSFLG_* */
unsigned int ticks; /* requested resolution in ticks */
unsigned int queue_size; /* total size of queue (32-1024) */
unsigned int reserved0; /* reserved, was: failure locations */
unsigned char reserved[64]; /* reserved */
};
struct sndrv_timer_status {
struct timeval tstamp; /* Timestamp */
unsigned int resolution; /* current resolution */
unsigned int lost; /* counter of master tick lost */
unsigned int overrun; /* count of read queue overruns */
unsigned int queue; /* used queue size */
unsigned char reserved[64]; /* reserved */
};
enum {
SNDRV_TIMER_IOCTL_PVERSION = _IOR('T', 0x00, int),
SNDRV_TIMER_IOCTL_NEXT_DEVICE = _IOWR('T', 0x01, struct sndrv_timer_id),
SNDRV_TIMER_IOCTL_SELECT = _IOW('T', 0x10, struct sndrv_timer_select),
SNDRV_TIMER_IOCTL_INFO = _IOR('T', 0x11, struct sndrv_timer_info),
SNDRV_TIMER_IOCTL_PARAMS = _IOW('T', 0x12, struct sndrv_timer_params),
SNDRV_TIMER_IOCTL_STATUS = _IOW('T', 0x14, struct sndrv_timer_status),
SNDRV_TIMER_IOCTL_START = _IO('T', 0x20),
SNDRV_TIMER_IOCTL_STOP = _IO('T', 0x21),
SNDRV_TIMER_IOCTL_CONTINUE = _IO('T', 0x22),
};
struct sndrv_timer_read {
unsigned int resolution;
unsigned int ticks;
};
/****************************************************************************
* *
* Section for driver control interface - /dev/snd/control? *
* *
****************************************************************************/
#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0)
struct sndrv_ctl_card_info {
int card; /* card number */
int pad; /* reserved for future (was type) */
unsigned char id[16]; /* ID of card (user selectable) */
unsigned char driver[16]; /* Driver name */
unsigned char name[32]; /* Short name of soundcard */
unsigned char longname[80]; /* name + info text about soundcard */
unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */
unsigned char mixername[80]; /* visual mixer identification */
unsigned char components[80]; /* card components / fine identification, delimited with one space (AC97 etc..) */
unsigned char reserved[48]; /* reserved for future */
};
enum sndrv_ctl_elem_type {
SNDRV_CTL_ELEM_TYPE_NONE = 0, /* invalid */
SNDRV_CTL_ELEM_TYPE_BOOLEAN, /* boolean type */
SNDRV_CTL_ELEM_TYPE_INTEGER, /* integer type */
SNDRV_CTL_ELEM_TYPE_ENUMERATED, /* enumerated type */
SNDRV_CTL_ELEM_TYPE_BYTES, /* byte array */
SNDRV_CTL_ELEM_TYPE_IEC958, /* IEC958 (S/PDIF) setup */
SNDRV_CTL_ELEM_TYPE_INTEGER64, /* 64-bit integer type */
SNDRV_CTL_ELEM_TYPE_LAST = SNDRV_CTL_ELEM_TYPE_INTEGER64,
};
enum sndrv_ctl_elem_iface {
SNDRV_CTL_ELEM_IFACE_CARD = 0, /* global control */
SNDRV_CTL_ELEM_IFACE_HWDEP, /* hardware dependent device */
SNDRV_CTL_ELEM_IFACE_MIXER, /* virtual mixer device */
SNDRV_CTL_ELEM_IFACE_PCM, /* PCM device */
SNDRV_CTL_ELEM_IFACE_RAWMIDI, /* RawMidi device */
SNDRV_CTL_ELEM_IFACE_TIMER, /* timer device */
SNDRV_CTL_ELEM_IFACE_SEQUENCER, /* sequencer client */
SNDRV_CTL_ELEM_IFACE_LAST = SNDRV_CTL_ELEM_IFACE_SEQUENCER,
};
#define SNDRV_CTL_ELEM_ACCESS_READ (1<<0)
#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1)
#define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE)
#define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */
#define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */
#define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */
#define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */
#define SNDRV_CTL_ELEM_ACCESS_INDIRECT (1<<31) /* indirect access */
/* for further details see the ACPI and PCI power management specification */
#define SNDRV_CTL_POWER_D0 0x0000 /* full On */
#define SNDRV_CTL_POWER_D1 0x0100 /* partial On */
#define SNDRV_CTL_POWER_D2 0x0200 /* partial On */
#define SNDRV_CTL_POWER_D3 0x0300 /* Off */
#define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */
#define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */
struct sndrv_ctl_elem_id {
unsigned int numid; /* numeric identifier, zero = invalid */
enum sndrv_ctl_elem_iface iface; /* interface identifier */
unsigned int device; /* device/client number */
unsigned int subdevice; /* subdevice (substream) number */
unsigned char name[44]; /* ASCII name of item */
unsigned int index; /* index of item */
};
struct sndrv_ctl_elem_list {
unsigned int offset; /* W: first element ID to get */
unsigned int space; /* W: count of element IDs to get */
unsigned int used; /* R: count of element IDs set */
unsigned int count; /* R: count of all elements */
struct sndrv_ctl_elem_id *pids; /* R: IDs */
unsigned char reserved[50];
};
struct sndrv_ctl_elem_info {
struct sndrv_ctl_elem_id id; /* W: element ID */
enum sndrv_ctl_elem_type type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */
unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */
unsigned int count; /* count of values */
pid_t owner; /* owner's PID of this control */
union {
struct {
long min; /* R: minimum value */
long max; /* R: maximum value */
long step; /* R: step (0 variable) */
} integer;
struct {
long long min; /* R: minimum value */
long long max; /* R: maximum value */
long long step; /* R: step (0 variable) */
} integer64;
struct {
unsigned int items; /* R: number of items */
unsigned int item; /* W: item number */
char name[64]; /* R: value name */
} enumerated;
unsigned char reserved[128];
} value;
unsigned char reserved[64];
};
struct sndrv_ctl_elem_value {
struct sndrv_ctl_elem_id id; /* W: element ID */
unsigned int indirect: 1; /* W: use indirect pointer (xxx_ptr member) */
union {
union {
long value[128];
long *value_ptr;
} integer;
union {
long long value[64];
long long *value_ptr;
} integer64;
union {
unsigned int item[128];
unsigned int *item_ptr;
} enumerated;
union {
unsigned char data[512];
unsigned char *data_ptr;
} bytes;
struct sndrv_aes_iec958 iec958;
} value; /* RO */
unsigned char reserved[128];
};
enum {
SNDRV_CTL_IOCTL_PVERSION = _IOR('U', 0x00, int),
SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct sndrv_ctl_card_info),
SNDRV_CTL_IOCTL_ELEM_LIST = _IOWR('U', 0x10, struct sndrv_ctl_elem_list),
SNDRV_CTL_IOCTL_ELEM_INFO = _IOWR('U', 0x11, struct sndrv_ctl_elem_info),
SNDRV_CTL_IOCTL_ELEM_READ = _IOWR('U', 0x12, struct sndrv_ctl_elem_value),
SNDRV_CTL_IOCTL_ELEM_WRITE = _IOWR('U', 0x13, struct sndrv_ctl_elem_value),
SNDRV_CTL_IOCTL_ELEM_LOCK = _IOW('U', 0x14, struct sndrv_ctl_elem_id),
SNDRV_CTL_IOCTL_ELEM_UNLOCK = _IOW('U', 0x15, struct sndrv_ctl_elem_id),
SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS = _IOWR('U', 0x16, int),
SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int),
SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct sndrv_hwdep_info),
SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int),
SNDRV_CTL_IOCTL_PCM_INFO = _IOWR('U', 0x31, struct sndrv_pcm_info),
SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE = _IOW('U', 0x32, int),
SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE = _IOWR('U', 0x40, int),
SNDRV_CTL_IOCTL_RAWMIDI_INFO = _IOWR('U', 0x41, struct sndrv_rawmidi_info),
SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE = _IOW('U', 0x42, int),
SNDRV_CTL_IOCTL_POWER = _IOWR('U', 0xd0, int),
SNDRV_CTL_IOCTL_POWER_STATE = _IOR('U', 0xd1, int),
};
/*
* Read interface.
*/
enum sndrv_ctl_event_type {
SNDRV_CTL_EVENT_ELEM = 0,
SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM,
};
#define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */
#define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */
#define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */
#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */
struct sndrv_ctl_event {
enum sndrv_ctl_event_type type; /* event type - SNDRV_CTL_EVENT_* */
union {
struct {
unsigned int mask;
struct sndrv_ctl_elem_id id;
} elem;
unsigned char data8[60];
} data;
};
/*
* Control names
*/
#define SNDRV_CTL_NAME_NONE ""
#define SNDRV_CTL_NAME_PLAYBACK "Playback "
#define SNDRV_CTL_NAME_CAPTURE "Capture "
#define SNDRV_CTL_NAME_IEC958_NONE ""
#define SNDRV_CTL_NAME_IEC958_SWITCH "Switch"
#define SNDRV_CTL_NAME_IEC958_VOLUME "Volume"
#define SNDRV_CTL_NAME_IEC958_DEFAULT "Default"
#define SNDRV_CTL_NAME_IEC958_MASK "Mask"
#define SNDRV_CTL_NAME_IEC958_CON_MASK "Con Mask"
#define SNDRV_CTL_NAME_IEC958_PRO_MASK "Pro Mask"
#define SNDRV_CTL_NAME_IEC958_PCM_STREAM "PCM Stream"
#define SNDRV_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what
/*
*
*/
struct sndrv_xferv {
const struct iovec *vector;
unsigned long count;
};
enum {
SNDRV_IOCTL_READV = _IOW('K', 0x00, struct sndrv_xferv),
SNDRV_IOCTL_WRITEV = _IOW('K', 0x01, struct sndrv_xferv),
};
#endif /* __SOUND_ASOUND_H */

227
include/sound/asoundef.h Normal file
View file

@ -0,0 +1,227 @@
#ifndef __SOUND_ASOUNDEF_H
#define __SOUND_ASOUNDEF_H
/*
* Advanced Linux Sound Architecture - ALSA - Driver
* Copyright (c) 1994-2000 by Jaroslav Kysela <perex@suse.cz>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/****************************************************************************
* *
* Digital audio interface *
* *
****************************************************************************/
/* AES/IEC958 channel status bits */
#define IEC958_AES0_PROFESSIONAL (1<<0) /* 0 = consumer, 1 = professional */
#define IEC958_AES0_NONAUDIO (1<<1) /* 0 = audio, 1 = non-audio */
#define IEC958_AES0_PRO_EMPHASIS (7<<2) /* mask - emphasis */
#define IEC958_AES0_PRO_EMPHASIS_NOTID (0<<2) /* emphasis not indicated */
#define IEC958_AES0_PRO_EMPHASIS_NONE (1<<2) /* none emphasis */
#define IEC958_AES0_PRO_EMPHASIS_5015 (3<<2) /* 50/15us emphasis */
#define IEC958_AES0_PRO_EMPHASIS_CCITT (7<<2) /* CCITT J.17 emphasis */
#define IEC958_AES0_PRO_FREQ_UNLOCKED (1<<5) /* source sample frequency: 0 = locked, 1 = unlocked */
#define IEC958_AES0_PRO_FS (3<<6) /* mask - sample frequency */
#define IEC958_AES0_PRO_FS_NOTID (0<<6) /* fs not indicated */
#define IEC958_AES0_PRO_FS_44100 (1<<6) /* 44.1kHz */
#define IEC958_AES0_PRO_FS_48000 (2<<6) /* 48kHz */
#define IEC958_AES0_PRO_FS_32000 (3<<6) /* 32kHz */
#define IEC958_AES0_CON_NOT_COPYRIGHT (1<<2) /* 0 = copyright, 1 = not copyright */
#define IEC958_AES0_CON_EMPHASIS (7<<3) /* mask - emphasis */
#define IEC958_AES0_CON_EMPHASIS_NONE (0<<3) /* none emphasis */
#define IEC958_AES0_CON_EMPHASIS_5015 (1<<3) /* 50/15us emphasis */
#define IEC958_AES0_CON_MODE (3<<6) /* mask - mode */
#define IEC958_AES1_PRO_MODE (15<<0) /* mask - channel mode */
#define IEC958_AES1_PRO_MODE_NOTID (0<<0) /* not indicated */
#define IEC958_AES1_PRO_MODE_STEREOPHONIC (2<<0) /* stereophonic - ch A is left */
#define IEC958_AES1_PRO_MODE_SINGLE (4<<0) /* single channel */
#define IEC958_AES1_PRO_MODE_TWO (8<<0) /* two channels */
#define IEC958_AES1_PRO_MODE_PRIMARY (12<<0) /* primary/secondary */
#define IEC958_AES1_PRO_MODE_BYTE3 (15<<0) /* vector to byte 3 */
#define IEC958_AES1_PRO_USERBITS (15<<4) /* mask - user bits */
#define IEC958_AES1_PRO_USERBITS_NOTID (0<<4) /* not indicated */
#define IEC958_AES1_PRO_USERBITS_192 (8<<4) /* 192-bit structure */
#define IEC958_AES1_PRO_USERBITS_UDEF (12<<4) /* user defined application */
#define IEC958_AES1_CON_CATEGORY 0x7f
#define IEC958_AES1_CON_GENERAL 0x00
#define IEC958_AES1_CON_EXPERIMENTAL 0x40
#define IEC958_AES1_CON_SOLIDMEM_MASK 0x0f
#define IEC958_AES1_CON_SOLIDMEM_ID 0x08
#define IEC958_AES1_CON_BROADCAST1_MASK 0x07
#define IEC958_AES1_CON_BROADCAST1_ID 0x04
#define IEC958_AES1_CON_DIGDIGCONV_MASK 0x07
#define IEC958_AES1_CON_DIGDIGCONV_ID 0x02
#define IEC958_AES1_CON_ADC_COPYRIGHT_MASK 0x1f
#define IEC958_AES1_CON_ADC_COPYRIGHT_ID 0x06
#define IEC958_AES1_CON_ADC_MASK 0x1f
#define IEC958_AES1_CON_ADC_ID 0x16
#define IEC958_AES1_CON_BROADCAST2_MASK 0x0f
#define IEC958_AES1_CON_BROADCAST2_ID 0x0e
#define IEC958_AES1_CON_LASEROPT_MASK 0x07
#define IEC958_AES1_CON_LASEROPT_ID 0x01
#define IEC958_AES1_CON_MUSICAL_MASK 0x07
#define IEC958_AES1_CON_MUSICAL_ID 0x05
#define IEC958_AES1_CON_MAGNETIC_MASK 0x07
#define IEC958_AES1_CON_MAGNETIC_ID 0x03
#define IEC958_AES1_CON_IEC908_CD (IEC958_AES1_CON_LASEROPT_ID|0x00)
#define IEC958_AES1_CON_NON_IEC908_CD (IEC958_AES1_CON_LASEROPT_ID|0x08)
#define IEC958_AES1_CON_PCM_CODER (IEC958_AES1_CON_DIGDIGCONV_ID|0x00)
#define IEC958_AES1_CON_SAMPLER (IEC958_AES1_CON_DIGDIGCONV_ID|0x20)
#define IEC958_AES1_CON_MIXER (IEC958_AES1_CON_DIGDIGCONV_ID|0x10)
#define IEC958_AES1_CON_RATE_CONVERTER (IEC958_AES1_CON_DIGDIGCONV_ID|0x18)
#define IEC958_AES1_CON_SYNTHESIZER (IEC958_AES1_CON_MUSICAL_ID|0x00)
#define IEC958_AES1_CON_MICROPHONE (IEC958_AES1_CON_MUSICAL_ID|0x08)
#define IEC958_AES1_CON_DAT (IEC958_AES1_CON_MAGNETIC_ID|0x00)
#define IEC958_AES1_CON_VCR (IEC958_AES1_CON_MAGNETIC_ID|0x08)
#define IEC958_AES1_CON_ORIGINAL (1<<7) /* this bits depends on the category code */
#define IEC958_AES2_PRO_SBITS (7<<0) /* mask - sample bits */
#define IEC958_AES2_PRO_SBITS_20 (2<<0) /* 20-bit - coordination */
#define IEC958_AES2_PRO_SBITS_24 (4<<0) /* 24-bit - main audio */
#define IEC958_AES2_PRO_SBITS_UDEF (6<<0) /* user defined application */
#define IEC958_AES2_PRO_WORDLEN (7<<3) /* mask - source word length */
#define IEC958_AES2_PRO_WORDLEN_NOTID (0<<3) /* not indicated */
#define IEC958_AES2_PRO_WORDLEN_22_18 (2<<3) /* 22-bit or 18-bit */
#define IEC958_AES2_PRO_WORDLEN_23_19 (4<<3) /* 23-bit or 19-bit */
#define IEC958_AES2_PRO_WORDLEN_24_20 (5<<3) /* 24-bit or 20-bit */
#define IEC958_AES2_PRO_WORDLEN_20_16 (6<<3) /* 20-bit or 16-bit */
#define IEC958_AES2_CON_SOURCE (15<<0) /* mask - source number */
#define IEC958_AES2_CON_SOURCE_UNSPEC (0<<0) /* unspecified */
#define IEC958_AES2_CON_CHANNEL (15<<4) /* mask - channel number */
#define IEC958_AES2_CON_CHANNEL_UNSPEC (0<<4) /* unspecified */
#define IEC958_AES3_CON_FS (15<<0) /* mask - sample frequency */
#define IEC958_AES3_CON_FS_44100 (0<<0) /* 44.1kHz */
#define IEC958_AES3_CON_FS_48000 (2<<0) /* 48kHz */
#define IEC958_AES3_CON_FS_32000 (3<<0) /* 32kHz */
#define IEC958_AES3_CON_CLOCK (3<<4) /* mask - clock accuracy */
#define IEC958_AES3_CON_CLOCK_1000PPM (0<<4) /* 1000 ppm */
#define IEC958_AES3_CON_CLOCK_50PPM (1<<4) /* 50 ppm */
#define IEC958_AES3_CON_CLOCK_VARIABLE (2<<4) /* variable pitch */
/*****************************************************************************
* *
* MIDI v1.0 interface *
* *
*****************************************************************************/
#define MIDI_CHANNELS 16
#define MIDI_GM_DRUM_CHANNEL (10-1)
/*
* MIDI commands
*/
#define MIDI_CMD_NOTE_OFF 0x80
#define MIDI_CMD_NOTE_ON 0x90
#define MIDI_CMD_NOTE_PRESSURE 0xa0
#define MIDI_CMD_CONTROL 0xb0
#define MIDI_CMD_PGM_CHANGE 0xc0
#define MIDI_CMD_CHANNEL_PRESSURE 0xd0
#define MIDI_CMD_BENDER 0xe0
#define MIDI_CMD_COMMON_SYSEX 0xf0
#define MIDI_CMD_COMMON_MTC_QUARTER 0xf1
#define MIDI_CMD_COMMON_SONG_POS 0xf2
#define MIDI_CMD_COMMON_SONG_SELECT 0xf3
#define MIDI_CMD_COMMON_TUNE_REQUEST 0xf6
#define MIDI_CMD_COMMON_SYSEX_END 0xf7
#define MIDI_CMD_COMMON_CLOCK 0xf8
#define MIDI_CMD_COMMON_START 0xfa
#define MIDI_CMD_COMMON_CONTINUE 0xfb
#define MIDI_CMD_COMMON_STOP 0xfc
#define MIDI_CMD_COMMON_SENSING 0xfe
#define MIDI_CMD_COMMON_RESET 0xff
/*
* MIDI controllers
*/
#define MIDI_CTL_MSB_BANK 0x00
#define MIDI_CTL_MSB_MODWHEEL 0x01
#define MIDI_CTL_MSB_BREATH 0x02
#define MIDI_CTL_MSB_FOOT 0x04
#define MIDI_CTL_MSB_PORTAMENTO_TIME 0x05
#define MIDI_CTL_MSB_DATA_ENTRY 0x06
#define MIDI_CTL_MSB_MAIN_VOLUME 0x07
#define MIDI_CTL_MSB_BALANCE 0x08
#define MIDI_CTL_MSB_PAN 0x0a
#define MIDI_CTL_MSB_EXPRESSION 0x0b
#define MIDI_CTL_MSB_EFFECT1 0x0c
#define MIDI_CTL_MSB_EFFECT2 0x0d
#define MIDI_CTL_MSB_GENERAL_PURPOSE1 0x10
#define MIDI_CTL_MSB_GENERAL_PURPOSE2 0x11
#define MIDI_CTL_MSB_GENERAL_PURPOSE3 0x12
#define MIDI_CTL_MSB_GENERAL_PURPOSE4 0x13
#define MIDI_CTL_LSB_BANK 0x20
#define MIDI_CTL_LSB_MODWHEEL 0x21
#define MIDI_CTL_LSB_BREATH 0x22
#define MIDI_CTL_LSB_FOOT 0x24
#define MIDI_CTL_LSB_PORTAMENTO_TIME 0x25
#define MIDI_CTL_LSB_DATA_ENTRY 0x26
#define MIDI_CTL_LSB_MAIN_VOLUME 0x27
#define MIDI_CTL_LSB_BALANCE 0x28
#define MIDI_CTL_LSB_PAN 0x2a
#define MIDI_CTL_LSB_EXPRESSION 0x2b
#define MIDI_CTL_LSB_EFFECT1 0x2c
#define MIDI_CTL_LSB_EFFECT2 0x2d
#define MIDI_CTL_LSB_GENERAL_PURPOSE1 0x30
#define MIDI_CTL_LSB_GENERAL_PURPOSE2 0x31
#define MIDI_CTL_LSB_GENERAL_PURPOSE3 0x32
#define MIDI_CTL_LSB_GENERAL_PURPOSE4 0x33
#define MIDI_CTL_SUSTAIN 0x40
#define MIDI_CTL_PORTAMENTO 0x41
#define MIDI_CTL_SUSTENUTO 0x42
#define MIDI_CTL_SOFT_PEDAL 0x43
#define MIDI_CTL_LEGATO_FOOTSWITCH 0x44
#define MIDI_CTL_HOLD2 0x45
#define MIDI_CTL_SC1_SOUND_VARIATION 0x46
#define MIDI_CTL_SC2_TIMBRE 0x47
#define MIDI_CTL_SC3_RELEASE_TIME 0x48
#define MIDI_CTL_SC4_ATTACK_TIME 0x49
#define MIDI_CTL_SC5_BRIGHTNESS 0x4a
#define MIDI_CTL_SC6 0x4b
#define MIDI_CTL_SC7 0x4c
#define MIDI_CTL_SC8 0x4d
#define MIDI_CTL_SC9 0x4e
#define MIDI_CTL_SC10 0x4f
#define MIDI_CTL_GENERAL_PURPOSE5 0x50
#define MIDI_CTL_GENERAL_PURPOSE6 0x51
#define MIDI_CTL_GENERAL_PURPOSE7 0x52
#define MIDI_CTL_GENERAL_PURPOSE8 0x53
#define MIDI_CTL_PORTAMENTO_CONTROL 0x54
#define MIDI_CTL_E1_REVERB_DEPTH 0x5b
#define MIDI_CTL_E2_TREMOLO_DEPTH 0x5c
#define MIDI_CTL_E3_CHORUS_DEPTH 0x5d
#define MIDI_CTL_E4_DETUNE_DEPTH 0x5e
#define MIDI_CTL_E5_PHASER_DEPTH 0x5f
#define MIDI_CTL_DATA_INCREMENT 0x60
#define MIDI_CTL_DATA_DECREMENT 0x61
#define MIDI_CTL_NONREG_PARM_NUM_LSB 0x62
#define MIDI_CTL_NONREG_PARM_NUM_MSB 0x63
#define MIDI_CTL_REGIST_PARM_NUM_LSB 0x64
#define MIDI_CTL_REGIST_PARM_NUM_MSB 0x65
#define MIDI_CTL_ALL_SOUNDS_OFF 0x78
#define MIDI_CTL_RESET_CONTROLLERS 0x79
#define MIDI_CTL_LOCAL_CONTROL_SWITCH 0x7a
#define MIDI_CTL_ALL_NOTES_OFF 0x7b
#define MIDI_CTL_OMNI_OFF 0x7c
#define MIDI_CTL_OMNI_ON 0x7d
#define MIDI_CTL_MONO1 0x7e
#define MIDI_CTL_MONO2 0x7f
#endif /* __SOUND_ASOUNDEF_H */