/* EPS.H * Definitions and stuff for EPS SysEx messages. * * Copyright (C) 1991 by Andrew Arensburger. Permission is granted to * use, copy and/or distribute this file freely for non-commercial purposes, * as long as this notice remains intact. Any commercial use is prohibited * without express permission from the author. * * If you make any changes, fix bugs, etc., please send them to me that I * might coordinate fixes and improvements. */ #define DRR (!(inportb(MPU_STAT)&0x40)) /* MPU is ready to receive * data. */ #define DSR (!(inportb(MPU_STAT)&0x80)) /* MPU has data ready to * be read. */ #define BREATHER 3 /* Number of PC clock ticks to wait after * the completion of a command. I'm not * sure why this is necessary. */ #define SHORT_TIMEOUT 38 /* Number of PC clock ticks in a 2-second * timeout. */ #define LONG_TIMEOUT 540 /* Number of PC clock ticks in a 30-second * timeout. */ /* Command codes */ #define RESPONSE 0x01 /* Response to a received command */ #define CANCEL 0x02 /* Cancel current command */ #define GET_INST 0x03 /* Request for instrument parameters */ #define GET_LAYER 0x04 /* Request for layer parameters */ #define GET_WS 0x05 /* Request for wavesample parameters */ #define GET_WSDATA 0x06 /* Request for wavesample data */ #define GET_PITCHTAB 0x07 /* Request for pitch table data */ #define GET_PARAM 0x08 /* Request for a parameter value */ #define GET_WSOVER 0x0a /* Request for wavesample data overview */ #define PUT_INST 0x0c /* Instrument parameter block dump */ #define PUT_LAYER 0x0d /* Layer parameter block dump */ #define PUT_WS 0x0e /* Wavesample parameter block dump */ #define PUT_WSDATA 0x0f /* Wavesample data block dump */ #define PUT_PITCHTAB 0x10 /* Pitch table data block dump */ #define PUT_PARAM 0x11 /* Update a parameter value */ #define PUT_WSOVER 0x13 /* Wavesample data overview dump */ #define CRE_INST 0x15 /* Create a new instrument */ #define DEL_INST 0x1c /* Delete an instrument */ #define CPY_INST 0x12 /* Copy an instrument */ #define CRE_LAYER 0x16 /* Define a new layer */ #define DEL_LAYER 0x17 /* Undefine a layer */ #define CPY_LAYER 0x18 /* Copy a layer */ #define CRE_WS 0x19 /* Create a new wavesample */ #define DEL_WS 0x1a /* Undefine a wavesample */ #define CPY_WS 0x1b /* Copy wavesample parameters */ #define AUDITION 0x1d /* Audition old and new wavesamples */ #define BUTTON 0x40 /* Send a virtual button press */ #define CRE_PRESET 0x44 /* Create a preset */ #define TRUNC_WS 0x1e /* Delete unused wavesample data */ #define CLR_WDATA 0x1f /* Clear wavesample data */ #define CPY_WDATA 0x20 /* Copy wavesample data */ #define ADD_WDATA 0x21 /* Add source data to destination */ #define SCALE_WDATA 0x22 /* Scale data */ #define INV_WDATA 0x23 /* Invert wavesample data */ #define REV_WDATA 0x24 /* Reverse wavesample data */ #define REP_WDATA 0x25 /* Append wavesample data to itself */ #define CF_LOOP 0x26 /* Make a cross fade loop */ #define FIN_WDATA 0x27 /* Fade in the wavesample data */ #define FOUT_WDATA 0x28 /* Fade out the wavesample data */ #define REVCF_LOOP 0x29 /* Make a reverse cross fade loop */ #define ENSCF_LOOP 0x2a /* Make an ensemble cross fade loop */ #define BOWCF_LOOP 0x2b /* Make a bowtie cross fade loop */ #define LEN_LOOP 0x2c /* Lengthen loop */ #define MIX_WDATA 0x2d /* Mix source wavesample data into dest */ #define SPL_WDATA 0x2e /* Merge/splice wavedata */ #define VOL_SMOOTH 0x2f /* Volume smoothing */ #define NORM_GAIN 0x41 /* Normalize gain */ #define SYN_LOOP 0x42 /* Create a synthesized loop */ #define BIDCF_LOOP 0x43 /* Make a bidirectional cross fade loop */ /* Response codes */ #define ACK 0x00 /* Acknowledgement */ #define WAIT 0x01 /* Wait. Set timeout counter to 30 seconds */ /* Button codes */ #define BUT_INST_1 0 /* Instrument 1 */ #define BUT_INST_2 1 /* Instrument 2 */ #define BUT_INST_3 2 /* Instrument 3 */ #define BUT_INST_4 3 /* Instrument 4 */ #define BUT_INST_5 4 /* Instrument 5 */ #define BUT_INST_6 5 /* Instrument 6 */ #define BUT_INST_7 6 /* Instrument 7 */ #define BUT_INST_8 7 /* Instrument 8 */ #define BUT_SAMPLE 16 /* Sample */ #define BUT_COMMAND 17 /* Command mode */ #define BUT_KEY_RANGE 18 /* Key Range (instrument or wavesample) */ #define BUT_EDIT 19 /* Edit mode */ #define BUT_LOAD 20 /* Load mode */ #define BUT_MIDI 21 /* MIDI */ #define BUT_SEQSONG 22 /* Seq . Song */ #define BUT_INSTRUMENT 23 /* Instrument */ #define BUT_SYSTEM 24 /* System */ #define BUT_UARROW 32 /* Up arrow (increment) */ #define BUT_DARROW 33 /* Down arrow (decrement) */ #define BUT_LARROW 34 /* Left arrow (scroll left) */ #define BUT_NO 35 /* Cancel . No */ #define BUT_RARROW 36 /* Right arrow (scroll right) */ #define BUT_YES 37 /* Enter . Yes */ #define BUT_TRACK 48 /* 0 . Track */ #define BUT_0 48 #define BUT_ENV1 49 /* 1 . Env 1 */ #define BUT_1 49 #define BUT_ENV2 50 /* 2 . Env 2 */ #define BUT_2 50 #define BUT_ENV3 51 /* 3 . Env 3 */ #define BUT_3 51 #define BUT_PITCH 52 /* 4 . Pitch */ #define BUT_4 52 #define BUT_FILTER 53 /* 5 . Filter */ #define BUT_5 53 #define BUT_AMP 54 /* 6 . Amp */ #define BUT_6 54 #define BUT_LFO 55 /* 7 . LFO */ #define BUT_7 55 #define BUT_WAVE 56 /* 8 . Wave */ #define BUT_8 56 #define BUT_LAYER 57 /* 9 . Layer */ #define BUT_9 57 /* PARAMETER NUMBERS * These parameter numbers are the ones you should give to 'get_param()' * and 'put_param()'. If anyone is interested, the high byte of the * parameter number is the page number, and the low byte is the number * of the parameter within the page. */ /* System parameters */ #define PS_FSBLKS 0x0d00 /* Free system blocks */ #define PS_FDBLKS 0x0d01 /* Free disk blocks */ #define PS_MTUNE 0x0d02 /* Master tune */ #define PS_BENDRNG 0x0d03 /* Global bend range */ #define PS_TCHSENS 0x0d04 /* Touch sensitivity */ #define PS_MODPMODE 0x0d05 /* Mod pedal mode */ #define PS_SUSPMODE 0x0d06 /* Sustain pedal mode */ #define PS_AUXPMODE 0x0d07 /* Aux pedal mode */ #define PS_AUTOLOOP 0x0d08 /* Autoloop switch */ /* MIDI parameters */ #define PM_BASE 0x0c00 /* Base channel */ #define PM_XMITMODE 0x0c01 /* Transmit mode */ #define PM_CHPRMODE 0x0c02 /* Base channel pressure mode */ #define PM_INMODE 0x0c03 /* MIDI IN mode */ #define PM_CTRLENBL 0x0c04 /* Controller enable */ #define PM_SYSXENBL 0x0c05 /* SysEx enable */ #define PM_PROGENBL 0x0c06 /* Program change enable */ #define PM_SPOSENBL 0x0c07 /* Song position enable */ #define PM_XCTLENBL 0x0c08 /* XCTRL enable */ /* Instrument parameters */ #define PI_PATCH 0x0a00 /* Patch */ #define PI_KDLAYS 0x0a01 /* Key down layers */ #define PI_KULAYS 0x0a02 /* Key up layers */ #define PI_CHAN 0x0a03 /* MIDI channel */ #define PI_PROG 0x0a04 /* MIDI program */ #define PI_PRESMODE 0x0a05 /* Pressure mode */ #define PI_INSTSIZE 0x0a07 /* Instrument size */ #define PI_SENDKEYS 0x0a06 /* Send keys to */ #define PI_RNGLOW 0x0a0a /* Range low key */ #define PI_RNGHIGH 0x0a0b /* Range high key */ #define PI_XPOSOCT 0x0a0c /* Transpose amount: octave */ #define PI_XPOSSEMI 0x0a0d /* Transpose amount: semitone */ /* Layer parameters */ #define PL_GLIDMODE 0x0900 /* Glide mode */ #define PL_GLIDTIME 0x0901 /* Glide time */ #define PL_LEGLAY 0x0902 /* Legato layer */ #define PL_VELLOW 0x0903 /* Velocity low */ #define PL_VELHIGH 0x090a /* Velocity high */ #define PL_PTAB 0x0904 /* Pitch table */ /* Wavesample parameters */ #define PW_LOOPMODE 0x0800 /* Loop mode */ #define PL_LOOPMTYP 0x0806 /* Loop mod type */ #define PL_LOOPMSRC 0x0807 /* Loop mod source */ #define PL_LOOPMAMT1 0x0808 /* Loop mod amount 1 */ #define PL_LOOPMAMT2 0x0809 /* Loop mod amount 2 */ #define PL_WDSTART 0x0815 /* Wavedata start */ #define PL_WDEND 0x0816 /* Wavedata end */ #define PL_WDLSTART 0x0817 /* Loop start */ #define PL_WDLEND 0x0818 /* Loop end */ #define PL_WDLENDFR 0x080a /* Loop end fractional */ #define PL_KRNGLOW 0x080b /* Key range low */ #define PL_KRNGHIGH 0x080c /* Key range high */ #define PL_LOOPPOS 0x0819 /* Loop position */ #define PL_SMPLRATE 0x080d /* Sample rate */ /* Envelope 1 parameters */ #define PE1_TYPE 0x0100 /* Envelope type */ #define PE1_L0H 0x0101 /* Level 0 hard */ #define PE1_L0S 0x0102 /* Level 0 soft */ #define PE1_L1H 0x010b /* Level 1 hard */ #define PE1_L1S 0x010e /* Level 1 soft */ #define PE1_L2H 0x010c /* Level 2 hard */ #define PE1_L2S 0x0110 /* Level 2 soft */ #define PE1_L3H 0x010d /* Level 3 hard */ #define PE1_L3S 0x0111 /* Level 3 soft */ #define PE1_L4H 0x010e /* Level 4 hard */ #define PE1_L4S 0x0112 /* Level 4 soft */ #define PE1_T1 0x0103 /* Time 1 */ #define PE1_T2 0x0113 /* Time 2 */ #define PE1_T3 0x0114 /* Time 3 */ #define PE1_T4 0x0115 /* Time 4 */ #define PE1_T5 0x0116 /* Time 5 */ #define PE1_2RELT 0x0104 /* 2nd release time */ #define PE1_2RELL 0x0117 /* 2nd release level */ #define PE1_ATTVEL 0x0105 /* Attack time velocity */ #define PE1_KBDSCAL 0x0106 /* Keyboard scaling */ #define PE1_SVEL 0x0107 /* Soft velocity on/off */ #define PE1_ENVMODE 0x0108 /* Envelope mode */ /* Envelope 2 parameters */ #define PE2_TYPE 0x0200 /* Envelope type */ #define PE2_L0H 0x0201 /* Level 0 hard */ #define PE2_L0S 0x0202 /* Level 0 soft */ #define PE2_L1H 0x020b /* Level 1 hard */ #define PE2_L1S 0x020e /* Level 1 soft */ #define PE2_L2H 0x020c /* Level 2 hard */ #define PE2_L2S 0x0210 /* Level 2 soft */ #define PE2_L3H 0x020d /* Level 3 hard */ #define PE2_L3S 0x0211 /* Level 3 soft */ #define PE2_L4H 0x020e /* Level 4 hard */ #define PE2_L4S 0x0212 /* Level 4 soft */ #define PE2_T1 0x0203 /* Time 1 */ #define PE2_T2 0x0213 /* Time 2 */ #define PE2_T3 0x0214 /* Time 3 */ #define PE2_T4 0x0215 /* Time 4 */ #define PE2_T5 0x0216 /* Time 5 */ #define PE2_2RELT 0x0204 /* 2nd release time */ #define PE2_2RELL 0x0217 /* 2nd release level */ #define PE2_ATTVEL 0x0205 /* Attack time velocity */ #define PE2_KBDSCAL 0x0206 /* Keyboard scaling */ #define PE2_SVEL 0x0207 /* Soft velocity on/off */ #define PE2_ENVMODE 0x0208 /* Envelope mode */ /* Envelope 3 parameters */ #define PE3_TYPE 0x0300 /* Envelope type */ #define PE3_L0H 0x0301 /* Level 0 hard */ #define PE3_L0S 0x0302 /* Level 0 soft */ #define PE3_L1H 0x030b /* Level 1 hard */ #define PE3_L1S 0x030e /* Level 1 soft */ #define PE3_L2H 0x030c /* Level 2 hard */ #define PE3_L2S 0x0310 /* Level 2 soft */ #define PE3_L3H 0x030d /* Level 3 hard */ #define PE3_L3S 0x0311 /* Level 3 soft */ #define PE3_L4H 0x030e /* Level 4 hard */ #define PE3_L4S 0x0312 /* Level 4 soft */ #define PE3_T1 0x0303 /* Time 1 */ #define PE3_T2 0x0313 /* Time 2 */ #define PE3_T3 0x0314 /* Time 3 */ #define PE3_T4 0x0315 /* Time 4 */ #define PE3_T5 0x0316 /* Time 5 */ #define PE3_2RELT 0x0304 /* 2nd release time */ #define PE3_2RELL 0x0317 /* 2nd release level */ #define PE3_ATTVEL 0x0305 /* Attack time velocity */ #define PE3_KBDSCAL 0x0306 /* Keyboard scaling */ #define PE3_SVEL 0x0307 /* Soft velocity on/off */ #define PE3_ENVMODE 0x0308 /* Envelope mode */ /* Pitch parameters */ #define PP_ROOT 0x0401 /* Root key */ #define PP_FINETUNE 0x040a /* Fine tune */ #define PP_LFOAMT 0x0402 /* LFO amount */ #define PP_ENV1AMT 0x0403 /* Envelope 1 amount */ #define PP_RNDFREQ 0x0405 /* Random frequency */ #define PP_RNDAMT 0x040c /* Random amount */ #define PP_BENDRNG 0x0406 /* Bend range */ #define PP_MODSRC 0x0407 /* Modulation source */ #define PP_MODAMT 0x040b /* Modulation amount */ /* Filter parameters */ #define PF_MODE 0x0500 /* Filter mode */ #define PF_1CUTOFF 0x0501 /* Filter 1 cutoff */ #define PF_2CUTOFF 0x050b /* Filter 2 cutoff */ #define PF_1E2AMT 0x0502 /* Filter 1 envelope 2 amount */ #define PF_2E2AMT 0x050c /* Filter 2 envelope 2 amount */ #define PF_1KBDAMT 0x0503 /* Filter 1 keyboard amount */ #define PF_2KBDAMT 0x050d /* Filter 2 keyboard amount */ #define PF_1MODSRC 0x0507 /* Filter 1 modulation source */ #define PF_1MODAMT 0x050e /* Filter 1 modulation amount */ #define PF_2MODSRC 0x0508 /* Filter 2 modulation source */ #define PF_2MODAMT 0x050f /* Filter 2 modulation amount */ /* Volume parameters */ #define PV_WSVOL 0x0601 /* Wavesample volume */ #define PV_PAN 0x0602 /* Pan */ #define PV_MODA 0x0603 /* Modulation A */ #define PV_MODB 0x060b /* Modulation B */ #define PV_MODC 0x0604 /* Modulation C */ #define PV_MODD 0x060c /* Modulation D */ #define PV_MODSRC 0x0607 /* Modulation source */ #define PV_MODAMT 0x060a /* Modulation amount */ /* LFO parameters */ #define PLFO_WAVE 0x0701 /* LFO wave */ #define PLFO_SPEED 0x0702 /* LFO speed */ #define PLFO_DEPTH 0x0703 /* LFO speed */ #define PLFO_DELAY 0x0704 /* LFO delay */ #define PLFO_MODE 0x0705 /* LFO mode */ #define PLFO_MODSRC 0x0707 /* LFO modulation source */ /* Edit parameters */ #define PED_INST 0x0e00 /* Instrument */ #define PED_LAY 0x0e01 /* Layer */ #define PED_WS 0x0e02 /* Wavesample */ typedef unsigned char uchar; typedef unsigned short ushort; typedef unsigned long ulong; /* Data transfer structures */ typedef struct edit_spec { /* This structure uniquely identifies * a wavesample within an instrument */ int inst_num; /* Instrument number */ int layer_num; /* Layer number */ int ws_num; /* Wavesample number */ } edit_spec; typedef struct inst_par { /* Instrument parameters */ char name[12]; /* Name */ uchar midi_chan; /* MIDI channel (outbound) */ ushort midi_prog; /* MIDI program number (outbound) */ ushort midi_pres; /* MIDI pressure (outbound) */ ushort size; /* Total instrument size (blocks) */ ushort key_dest; /* Key destination (LOCAL, MIDI, BOTH) */ ushort patches[4]; /* Bitmaps of patch layers */ ushort down_layers; /* Bitmap of key down layers */ ushort up_layers; /* Bitmap of key up layers */ ushort low_key; /* Key range: low key */ ushort high_key; /* Key range: high key */ ushort transpose; /* Transposition (in semitones) */ ushort pitch_off[16]; /* Pitch table offsets */ ushort layer_off[16]; /* Layer offsets */ ushort ws_off[256]; /* Wavesample offsets */ } inst_par; typedef struct layer_par { /* Layer parameters */ char name[12]; /* Layer name */ ushort glidemode; /* Glide mode */ ushort glidetime; /* Glide time */ ushort legato_lay; /* Legato layer number */ ushort low_vel; /* Velocity low */ ushort high_vel; /* Velocity high */ ushort pitch_tab; /* Pitch table number */ ushort layermap[88]; /* Layer map (one wavesample number per * key in high byte. */ } layer_par; typedef struct envelope { /* Wavesample envelope description */ ushort env_type; /* Envelope type (default envelopes) */ ushort soft_lev[5]; /* Soft levels */ ushort hard_lev[5]; /* Hard levels */ ushort times[6]; /* Times (includes 2nd release time) */ ushort vel_switch; /* Velocity switch - soft level on/off */ ushort rel_bkpt; /* Release breakpoint rel. to sustain level */ ushort vel_sens; /* Time 1 velocity sensitivity */ ushort time_scal; /* Keyboard time scaling */ ushort mode; /* Mode */ } envelope; typedef struct ws_par { /* Wavesample parameters */ char name[12]; /* Wavesample name */ ushort cp_num; /* Wavesample copy number */ ushort cp_lay; /* Wavesample copy layer */ envelope pitch_env; /* Pitch envelope #1 */ envelope filter_env; /* Filter envelope #2 */ envelope amp_env; /* Amplitude envelope #3 */ ushort root; /* Root key - MIDI key number */ ushort penv_amt; /* Pitch envelope amount */ ushort lfo_amt; /* LFO amount */ ushort randmod_amt; /* Random modulation amount */ ushort bend_rng; /* Pitch wheel bend range */ ushort mod_src; /* Modulation source */ ushort finetune; /* Fine tune - signed 7 bit fraction */ ushort mod_amt; /* Modulation amount */ ushort filter_mode; /* Filter mode */ ushort fc1_cut; /* FC #1 cutoff */ ushort fc2_cut; /* FC #2 cutoff */ ushort fc1_kbd; /* FC #1 keyboard amount */ ushort fc2_kbd; /* FC #2 keyboard amount */ ushort fc1_filter; /* FC #1 filter envelope amount */ ushort fc2_filter; /* FC #2 filter envelope amount */ ushort fc1_modsrc; /* FC #1 modulation source */ ushort fc2_modsrc; /* FC #2 modulation source */ ushort fc1_modamt; /* FC #1 modulation amount */ ushort fc2_modamt; /* FC #2 modulation amount */ ushort volume; /* Volume */ ushort amod_src; /* Amplitude modulation source */ ushort acc_a; /* Amplitude crossfade curve point A */ ushort acc_b; /* Amplitude crossfade curve point B */ ushort acc_c; /* Amplitude crossfade curve point C */ ushort acc_d; /* Amplitude crossfade curve point D */ ushort pan_pos; /* Pan position - including separate out */ ushort amod_amt; /* Amplitude modulation amount */ ushort lfo_wave; /* LFO waveform */ ushort lfo_speed; /* LFO speed */ ushort lfo_depth; /* LFO depth */ ushort lfo_delay; /* LFO delay time */ ushort lfo_modsrc; /* LFO modulatio source */ ushort lfo_mode; /* LFO mode */ ushort randmod_freq; /* Random modulator frequency */ ushort loopmode; /* Loop mode */ ulong sstart_off; /* Sample start offset */ ulong send_off; /* Sample end offset */ ulong lstart_off; /* Loop start offset */ ulong lend_off; /* Loop end offset */ ushort rate; /* Sample rate */ ushort low_range; /* Key range - low key */ ushort high_range; /* Key range - high key */ ushort sl_modsrc; /* Start or loop modulation source */ ushort sl_modamt; /* Start or loop modulation amount */ ushort sl_modrng; /* Start or loop modulation range */ ushort mod_type; /* Modulation type */ } ws_par; typedef struct pitch_tab { /* Pitch table */ char name[12]; /* Name */ ushort semi[88]; /* Semitones */ ushort fract[88]; /* Semitone fractions */ } pitch_tab; #ifndef EPS_GLOBAL extern unsigned long *pc_clock; extern int last_response; extern char *err_msgs[]; extern int timeout(); /* Wait for a timeout or for data to come in */ extern send12(); /* Send a 12-bit word */ extern ushort recv12(); /* Receive a 12-bit word */ extern send16(); /* Send a 16-bit word */ extern ushort recv16(); /* Receive a 16-bit word */ extern send_off(); /* Send a 20-bit offset */ extern ulong recv_off();/* Receive a 20-bit offset */ extern send_head(); /* Send the head of a SysEx message */ extern send_tail(); /* Send the tail of a SysEx message */ extern int recv_head(); /* Receive the head of a SysEx message */ extern int recv_tail(); /* Receive the tail of a SysEx message */ extern send_response(); /* Send a 'Response' message */ extern int recv_response(); /* Receive a 'Response' message */ extern int push_button(); /* Push a button */ extern wait(); /* Wait for a number of PC clock ticks */ #endif