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