[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | ptfield.c -- MIDAS-VII patch display field functions
|
---|
| 4 | Version 35 -- 1989-11-16 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #define DEBUGXP 0
|
---|
| 9 |
|
---|
| 10 | #define USEVECTR 0 /* to force vector cursor control */
|
---|
| 11 |
|
---|
[b28a12e] | 12 | #include "ram.h"
|
---|
[e225e77] | 13 |
|
---|
[f40a309] | 14 | #if DEBUGXP
|
---|
| 15 | short debugxp = 1;
|
---|
| 16 | #endif
|
---|
| 17 |
|
---|
| 18 | #if USEVECTR
|
---|
| 19 | short usevect = TRUE;
|
---|
| 20 | #endif
|
---|
| 21 |
|
---|
| 22 | /* |
---|
| 23 |
|
---|
| 24 | */
|
---|
[7258c6a] | 25 |
|
---|
| 26 | int8_t *trdata[] = { "Trans", "Stop ", "Start" };
|
---|
[f40a309] | 27 | int8_t *ssdata[] = { "Stop ", "Start" };
|
---|
[7258c6a] | 28 |
|
---|
[f40a309] | 29 | int8_t *stdata[] = { "Srce" , "Mult", "Time", "Valu", "Func" };
|
---|
[7258c6a] | 30 |
|
---|
[f40a309] | 31 | int8_t *smdata[] = {
|
---|
| 32 |
|
---|
| 33 | " ", /* SM_NONE 0 No source - always 0 */
|
---|
| 34 | "Randm", /* SM_RAND 1 Random source */
|
---|
| 35 | "GPC/V", /* SM_CTL1 2 Control Voltage 1 / MIDI GPC 1 */
|
---|
| 36 | "??3??", /* ------- 3 -unused- */
|
---|
| 37 | "??4??", /* ------- 4 -unused- */
|
---|
| 38 | "Pitch", /* SM_PTCH 5 Key Pitch */
|
---|
| 39 | "KeyPr", /* SM_KPRS 6 Key Pressure */
|
---|
| 40 | "KeyVL", /* SM_KVEL 7 Key Velocity */
|
---|
| 41 | "Pedal", /* SM_PED1 8 Pedal 1 */
|
---|
| 42 | "??9??", /* ------- 9 -unused- */
|
---|
| 43 | "Freq ", /* SM_FREQ 10 Key Frequency */
|
---|
| 44 | "PchWh", /* SM_HTPW 11 Tablet X / MIDI Pitch Wheel */
|
---|
| 45 | "ModWh", /* SM_VTMW 12 Tablet Y / MIDI Mod Wheel */
|
---|
| 46 | "Breth", /* SM_LPBR 13 LongPot / MIDI Breath Controller */
|
---|
| 47 | };
|
---|
| 48 |
|
---|
| 49 | struct curpak pt_flds = {
|
---|
| 50 |
|
---|
| 51 | stdctp5, /* curtype */
|
---|
| 52 | nokey, /* premove */
|
---|
| 53 | aftercm, /* pstmove */
|
---|
| 54 | cxkstd, /* cx_key */
|
---|
| 55 | cykstd, /* cy_key */
|
---|
| 56 | smxupd, /* cx_upd */
|
---|
| 57 | smyupd, /* cy_upd */
|
---|
| 58 | stopcm, /* xy_up */
|
---|
| 59 | nokey, /* xy_dn */
|
---|
| 60 | ptxkey, /* x_key */
|
---|
| 61 | ptekey, /* e_key */
|
---|
| 62 | ptmkey, /* m_key */
|
---|
[60288f5] | 63 | ptdkey, /* d_key */
|
---|
[f40a309] | 64 | nonf, /* not_fld */
|
---|
| 65 | (struct fet *)NULL, /* curfet */
|
---|
| 66 | ptboxes, /* csbp */
|
---|
| 67 | crate1, /* cratex */
|
---|
| 68 | crate1, /* cratey */
|
---|
| 69 | CT_SMTH, /* cmtype */
|
---|
| 70 | CTOX(2), /* cxval */
|
---|
| 71 | RTOY(DATAROW) /* cyval */
|
---|
| 72 | };
|
---|
| 73 |
|
---|
| 74 | /* |
---|
| 75 |
|
---|
| 76 | */
|
---|
| 77 |
|
---|
| 78 | /*
|
---|
| 79 | =============================================================================
|
---|
| 80 | ptmkey() -- M key processing for the patch display
|
---|
| 81 | =============================================================================
|
---|
[0580615] | 82 | */
|
---|
[f40a309] | 83 |
|
---|
[7258c6a] | 84 | void ptmkey(void)
|
---|
[f40a309] | 85 | {
|
---|
| 86 | register int16_t nc;
|
---|
| 87 |
|
---|
| 88 | if (astat) {
|
---|
| 89 |
|
---|
| 90 | if (stccol EQ 48) {
|
---|
| 91 |
|
---|
| 92 | if (ss_sqsw EQ 0) {
|
---|
| 93 |
|
---|
| 94 | (*xy_dn)(); /* handle KEY_DOWN functions */
|
---|
| 95 |
|
---|
| 96 | (*premove)(); /* handle PRE-MOVE functions */
|
---|
| 97 |
|
---|
| 98 | nc = (*curtype)(); /* get new CURSOR TYPE wanted */
|
---|
| 99 |
|
---|
| 100 | cvtime = syrate;
|
---|
| 101 | ncvwait = curhold;
|
---|
| 102 |
|
---|
| 103 | ss_ptsw = -1;
|
---|
| 104 | cmtype = nc;
|
---|
| 105 | cvwait = 1;
|
---|
[9519422] | 106 | }
|
---|
[f40a309] | 107 |
|
---|
| 108 | } else
|
---|
| 109 | stdmkey();
|
---|
| 110 |
|
---|
| 111 | } else {
|
---|
| 112 |
|
---|
| 113 | if (stccol EQ 48) {
|
---|
| 114 |
|
---|
| 115 | ss_ptsw = 0;
|
---|
| 116 | cvwait = 1;
|
---|
| 117 | ncvwait = cvtime;
|
---|
| 118 | cmfirst = TRUE;
|
---|
| 119 |
|
---|
| 120 | if (ss_sqsw EQ 0)
|
---|
| 121 | (*xy_up)();
|
---|
| 122 |
|
---|
| 123 | (*pstmove)(); /* handle POST-MOVE functions */
|
---|
| 124 |
|
---|
| 125 | } else
|
---|
| 126 | stdmkey();
|
---|
| 127 | }
|
---|
| 128 | }
|
---|
| 129 |
|
---|
| 130 | /* |
---|
| 131 |
|
---|
| 132 | */
|
---|
| 133 |
|
---|
| 134 | /*
|
---|
| 135 | =============================================================================
|
---|
| 136 | ptekey() -- E key processing for the patch display
|
---|
[0580615] | 137 | =============================================================================
|
---|
[f40a309] | 138 | */
|
---|
[7258c6a] | 139 |
|
---|
[f40a309] | 140 | void ptekey(void)
|
---|
| 141 | {
|
---|
| 142 | register int16_t nc;
|
---|
| 143 |
|
---|
| 144 | if (astat) {
|
---|
| 145 |
|
---|
| 146 | if (stccol EQ 48) {
|
---|
| 147 |
|
---|
| 148 | if (ss_sqsw EQ 0) {
|
---|
| 149 |
|
---|
| 150 | (*xy_dn)(); /* handle KEY_DOWN functions */
|
---|
| 151 |
|
---|
| 152 | (*premove)(); /* handle PRE-MOVE functions */
|
---|
| 153 |
|
---|
| 154 | nc = (*curtype)(); /* get new CURSOR TYPE wanted */
|
---|
| 155 |
|
---|
| 156 | cvtime = syrate;
|
---|
| 157 | ncvwait = curhold;
|
---|
| 158 |
|
---|
| 159 | ss_ptsw = 1;
|
---|
| 160 | cmtype = nc;
|
---|
| 161 | cvwait = 1;
|
---|
| 162 | }
|
---|
| 163 |
|
---|
| 164 | } else
|
---|
| 165 | select();
|
---|
| 166 |
|
---|
| 167 | } else {
|
---|
| 168 |
|
---|
| 169 | if (stccol EQ 48) {
|
---|
| 170 |
|
---|
| 171 | ss_ptsw = 0;
|
---|
| 172 | cvwait = 1;
|
---|
| 173 | ncvwait = cvtime;
|
---|
| 174 | cmfirst = TRUE;
|
---|
| 175 |
|
---|
| 176 | if (ss_sqsw EQ 0)
|
---|
| 177 | (*xy_up)();
|
---|
| 178 |
|
---|
| 179 | (*pstmove)(); /* handle POST-MOVE functions */
|
---|
| 180 |
|
---|
| 181 | } else
|
---|
| 182 | select();
|
---|
| 183 | }
|
---|
| 184 | }
|
---|
| 185 |
|
---|
| 186 | /* |
---|
| 187 |
|
---|
| 188 | */
|
---|
| 189 |
|
---|
| 190 | /*
|
---|
| 191 | =============================================================================
|
---|
[0580615] | 192 | ptxkey() -- X key processing for the patch display
|
---|
[f40a309] | 193 | =============================================================================
|
---|
[7258c6a] | 194 | */
|
---|
[f40a309] | 195 |
|
---|
| 196 | void ptxkey(void)
|
---|
| 197 | {
|
---|
| 198 | register int16_t i, cp, pp, sp, stm;
|
---|
| 199 |
|
---|
| 200 | if (NOT astat) /* only on key closures ... */
|
---|
| 201 | return;
|
---|
| 202 |
|
---|
| 203 | if (inrange(stccol, 2, 13)) { /* definer -- clear definer */
|
---|
| 204 |
|
---|
| 205 | if (ptecpos AND NOT ptbflag) { /* refresh data entry stuff */
|
---|
| 206 |
|
---|
| 207 | memcpyw(&ptebuf.defnum, &patches[ptecpos].defnum, 6);
|
---|
| 208 | pteset = TRUE;
|
---|
| 209 | pte2buf();
|
---|
| 210 | }
|
---|
| 211 |
|
---|
| 212 | ptedef = NULL_DEF;
|
---|
| 213 | ptedfok = TRUE;
|
---|
| 214 |
|
---|
| 215 | memset(&ptdebuf[2], ' ', 12);
|
---|
| 216 |
|
---|
| 217 | for (i = 0; i < 48; i++)
|
---|
| 218 | if (ptdebuf[i] EQ '\0')
|
---|
| 219 | ptdebuf[i] = ' ';
|
---|
| 220 |
|
---|
| 221 | ptdebuf[0] = '\260';
|
---|
| 222 | ptdebuf[48] = '\0';
|
---|
| 223 |
|
---|
| 224 | UpdVid(7, 0, ptdebuf, PTEATR);
|
---|
| 225 | movectc(stcrow, stccol);
|
---|
| 226 |
|
---|
| 227 | /* |
---|
| 228 |
|
---|
| 229 | */
|
---|
| 230 | } else if (inrange(stccol, 15, 26)) { /* stimulus -- clear stimulus */
|
---|
| 231 |
|
---|
| 232 | if (ptecpos AND NOT ptbflag) { /* refresh data entry stuff */
|
---|
| 233 |
|
---|
| 234 | memcpyw(&ptebuf.defnum, &patches[ptecpos].defnum, 6);
|
---|
| 235 | pteset = TRUE;
|
---|
| 236 | pte2buf();
|
---|
| 237 | }
|
---|
| 238 |
|
---|
| 239 | ptestm = NULL_DEF;
|
---|
| 240 | ptestok = FALSE;
|
---|
| 241 |
|
---|
| 242 | memset(&ptdebuf[15], ' ', 12);
|
---|
| 243 |
|
---|
| 244 | for (i = 0; i < 48; i++)
|
---|
| 245 | if (ptdebuf[i] EQ '\0')
|
---|
| 246 | ptdebuf[i] = ' ';
|
---|
| 247 |
|
---|
| 248 | ptdebuf[0] = '\260';
|
---|
| 249 | ptdebuf[48] = '\0';
|
---|
| 250 |
|
---|
| 251 | UpdVid(7, 0, ptdebuf, PTEATR);
|
---|
| 252 | movectc(stcrow, stccol);
|
---|
| 253 |
|
---|
| 254 | } else if (inrange(stccol, 28, 40)) { /* destination -- clear line */
|
---|
| 255 |
|
---|
| 256 | voidpb(); /* void the patch buffer */
|
---|
| 257 |
|
---|
| 258 | ptdebuf[0] = '\260';
|
---|
| 259 | ptdebuf[48] = '\0';
|
---|
| 260 |
|
---|
| 261 | UpdVid(7, 0, ptdebuf, PTEATR);
|
---|
| 262 | movectc(stcrow, stccol);
|
---|
| 263 | /* |
---|
| 264 |
|
---|
| 265 | */
|
---|
| 266 | } else if (inrange(stccol, 42, 46)) { /* datum -- delete the patch */
|
---|
| 267 |
|
---|
| 268 | if (ptecpos) {
|
---|
| 269 |
|
---|
| 270 | cp = ptecpos; /* setup indices */
|
---|
| 271 | pp = patches[cp].prevstm;
|
---|
| 272 | sp = patches[cp].nextstm;
|
---|
| 273 |
|
---|
| 274 | stm = patches[cp].stmnum; /* get stimulus used */
|
---|
| 275 | #if DEBUGXP
|
---|
| 276 | if (debugsw AND debugxp)
|
---|
| 277 | printf("ptxkey(): DELETING PATCH pp = %d cp = %d sp = %d\n",
|
---|
| 278 | pp, cp, sp);
|
---|
| 279 | #endif
|
---|
| 280 |
|
---|
| 281 | if (pp) /* adjust predecessor */
|
---|
| 282 | patches[pp].nextstm = sp;
|
---|
| 283 | else /* adjust stmptr */
|
---|
| 284 | stmptr[TRG_MASK & stm] = sp;
|
---|
| 285 |
|
---|
| 286 | if (sp) /* adjust successor */
|
---|
| 287 | patches[sp].prevstm = pp;
|
---|
| 288 |
|
---|
| 289 | if (sp = findnxt(cp)) /* adjust ptecpos */
|
---|
| 290 | ptecpos = sp;
|
---|
| 291 | else if (pp = findprv(cp))
|
---|
| 292 | ptecpos = pp;
|
---|
| 293 | else
|
---|
| 294 | ptecpos = 0;
|
---|
| 295 |
|
---|
| 296 | pt_del(cp); /* delete the patch entry */
|
---|
| 297 | /* |
---|
| 298 |
|
---|
| 299 | */
|
---|
| 300 | for (i = 0; i < NDEFSTMS; ++i) { /* adjust defptr list */
|
---|
| 301 |
|
---|
| 302 | if (cp = defptr[i]) { /* in use ? */
|
---|
| 303 |
|
---|
| 304 | pp = 0; /* initial predecessor */
|
---|
| 305 |
|
---|
| 306 | while (cp) { /* check the chain */
|
---|
| 307 |
|
---|
| 308 | sp = defents[cp].nextdef; /* successor */
|
---|
| 309 |
|
---|
| 310 | if (defents[cp].stm EQ stm) {
|
---|
| 311 |
|
---|
| 312 | #if DEBUGXP
|
---|
| 313 | if (debugsw AND debugxp) {
|
---|
| 314 |
|
---|
| 315 | printf("ptxkey(): DELETING DEF trg=$%04.4X stm=$%04.4X\n",
|
---|
| 316 | i, stm);
|
---|
| 317 |
|
---|
| 318 | printf("ptxkey(): DELETING DEF pp=%d cp=%d sp=%d\n",
|
---|
| 319 | pp, cp, sp);
|
---|
| 320 | }
|
---|
| 321 | #endif
|
---|
| 322 |
|
---|
| 323 | if (pp) /* adjust predecessor */
|
---|
| 324 | defents[pp].nextdef = sp;
|
---|
| 325 | else /* adjust defptr */
|
---|
| 326 | defptr[i] = sp;
|
---|
| 327 |
|
---|
| 328 | dt_del(cp); /* delete def entry */
|
---|
| 329 |
|
---|
| 330 | } else {
|
---|
| 331 |
|
---|
| 332 | pp = cp; /* update predecessor index */
|
---|
| 333 | }
|
---|
| 334 |
|
---|
| 335 | cp = sp; /* next defent */
|
---|
| 336 | }
|
---|
| 337 | }
|
---|
| 338 | }
|
---|
| 339 |
|
---|
| 340 | dptw(); /* update the display */
|
---|
| 341 | }
|
---|
| 342 | }
|
---|
| 343 | }
|
---|
| 344 |
|
---|
| 345 | /* |
---|
| 346 |
|
---|
[7258c6a] | 347 | */
|
---|
[f40a309] | 348 |
|
---|
[7258c6a] | 349 | /*
|
---|
[f40a309] | 350 | =============================================================================
|
---|
| 351 | dspdfst() -- convert a patch DEF or STM value for display
|
---|
| 352 | =============================================================================
|
---|
| 353 | */
|
---|
| 354 |
|
---|
| 355 | void dspdfst(int8_t *buf, uint16_t val)
|
---|
| 356 | {
|
---|
| 357 | register uint16_t chan, port, stim;
|
---|
| 358 |
|
---|
| 359 | if (val EQ NULL_DEF) { /* handle possible blank definer */
|
---|
| 360 |
|
---|
| 361 | strcpy(buf, " ");
|
---|
| 362 | return;
|
---|
| 363 | }
|
---|
| 364 |
|
---|
| 365 | port = (val >> 11) & 0x0003;
|
---|
| 366 | chan = (val >> 7) & 0x000F;
|
---|
| 367 | stim = val & 0x007F;
|
---|
| 368 |
|
---|
| 369 | switch (port) { /* use port to decode possible types */
|
---|
| 370 |
|
---|
| 371 | case 0: /* MIDI-1 - Keys */
|
---|
| 372 | case 1: /* MIDI-2 - Keys */
|
---|
| 373 |
|
---|
| 374 | sprintf(buf, "%s %03u %u %02u",
|
---|
| 375 | (val & 0x8000) ? "Rel" : "Key",
|
---|
| 376 | 1 + stim, 1 + port, 1 + chan);
|
---|
| 377 |
|
---|
| 378 | break;
|
---|
| 379 | /* |
---|
| 380 |
|
---|
| 381 | */
|
---|
| 382 |
|
---|
| 383 | case 2: /* Local Keys */
|
---|
| 384 |
|
---|
| 385 | switch (chan) { /* use channel to further decode */
|
---|
| 386 |
|
---|
| 387 | case 0: /* Keys - Local Keyboard */
|
---|
| 388 |
|
---|
| 389 | sprintf(buf, "%s %03u L ",
|
---|
| 390 | (val & 0x8000) ? "Rel" : "Key",
|
---|
| 391 | 1 + stim);
|
---|
| 392 |
|
---|
| 393 | break;
|
---|
| 394 |
|
---|
| 395 | case 2: /* Triggers */
|
---|
| 396 |
|
---|
| 397 | sprintf(buf, "Trig %02u ", 1 + stim);
|
---|
| 398 | break;
|
---|
| 399 |
|
---|
| 400 | case 3: /* Pulses */
|
---|
| 401 |
|
---|
| 402 | sprintf(buf, "Pulse %u ", 1 + stim);
|
---|
| 403 | break;
|
---|
| 404 |
|
---|
| 405 | default: /* spurious type -- shouldn't happen */
|
---|
| 406 |
|
---|
| 407 | sprintf(buf, "%s?? %03u L %02u",
|
---|
| 408 | (val & 0x8000) ? "r" : "c",
|
---|
| 409 | 1 + stim, 1 + chan);
|
---|
| 410 | break;
|
---|
| 411 |
|
---|
| 412 | }
|
---|
| 413 |
|
---|
| 414 | break;
|
---|
| 415 |
|
---|
| 416 | default: /* spurious port -- should never happen */
|
---|
| 417 |
|
---|
| 418 | sprintf(buf, "??? %03u %u %02u", 1 + stim, 1 + port, 1 + chan);
|
---|
| 419 | break;
|
---|
| 420 | }
|
---|
| 421 | }
|
---|
| 422 |
|
---|
[7258c6a] | 423 | /* |
---|
[f40a309] | 424 |
|
---|
[7258c6a] | 425 | */
|
---|
| 426 |
|
---|
| 427 | /*
|
---|
[f40a309] | 428 | =============================================================================
|
---|
| 429 | dfpdat() -- convert FPU datum for display
|
---|
| 430 | =============================================================================
|
---|
| 431 | */
|
---|
| 432 |
|
---|
| 433 | int8_t *dfpdat(struct patch *pp)
|
---|
| 434 | {
|
---|
| 435 | static int8_t buf[32];
|
---|
| 436 | uint16_t sgn, vp1, vp2;
|
---|
| 437 | int16_t val;
|
---|
| 438 |
|
---|
| 439 | val = pp->padat2;
|
---|
| 440 |
|
---|
| 441 | switch (pp->padat1) {
|
---|
| 442 |
|
---|
| 443 | case PSA_SRC: /* source */
|
---|
| 444 |
|
---|
| 445 | strcpy(buf, smdata[val]);
|
---|
| 446 | break;
|
---|
| 447 |
|
---|
| 448 | case PSA_MLT: /* multiplier */
|
---|
| 449 |
|
---|
| 450 | fr2dec(val, ebuf);
|
---|
| 451 |
|
---|
| 452 | buf[0] = ebuf[3];
|
---|
| 453 | buf[1] = ebuf[0];
|
---|
| 454 | buf[2] = '.';
|
---|
| 455 | buf[3] = ebuf[1];
|
---|
| 456 | buf[4] = ebuf[2];
|
---|
| 457 | buf[5] = '\0';
|
---|
| 458 | break;
|
---|
| 459 | /* |
---|
| 460 |
|
---|
| 461 | */
|
---|
| 462 | case PSA_VAL: /* value */
|
---|
| 463 |
|
---|
| 464 | val >>= 5;
|
---|
| 465 |
|
---|
| 466 | if (val < 0) {
|
---|
| 467 |
|
---|
| 468 | val = -val;
|
---|
| 469 | sgn = '-';
|
---|
| 470 |
|
---|
| 471 | } else {
|
---|
| 472 |
|
---|
| 473 | sgn = '+';
|
---|
| 474 | }
|
---|
| 475 |
|
---|
| 476 | vp1 = val / 100;
|
---|
| 477 | vp2 = val - (vp1 * 100);
|
---|
| 478 |
|
---|
| 479 | if (vp1 > 9) {
|
---|
| 480 |
|
---|
| 481 | vp1 = 0;
|
---|
| 482 |
|
---|
| 483 | if (sgn EQ '+')
|
---|
| 484 | sgn = '\240';
|
---|
| 485 | else
|
---|
| 486 | sgn = '\241';
|
---|
| 487 | }
|
---|
| 488 |
|
---|
| 489 | sprintf(buf, "%c%u.%02u", sgn, vp1, vp2);
|
---|
| 490 | break;
|
---|
| 491 | /* |
---|
| 492 |
|
---|
| 493 | */
|
---|
| 494 | case PSA_TIM: /* time */
|
---|
| 495 |
|
---|
| 496 | vp1 = fromfpu(val);
|
---|
| 497 |
|
---|
| 498 | sprintf(buf, "%5u", vp1);
|
---|
| 499 | break;
|
---|
| 500 |
|
---|
| 501 | case PSA_FNC: /* function / control */
|
---|
| 502 |
|
---|
| 503 | if ((PE_SPEC & pp->paspec) EQ PA_AUX)
|
---|
| 504 | sprintf(buf, "%s", (val & 0x0001) ? "On " : "Off ");
|
---|
| 505 | else
|
---|
| 506 | sprintf(buf, "%s", (val & 0x0001) ? "Start" : "Stop ");
|
---|
| 507 |
|
---|
| 508 | break;
|
---|
| 509 |
|
---|
| 510 | default:
|
---|
| 511 |
|
---|
| 512 | sprintf(buf, "$%04.4X", val);
|
---|
| 513 | break;
|
---|
| 514 | }
|
---|
| 515 |
|
---|
| 516 | return(buf);
|
---|
| 517 | }
|
---|
[7258c6a] | 518 |
|
---|
[f40a309] | 519 | /* |
---|
| 520 |
|
---|
| 521 | */
|
---|
| 522 |
|
---|
| 523 | /*
|
---|
| 524 | =============================================================================
|
---|
| 525 | pafpu1() -- convert patch for display -- aaaaa ssss tn ddddd
|
---|
| 526 |
|
---|
| 527 | Level, Filtr, Fil Q, Loctn, Dynmc
|
---|
| 528 | =============================================================================
|
---|
| 529 | */
|
---|
| 530 |
|
---|
[7258c6a] | 531 | void pafpu1(int8_t *bf, int8_t *ad, uint16_t gt, uint16_t gn, struct patch *pp)
|
---|
[f40a309] | 532 | {
|
---|
| 533 | sprintf(bf, "%s %s %c%c %s", ad, stdata[pp->padat1], gt, gn, dfpdat(pp));
|
---|
| 534 | }
|
---|
| 535 |
|
---|
| 536 | /*
|
---|
| 537 | =============================================================================
|
---|
| 538 | pafpu2() -- convert patch for display -- aaa n ssss tn ddddd
|
---|
| 539 |
|
---|
| 540 | Index, Freq
|
---|
| 541 | =============================================================================
|
---|
| 542 | */
|
---|
| 543 |
|
---|
[7258c6a] | 544 | void pafpu2(int8_t *bf, int8_t *ad, uint16_t os, uint16_t gt, uint16_t gn, struct patch *pp)
|
---|
[f40a309] | 545 | {
|
---|
| 546 | sprintf(bf, "%s %d %s %c%c %s", ad, os, stdata[pp->padat1], gt, gn, dfpdat(pp));
|
---|
| 547 | }
|
---|
| 548 |
|
---|
| 549 | /*
|
---|
| 550 | =============================================================================
|
---|
| 551 | pafpu3() -- convert patch for display -- aaaaa ssss ddddd
|
---|
| 552 |
|
---|
| 553 | Aux, Rate, Inten, Depth, Vlt
|
---|
| 554 | =============================================================================
|
---|
| 555 | */
|
---|
| 556 |
|
---|
| 557 | void pafpu3(int8_t *bf, int8_t *ad, struct patch *pp)
|
---|
[7258c6a] | 558 | {
|
---|
[f40a309] | 559 | sprintf(bf, "%s %s %s", ad, stdata[pp->padat1], dfpdat(pp));
|
---|
[7258c6a] | 560 | }
|
---|
| 561 |
|
---|
| 562 | /* |
---|
[f40a309] | 563 |
|
---|
| 564 | */
|
---|
| 565 |
|
---|
| 566 | /*
|
---|
| 567 | =============================================================================
|
---|
| 568 | dspdest() -- convert patch destination and datum for display
|
---|
| 569 | =============================================================================
|
---|
| 570 | */
|
---|
| 571 |
|
---|
| 572 | void dspdest(int8_t *buf, struct patch *pp)
|
---|
| 573 | {
|
---|
| 574 | uint16_t chan, osc, port, stim, vg, vgt, vgn, vp1, vp2, sgn;
|
---|
| 575 | int16_t val;
|
---|
| 576 | int8_t buf2[16], *rtype;
|
---|
| 577 |
|
---|
| 578 | port = (pp->pasuba >> 11) & 0x0003; /* for trg types */
|
---|
| 579 | chan = (pp->pasuba >> 7) & 0x000F;
|
---|
| 580 | stim = pp->pasuba & 0x007F;
|
---|
| 581 |
|
---|
| 582 | vg = (pp->pasuba >> 8) & 0x00FF; /* for vg types */
|
---|
| 583 | osc = (pp->pasuba & 0x00FF) + 1;
|
---|
| 584 |
|
---|
| 585 | if (vg > 11) {
|
---|
| 586 |
|
---|
| 587 | vgt = 'G';
|
---|
| 588 | vgn = vg - 11;
|
---|
| 589 |
|
---|
| 590 | } else {
|
---|
| 591 |
|
---|
| 592 | vgt = 'V';
|
---|
| 593 | vgn = vg + 1;
|
---|
| 594 | }
|
---|
| 595 |
|
---|
| 596 | vgn = vgn + ((vgn > 9) ? '\242' : '0');
|
---|
| 597 |
|
---|
| 598 | /* |
---|
| 599 |
|
---|
| 600 | */
|
---|
| 601 | switch (PE_SPEC & pp->paspec) {
|
---|
| 602 |
|
---|
| 603 | case PA_KEY: /* key action */
|
---|
| 604 |
|
---|
| 605 | sprintf(buf, "K %03u %u %02u %s",
|
---|
| 606 | 1 + stim, 1 + port, 1 + chan,
|
---|
| 607 | trdata[pp->padat2 & 0x0003]);
|
---|
| 608 |
|
---|
| 609 | break;
|
---|
| 610 |
|
---|
| 611 | case PA_TRG:
|
---|
| 612 |
|
---|
| 613 | sprintf(buf, "Trigger %02u %s",
|
---|
| 614 | 1 + stim,
|
---|
| 615 | ssdata[pp->padat2 & 0x0001]);
|
---|
| 616 |
|
---|
| 617 | break;
|
---|
| 618 |
|
---|
| 619 | case PA_PLS:
|
---|
| 620 |
|
---|
| 621 | sprintf(buf, "Pulse %u %s",
|
---|
| 622 | 1 + stim,
|
---|
| 623 | trdata[pp->padat2 & 0x0003]);
|
---|
| 624 |
|
---|
| 625 | break;
|
---|
| 626 | /* |
---|
| 627 |
|
---|
| 628 | */
|
---|
| 629 | case PA_LED:
|
---|
| 630 |
|
---|
| 631 | if (pp->pasuba & 0x0001) {
|
---|
| 632 |
|
---|
| 633 | sprintf(buf, "LED %c %c%c%c%c",
|
---|
| 634 | 'A' + pp->pasuba,
|
---|
| 635 | '0' + ((pp->padat1 >> 14) & 0x0003),
|
---|
| 636 | '0' + ((pp->padat1 >> 12) & 0x0003),
|
---|
| 637 | '0' + ((pp->padat1 >> 10) & 0x0003),
|
---|
| 638 | '0' + ((pp->padat1 >> 8) & 0x0003));
|
---|
| 639 |
|
---|
| 640 | } else {
|
---|
| 641 |
|
---|
| 642 | sprintf(buf, "LED %c %c%c%c",
|
---|
| 643 | 'A' + pp->pasuba,
|
---|
| 644 | '0' + ((pp->padat1 >> 14) & 0x0003),
|
---|
| 645 | '0' + ((pp->padat1 >> 12) & 0x0003),
|
---|
| 646 | '0' + ((pp->padat1 >> 10) & 0x0003));
|
---|
| 647 | }
|
---|
| 648 |
|
---|
| 649 | break;
|
---|
| 650 |
|
---|
| 651 | case PA_SLIN:
|
---|
| 652 |
|
---|
| 653 | sprintf(buf, "Seq %02u Lin %03u",
|
---|
| 654 | 1 + pp->pasuba,
|
---|
| 655 | pp->padat1);
|
---|
| 656 |
|
---|
| 657 | break;
|
---|
| 658 |
|
---|
| 659 | case PA_SCTL:
|
---|
| 660 |
|
---|
| 661 | sprintf(buf, "Seq %02u Ctl %s",
|
---|
| 662 | 1 + pp->pasuba,
|
---|
| 663 | ssdata[pp->padat2 & 0x0001]);
|
---|
| 664 |
|
---|
| 665 | break;
|
---|
| 666 |
|
---|
| 667 | case PA_TUNE:
|
---|
| 668 |
|
---|
| 669 | sprintf(buf, "Tune Table %u",
|
---|
| 670 | pp->padat1);
|
---|
| 671 |
|
---|
| 672 | break;
|
---|
| 673 | /* |
---|
| 674 |
|
---|
| 675 | */
|
---|
| 676 | case PA_RSET:
|
---|
| 677 |
|
---|
| 678 | rtype = "Set";
|
---|
| 679 | goto doregs;
|
---|
| 680 |
|
---|
| 681 | case PA_RADD:
|
---|
| 682 |
|
---|
| 683 | rtype = "Add";
|
---|
| 684 |
|
---|
| 685 | doregs:
|
---|
| 686 |
|
---|
| 687 | if (pp->padat1 & 0x0001) {
|
---|
| 688 |
|
---|
| 689 | sprintf(buf, "Reg %02u %s R%02u",
|
---|
| 690 | 1 + pp->pasuba, rtype,
|
---|
| 691 | 1 + pp->padat2);
|
---|
| 692 |
|
---|
| 693 | } else {
|
---|
| 694 |
|
---|
| 695 | if ((val = pp->padat2) < 0) {
|
---|
| 696 |
|
---|
| 697 | sgn = '-';
|
---|
| 698 | val = - val;
|
---|
| 699 |
|
---|
| 700 | } else {
|
---|
| 701 |
|
---|
| 702 | sgn = '+';
|
---|
| 703 | }
|
---|
| 704 |
|
---|
| 705 | sprintf(buf, "Reg %02u %s %c%02u",
|
---|
| 706 | 1 + pp->pasuba, rtype,
|
---|
| 707 | sgn, val);
|
---|
| 708 | }
|
---|
| 709 |
|
---|
| 710 | break;
|
---|
| 711 |
|
---|
| 712 | case PA_INST:
|
---|
| 713 |
|
---|
| 714 | sprintf(buf, "Instrument %c%c %02u",
|
---|
| 715 | vgt, vgn, pp->padat1);
|
---|
| 716 |
|
---|
| 717 | break;
|
---|
| 718 | /* |
---|
| 719 |
|
---|
| 720 | */
|
---|
| 721 | case PA_OSC:
|
---|
| 722 |
|
---|
| 723 | val = pp->padat2 >> 1;
|
---|
| 724 |
|
---|
| 725 | switch (pp->padat1) {
|
---|
| 726 |
|
---|
| 727 | case PSO_INT: /* interval */
|
---|
| 728 |
|
---|
| 729 | if (val < 0) {
|
---|
| 730 |
|
---|
| 731 | sgn = '-';
|
---|
| 732 | val = -val;
|
---|
| 733 |
|
---|
| 734 | } else {
|
---|
| 735 |
|
---|
| 736 | sgn = '+';
|
---|
| 737 | }
|
---|
| 738 |
|
---|
| 739 | sprintf(buf, "Osc %u Int %c%c %c%04u",
|
---|
| 740 | osc, vgt, vgn, sgn, val);
|
---|
| 741 |
|
---|
| 742 | break;
|
---|
| 743 |
|
---|
| 744 | case PSO_RAT: /* ratio */
|
---|
| 745 |
|
---|
| 746 | int2rat(val);
|
---|
| 747 |
|
---|
| 748 | sprintf(buf, "Osc %u Rat %c%c %s",
|
---|
| 749 | osc, vgt, vgn, ebuf);
|
---|
| 750 |
|
---|
| 751 | break;
|
---|
| 752 |
|
---|
| 753 | case PSO_FRQ: /* frequency */
|
---|
| 754 |
|
---|
| 755 | vp1 = val / 10;
|
---|
| 756 | vp2 = val - (vp1 * 10);
|
---|
| 757 |
|
---|
| 758 | sprintf(buf, "Osc %u Frq %c%c %02u.%u",
|
---|
| 759 | osc, vgt, vgn, vp1, vp2);
|
---|
| 760 |
|
---|
| 761 | break;
|
---|
| 762 | /* |
---|
| 763 |
|
---|
| 764 | */
|
---|
| 765 | case PSO_PCH: /* pitch */
|
---|
| 766 |
|
---|
| 767 | cnvc2p(ebuf, val);
|
---|
| 768 |
|
---|
| 769 | sprintf(buf, "Osc %u Pch %c%c %s",
|
---|
| 770 | osc, vgt, vgn, ebuf);
|
---|
| 771 |
|
---|
| 772 | break;
|
---|
| 773 |
|
---|
| 774 | default:
|
---|
| 775 |
|
---|
| 776 | break;
|
---|
| 777 | }
|
---|
| 778 |
|
---|
| 779 | break;
|
---|
| 780 | /* |
---|
| 781 |
|
---|
| 782 | */
|
---|
| 783 | case PA_WAVA:
|
---|
| 784 |
|
---|
| 785 | sgn = 'A';
|
---|
| 786 | goto dowaves;
|
---|
| 787 |
|
---|
| 788 | case PA_WAVB:
|
---|
| 789 |
|
---|
| 790 | sgn = 'B';
|
---|
| 791 |
|
---|
| 792 | dowaves:
|
---|
| 793 |
|
---|
| 794 | sprintf(buf, "Waveshape%c %c%c %02u",
|
---|
| 795 | sgn, vgt, vgn, pp->padat1);
|
---|
| 796 |
|
---|
| 797 | break;
|
---|
| 798 |
|
---|
| 799 | case PA_CNFG:
|
---|
| 800 |
|
---|
| 801 | sprintf(buf, "Configure %c%c %02u",
|
---|
| 802 | vgt, vgn, pp->padat1);
|
---|
| 803 |
|
---|
| 804 | break;
|
---|
| 805 | /* |
---|
| 806 |
|
---|
| 807 | */
|
---|
| 808 | case PA_LEVL:
|
---|
| 809 |
|
---|
| 810 | pafpu1(buf, "Level", vgt, vgn, pp);
|
---|
| 811 | break;
|
---|
| 812 |
|
---|
| 813 | case PA_INDX:
|
---|
| 814 |
|
---|
| 815 | pafpu2(buf, "Ind", osc, vgt, vgn, pp);
|
---|
| 816 | break;
|
---|
| 817 |
|
---|
| 818 | case PA_FREQ:
|
---|
| 819 |
|
---|
| 820 | pafpu2(buf, "Frq", osc, vgt, vgn, pp);
|
---|
| 821 | break;
|
---|
| 822 |
|
---|
| 823 | case PA_FILT:
|
---|
| 824 |
|
---|
| 825 | pafpu1(buf, "Filtr", vgt, vgn, pp);
|
---|
| 826 | break;
|
---|
| 827 |
|
---|
| 828 | case PA_FILQ:
|
---|
| 829 |
|
---|
| 830 | pafpu1(buf, "Fil Q", vgt, vgn, pp);
|
---|
| 831 | break;
|
---|
| 832 |
|
---|
| 833 | case PA_LOCN:
|
---|
| 834 |
|
---|
| 835 | pafpu1(buf, "Loctn", vgt, vgn, pp);
|
---|
| 836 | break;
|
---|
| 837 |
|
---|
| 838 | case PA_DYNM:
|
---|
| 839 |
|
---|
| 840 | pafpu1(buf, "Dynmc", vgt, vgn, pp);
|
---|
| 841 | break;
|
---|
| 842 | /* |
---|
| 843 |
|
---|
| 844 | */
|
---|
| 845 | case PA_AUX:
|
---|
| 846 |
|
---|
| 847 | pafpu3(buf, "Aux ", pp);
|
---|
| 848 | break;
|
---|
| 849 |
|
---|
| 850 | case PA_RATE:
|
---|
| 851 |
|
---|
| 852 | pafpu3(buf, "Rate ", pp);
|
---|
| 853 | break;
|
---|
| 854 |
|
---|
| 855 | case PA_INTN:
|
---|
| 856 |
|
---|
| 857 | pafpu3(buf, "Inten", pp);
|
---|
| 858 | break;
|
---|
| 859 |
|
---|
| 860 | case PA_DPTH:
|
---|
| 861 |
|
---|
| 862 | pafpu3(buf, "Depth", pp);
|
---|
| 863 | break;
|
---|
[0580615] | 864 |
|
---|
[f40a309] | 865 | case PA_VOUT:
|
---|
| 866 |
|
---|
| 867 | sprintf(buf2, "Vlt %u", pp->pasuba);
|
---|
| 868 | pafpu3(buf, buf2, pp);
|
---|
| 869 | break;
|
---|
| 870 |
|
---|
| 871 | default:
|
---|
| 872 |
|
---|
| 873 | break;
|
---|
| 874 | }
|
---|
| 875 | }
|
---|
| 876 |
|
---|
[6262b5c] | 877 | /* |
---|
| 878 |
|
---|
| 879 | */
|
---|
| 880 |
|
---|
| 881 | /*
|
---|
| 882 | =============================================================================
|
---|
| 883 | ptfield() -- setup field routines for the patch editor
|
---|
| 884 | =============================================================================
|
---|
| 885 | */
|
---|
| 886 |
|
---|
| 887 | void ptfield(void)
|
---|
| 888 | {
|
---|
| 889 | curset(&pt_flds);
|
---|
| 890 |
|
---|
| 891 | #if USEVECTR
|
---|
| 892 | if (usevect) {
|
---|
| 893 |
|
---|
| 894 | cx_key = cxkstd;
|
---|
| 895 | cy_key = cykstd;
|
---|
| 896 | }
|
---|
| 897 | #endif
|
---|
| 898 |
|
---|
| 899 | }
|
---|
| 900 |
|
---|