summaryrefslogtreecommitdiffstats
path: root/include/linux/awe_voice.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1997-12-06 23:51:34 +0000
committerRalf Baechle <ralf@linux-mips.org>1997-12-06 23:51:34 +0000
commit230e5ab6a084ed50470f101934782dbf54b0d06b (patch)
tree5dd821c8d33f450470588e7a543f74bf74306e9e /include/linux/awe_voice.h
parentc9b1c8a64c6444d189856f1e26bdcb8b4cd0113a (diff)
Merge with Linux 2.1.67.
Diffstat (limited to 'include/linux/awe_voice.h')
-rw-r--r--include/linux/awe_voice.h292
1 files changed, 222 insertions, 70 deletions
diff --git a/include/linux/awe_voice.h b/include/linux/awe_voice.h
index cdfb0ff2e..aa1313131 100644
--- a/include/linux/awe_voice.h
+++ b/include/linux/awe_voice.h
@@ -3,7 +3,7 @@
*
* Voice information definitions for the low level driver for the
* AWE32/Sound Blaster 32 wave table synth.
- * version 0.3.1b; Jan. 21, 1997
+ * version 0.4.2c; Oct. 7, 1997
*
* Copyright (C) 1996,1997 Takashi Iwai
*
@@ -44,14 +44,19 @@ typedef struct awe_patch_info {
short device_no; /* synthesizer number */
unsigned short sf_id; /* file id (should be zero) */
- short sf_version; /* patch version (not referred) */
- long len; /* data length (without this header) */
-
- short type; /* following data type */
-#define AWE_LOAD_INFO 0
-#define AWE_LOAD_DATA 1
-#define AWE_APPEND_DATA 0x00
-#define AWE_REPLACE_DATA 0x80
+ short optarg; /* optional argument */
+ int len; /* data length (without this header) */
+
+ short type; /* patch operation type */
+#define AWE_LOAD_INFO 0 /* awe_voice_rec */
+#define AWE_LOAD_DATA 1 /* awe_sample_info */
+#define AWE_OPEN_PATCH 2 /* awe_open_parm */
+#define AWE_CLOSE_PATCH 3 /* none */
+#define AWE_UNLOAD_PATCH 4 /* none */
+#define AWE_REPLACE_DATA 5 /* awe_sample_info (optarg=#channels)*/
+#define AWE_MAP_PRESET 6 /* awe_voice_map */
+#define AWE_LOAD_CHORUS_FX 0x10 /* awe_chorus_fx_rec (optarg=mode) */
+#define AWE_LOAD_REVERB_FX 0x11 /* awe_reverb_fx_rec (optarg=mode) */
short reserved; /* word alignment data */
@@ -61,7 +66,35 @@ typedef struct awe_patch_info {
#endif
} awe_patch_info;
-#define AWE_PATCH_INFO_SIZE 16
+/*#define AWE_PATCH_INFO_SIZE 16*/
+#define AWE_PATCH_INFO_SIZE sizeof(awe_patch_info)
+
+
+/*----------------------------------------------------------------
+ * open patch
+ *----------------------------------------------------------------*/
+
+#define AWE_PATCH_NAME_LEN 32
+
+typedef struct _awe_open_parm {
+ unsigned short type; /* sample type */
+#define AWE_PAT_TYPE_MISC 0
+#define AWE_PAT_TYPE_GM 1
+#define AWE_PAT_TYPE_GS 2
+#define AWE_PAT_TYPE_MT32 3
+#define AWE_PAT_TYPE_XG 4
+#define AWE_PAT_TYPE_SFX 5
+#define AWE_PAT_TYPE_GUS 6
+#define AWE_PAT_TYPE_MAP 7
+
+#define AWE_PAT_LOCKED 0x100 /* lock the samples */
+
+ short reserved;
+ char name[AWE_PATCH_NAME_LEN];
+} awe_open_parm;
+
+/*#define AWE_OPEN_PARM_SIZE 28*/
+#define AWE_OPEN_PARM_SIZE sizeof(awe_open_parm)
/*----------------------------------------------------------------
@@ -100,8 +133,8 @@ typedef struct _awe_voice_parm {
typedef struct _awe_voice_info {
unsigned short sf_id; /* file id (should be zero) */
unsigned short sample; /* sample id */
- long start, end; /* sample offset correction */
- long loopstart, loopend; /* loop offset correction */
+ int start, end; /* sample offset correction */
+ int loopstart, loopend; /* loop offset correction */
short rate_offset; /* sample rate pitch offset */
unsigned short mode; /* sample mode */
#define AWE_MODE_ROMSOUND 0x8000
@@ -124,7 +157,8 @@ typedef struct _awe_voice_info {
short index; /* internal index (set by driver) */
} awe_voice_info;
-#define AWE_VOICE_INFO_SIZE 92
+/*#define AWE_VOICE_INFO_SIZE 92*/
+#define AWE_VOICE_INFO_SIZE sizeof(awe_voice_info)
/*----------------------------------------------------------------*/
@@ -134,24 +168,44 @@ typedef struct _awe_voice_info {
* from older versions.
* Use AWE_VOICE_REC_SIZE instead.
*/
+
+/* instrument info header: 4 bytes */
+typedef struct _awe_voice_rec_hdr {
+ unsigned char bank; /* midi bank number */
+ unsigned char instr; /* midi preset number */
+ char nvoices; /* number of voices */
+ char write_mode; /* write mode; normally 0 */
+#define AWE_WR_APPEND 0 /* append anyway */
+#define AWE_WR_EXCLUSIVE 1 /* skip if already exists */
+#define AWE_WR_REPLACE 2 /* replace if already exists */
+} awe_voice_rec_hdr;
+
+/*#define AWE_VOICE_REC_SIZE 4*/
+#define AWE_VOICE_REC_SIZE sizeof(awe_voice_rec_hdr)
+
+/* the standard patch structure for one sample */
+typedef struct _awe_voice_rec_patch {
+ awe_patch_info patch;
+ awe_voice_rec_hdr hdr;
+ awe_voice_info info;
+} awe_voice_rec_patch;
+
+
+/* obsolete data type */
#if defined(AWE_COMPAT_030) && AWE_COMPAT_030
#define AWE_INFOARRAY_SIZE 0
#else
#define AWE_INFOARRAY_SIZE 1
#endif
-/* instrument info header: 4 bytes */
typedef struct _awe_voice_rec {
unsigned char bank; /* midi bank number */
unsigned char instr; /* midi preset number */
short nvoices; /* number of voices */
-
/* voice information follows here */
awe_voice_info info[AWE_INFOARRAY_SIZE];
} awe_voice_rec;
-#define AWE_VOICE_REC_SIZE 4
-
/*----------------------------------------------------------------
* sample wave information
@@ -161,9 +215,9 @@ typedef struct _awe_voice_rec {
typedef struct awe_sample_info {
unsigned short sf_id; /* file id (should be zero) */
unsigned short sample; /* sample id */
- long start, end; /* start & end offset */
- long loopstart, loopend; /* loop start & end offset */
- long size; /* size (0 = ROM) */
+ int start, end; /* start & end offset */
+ int loopstart, loopend; /* loop start & end offset */
+ int size; /* size (0 = ROM) */
short checksum_flag; /* use check sum = 1 */
unsigned short mode_flags; /* mode flags */
#define AWE_SAMPLE_8BITS 1 /* wave data is 8bits */
@@ -174,36 +228,31 @@ typedef struct awe_sample_info {
#define AWE_SAMPLE_STEREO_LEFT 32 /* stereo left sound */
#define AWE_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */
#define AWE_SAMPLE_REVERSE_LOOP 128 /* reverse looping */
- unsigned long checksum; /* check sum */
+ unsigned int checksum; /* check sum */
#if defined(AWE_COMPAT_030) && AWE_COMPAT_030
unsigned short data[0]; /* sample data follows here */
#endif
} awe_sample_info;
-#define AWE_SAMPLE_INFO_SIZE 32
+/*#define AWE_SAMPLE_INFO_SIZE 32*/
+#define AWE_SAMPLE_INFO_SIZE sizeof(awe_sample_info)
/*----------------------------------------------------------------
- * awe hardware controls
+ * voice preset mapping
*----------------------------------------------------------------*/
-typedef struct _awe_mode_rec {
- int base_addr;
- long mem_size; /* word size */
- int max_voices, max_infos, max_samples;
- unsigned short current_sf_id;
- long free_mem; /* word offset */
- int free_info;
- int free_sample;
- short reverb_mode;
- short chorus_mode;
- unsigned short init_atten;
- short channel_mode;
- short gus_bank;
- short exclusive_sound;
- unsigned long drum_flags;
- int debug_mode;
-} awe_mode_rec;
+typedef struct awe_voice_map {
+ int map_bank, map_instr, map_key; /* key = -1 means all keys */
+ int src_bank, src_instr, src_key;
+} awe_voice_map;
+
+#define AWE_VOICE_MAP_SIZE sizeof(awe_voice_map)
+
+
+/*----------------------------------------------------------------
+ * awe hardware controls
+ *----------------------------------------------------------------*/
#define _AWE_DEBUG_MODE 0x00
#define _AWE_REVERB_MODE 0x01
@@ -214,56 +263,116 @@ typedef struct _awe_mode_rec {
#define _AWE_TERMINATE_CHANNEL 0x06
#define _AWE_TERMINATE_ALL 0x07
#define _AWE_INITIAL_VOLUME 0x08
-#define _AWE_SET_GUS_BANK 0x09
-#define _AWE_CHANNEL_MODE 0x0a /* v0.3 features */
-#define _AWE_DRUM_CHANNELS 0x0b /* v0.3 features */
-#define _AWE_EXCLUSIVE_SOUND 0x0c /* v0.3 features */
#define _AWE_INITIAL_ATTEN _AWE_INITIAL_VOLUME
+#define _AWE_RESET_CHANNEL 0x09
+#define _AWE_CHANNEL_MODE 0x0a
+#define _AWE_DRUM_CHANNELS 0x0b
+#define _AWE_MISC_MODE 0x0c
+#define _AWE_RELEASE_ALL 0x0d
#define _AWE_NOTEOFF_ALL 0x0e
-#define _AWE_GET_CURRENT_MODE 0x10 /* v0.3 features */
+#define _AWE_CHN_PRESSURE 0x0f
+/*#define _AWE_GET_CURRENT_MODE 0x10*/
+#define _AWE_EQUALIZER 0x11
+/*#define _AWE_GET_MISC_MODE 0x12*/
+/*#define _AWE_GET_FONTINFO 0x13*/
#define _AWE_MODE_FLAG 0x80
#define _AWE_COOKED_FLAG 0x40 /* not supported */
#define _AWE_MODE_VALUE_MASK 0x3F
-#define _AWE_CMD(chn, voice, cmd, p1, p2) \
-{_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr] = SEQ_PRIVATE;\
- _seqbuf[_seqbufptr+1] = chn;\
- _seqbuf[_seqbufptr+2] = _AWE_MODE_FLAG|(cmd);\
- _seqbuf[_seqbufptr+3] = voice;\
- *(unsigned short*)&_seqbuf[_seqbufptr+4] = p1;\
- *(unsigned short*)&_seqbuf[_seqbufptr+6] = p2;\
+/*----------------------------------------------------------------*/
+
+#define _AWE_SET_CMD(p,dev,voice,cmd,p1,p2) \
+{((char*)(p))[0] = SEQ_PRIVATE;\
+ ((char*)(p))[1] = dev;\
+ ((char*)(p))[2] = _AWE_MODE_FLAG|(cmd);\
+ ((char*)(p))[3] = voice;\
+ ((unsigned short*)(p))[2] = p1;\
+ ((unsigned short*)(p))[3] = p2;}
+
+/* buffered access */
+#define _AWE_CMD(dev, voice, cmd, p1, p2) \
+{_SEQ_NEEDBUF(8);\
+ _AWE_SET_CMD(_seqbuf + _seqbufptr, dev, voice, cmd, p1, p2);\
_SEQ_ADVBUF(8);}
+/* direct access */
+#define _AWE_CMD_NOW(seqfd,dev,voice,cmd,p1,p2) \
+{struct seq_event_rec tmp;\
+ _AWE_SET_CMD(&tmp, dev, voice, cmd, p1, p2);\
+ ioctl(seqfd, SNDCTL_SEQ_OUTOFBAND, &tmp);}
+
+/*----------------------------------------------------------------*/
+
+/* set debugging mode */
#define AWE_DEBUG_MODE(dev,p1) _AWE_CMD(dev, 0, _AWE_DEBUG_MODE, p1, 0)
+/* set reverb mode; from 0 to 7 */
#define AWE_REVERB_MODE(dev,p1) _AWE_CMD(dev, 0, _AWE_REVERB_MODE, p1, 0)
+/* set chorus mode; from 0 to 7 */
#define AWE_CHORUS_MODE(dev,p1) _AWE_CMD(dev, 0, _AWE_CHORUS_MODE, p1, 0)
-#define AWE_REMOVE_LAST_SAMPLES(dev) _AWE_CMD(dev, 0, _AWE_REMOVE_LAST_SAMPLES, 0, 0)
-#define AWE_INITIALIZE_CHIP(dev) _AWE_CMD(dev, 0, _AWE_INITIALIZE_CHIP, 0, 0)
+
+/* reset channel */
+#define AWE_RESET_CHANNEL(dev,ch) _AWE_CMD(dev, ch, _AWE_RESET_CHANNEL, 0, 0)
+#define AWE_RESET_CONTROL(dev,ch) _AWE_CMD(dev, ch, _AWE_RESET_CHANNEL, 1, 0)
+
+/* send an effect to all layers */
#define AWE_SEND_EFFECT(dev,voice,type,value) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,type,value)
+#define AWE_ADD_EFFECT(dev,voice,type,value) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,((type)|0x80),value)
+#define AWE_UNSET_EFFECT(dev,voice,type) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,((type)|0x40),0)
+/* send an effect to a layer */
+#define AWE_SEND_LAYER_EFFECT(dev,voice,layer,type,value) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,((layer+1)<<8|(type)),value)
+#define AWE_ADD_LAYER_EFFECT(dev,voice,layer,type,value) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,((layer+1)<<8|(type)|0x80),value)
+#define AWE_UNSET_LAYER_EFFECT(dev,voice,layer,type) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,((layer+1)<<8|(type)|0x40),0)
+
+/* terminate sound on the channel/voice */
#define AWE_TERMINATE_CHANNEL(dev,voice) _AWE_CMD(dev,voice,_AWE_TERMINATE_CHANNEL,0,0)
+/* terminate all sounds */
#define AWE_TERMINATE_ALL(dev) _AWE_CMD(dev, 0, _AWE_TERMINATE_ALL, 0, 0)
+/* release all sounds (w/o sustain effect) */
+#define AWE_RELEASE_ALL(dev) _AWE_CMD(dev, 0, _AWE_RELEASE_ALL, 0, 0)
+/* note off all sounds (w sustain effect) */
#define AWE_NOTEOFF_ALL(dev) _AWE_CMD(dev, 0, _AWE_NOTEOFF_ALL, 0, 0)
+
+/* set initial attenuation */
#define AWE_INITIAL_VOLUME(dev,atten) _AWE_CMD(dev, 0, _AWE_INITIAL_VOLUME, atten, 0)
#define AWE_INITIAL_ATTEN AWE_INITIAL_VOLUME
-#define AWE_SET_GUS_BANK(dev,bank) _AWE_CMD(dev, 0, _AWE_SET_GUS_BANK, bank, 0)
-#define AWE_SET_CHANNEL_MODE(dev,mode) _AWE_CMD(dev, 0, _AWE_CHANNEL_MODE, mode, 0)
-#define AWE_DRUM_CHANNELS(dev,channels) _AWE_CMD(dev, 0, _AWE_DRUM_CHANNELS, channels, 0)
-#define AWE_EXCLUSIVE_SOUND(dev,mode) _AWE_CMD(dev, 0, _AWE_EXCLUSIVE_SOUND, mode, 0)
+/* relative attenuation */
+#define AWE_SET_ATTEN(dev,atten) _AWE_CMD(dev, 0, _AWE_INITIAL_VOLUME, atten, 1)
-/* it must be direct access */
-#define AWE_GET_CURRENT_MODE(dev,addr) \
-{char tmpbuf[8];\
- tmpbuf[0] = SEQ_PRIVATE; tmpbuf[1] = dev;\
- tmpbuf[2] = _AWE_MODE_FLAG|_AWE_GET_CURRENT_MODE;\
- tmpbuf[3] = 0; *(awe_mode_rec**)(tmpbuf +4) = (awe_mode_rec*)(addr);\
- write(seqfd, tmpbuf, 8);}
+/* set channel playing mode; mode=0/1/2 */
+#define AWE_SET_CHANNEL_MODE(dev,mode) _AWE_CMD(dev, 0, _AWE_CHANNEL_MODE, mode, 0)
+#define AWE_PLAY_INDIRECT 0 /* indirect voice mode (default) */
+#define AWE_PLAY_MULTI 1 /* multi note voice mode */
+#define AWE_PLAY_DIRECT 2 /* direct single voice mode */
+#define AWE_PLAY_MULTI2 3 /* sequencer2 mode; used internally */
+
+/* set drum channel mask; channels is 32bit long value */
+#define AWE_DRUM_CHANNELS(dev,channels) _AWE_CMD(dev, 0, _AWE_DRUM_CHANNELS, ((channels) & 0xffff), ((channels) >> 16))
+
+/* set bass and treble control; values are from 0 to 11 */
+#define AWE_EQUALIZER(dev,bass,treble) _AWE_CMD(dev, 0, _AWE_EQUALIZER, bass, treble)
+
+/* remove last loaded samples */
+#define AWE_REMOVE_LAST_SAMPLES(seqfd,dev) _AWE_CMD_NOW(seqfd, dev, 0, _AWE_REMOVE_LAST_SAMPLES, 0, 0)
+/* initialize emu8000 chip */
+#define AWE_INITIALIZE_CHIP(seqfd,dev) _AWE_CMD_NOW(seqfd, dev, 0, _AWE_INITIALIZE_CHIP, 0, 0)
+
+/* set miscellaneous modes; meta command */
+#define AWE_MISC_MODE(dev,mode,value) _AWE_CMD(dev, 0, _AWE_MISC_MODE, mode, value)
+/* exclusive sound off; 1=off */
+#define AWE_EXCLUSIVE_SOUND(dev,mode) AWE_MISC_MODE(dev,AWE_MD_EXCLUSIVE_SOUND,mode)
+/* default GUS bank number */
+#define AWE_SET_GUS_BANK(dev,bank) AWE_MISC_MODE(dev,AWE_MD_GUS_BANK,bank)
+/* change panning position in realtime; 0=don't 1=do */
+#define AWE_REALTIME_PAN(dev,mode) AWE_MISC_MODE(dev,AWE_MD_REALTIME_PAN,mode)
/* extended pressure controls; not portable with other sound drivers */
#define AWE_KEY_PRESSURE(dev,ch,note,vel) SEQ_START_NOTE(dev,ch,(note)+128,vel)
-#define AWE_CHN_PRESSURE(dev,ch,vel) SEQ_START_NOTE(dev,(ch)+128,0,vel)
+#define AWE_CHN_PRESSURE(dev,ch,vel) _AWE_CMD(dev,ch,_AWE_CHN_PRESSURE,vel,0)
-/* reverb mode */
+/*----------------------------------------------------------------*/
+
+/* reverb mode parameters */
#define AWE_REVERB_ROOM1 0
#define AWE_REVERB_ROOM2 1
#define AWE_REVERB_ROOM3 2
@@ -272,8 +381,17 @@ typedef struct _awe_mode_rec {
#define AWE_REVERB_PLATE 5
#define AWE_REVERB_DELAY 6
#define AWE_REVERB_PANNINGDELAY 7
+#define AWE_REVERB_PREDEFINED 8
+/* user can define reverb modes up to 32 */
+#define AWE_REVERB_NUMBERS 32
+
+typedef struct awe_reverb_fx_rec {
+ unsigned short parms[28];
+} awe_reverb_fx_rec;
+
+/*----------------------------------------------------------------*/
-/* chorus mode */
+/* chorus mode parameters */
#define AWE_CHORUS_1 0
#define AWE_CHORUS_2 1
#define AWE_CHORUS_3 2
@@ -282,8 +400,42 @@ typedef struct _awe_mode_rec {
#define AWE_CHORUS_FLANGER 5
#define AWE_CHORUS_SHORTDELAY 6
#define AWE_CHORUS_SHORTDELAY2 7
+#define AWE_CHORUS_PREDEFINED 8
+/* user can define chorus modes up to 32 */
+#define AWE_CHORUS_NUMBERS 32
+
+typedef struct awe_chorus_fx_rec {
+ unsigned short feedback; /* feedback level (0xE600-0xE6FF) */
+ unsigned short delay_offset; /* delay (0-0x0DA3) [1/44100 sec] */
+ unsigned short lfo_depth; /* LFO depth (0xBC00-0xBCFF) */
+ unsigned int delay; /* right delay (0-0xFFFFFFFF) [1/256/44100 sec] */
+ unsigned int lfo_freq; /* LFO freq LFO freq (0-0xFFFFFFFF) */
+} awe_chorus_fx_rec;
+
+/*----------------------------------------------------------------*/
-/* effects */
+/* misc mode types */
+enum {
+/* 0*/ AWE_MD_EXCLUSIVE_OFF, /* obsolete */
+/* 1*/ AWE_MD_EXCLUSIVE_ON, /* obsolete */
+/* 2*/ AWE_MD_VERSION, /* read only */
+/* 3*/ AWE_MD_EXCLUSIVE_SOUND, /* ignored */
+/* 4*/ AWE_MD_REALTIME_PAN, /* 0/1: do realtime pan change (default=1) */
+/* 5*/ AWE_MD_GUS_BANK, /* bank number for GUS patches (default=0) */
+/* 6*/ AWE_MD_KEEP_EFFECT, /* 0/1: keep effect values, (default=0) */
+/* 7*/ AWE_MD_ZERO_ATTEN, /* attenuation of max volume (default=32) */
+/* 8*/ AWE_MD_CHN_PRIOR, /* 0/1: set MIDI channel priority mode (default=1) */
+/* 9*/ AWE_MD_MOD_SENSE, /* integer: modwheel sensitivity (def=18) */
+/*10*/ AWE_MD_DEF_PRESET, /* integer: default preset number (def=0) */
+/*11*/ AWE_MD_DEF_BANK, /* integer: default bank number (def=0) */
+/*12*/ AWE_MD_DEF_DRUM, /* integer: default drumset number (def=0) */
+/*13*/ AWE_MD_TOGGLE_DRUM_BANK, /* 0/1: toggle drum flag with bank# (def=0) */
+ AWE_MD_END,
+};
+
+/*----------------------------------------------------------------*/
+
+/* effect parameters */
enum {
/* modulation envelope parameters */
@@ -330,9 +482,9 @@ enum {
/*30*/ AWE_FX_COARSE_SAMPLE_START, /* SHORT: upper word offset */
/*31*/ AWE_FX_COARSE_LOOP_START, /* SHORT: upper word offset */
/*32*/ AWE_FX_COARSE_LOOP_END, /* SHORT: upper word offset */
+/*33*/ AWE_FX_ATTEN, /* BYTE: lo IFATN */
AWE_FX_END,
};
-
#endif /* AWE_VOICE_H */