[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | instdsp.c -- instrument definition display driver and support functions
|
---|
| 4 | Version 181 -- 1988-10-06 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #define D_EXECKI 0 /* debug execins() */
|
---|
| 9 |
|
---|
| 10 | #include "stddefs.h"
|
---|
| 11 | #include "memory.h"
|
---|
| 12 |
|
---|
| 13 | #include "biosdefs.h"
|
---|
| 14 | #include "charset.h"
|
---|
| 15 | #include "fields.h"
|
---|
| 16 | #include "fpu.h"
|
---|
| 17 | #include "hwdefs.h"
|
---|
| 18 | #include "vsdd.h"
|
---|
| 19 | #include "vsddsw.h"
|
---|
| 20 | #include "vsddvars.h"
|
---|
| 21 | #include "graphdef.h"
|
---|
| 22 | #include "smdefs.h"
|
---|
| 23 |
|
---|
| 24 | #include "midas.h"
|
---|
| 25 | #include "instdsp.h"
|
---|
| 26 |
|
---|
[e225e77] | 27 | #include "stdio.h"
|
---|
| 28 |
|
---|
[f40a309] | 29 | #define LSPCH 2 /* pitch source scale factor */
|
---|
| 30 | #define MAXRAND (0x00FFFFFFL) /* largest random number */
|
---|
| 31 |
|
---|
| 32 | /* things defined elsewhere */
|
---|
[0c834c5] | 33 |
|
---|
[7258c6a] | 34 | extern void (*point)(int16_t x, int16_t y, int16_t pen);
|
---|
[f40a309] | 35 |
|
---|
[0580615] | 36 | extern void fpuint(void);
|
---|
[7258c6a] | 37 | extern uint16_t setipl(uint16_t arg);
|
---|
| 38 | extern void cnvc2p(int8_t *buf, int16_t cv);
|
---|
[f40a309] | 39 |
|
---|
[7258c6a] | 40 | extern uint16_t tofpu(uint16_t time);
|
---|
| 41 | extern uint16_t fromfpu(uint16_t fputime);
|
---|
| 42 | extern uint16_t exp_c(uint16_t c);
|
---|
[f40a309] | 43 |
|
---|
[7258c6a] | 44 | extern int8_t *dsimlt(int8_t *buf, int16_t src, int16_t mltval);
|
---|
[f40a309] | 45 |
|
---|
[7258c6a] | 46 | extern int32_t rand24(void);
|
---|
[f40a309] | 47 |
|
---|
| 48 | /* |
---|
| 49 |
|
---|
| 50 | */
|
---|
[7258c6a] | 51 |
|
---|
| 52 | extern int16_t cxval, cyval, stcrow, stccol, initcfg;
|
---|
[f40a309] | 53 | extern int16_t curslim, idimsw;
|
---|
[7258c6a] | 54 |
|
---|
[f40a309] | 55 | extern uint16_t *obj0, *obj2;
|
---|
[7258c6a] | 56 |
|
---|
| 57 | extern int8_t bfs[], *srctbl[], sfdsp[];
|
---|
[f40a309] | 58 | extern int8_t vtlin1[], vtlin2[], vtlin3[];
|
---|
| 59 |
|
---|
| 60 | extern struct sment sments[];
|
---|
| 61 | extern struct valent valents[];
|
---|
| 62 | extern struct sment *vpsms[];
|
---|
[7258c6a] | 63 |
|
---|
| 64 | extern int16_t s_inst[], vce2trg[], vce2grp[];
|
---|
| 65 |
|
---|
| 66 | extern int16_t curfunc; /* current function number */
|
---|
| 67 | extern int16_t curinst; /* current instrument number */
|
---|
| 68 | extern int16_t curpnt; /* current point number (absolute) */
|
---|
| 69 | extern int16_t curvce; /* current voice number */
|
---|
| 70 | extern int16_t idcfsw; /* copy / fetch menu switch */
|
---|
| 71 | extern int16_t idintmp; /* temporary for instrument number */
|
---|
| 72 | extern int16_t idnamsw; /* typewriter switch */
|
---|
| 73 | extern int16_t idsrcsw; /* source menu switch */
|
---|
| 74 | extern int16_t npts; /* number of points in function */
|
---|
| 75 | extern int16_t pecase; /* point edit case variable */
|
---|
| 76 | extern int16_t pntsv; /* point selection state variable */
|
---|
| 77 | extern int16_t subj; /* edited point number (relative) */
|
---|
| 78 | extern int16_t submenu; /* submenu cursor switch */
|
---|
| 79 | extern int16_t temax; /* time upper limit */
|
---|
| 80 | extern int16_t temin; /* time lower limit */
|
---|
| 81 | extern int16_t vlbtype; /* type of message window display */
|
---|
| 82 | extern int16_t wcflag; /* ws/cf menu type */
|
---|
| 83 | extern int16_t wcpage; /* ws/cf menu page */
|
---|
| 84 |
|
---|
| 85 | extern int16_t instmod[12]; /* intrument data modified */
|
---|
| 86 |
|
---|
[f40a309] | 87 | extern uint16_t *instob; /* instrument object pointer */
|
---|
| 88 |
|
---|
| 89 | extern struct octent *idoct; /* instrument display octent pointer */
|
---|
| 90 | extern struct instpnt *pntptr; /* pointer to edited point */
|
---|
| 91 |
|
---|
| 92 | extern struct instdef idefs[NINST]; /* current instrument definitions */
|
---|
| 93 | extern struct instdef vbufs[12]; /* voice instrument buffers */
|
---|
[7258c6a] | 94 |
|
---|
| 95 | extern int8_t *funcndx[256][2]; /* function header pointers */
|
---|
[f40a309] | 96 | extern int8_t *vlbptr[3]; /* variable label pointers */
|
---|
[7258c6a] | 97 |
|
---|
[f40a309] | 98 | extern int8_t idbuf[65]; /* display conversion work area */
|
---|
| 99 |
|
---|
| 100 | /* |
---|
| 101 |
|
---|
| 102 | */
|
---|
| 103 |
|
---|
[7258c6a] | 104 | /* forward references */
|
---|
[f40a309] | 105 |
|
---|
[e225e77] | 106 | void idpoint(int16_t x, int16_t y, int16_t pen);
|
---|
| 107 |
|
---|
| 108 | extern int16_t timeto(int16_t fn, int16_t pj);
|
---|
| 109 | extern int16_t ttox(uint16_t time, int16_t window);
|
---|
| 110 | extern int16_t vtoy(int16_t val, int16_t window);
|
---|
| 111 | extern void arcurs(uint16_t icolor);
|
---|
| 112 | extern void dswap(void);
|
---|
| 113 | extern void idfield(void);
|
---|
| 114 | extern void int2rat(int16_t rat);
|
---|
| 115 | extern void itcini(uint16_t color);
|
---|
| 116 | extern void setgc(int16_t xv, int16_t yv);
|
---|
| 117 | extern void setinst(void);
|
---|
| 118 | extern void settc(int16_t rv, int16_t cv);
|
---|
| 119 | extern void showcfg(int16_t nn);
|
---|
| 120 | extern void ttcini(uint16_t color);
|
---|
[7258c6a] | 121 | extern void vsndpal(int16_t pp[16][3]);
|
---|
[f40a309] | 122 |
|
---|
| 123 | int16_t idbox[][8] = { /* display box parameters */
|
---|
| 124 |
|
---|
| 125 | { 1, 1, 84, 26, CFBX00, CBBX00, 0, 1}, /* 0: Freq 1 */
|
---|
| 126 | { 86, 1, 169, 26, CFBX01, CBBX01, 0, 11}, /* 1: Freq 2 */
|
---|
| 127 | {171, 1, 254, 26, CFBX02, CBBX02, 0, 22}, /* 2: Freq 3 */
|
---|
| 128 | {256, 1, 339, 26, CFBX03, CBBX03, 0, 33}, /* 3: Freq 4 */
|
---|
| 129 | {341, 1, 424, 26, CFBX04, CBBX04, 0, 44}, /* 4: Filter / Resonance */
|
---|
| 130 | {426, 1, 509, 26, CFBX05, CBBX05, 0, 54}, /* 5: Location */
|
---|
| 131 |
|
---|
| 132 | { 1, 29, 84, 54, CFBX06, CBBX06, 2, 1}, /* 6: Index 1 */
|
---|
| 133 | { 86, 29, 169, 54, CFBX07, CBBX07, 2, 11}, /* 7: Index 2 */
|
---|
| 134 | {171, 29, 254, 54, CFBX08, CBBX08, 2, 22}, /* 8: Index 3 */
|
---|
| 135 | {256, 29, 339, 54, CFBX09, CBBX09, 2, 33}, /* 9: Index 4 */
|
---|
| 136 | {341, 29, 424, 54, CFBX10, CBBX10, 2, 44}, /* 10: Index 5 */
|
---|
| 137 | {426, 29, 509, 54, CFBX11, CBBX11, 2, 54}, /* 11: Index 6 */
|
---|
| 138 |
|
---|
| 139 | { 1, 56, 509, 208, CFBX12, CBBX12, 4, 54}, /* 12: Level */
|
---|
| 140 |
|
---|
| 141 | { 1, 210, 110, 236, CFBX13, CBBX13, 15, 1}, /* 13: Source- Mlt */
|
---|
| 142 | {112, 210, 142, 236, CFBX14, CBBX14, 15, 15}, /* 14: Pt */
|
---|
| 143 | {144, 210, 206, 236, CFBX15, CBBX15, 15, 19}, /* 15: Time */
|
---|
| 144 | {208, 210, 366, 236, CFBX16, CBBX16, 15, 27}, /* 16: Value */
|
---|
| 145 | {368, 210, 509, 236, CFBX17, CBBX17, 15, 47}, /* 17: Action */
|
---|
| 146 |
|
---|
| 147 | { 1, 238, 131, 348, CFBX18, CBBX18, 17, 2}, /* 18: Configuration */
|
---|
| 148 | {133, 238, 267, 251, CFBX19, CBBX19, 17, 17}, /* 19: Voice & Inst */
|
---|
| 149 | {269, 238, 379, 306, CFBX20, CBBX20, 17, 35}, /* 20: Oscillators */
|
---|
| 150 | {381, 238, 509, 348, CFBX21, CBBX21, 17, 48}, /* 21: Waveshape */
|
---|
| 151 |
|
---|
| 152 | {133, 308, 379, 348, CFBX22, CBBX22, 22, 17}, /* 22: (messages) */
|
---|
| 153 |
|
---|
| 154 | {133, 252, 267, 306, CFBX23, CBBX23, 18, 17} /* 23: Name & comments */
|
---|
| 155 | };
|
---|
| 156 |
|
---|
| 157 | /* |
---|
| 158 |
|
---|
| 159 | */
|
---|
[7258c6a] | 160 |
|
---|
[f40a309] | 161 | /* instrument function to FPU function table */
|
---|
| 162 |
|
---|
| 163 | int16_t fnoff[NFINST] = {
|
---|
| 164 |
|
---|
| 165 | 1, /* 0: Freq 1 */
|
---|
| 166 | 3, /* 1: Freq 2 */
|
---|
| 167 | 5, /* 2: Freq 3 */
|
---|
| 168 | 7, /* 3: Freq 4 */
|
---|
| 169 | 10, /* 4: Filter / Resonance */
|
---|
| 170 | 4, /* 5: Location */
|
---|
| 171 | 9, /* 6: Index 1 */
|
---|
| 172 | 11, /* 7: Index 2 */
|
---|
| 173 | 12, /* 8: Index 3 */
|
---|
| 174 | 13, /* 9: Index 4 */
|
---|
| 175 | 14, /* 10: Index 5 */
|
---|
| 176 | 15, /* 11: Index 6 */
|
---|
[7258c6a] | 177 | 2 /* 12: Level */
|
---|
[f40a309] | 178 | };
|
---|
| 179 |
|
---|
| 180 | int16_t inspal[16][3] = { /* instrument display color palette */
|
---|
| 181 |
|
---|
| 182 | {0, 0, 0}, /* 0 */
|
---|
| 183 | {3, 3, 3}, /* 1 */
|
---|
| 184 | {2, 2, 2}, /* 2 */
|
---|
| 185 | {3, 0, 0}, /* 3 */
|
---|
| 186 | {0, 3, 2}, /* 4 */
|
---|
| 187 | {0, 0, 1}, /* 5 */
|
---|
| 188 | {0, 1, 1}, /* 6 */
|
---|
| 189 | {1, 0, 1}, /* 7 */
|
---|
| 190 | {3, 2, 0}, /* 8 */
|
---|
| 191 | {1, 1, 2}, /* 9 */
|
---|
| 192 | {2, 3, 0}, /* 10 */
|
---|
| 193 | {2, 3, 3}, /* 11 */
|
---|
| 194 | {3, 0, 2}, /* 12 */
|
---|
| 195 | {0, 2, 3}, /* 13 */
|
---|
| 196 | {0, 3, 0}, /* 14 */
|
---|
| 197 | {3, 3, 0} /* 15 */
|
---|
| 198 | };
|
---|
| 199 |
|
---|
[7258c6a] | 200 | /* |
---|
[f40a309] | 201 |
|
---|
| 202 | */
|
---|
| 203 |
|
---|
| 204 | int8_t *idbxlbl[] = { /* display box labels */
|
---|
| 205 |
|
---|
| 206 | " Frq 1", /* 0 */
|
---|
| 207 | " Frq 2", /* 1 */
|
---|
| 208 | " Frq 3", /* 2 */
|
---|
| 209 | " Frq 4", /* 3 */
|
---|
| 210 | " Filtr", /* 4 */
|
---|
| 211 | " Loctn", /* 5 */
|
---|
| 212 | " Ind 1", /* 6 */
|
---|
| 213 | " Ind 2", /* 7 */
|
---|
| 214 | " Ind 3", /* 8 */
|
---|
| 215 | " Ind 4", /* 9 */
|
---|
| 216 | " Ind 5", /* 10 */
|
---|
| 217 | " Ind 6", /* 11 */
|
---|
| 218 | " Level", /* 12 */
|
---|
| 219 | "Source Mult", /* 13 */
|
---|
| 220 | "Pt", /* 14 */
|
---|
| 221 | "Time ", /* 15 */
|
---|
| 222 | "Value Source Mult", /* 16 */
|
---|
| 223 | "Conditioned Acts", /* 17 */
|
---|
| 224 | " Config #", /* 18 */
|
---|
| 225 | "Voice Inst", /* 19 */
|
---|
| 226 | "Oscillators", /* 20 */
|
---|
| 227 | "Wavshpe", /* 21 */
|
---|
[7258c6a] | 228 | "", /* 22 */
|
---|
[f40a309] | 229 | "" /* 23 */
|
---|
| 230 | };
|
---|
| 231 |
|
---|
[7258c6a] | 232 | int8_t idhlbl[] = /* main function time axis label */
|
---|
[f40a309] | 233 | " \324\302 \325\305 \326 \301 \302 \304 \310 \321\306 \323\302";
|
---|
| 234 |
|
---|
| 235 |
|
---|
| 236 | int8_t *osclbl[] = { /* oscillator mode labels */
|
---|
| 237 | /* NOTE: must match values in instdsp.h */
|
---|
| 238 |
|
---|
| 239 | "Int", /* 0: OC_INT - Interval */
|
---|
| 240 | "Rat", /* 1: OC_RAT - Ratio */
|
---|
| 241 | "Frq", /* 2: OC_FRQ - Frequency */
|
---|
| 242 | "Pch" /* 3: OC_PCH - Pitch */
|
---|
| 243 | };
|
---|
[7258c6a] | 244 |
|
---|
[f40a309] | 245 | /* |
---|
| 246 |
|
---|
| 247 | */
|
---|
| 248 |
|
---|
| 249 | int32_t rngdiv[] = { /* divisors for ranges of 0..9 */
|
---|
| 250 |
|
---|
| 251 | MAXRAND, /* 0..0 */
|
---|
| 252 | MAXRAND / 2, /* 0..1 */
|
---|
| 253 | MAXRAND / 3, /* 0..2 */
|
---|
| 254 | MAXRAND / 4, /* 0..3 */
|
---|
| 255 | MAXRAND / 5, /* 0..4 */
|
---|
| 256 | MAXRAND / 6, /* 0..5 */
|
---|
| 257 | MAXRAND / 7, /* 0..6 */
|
---|
| 258 | MAXRAND / 8, /* 0..7 */
|
---|
| 259 | MAXRAND / 9, /* 0..8 */
|
---|
| 260 | MAXRAND / 10 /* 0..9 */
|
---|
| 261 | };
|
---|
| 262 |
|
---|
| 263 | /* |
---|
| 264 |
|
---|
| 265 | */
|
---|
| 266 |
|
---|
[7258c6a] | 267 | /*
|
---|
[f40a309] | 268 | =============================================================================
|
---|
[7258c6a] | 269 | drawpt() -- draw a point as a cross
|
---|
[f40a309] | 270 | =============================================================================
|
---|
| 271 | */
|
---|
| 272 |
|
---|
| 273 | void drawpt(int16_t px, int16_t py, int16_t pc)
|
---|
| 274 | {
|
---|
| 275 | register int16_t tmp;
|
---|
| 276 |
|
---|
| 277 | tmp = px - 1;
|
---|
| 278 |
|
---|
| 279 | if (tmp > 7)
|
---|
| 280 | idpoint(tmp, py, pc);
|
---|
| 281 |
|
---|
| 282 | tmp = px + 1;
|
---|
| 283 |
|
---|
| 284 | if (tmp < 509)
|
---|
| 285 | idpoint(tmp, py, pc);
|
---|
| 286 |
|
---|
| 287 | tmp = py - 1;
|
---|
| 288 |
|
---|
| 289 | if (tmp > 55)
|
---|
| 290 | idpoint(px, tmp, pc);
|
---|
| 291 |
|
---|
| 292 | tmp = py + 1;
|
---|
| 293 |
|
---|
| 294 | if (tmp < 196)
|
---|
| 295 | idpoint(px, tmp, pc);
|
---|
| 296 |
|
---|
| 297 | idpoint(px, py, pc);
|
---|
| 298 | }
|
---|
| 299 |
|
---|
| 300 | /* |
---|
| 301 |
|
---|
| 302 | */
|
---|
[7258c6a] | 303 |
|
---|
[f40a309] | 304 | /*
|
---|
| 305 | =============================================================================
|
---|
| 306 | drawfn() -- draw a function
|
---|
| 307 | =============================================================================
|
---|
[7258c6a] | 308 | */
|
---|
| 309 |
|
---|
| 310 | void drawfn(int16_t fn, int16_t how, int16_t pen, int16_t wn)
|
---|
[f40a309] | 311 | {
|
---|
| 312 | struct idfnhdr *fp;
|
---|
| 313 | struct instdef *ip;
|
---|
| 314 | register struct instpnt *pt1, *pt2;
|
---|
| 315 | register int16_t i, npt1, npt2, xp;
|
---|
| 316 | register uint16_t color;
|
---|
| 317 | int16_t np, ptx, pty, ptc;
|
---|
| 318 |
|
---|
| 319 | ip = &vbufs[curvce];
|
---|
| 320 | fp = &ip->idhfnc[fn];
|
---|
| 321 | point = idpoint;
|
---|
| 322 |
|
---|
| 323 | np = fp->idfpif; /* number of points in the function */
|
---|
| 324 | xp = subj; /* edit point */
|
---|
| 325 |
|
---|
| 326 | npt1 = 0; /* left endpoint of line */
|
---|
| 327 | npt2 = 1; /* right endpoint of line */
|
---|
| 328 |
|
---|
| 329 | pt1 = &ip->idhpnt[fp->idfpt1]; /* left endpoint of line */
|
---|
| 330 | pt2 = pt1 + 1; /* right endpoint of line */
|
---|
| 331 |
|
---|
| 332 | color = exp_c(pen); /* replicate 4 bit 'pen' for 16 bit 'color' */
|
---|
| 333 |
|
---|
| 334 | /* |
---|
| 335 |
|
---|
| 336 | */
|
---|
| 337 | ptx = ttox(timeto(fn, npt1), wn);
|
---|
| 338 | pty = vtoy((pt1->ipval >> 5), wn);
|
---|
| 339 |
|
---|
| 340 | ptc = how ? ID_SELD :
|
---|
| 341 | ((pt1->ipact OR pt1->ipvsrc) ?
|
---|
[9519422] | 342 | ID_ACTP : ID_CPNT);
|
---|
[f40a309] | 343 |
|
---|
| 344 | if (np EQ 1) { /* single point ? */
|
---|
| 345 |
|
---|
| 346 | if (wn EQ 12)
|
---|
| 347 | drawpt(ptx, pty, ptc);
|
---|
| 348 | else
|
---|
| 349 | idpoint(ptx, pty, ptc);
|
---|
| 350 |
|
---|
| 351 | return;
|
---|
| 352 | }
|
---|
| 353 |
|
---|
| 354 | if (how AND (xp EQ 0))
|
---|
| 355 | if (wn EQ 12)
|
---|
| 356 | drawpt(ptx, pty, ID_SELD);
|
---|
| 357 | else
|
---|
| 358 | idpoint(ptx, pty, ID_SELD);
|
---|
| 359 |
|
---|
| 360 | for (i = 1; i < np; i++) {
|
---|
| 361 |
|
---|
| 362 | ptx = ttox(timeto(fn, npt2), wn);
|
---|
| 363 | pty = vtoy((pt2->ipval >> 5), wn);
|
---|
| 364 |
|
---|
| 365 | ptc = (pt2->ipact OR pt2->ipvsrc) ?
|
---|
| 366 | ID_ACTP : ID_CPNT;
|
---|
| 367 |
|
---|
| 368 | if (how AND (xp EQ (i - 1))) {
|
---|
| 369 |
|
---|
| 370 |
|
---|
| 371 | if (wn EQ 12)
|
---|
| 372 | drawpt(ptx, pty, ptc);
|
---|
| 373 | else
|
---|
| 374 | idpoint(ptx, pty, ptc);
|
---|
| 375 |
|
---|
| 376 | } else if (how AND (xp EQ i)) {
|
---|
| 377 |
|
---|
| 378 | ptc = ID_SELD;
|
---|
| 379 |
|
---|
| 380 | if (wn EQ 12)
|
---|
| 381 | drawpt(ptx, pty, ptc);
|
---|
| 382 | else
|
---|
| 383 | idpoint(ptx, pty, ptc);
|
---|
| 384 | /* |
---|
| 385 |
|
---|
| 386 | */
|
---|
| 387 | } else {
|
---|
| 388 |
|
---|
| 389 | lseg(ttox(timeto(fn, npt1), wn),
|
---|
| 390 | vtoy((pt1->ipval >> 5), wn),
|
---|
| 391 | ptx, pty, color);
|
---|
| 392 |
|
---|
| 393 | if (wn EQ 12) {
|
---|
| 394 |
|
---|
| 395 | drawpt(ttox(timeto(fn, npt1), wn),
|
---|
| 396 | vtoy((pt1->ipval >> 5), wn),
|
---|
| 397 | (pt1->ipact OR pt1->ipvsrc) ?
|
---|
| 398 | ID_ACTP : ID_CPNT);
|
---|
| 399 |
|
---|
| 400 | drawpt(ptx, pty, ptc);
|
---|
| 401 |
|
---|
| 402 | } else {
|
---|
| 403 |
|
---|
| 404 | idpoint(ttox(timeto(fn, npt1), wn),
|
---|
| 405 | vtoy((pt1->ipval >> 5), wn),
|
---|
| 406 | (pt1->ipact OR pt1->ipvsrc) ?
|
---|
| 407 | ID_ACTP : ID_CPNT);
|
---|
| 408 |
|
---|
| 409 | idpoint(ptx, pty, ptc);
|
---|
| 410 | }
|
---|
| 411 | }
|
---|
| 412 |
|
---|
| 413 | npt1++;
|
---|
| 414 | npt2++;
|
---|
| 415 | pt1++;
|
---|
| 416 | pt2++;
|
---|
| 417 | }
|
---|
| 418 |
|
---|
| 419 | return;
|
---|
| 420 | }
|
---|
| 421 |
|
---|
[7258c6a] | 422 | /* |
---|
[f40a309] | 423 |
|
---|
[7258c6a] | 424 | */
|
---|
[f40a309] | 425 |
|
---|
[7258c6a] | 426 | /*
|
---|
[f40a309] | 427 | =============================================================================
|
---|
| 428 | addpch() -- add an offset to a pitch function value
|
---|
| 429 | =============================================================================
|
---|
| 430 | */
|
---|
[7258c6a] | 431 |
|
---|
[f40a309] | 432 | int16_t addpch(int16_t p1, int16_t p2)
|
---|
| 433 | {
|
---|
| 434 | register int32_t pl;
|
---|
| 435 |
|
---|
| 436 | pl = ((((int32_t)p1 >> 5) - 500L) << LSPCH) + (int32_t)p2;
|
---|
| 437 |
|
---|
| 438 | if (pl > PITCHMAX)
|
---|
| 439 | pl = PITCHMAX;
|
---|
| 440 |
|
---|
| 441 | return((int16_t)pl);
|
---|
| 442 | }
|
---|
[7258c6a] | 443 |
|
---|
[f40a309] | 444 | /* |
---|
| 445 |
|
---|
| 446 | */
|
---|
| 447 |
|
---|
| 448 | /*
|
---|
| 449 | =============================================================================
|
---|
| 450 | irand() -- develop a random number in a given range
|
---|
[7258c6a] | 451 | =============================================================================
|
---|
[f40a309] | 452 | */
|
---|
| 453 |
|
---|
| 454 | int16_t irand(int16_t range)
|
---|
| 455 | {
|
---|
| 456 | if (range LE 0) /* limit things to 'reasonable' values */
|
---|
| 457 | return(0);
|
---|
| 458 |
|
---|
| 459 | if (range > 9) /* limit things to 'reasonable' values */
|
---|
| 460 | range = 9;
|
---|
| 461 |
|
---|
| 462 | return((int16_t)(rand24() / rngdiv[range]));
|
---|
[7258c6a] | 463 | }
|
---|
[f40a309] | 464 |
|
---|
[7258c6a] | 465 | /* |
---|
[f40a309] | 466 |
|
---|
[7258c6a] | 467 | */
|
---|
[f40a309] | 468 |
|
---|
| 469 | /*
|
---|
[7258c6a] | 470 | =============================================================================
|
---|
[f40a309] | 471 | xgetran() -- develop a random number
|
---|
| 472 | =============================================================================
|
---|
| 473 | */
|
---|
| 474 |
|
---|
| 475 | int16_t xgetran(int16_t mlt)
|
---|
| 476 | {
|
---|
| 477 | register int16_t sltmp;
|
---|
| 478 |
|
---|
| 479 | sltmp = (int16_t)rand24();
|
---|
| 480 |
|
---|
| 481 | if (mlt < 0)
|
---|
| 482 | sltmp += (int16_t)rand24();
|
---|
| 483 |
|
---|
[7258c6a] | 484 | return(sltmp);
|
---|
[f40a309] | 485 | }
|
---|
[7258c6a] | 486 |
|
---|
[f40a309] | 487 | /* |
---|
| 488 |
|
---|
| 489 | */
|
---|
| 490 |
|
---|
| 491 | /*
|
---|
| 492 | =============================================================================
|
---|
| 493 | dosync() -- update sync and configuration register
|
---|
| 494 | =============================================================================
|
---|
| 495 | */
|
---|
| 496 |
|
---|
| 497 | void dosync(int16_t vce)
|
---|
| 498 | {
|
---|
| 499 | register int16_t sync;
|
---|
| 500 | register struct instdef *ip;
|
---|
[7258c6a] | 501 |
|
---|
[f40a309] | 502 | ip = &vbufs[vce];
|
---|
| 503 | sync = ip->idhcfg << 8;
|
---|
| 504 |
|
---|
| 505 | if (ip->idhos1c & OC_SYN)
|
---|
| 506 | sync |= 0x2000;
|
---|
| 507 |
|
---|
| 508 | if (ip->idhos2c & OC_SYN)
|
---|
| 509 | sync |= 0x4000;
|
---|
| 510 |
|
---|
| 511 | if (ip->idhos3c & OC_SYN)
|
---|
| 512 | sync |= 0x8000;
|
---|
[7258c6a] | 513 |
|
---|
[f40a309] | 514 | *(io_fpu + vce + (int32_t)FPU_OCFG) = sync;
|
---|
[7258c6a] | 515 | }
|
---|
[f40a309] | 516 |
|
---|
| 517 | /* |
---|
| 518 |
|
---|
| 519 | */
|
---|
| 520 |
|
---|
| 521 | /*
|
---|
| 522 | =============================================================================
|
---|
| 523 | oscdsp() -- display an oscillator frequency specification
|
---|
| 524 | =============================================================================
|
---|
| 525 | */
|
---|
| 526 |
|
---|
| 527 | void oscdsp(int16_t row, int16_t val, int16_t n, int16_t frq, int8_t *lbl)
|
---|
| 528 | {
|
---|
| 529 | register int16_t fh, fl;
|
---|
| 530 |
|
---|
| 531 | tsplot4(instob, 64, idbox[n][4], row, 34, lbl, 14);
|
---|
| 532 | tsplot4(instob, 64, idbox[n][4], row, 36, osclbl[val & 3], 14);
|
---|
| 533 |
|
---|
| 534 | switch (val & 3) {
|
---|
| 535 |
|
---|
| 536 | case OC_INT: /* interval */
|
---|
| 537 |
|
---|
| 538 | sprintf(idbuf, "%c%04d", (frq < 0 ? '-' : '+'),
|
---|
| 539 | ((frq < 0 ? -frq : frq) >> 1));
|
---|
| 540 |
|
---|
| 541 | break;
|
---|
| 542 |
|
---|
| 543 | case OC_RAT: /* ratio */
|
---|
| 544 |
|
---|
| 545 | int2rat(frq >> 1);
|
---|
| 546 |
|
---|
| 547 | ebflag = FALSE;
|
---|
| 548 |
|
---|
| 549 | idbuf[0] = ebuf[0];
|
---|
| 550 | idbuf[1] = ebuf[1];
|
---|
| 551 | idbuf[2] = ebuf[2];
|
---|
| 552 | idbuf[3] = '\0';
|
---|
| 553 |
|
---|
| 554 | break;
|
---|
| 555 |
|
---|
| 556 | case OC_FRQ: /* frequency */
|
---|
| 557 |
|
---|
| 558 | fh = (frq >> 1) / 10;
|
---|
| 559 | fl = (frq >> 1) - (fh * 10);
|
---|
| 560 |
|
---|
| 561 | sprintf(idbuf, "%02d.%d ", fh, fl);
|
---|
| 562 | break;
|
---|
| 563 | /* |
---|
| 564 |
|
---|
| 565 | */
|
---|
| 566 | case OC_PCH:
|
---|
| 567 |
|
---|
| 568 | cnvc2p(idbuf, (frq >> 1));
|
---|
| 569 | idbuf[0] += '0';
|
---|
| 570 | idbuf[1] += 'A';
|
---|
| 571 | idbuf[2] = sfdsp[idbuf[2]];
|
---|
| 572 | idbuf[3] += '0';
|
---|
| 573 | idbuf[4] += '0';
|
---|
| 574 | idbuf[5] = '\0';
|
---|
| 575 | break;
|
---|
| 576 | }
|
---|
| 577 |
|
---|
| 578 | tsplot4(instob, 64, idbox[n][4], row, 40, idbuf, 14);
|
---|
[7258c6a] | 579 |
|
---|
[f40a309] | 580 | if (row NE 21)
|
---|
[7258c6a] | 581 | tsplot4(instob, 64, idbox[n][4], row, 46,
|
---|
[f40a309] | 582 | ((val & OC_SYN) ? "S" : "s"), 14);
|
---|
| 583 | }
|
---|
| 584 |
|
---|
| 585 | /* |
---|
| 586 |
|
---|
| 587 | */
|
---|
| 588 |
|
---|
| 589 | /*
|
---|
| 590 | =============================================================================
|
---|
| 591 | pltws() -- plot a small waveshape display
|
---|
| 592 | =============================================================================
|
---|
| 593 | */
|
---|
| 594 |
|
---|
| 595 | void pltws(uint16_t ws[], int16_t pen)
|
---|
| 596 | {
|
---|
| 597 | register int16_t i, x, y;
|
---|
| 598 |
|
---|
| 599 | for (i = 1; i < 254; i++) {
|
---|
| 600 |
|
---|
[7258c6a] | 601 | x = 382 + (i >> 1);
|
---|
[f40a309] | 602 | y = 348 - ((ws[i] ^ 0x8000) / 676);
|
---|
[7258c6a] | 603 |
|
---|
| 604 | idpoint(x, y, pen);
|
---|
| 605 | }
|
---|
| 606 | }
|
---|
[f40a309] | 607 |
|
---|
| 608 | /* |
---|
| 609 |
|
---|
| 610 | */
|
---|
| 611 |
|
---|
| 612 | /*
|
---|
| 613 | =============================================================================
|
---|
| 614 | dswin() -- display a window
|
---|
| 615 | =============================================================================
|
---|
| 616 | */
|
---|
| 617 |
|
---|
| 618 | void dswin(int16_t n)
|
---|
| 619 | {
|
---|
| 620 | int16_t th, tl, vh, vl, vv, mltval, lboff;
|
---|
| 621 | int8_t *s1, mltstr[6], mltsgn;
|
---|
| 622 | int32_t tt, sc;
|
---|
| 623 | register int16_t cx, pnt, par;
|
---|
| 624 | register struct instdef *ip;
|
---|
| 625 | register struct idfnhdr *fp;
|
---|
| 626 | register struct instpnt *pp;
|
---|
| 627 |
|
---|
| 628 | if (wcflag NE -1)
|
---|
| 629 | return;
|
---|
| 630 |
|
---|
| 631 | if (idimsw AND (n NE 19) AND (n < 22))
|
---|
| 632 | return;
|
---|
| 633 |
|
---|
| 634 | ip = &vbufs[curvce];
|
---|
| 635 |
|
---|
| 636 | fp = &ip->idhfnc[n LE 12 ? n : curfunc];
|
---|
| 637 |
|
---|
| 638 | curpnt = subj + fp->idfpt1;
|
---|
| 639 | pp = &ip->idhpnt[curpnt];
|
---|
| 640 |
|
---|
| 641 | cx = idbox[n][5];
|
---|
| 642 | cx |= cx << 4;
|
---|
| 643 | cx |= cx << 8;
|
---|
| 644 |
|
---|
| 645 | /* |
---|
| 646 |
|
---|
| 647 | */
|
---|
| 648 |
|
---|
| 649 | /* first, fill the box with the background color */
|
---|
| 650 |
|
---|
| 651 | if (v_regs[5] & 0x0180)
|
---|
| 652 | vbank(0);
|
---|
| 653 |
|
---|
| 654 | vbfill4(instob, 128, idbox[n][0], idbox[n][1], idbox[n][2], idbox[n][3], cx);
|
---|
| 655 |
|
---|
| 656 | if (n < 12) /* draw the function if it's a label window */
|
---|
| 657 | drawfn(n, 0, ID_CLIN, n);
|
---|
| 658 |
|
---|
| 659 | /* put in the box label */
|
---|
| 660 |
|
---|
| 661 | if (n GT 12) {
|
---|
| 662 |
|
---|
| 663 | tsplot4(instob, 64, idbox[n][4], idbox[n][6], idbox[n][7],
|
---|
| 664 | idbxlbl[n], 14);
|
---|
| 665 |
|
---|
| 666 | } else {
|
---|
| 667 |
|
---|
| 668 | tsplot4(instob, 64,
|
---|
| 669 | ((ip->idhfnc[n].idftmd & I_TM_KEY) ? idbox[n][4] : ID_INST),
|
---|
| 670 | idbox[n][6], idbox[n][7], idbxlbl[n], 14);
|
---|
| 671 | }
|
---|
| 672 |
|
---|
| 673 | /* |
---|
| 674 |
|
---|
| 675 | */
|
---|
| 676 | switch (n) { /* final text - overlays above stuff */
|
---|
| 677 |
|
---|
| 678 | case 12: /* level */
|
---|
| 679 |
|
---|
| 680 | /* x labels */
|
---|
| 681 |
|
---|
| 682 | tsplot4(instob, 64, TGRID, 14, 0, idhlbl, 14);
|
---|
| 683 |
|
---|
| 684 | /* y labels */
|
---|
| 685 |
|
---|
| 686 | tsplot4(instob, 64, TGRID, 14, 0, "\300", 14);
|
---|
| 687 | tsplot4(instob, 64, TGRID, 12, 0, "\302", 14);
|
---|
| 688 | tsplot4(instob, 64, TGRID, 10, 0, "\304", 14);
|
---|
| 689 | tsplot4(instob, 64, TGRID, 8, 0, "\306", 14);
|
---|
| 690 | tsplot4(instob, 64, TGRID, 6, 0, "\310", 14);
|
---|
| 691 | tsplot4(instob, 64, TGRID, 4, 0, "\312", 14);
|
---|
| 692 |
|
---|
| 693 | lseg( 7, 56, 7, 196, LGRID); /* draw the grid */
|
---|
| 694 | lseg( 7, 196, 509, 196, LGRID);
|
---|
| 695 |
|
---|
| 696 | drawfn(12, 0, ID_CLIN, 12); /* draw the function */
|
---|
| 697 |
|
---|
| 698 | return;
|
---|
| 699 |
|
---|
| 700 | case 13: /* source - multiplier */
|
---|
| 701 |
|
---|
| 702 | dsimlt(bfs, fp->idfsrc, fp->idfmlt);
|
---|
| 703 |
|
---|
| 704 | tsplot4(instob, 64, idbox[n][4],
|
---|
| 705 | idbox[n][6]+1, idbox[n][7], bfs, 14);
|
---|
| 706 | return;
|
---|
| 707 |
|
---|
| 708 | case 14: /* point number */
|
---|
| 709 |
|
---|
| 710 | sprintf(bfs, "%02d", subj);
|
---|
| 711 |
|
---|
| 712 | tsplot4(instob, 64, idbox[n][4], idbox[n][6]+1, idbox[n][7], bfs, 14);
|
---|
| 713 |
|
---|
| 714 | return;
|
---|
| 715 | /* |
---|
| 716 |
|
---|
| 717 | */
|
---|
| 718 | case 15: /* time */
|
---|
| 719 |
|
---|
| 720 | sc = 1000L;
|
---|
| 721 | tt = timeto(curfunc, subj);
|
---|
| 722 | th = tt / sc;
|
---|
| 723 | tl = tt - (th * sc);
|
---|
| 724 |
|
---|
| 725 | sprintf(bfs, "%02d.%03d", th, tl);
|
---|
| 726 | tsplot4(instob, 64, idbox[n][4], idbox[n][6] + 1,
|
---|
| 727 | idbox[n][7], bfs, 14);
|
---|
| 728 |
|
---|
| 729 | return;
|
---|
| 730 |
|
---|
| 731 | case 16: /* value */
|
---|
| 732 |
|
---|
| 733 | vv = pp->ipval >> 5;
|
---|
| 734 | vh = vv / 100;
|
---|
| 735 | vl = vv - (vh * 100);
|
---|
| 736 |
|
---|
| 737 | sprintf(bfs, "%02d.%02d ", vh, vl);
|
---|
| 738 |
|
---|
| 739 | dsimlt(&bfs[6], pp->ipvsrc, pp->ipvmlt);
|
---|
| 740 |
|
---|
| 741 | tsplot4(instob, 64, idbox[n][4], idbox[n][6] + 1,
|
---|
| 742 | idbox[n][7], bfs, 14);
|
---|
| 743 |
|
---|
| 744 | return;
|
---|
| 745 |
|
---|
| 746 | /* |
---|
| 747 |
|
---|
| 748 | */
|
---|
| 749 | case 17: /* action */
|
---|
| 750 |
|
---|
| 751 | pnt = pp->ippar1;
|
---|
| 752 | par = pp->ippar2;
|
---|
| 753 |
|
---|
| 754 | switch (pp->ipact) {
|
---|
| 755 |
|
---|
| 756 | case AC_NULL:
|
---|
| 757 |
|
---|
| 758 | s1 = " ";
|
---|
| 759 | break;
|
---|
| 760 |
|
---|
| 761 | case AC_SUST:
|
---|
| 762 |
|
---|
| 763 | sprintf(bfs, "Pause if key %c ", SP_DNA);
|
---|
| 764 | s1 = bfs;
|
---|
| 765 | break;
|
---|
| 766 |
|
---|
| 767 | case AC_ENBL:
|
---|
| 768 |
|
---|
| 769 | sprintf(bfs, "Stop if key %c ", SP_UPA);
|
---|
| 770 | s1 = bfs;
|
---|
| 771 | break;
|
---|
| 772 |
|
---|
| 773 | case AC_JUMP:
|
---|
| 774 |
|
---|
| 775 | sprintf(bfs, "GoTo %02d forever ", pnt);
|
---|
| 776 | s1 = bfs;
|
---|
| 777 | break;
|
---|
| 778 |
|
---|
| 779 | /* |
---|
| 780 |
|
---|
| 781 | */
|
---|
| 782 | case AC_LOOP:
|
---|
| 783 |
|
---|
| 784 | sprintf(bfs, "GoTo %02d %02d times", pnt, par);
|
---|
| 785 |
|
---|
| 786 | if (bfs[8] EQ '9') /* random */
|
---|
| 787 | bfs[8] = 'R';
|
---|
| 788 |
|
---|
| 789 | s1 = bfs;
|
---|
| 790 | break;
|
---|
| 791 |
|
---|
| 792 | case AC_KYUP:
|
---|
| 793 |
|
---|
| 794 | sprintf(bfs, "GoTo %02d if key %c",
|
---|
| 795 | pnt, SP_UPA);
|
---|
| 796 | s1 = bfs;
|
---|
| 797 | break;
|
---|
| 798 |
|
---|
| 799 | case AC_KYDN:
|
---|
| 800 |
|
---|
| 801 | sprintf(bfs, "GoTo %02d if key %c",
|
---|
| 802 | pnt, SP_DNA);
|
---|
| 803 | s1 = bfs;
|
---|
| 804 | break;
|
---|
| 805 |
|
---|
| 806 | default:
|
---|
| 807 |
|
---|
| 808 | s1 = "????????????????";
|
---|
| 809 | break;
|
---|
| 810 | }
|
---|
| 811 |
|
---|
| 812 | tsplot4(instob, 64, idbox[n][4], idbox[n][6] + 1,
|
---|
| 813 | idbox[n][7], s1, 14);
|
---|
| 814 |
|
---|
| 815 | return;
|
---|
| 816 |
|
---|
| 817 | /* |
---|
| 818 |
|
---|
| 819 | */
|
---|
| 820 |
|
---|
| 821 | case 18: /* configuration */
|
---|
| 822 |
|
---|
| 823 | showcfg(ip->idhcfg);
|
---|
| 824 | return;
|
---|
| 825 |
|
---|
| 826 | case 19: /* voice & instrument */
|
---|
| 827 |
|
---|
| 828 | sprintf(idbuf, "%02d", curvce + 1);
|
---|
| 829 | tsplot4(instob, 64, idbox[n][4], 17, 23, idbuf, 14);
|
---|
| 830 |
|
---|
| 831 | sprintf(idbuf, "%02d", curinst);
|
---|
| 832 | tsplot4(instob, 64, (instmod[curvce] ? ID_CHGD :idbox[n][4]),
|
---|
| 833 | 17, 31, idbuf, 14);
|
---|
| 834 |
|
---|
| 835 | return;
|
---|
| 836 |
|
---|
| 837 | case 20: /* oscillators */
|
---|
| 838 |
|
---|
| 839 | oscdsp(18, ip->idhos1c, n, "1", ip->idhos1v);
|
---|
| 840 | oscdsp(19, ip->idhos2c, n, "2", ip->idhos2v);
|
---|
| 841 | oscdsp(20, ip->idhos3c, n, "3", ip->idhos3v);
|
---|
| 842 | oscdsp(21, ip->idhos4c, n, "4", ip->idhos4v);
|
---|
| 843 |
|
---|
| 844 | return;
|
---|
| 845 |
|
---|
| 846 | case 21: /* waveshapes */
|
---|
| 847 |
|
---|
| 848 | sprintf(idbuf, "A%02d", ip->idhwsa + 1);
|
---|
| 849 | tsplot4(instob, 64, WSAFC, 17, 56, idbuf, 14);
|
---|
| 850 | pltws(ip->idhwvaf, WSAFC);
|
---|
| 851 |
|
---|
| 852 | sprintf(idbuf, "B%02d", ip->idhwsb + 1);
|
---|
| 853 | tsplot4(instob, 64, WSBFC, 17, 60, idbuf, 14);
|
---|
| 854 | pltws(ip->idhwvbf, WSBFC);
|
---|
| 855 |
|
---|
| 856 | return;
|
---|
| 857 | /* |
---|
| 858 |
|
---|
| 859 | */
|
---|
| 860 | case 22: /* message window */
|
---|
| 861 |
|
---|
| 862 | tsplot4(instob, 64, idbox[n][4], 22, 17, vlbptr[0], 14);
|
---|
| 863 | tsplot4(instob, 64, idbox[n][4], 23, 17, vlbptr[1], 14);
|
---|
| 864 | tsplot4(instob, 64, idbox[n][4], 24, 17, vlbptr[2], 14);
|
---|
| 865 |
|
---|
| 866 | if (idsrcsw) {
|
---|
| 867 |
|
---|
| 868 | point = idpoint;
|
---|
| 869 |
|
---|
| 870 | lseg(196, 308, 196, 348, CBORD);
|
---|
| 871 | lseg(260, 308, 260, 348, CBORD);
|
---|
| 872 | lseg(324, 308, 324, 348, CBORD);
|
---|
[0580615] | 873 | }
|
---|
[f40a309] | 874 |
|
---|
[7258c6a] | 875 | return;
|
---|
[f40a309] | 876 |
|
---|
| 877 | case 23: /* Name and comments */
|
---|
| 878 |
|
---|
| 879 | tsplot4(instob, 64, idbox[n][4], 18, 17, ip->idhname, 14);
|
---|
| 880 | tsplot4(instob, 64, idbox[n][4], 19, 17, ip->idhcom1, 14);
|
---|
| 881 | tsplot4(instob, 64, idbox[n][4], 20, 17, ip->idhcom2, 14);
|
---|
| 882 | tsplot4(instob, 64, idbox[n][4], 21, 17, ip->idhcom3, 14);
|
---|
| 883 |
|
---|
| 884 | return;
|
---|
| 885 | }
|
---|
| 886 | }
|
---|
[7258c6a] | 887 |
|
---|
[f40a309] | 888 | /* |
---|
| 889 |
|
---|
| 890 | */
|
---|
| 891 |
|
---|
| 892 | /*
|
---|
| 893 | =============================================================================
|
---|
| 894 | allwins() -- display all windows
|
---|
| 895 | =============================================================================
|
---|
| 896 | */
|
---|
| 897 |
|
---|
| 898 | void allwins(void)
|
---|
| 899 | {
|
---|
| 900 | register int16_t i;
|
---|
| 901 |
|
---|
| 902 | for (i = 0; i < 24; i++)
|
---|
| 903 | dswin(i);
|
---|
[0580615] | 904 | }
|
---|
[f40a309] | 905 |
|
---|
| 906 | /*
|
---|
| 907 | =============================================================================
|
---|
| 908 | idpoint() -- plot a point for the lseg function
|
---|
| 909 | =============================================================================
|
---|
| 910 | */
|
---|
| 911 |
|
---|
| 912 | void idpoint(int16_t x, int16_t y, int16_t pen)
|
---|
| 913 | {
|
---|
| 914 | if (v_regs[5] & 0x0180)
|
---|
| 915 | vbank(0);
|
---|
| 916 |
|
---|
| 917 | vputp(idoct, x, y, pen);
|
---|
| 918 | }
|
---|
| 919 |
|
---|
| 920 | /* |
---|
| 921 |
|
---|
| 922 | */
|
---|
| 923 |
|
---|
| 924 | /*
|
---|
| 925 | =============================================================================
|
---|
| 926 | idbord() -- draw the border for the instrument display
|
---|
| 927 | =============================================================================
|
---|
| 928 | */
|
---|
| 929 |
|
---|
| 930 | void idbord(void)
|
---|
| 931 | {
|
---|
| 932 | point = idpoint;
|
---|
| 933 |
|
---|
| 934 | lseg( 0, 0, 510, 0, CBORD); /* outer border */
|
---|
| 935 | lseg(510, 0, 510, 349, CBORD);
|
---|
| 936 | lseg(510, 349, 0, 349, CBORD);
|
---|
| 937 | lseg( 0, 349, 0, 0, CBORD);
|
---|
| 938 |
|
---|
| 939 | lseg( 0, 27, 510, 27, CBORD); /* label widows - H lines */
|
---|
| 940 | lseg( 0, 55, 510, 55, CBORD);
|
---|
| 941 |
|
---|
| 942 | lseg( 85, 1, 85, 54, CBORD); /* label windows - V lines */
|
---|
| 943 | lseg(170, 1, 170, 54, CBORD);
|
---|
| 944 | lseg(255, 1, 255, 54, CBORD);
|
---|
[0580615] | 945 | lseg(340, 1, 340, 54, CBORD);
|
---|
[f40a309] | 946 | lseg(425, 1, 425, 54, CBORD);
|
---|
| 947 |
|
---|
| 948 | lseg( 0, 209, 510, 209, CBORD); /* S/M, Time, Val - H lines */
|
---|
| 949 | lseg( 0, 237, 510, 237, CBORD);
|
---|
| 950 |
|
---|
| 951 | lseg(111, 210, 111, 236, CBORD); /* S/M, Time, Val - V lines */
|
---|
| 952 | lseg(143, 210, 143, 236, CBORD);
|
---|
| 953 | lseg(207, 210, 207, 236, CBORD);
|
---|
| 954 | lseg(367, 210, 367, 236, CBORD);
|
---|
| 955 |
|
---|
| 956 | lseg(132, 238, 132, 349, CBORD); /* Voice, Osc, Vars */
|
---|
| 957 | lseg(380, 238, 380, 349, CBORD);
|
---|
[0580615] | 958 | lseg(132, 307, 380, 307, CBORD);
|
---|
[f40a309] | 959 | lseg(268, 238, 268, 306, CBORD);
|
---|
| 960 | }
|
---|
| 961 |
|
---|
| 962 | /* |
---|
| 963 |
|
---|
| 964 | */
|
---|
| 965 |
|
---|
| 966 | /*
|
---|
| 967 | =============================================================================
|
---|
| 968 | idvlblc() -- clear the message window
|
---|
| 969 | =============================================================================
|
---|
| 970 | */
|
---|
| 971 |
|
---|
| 972 | void idvlblc(void)
|
---|
| 973 | {
|
---|
| 974 | vlbtype = 0; /* nothing in the message window */
|
---|
| 975 |
|
---|
| 976 | vlbptr[0] = vlbptr[1] = vlbptr[2] = " ";
|
---|
| 977 | }
|
---|
[0580615] | 978 |
|
---|
[f40a309] | 979 | /*
|
---|
| 980 | =============================================================================
|
---|
| 981 | idvlbld() -- put the labels in the message window
|
---|
| 982 | =============================================================================
|
---|
| 983 | */
|
---|
| 984 |
|
---|
| 985 | void idvlbld(void)
|
---|
| 986 | {
|
---|
| 987 | vlbtype = 1; /* variable labels */
|
---|
| 988 |
|
---|
| 989 | /* "123456789012345678901234567890" */
|
---|
| 990 |
|
---|
| 991 | vlbptr[0] = "PchW/HT Pch/Frq Random GPC/V1";
|
---|
| 992 | vlbptr[1] = "ModW/VT Key Vel Pedal 1 ";
|
---|
[0580615] | 993 | vlbptr[2] = "Brth/LP Key Prs ";
|
---|
[f40a309] | 994 | }
|
---|
| 995 |
|
---|
| 996 | /* |
---|
| 997 |
|
---|
| 998 | */
|
---|
| 999 |
|
---|
| 1000 | /*
|
---|
| 1001 | =============================================================================
|
---|
| 1002 | idvtyp() -- display the virtual typewriter in the message window
|
---|
| 1003 | =============================================================================
|
---|
| 1004 | */
|
---|
| 1005 |
|
---|
| 1006 | void idvtyp(void)
|
---|
| 1007 | {
|
---|
| 1008 | vlbtype = 2; /* virtual typewriter */
|
---|
| 1009 |
|
---|
| 1010 | vlbptr[0] = vtlin1;
|
---|
| 1011 | vlbptr[1] = vtlin2;
|
---|
| 1012 | vlbptr[2] = vtlin3;
|
---|
[0580615] | 1013 | }
|
---|
[f40a309] | 1014 |
|
---|
| 1015 | /*
|
---|
| 1016 | =============================================================================
|
---|
| 1017 | idcpfch() -- display the copy / fetch menu in the message window
|
---|
| 1018 | =============================================================================
|
---|
| 1019 | */
|
---|
| 1020 |
|
---|
| 1021 | void idcpfch(void)
|
---|
| 1022 | {
|
---|
| 1023 | vlbtype = 3; /* copy / fetch menu */
|
---|
| 1024 |
|
---|
| 1025 | /* "123456789012345678901234567890" */
|
---|
| 1026 |
|
---|
| 1027 | vlbptr[0] = "Fetch from library Escape ";
|
---|
| 1028 | vlbptr[1] = "Copy to library ";
|
---|
| 1029 | vlbptr[2] = " ";
|
---|
| 1030 | }
|
---|
| 1031 |
|
---|
| 1032 | /* |
---|
| 1033 |
|
---|
| 1034 | */
|
---|
| 1035 |
|
---|
| 1036 | /*
|
---|
| 1037 | =============================================================================
|
---|
| 1038 | instdsp() -- put up the instrument display
|
---|
| 1039 | =============================================================================
|
---|
| 1040 | */
|
---|
| 1041 |
|
---|
| 1042 | void instdsp(void)
|
---|
| 1043 | {
|
---|
| 1044 | register struct instdef *ip;
|
---|
| 1045 | register struct idfnhdr *fp;
|
---|
| 1046 |
|
---|
| 1047 | instob = &v_score[0]; /* setup object pointer */
|
---|
| 1048 | idoct = &v_obtab[INSTOBJ]; /* setup object control table pointer */
|
---|
| 1049 | obj0 = &v_curs0[0]; /* setup cursor object pointer */
|
---|
| 1050 | obj2 = &v_tcur[0]; /* setup typewriter cursor pointer */
|
---|
| 1051 |
|
---|
| 1052 | idnamsw = FALSE; /* typewriter not up */
|
---|
| 1053 | idsrcsw = FALSE; /* source menu not up */
|
---|
| 1054 | idcfsw = FALSE; /* copy / fetch menu not up */
|
---|
| 1055 | idimsw = FALSE; /* instrument menu not up */
|
---|
| 1056 | submenu = FALSE; /* submenu cursor not enabled */
|
---|
| 1057 | wcflag = -1; /* no menu page up */
|
---|
| 1058 | wcpage = 0; /* initial ws/cf page */
|
---|
| 1059 |
|
---|
| 1060 | setinst(); /* setup editing variables */
|
---|
| 1061 |
|
---|
| 1062 | dswap(); /* initialize display */
|
---|
| 1063 |
|
---|
| 1064 | vbank(0); /* clear the display */
|
---|
| 1065 | memsetw(instob, 0, 32767);
|
---|
| 1066 | memsetw(instob+32767L, 0, 12033);
|
---|
| 1067 |
|
---|
| 1068 | SetObj(INSTOBJ, 0, 0, instob, 512, 350, 0, 0, INSTFL, -1);
|
---|
[0580615] | 1069 | SetObj(0, 0, 1, obj0, 16, 16, ICURX, ICURY, OBFL_00, -1);
|
---|
[f40a309] | 1070 | SetObj(TTCURS, 0, 1, obj2, 16, 16, 0, 0, TTCCFL, -1);
|
---|
| 1071 |
|
---|
| 1072 | arcurs(ID_NCUR); /* setup arrow cursor object */
|
---|
| 1073 | itcini(ID_TCUR); /* setup text cursor object */
|
---|
| 1074 | ttcini(ID_TCUR); /* setup typewriter cursor object */
|
---|
| 1075 |
|
---|
| 1076 | vbank(0);
|
---|
| 1077 | idbord(); /* draw the border */
|
---|
| 1078 | idvlblc(); /* no initial label */
|
---|
| 1079 | allwins(); /* fill in the windows */
|
---|
| 1080 |
|
---|
| 1081 | SetPri(INSTOBJ, INSTPRI);
|
---|
| 1082 | SetPri(0, GCPRI); /* display the graphic cursor */
|
---|
| 1083 |
|
---|
| 1084 | setgc(ICURX, ICURY);
|
---|
| 1085 |
|
---|
| 1086 | vsndpal(inspal); /* set the palette */
|
---|
| 1087 | }
|
---|
| 1088 |
|
---|
| 1089 | /* |
---|
| 1090 |
|
---|
| 1091 | */
|
---|
| 1092 |
|
---|
| 1093 | /*
|
---|
| 1094 | =============================================================================
|
---|
| 1095 | reshowi() -- redisplay the instrument
|
---|
| 1096 | =============================================================================
|
---|
| 1097 | */
|
---|
| 1098 |
|
---|
| 1099 | void reshowi(void)
|
---|
| 1100 | {
|
---|
| 1101 | idfield(); /* fix up field table, etc. */
|
---|
| 1102 |
|
---|
| 1103 | wcflag = -1; /* no menu page up */
|
---|
| 1104 | wcpage = 0; /* first page of waveshapes */
|
---|
| 1105 |
|
---|
| 1106 | dswap(); /* initialize display */
|
---|
| 1107 |
|
---|
| 1108 | vbank(0); /* clear the display */
|
---|
| 1109 | memsetw(instob, 0, 32767);
|
---|
| 1110 | memsetw(instob+32767L, 0, 12033);
|
---|
| 1111 |
|
---|
| 1112 | SetObj(INSTOBJ, 0, 0, instob, 512, 350, 0, 0, INSTFL, -1);
|
---|
| 1113 | SetObj(0, 0, 1, obj0, 16, 16, ICURX, ICURY, OBFL_00, -1);
|
---|
| 1114 | SetObj(TTCURS, 0, 1, obj2, 16, 16, 0, 0, TTCCFL, -1);
|
---|
| 1115 |
|
---|
| 1116 | arcurs(ID_NCUR); /* setup arrow cursor object */
|
---|
| 1117 | itcini(ID_TCUR); /* setup text cursor object */
|
---|
| 1118 | ttcini(ID_TCUR); /* setup typewriter cursor object */
|
---|
| 1119 |
|
---|
| 1120 | vbank(0);
|
---|
| 1121 | idbord(); /* draw the border */
|
---|
| 1122 | idvlblc(); /* no initial label */
|
---|
| 1123 | allwins(); /* fill in the windows */
|
---|
| 1124 |
|
---|
| 1125 | SetPri(INSTOBJ, INSTPRI);
|
---|
| 1126 | SetPri(0, GCPRI); /* enable the cursor */
|
---|
| 1127 |
|
---|
| 1128 | if (cyval > curslim)
|
---|
| 1129 | settc(stcrow, stccol);
|
---|
| 1130 | else
|
---|
| 1131 | setgc(cxval, cyval);
|
---|
| 1132 |
|
---|
| 1133 | vsndpal(inspal); /* set the palette */
|
---|
| 1134 | }
|
---|