[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | swinit.c -- MIDAS-VII -- more variable definitions and initializations
|
---|
| 4 | Version 12 -- 1988-10-12 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #define FET_DEFS 1 /* so fields.h gets things right */
|
---|
| 9 |
|
---|
| 10 | #include "stddefs.h"
|
---|
| 11 | #include "scwheel.h"
|
---|
| 12 | #include "score.h"
|
---|
| 13 | #include "fields.h"
|
---|
| 14 | #include "vsdd.h"
|
---|
| 15 | #include "vsddsw.h"
|
---|
| 16 | #include "vsddvars.h"
|
---|
| 17 |
|
---|
| 18 | #include "midas.h"
|
---|
| 19 |
|
---|
| 20 | #include "scdsp.h"
|
---|
| 21 | #include "libdsp.h"
|
---|
| 22 | #include "wsdsp.h"
|
---|
| 23 |
|
---|
[e225e77] | 24 | #include "memory.h"
|
---|
| 25 |
|
---|
| 26 | extern void tkinit(void);
|
---|
| 27 |
|
---|
[7258c6a] | 28 | extern int16_t swctrl;
|
---|
| 29 | extern int16_t swdir;
|
---|
| 30 | extern int16_t swfiin;
|
---|
| 31 | extern int16_t swflag;
|
---|
[f40a309] | 32 |
|
---|
[7258c6a] | 33 | extern int16_t swfifo[NSWFIFO];
|
---|
[f40a309] | 34 |
|
---|
| 35 | /* |
---|
| 36 |
|
---|
| 37 | */
|
---|
| 38 |
|
---|
| 39 | BOOL se_chg; /* Score free list changed flag */
|
---|
[60288f5] | 40 |
|
---|
| 41 | LPF (*oldsw)[]; /* saved swpt value */
|
---|
[f40a309] | 42 | LPF (*swpt)[]; /* switch dispatch table pointer */
|
---|
[60288f5] | 43 |
|
---|
[f40a309] | 44 | LPF aswtbl[14]; /* assignment switch table */
|
---|
[0c834c5] | 45 |
|
---|
[7258c6a] | 46 | void (*curmove)(void); /* cursor move function */
|
---|
[0c834c5] | 47 | int16_t (*curtype)(void); /* cursor type function */
|
---|
| 48 | void (*cx_key)(void); /* x rate calculation */
|
---|
| 49 | void (*cx_upd)(void); /* x update */
|
---|
| 50 | void (*cy_key)(void); /* y rate calculation */
|
---|
[7258c6a] | 51 | void (*cy_upd)(void); /* y update */
|
---|
[0c834c5] | 52 | void (*d_key)(int16_t k); /* in-field data key processor */
|
---|
| 53 | void (*e_key)(void); /* E key processor */
|
---|
[7258c6a] | 54 | void (*m_key)(void); /* M key processor */
|
---|
[0c834c5] | 55 | void (*itxput)(int16_t row, int16_t col, int8_t *txt, int16_t tag);
|
---|
[7258c6a] | 56 | /* instrument menu text put function */
|
---|
| 57 | int16_t (*not_fld)(int16_t k); /* not-in-field data key processor */
|
---|
[0c834c5] | 58 | void (*olddkey)(int16_t k); /* saved d_key value */
|
---|
| 59 | void (*oldekey)(void); /* saved e_key value */
|
---|
| 60 | void (*oldmkey)(void); /* saved m_key value */
|
---|
| 61 | void (*oldxkey)(void); /* saved x_key value */
|
---|
| 62 | void (*premove)(void); /* cursor pre-move function */
|
---|
| 63 | void (*pstmove)(void); /* cursor post-move function */
|
---|
| 64 | void (*vt_adv)(void); /* vtyper data cursor advance function */
|
---|
| 65 | void (*vt_bsp)(void); /* vtyper data cursor backspace function */
|
---|
| 66 | void (*vt_cdn)(void); /* vtyper data cursor down function */
|
---|
[7258c6a] | 67 | void (*vt_cup)(void); /* vtyper data cursor up function */
|
---|
[0c834c5] | 68 | void (*vt_dsp)(uint16_t *obj, uint16_t fg, uint16_t bg, int16_t row, int16_t col, int8_t *buf);
|
---|
| 69 | /* vtyper display function */
|
---|
| 70 | void (*vt_stop)(void); /* vtyper exit function */
|
---|
| 71 | void (*x_key)(void); /* X key processor */
|
---|
| 72 | void (*xy_dn)(void); /* cursor - finger on (down) */
|
---|
[f40a309] | 73 | void (*xy_up)(void); /* cursor - finger off (up) */
|
---|
[7258c6a] | 74 |
|
---|
| 75 | int16_t *cratex; /* cursor x rate table pointer */
|
---|
| 76 | int16_t *cratey; /* cursor x rate table pointer */
|
---|
| 77 |
|
---|
| 78 | int16_t BotEdge; /* configuration box bottom edge */
|
---|
| 79 | int16_t LftEdge; /* configuration box left edge */
|
---|
| 80 | int16_t RgtEdge; /* configuration box right edge */
|
---|
| 81 | int16_t TopEdge; /* configuration box top edge */
|
---|
| 82 |
|
---|
| 83 | int16_t BarBcur[14]; /* current bottom-zero bar values */
|
---|
| 84 | int16_t BarCcur[14]; /* current centered-zero bar values */
|
---|
| 85 | int16_t BGeq[14]; /* current EQ bar settings */
|
---|
| 86 | int16_t BGother[14]; /* current other pot bar settings */
|
---|
| 87 | int16_t BGprmtr[14]; /* current parameter pot bar settings */
|
---|
| 88 |
|
---|
| 89 | int16_t articen[12]; /* voice articulation enable status */
|
---|
| 90 | int16_t grpdyn[12]; /* group dynamics table (0..9) */
|
---|
| 91 | int16_t grploc[12]; /* group location table (0..8) */
|
---|
| 92 | int16_t grpmode[12]; /* group mode - 0 = play, 1 = stdby, 2 = rec */
|
---|
| 93 | int16_t grpsel[12]; /* group select status for instrument selection */
|
---|
| 94 | int16_t grpstat[12]; /* group status - 0 = off, non-0 = on */
|
---|
| 95 | int16_t grptmap[12]; /* group map */
|
---|
| 96 | int16_t gtctab[12]; /* group to color table */
|
---|
| 97 | int16_t ins2grp[12]; /* instrument to group table (00..NINST-1) */
|
---|
| 98 | int16_t instmod[12]; /* intrument data modified */
|
---|
| 99 | int16_t key2grp[88]; /* port 1 key to group assignment table */
|
---|
| 100 | int16_t lastart[16]; /* last articulation values (by parameter) */
|
---|
| 101 | int16_t lastvce[12]; /* last voice assigned in each group */
|
---|
| 102 | int16_t lastvel[12]; /* last velocity sent to group */
|
---|
| 103 | int16_t ldmap[N_SCORES]; /* gather read map */
|
---|
| 104 | int16_t mctlnum[4]; /* MIDI controller number table (-1, 00..99) */
|
---|
| 105 | int16_t mpbend[48]; /* MIDI pitch bend data, by port and channel */
|
---|
| 106 | int16_t msmstv[3]; /* MIDI state machine state variables */
|
---|
| 107 | int16_t offsets[NUMWPCAL]; /* offsets for current waveshape */
|
---|
| 108 | int16_t oldtun[128]; /* previous tuning table for undo */
|
---|
| 109 | int16_t prstab[NTRIGS]; /* pressure */
|
---|
| 110 | int16_t s_inst[12]; /* instrument selections */
|
---|
| 111 | int16_t s_trns[12]; /* current transposition values */
|
---|
| 112 | int16_t swfifo[NSWFIFO]; /* scroll wheel fifo */
|
---|
| 113 | int16_t txfifo[NTKFIFO]; /* trackball X fifo */
|
---|
| 114 | int16_t tyfifo[NTKFIFO]; /* trackball Y fifo */
|
---|
| 115 | int16_t tuntab[128]; /* current tuning table */
|
---|
| 116 | int16_t vce2grp[12]; /* voice to group table (-1, 1..12)*/
|
---|
| 117 | int16_t vce2trg[12]; /* voice to trigger map (-1 EQ NULL) */
|
---|
| 118 | int16_t veltab[NTRIGS]; /* velocity */
|
---|
| 119 | int16_t vmtab[NUMHARM]; /* harmonics for current waveshape */
|
---|
[f40a309] | 120 | int16_t wsbuf[NUMWPCAL]; /* final values for current waveshape */
|
---|
| 121 |
|
---|
| 122 | /* |
---|
| 123 |
|
---|
[7258c6a] | 124 | */
|
---|
| 125 |
|
---|
| 126 | int8_t *lmln22; /* message window line 22 */
|
---|
| 127 | int8_t *lmln23; /* message window line 23 */
|
---|
| 128 | int8_t *lmln24; /* message window line 24 */
|
---|
| 129 | int8_t *vtdeptr; /* virtual typewriter data entry pointer */
|
---|
| 130 |
|
---|
| 131 | int8_t *funcndx[256][2]; /* function header pointers */
|
---|
| 132 | int8_t *vlbptr[3]; /* variable label pointers */
|
---|
| 133 |
|
---|
| 134 | int8_t bfs[128]; /* display generation buffer */
|
---|
| 135 | int8_t caname[16]; /* current assignment table name */
|
---|
| 136 | int8_t dspbuf[65]; /* display generation buffer */
|
---|
| 137 | int8_t ebuf[MAXEBUF+1]; /* edit data entry buffer */
|
---|
| 138 | int8_t errbuf[65]; /* error message build area */
|
---|
| 139 | int8_t idbuf[65]; /* display format conversion work area */
|
---|
| 140 | int8_t keystat[24]; /* front panel key status */
|
---|
| 141 | int8_t ldcmnt[38]; /* comment field */
|
---|
| 142 | int8_t ldfile[9]; /* file name field */
|
---|
| 143 | int8_t ldmsg1[65]; /* messsage build area 1 */
|
---|
| 144 | int8_t ldmsg2[65]; /* messsage build area 2 */
|
---|
| 145 | int8_t ldmsg3[65]; /* messsage build area 3 */
|
---|
| 146 | int8_t loadedc[NLTYPES][37]; /* loaded file comments */
|
---|
| 147 | int8_t loadedf[NLTYPES][8]; /* loaded file names */
|
---|
| 148 | int8_t masens[3]; /* MIDI port active sensing flags */
|
---|
| 149 | int8_t mctlval[NCTRLS]; /* MIDI controller values */
|
---|
| 150 | int8_t mdbyte[3]; /* MIDI data byte buffers */
|
---|
| 151 | int8_t mpsust[48]; /* MIDI sustain status, by port and channel */
|
---|
| 152 | int8_t mrstat[3]; /* MIDI running status */
|
---|
| 153 | int8_t scname[N_SCORES][16]; /* Score names */
|
---|
| 154 | int8_t trgtab[NTRIGS]; /* trigger status */
|
---|
[f40a309] | 155 | int8_t tuncurn[33]; /* current tuning table name */
|
---|
| 156 | int8_t tunname[NTUNS][32]; /* tuning table names */
|
---|
| 157 |
|
---|
| 158 | /* |
---|
[7258c6a] | 159 |
|
---|
| 160 | */
|
---|
| 161 |
|
---|
| 162 | int32_t *pspool; /* Score storage pool pointer */
|
---|
| 163 |
|
---|
| 164 | int32_t afi; /* analog processor FIFO value */
|
---|
| 165 | int32_t curtime; /* current sqscan time */
|
---|
| 166 | int32_t ctime; /* time at cursor */
|
---|
| 167 | int32_t dvwork; /* divide work area */
|
---|
| 168 | int32_t frags; /* Score storage pool fragment count */
|
---|
| 169 | int32_t iotime; /* saved lcdtime value */
|
---|
| 170 | int32_t lcdontm; /* LCD backlight on time */
|
---|
| 171 | int32_t lcdtime; /* LCD backlight timer */
|
---|
| 172 | int32_t lcsum; /* library checksum */
|
---|
| 173 | int32_t ndbytes; /* bytes needed for storage */
|
---|
| 174 | int32_t noteoff; /* note off time */
|
---|
| 175 | int32_t noteon; /* note on time */
|
---|
| 176 | int32_t noteper; /* note period */
|
---|
| 177 | int32_t noteval; /* note value */
|
---|
| 178 | int32_t nrest; /* number of rests */
|
---|
| 179 | int32_t schksum; /* Score checksum */
|
---|
| 180 | int32_t se1_cnt; /* Score - free list E_SIZE1 entry count */
|
---|
| 181 | int32_t se2_cnt; /* Score - free list E_SIZE2 entry count */
|
---|
| 182 | int32_t se3_cnt; /* Score - free list E_SIZE3 entry count */
|
---|
| 183 | int32_t snbreq; /* Score - disk bytes required */
|
---|
| 184 | int32_t snlreq; /* Score - score bytes required */
|
---|
| 185 | int32_t sntbreq; /* Score - total disk bytes required */
|
---|
| 186 | int32_t sntlreq; /* Score - total score bytes required */
|
---|
| 187 | int32_t spcount; /* Score - storage pool free entry count */
|
---|
| 188 | int32_t swcount; /* scroll wheel counter */
|
---|
| 189 | int32_t swrate; /* scroll wheel rate */
|
---|
| 190 | int32_t swtemp; /* scroll wheel work area */
|
---|
| 191 | int32_t t_bak; /* time at p_bak */
|
---|
| 192 | int32_t t_cbgn; /* time at p_cbgn */
|
---|
| 193 | int32_t t_cend; /* time at p_cend */
|
---|
| 194 | int32_t t_cur; /* time at p_cur */
|
---|
| 195 | int32_t t_ctr; /* time at p_ctr */
|
---|
| 196 | int32_t t_fwd; /* time at p_fwd */
|
---|
| 197 | int32_t t_ins; /* time at peg */
|
---|
| 198 | int32_t t_note; /* note duration between p_nbeg and p_nend */
|
---|
| 199 | int32_t t_sbgn; /* time at p_sbgn */
|
---|
| 200 | int32_t t_sec1; /* time at p_sec1 */
|
---|
| 201 | int32_t t_sec2; /* time at p_sec2 */
|
---|
| 202 | int32_t t_sect; /* section time */
|
---|
| 203 | int32_t t_send; /* time at p_send */
|
---|
| 204 | int32_t wshfac; /* waveshape scale factor */
|
---|
| 205 |
|
---|
| 206 | int32_t hwave[NUMWPCAL]; /* harmonic waveshape generation buffer */
|
---|
| 207 | int32_t nlpersc[N_SCORES]; /* number of longs per score */
|
---|
| 208 | int32_t scsums[N_SCORES]; /* score checksums */
|
---|
| 209 | int32_t spool[MAX_SE]; /* Score storage pool */
|
---|
| 210 |
|
---|
[f40a309] | 211 | int32_t vknm[NUMHARM][NUMWPCAL]; /* scaled harmonics for current ws */
|
---|
| 212 |
|
---|
| 213 | int32_t swrmin = SWRMIN; /* scroll wheel rate threshold */
|
---|
| 214 |
|
---|
| 215 | /* |
---|
| 216 |
|
---|
| 217 | */
|
---|
| 218 |
|
---|
| 219 | /*
|
---|
| 220 | =============================================================================
|
---|
[0580615] | 221 | swinit() -- initialize scroll wheel variables
|
---|
[f40a309] | 222 | =============================================================================
|
---|
| 223 | */
|
---|
| 224 |
|
---|
| 225 | void swinit(void)
|
---|
| 226 | {
|
---|
| 227 | swflag = FALSE; /* stop the scroll wheel */
|
---|
| 228 | swctrl = FALSE; /* ... */
|
---|
| 229 | swdir = D_FWD; /* ... */
|
---|
| 230 | swrate = 0; /* ... */
|
---|
| 231 | swcount = 0; /* ... */
|
---|
| 232 |
|
---|
| 233 | memsetw(swfifo, 0, NSWFIFO); /* clear scroll wheel fifo */
|
---|
| 234 | swfiin = 0; /* ... */
|
---|
| 235 |
|
---|
| 236 | tkinit(); /* initialize the trackball */
|
---|
| 237 | }
|
---|