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