source: buchla-68k/ram/scselbx.c@ 7ecfb7b

Last change on this file since 7ecfb7b was 7ecfb7b, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Unused variables and parameters.

  • Property mode set to 100644
File size: 33.4 KB
Line 
1/*
2 =============================================================================
3 scselbx.c -- MIDAS-VII -- score editor box selection functions
4 Version 87 -- 1989-11-15 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "ram.h"
9
10int8_t *sdmenus[][3] = { /* score display menus */
11
12 /* 0 - typewriter */
13
14 {" ABCDEFGHIJKLMNOPQRSTUVWXYZ | ",
15 " abcdefghijklmnopqrstuvwxyz -*- ",
16 " 0123456789+-/*().,:;!?&<> | "},
17
18 /* 1 - note edit */
19
20 {" Begin Acc Move Note Escape ",
21 " Begin Nat Move Begin ",
22 " End Note Move End "},
23
24 /* 2 - clock source */
25
26 {" Local PLS24 Step ",
27 " MIDI PLS48 ",
28 " SMPTE PLS96 "},
29
30 /* 3 - clock control */
31
32 {" Local ",
33 " MIDI ",
34 " SMPTE "},
35
36 /* 4 - Section menu */
37
38 {" GoTo Move SMPTE ",
39 " Begin Copy Del Gr ",
40 " End Merge Del Ev "}
41};
42
43int8_t sdmln3[] =
44 " ReGrp Remove Trn S ";
45
46int8_t sdmln4[] =
47 "Escape D ";
48
49int16_t sdmht[][3] = { /* score section menu highlight table */
50
51 /* row, lcol, rcol */
52
53 { 6, 0, 0}, /* 0 - SOP_NUL */
54 { 3, 1, 4}, /* 1 - SOP_GO */
55 { 4, 1, 5}, /* 2 - SOP_BGN */
56 { 5, 1, 3}, /* 3 - SOP_END */
57 { 3, 8, 11}, /* 4 - SOP_MOV */
58 { 4, 8, 11}, /* 5 - SOP_CPY */
59 { 5, 8, 12}, /* 6 - SOP_MRG */
60 { 3, 15, 19}, /* 7 - SOP_STC */
61 { 4, 15, 23}, /* 8 - SOP_DGR */
62 { 5, 15, 23}, /* 9 - SOP_DEV */
63 { 6, 15, 20}, /* 10 - SOP_RMV */
64 { 6, 8, 12} /* 11 - SOP_GRP */
65};
66
67int16_t sdmlim[][4] = { /* score display menu cursor limits */
68
69 /* top, left, bottom, right */
70
71 { 19, 1, 21, 30 }, /* 0 - typewriter */
72 { 19, 1, 21, 30 }, /* 1 - note edit */
73 { 19, 1, 21, 20 }, /* 2 - clock source */
74 { 19, 1, 21, 19 }, /* 3 - clock control */
75 { 19, 1, 23, 62 } /* 4 - section menu */
76};
77
78int8_t *nedlbl[] = { /* note edit function labels */
79
80 "Note Edit", /* 0 - NOP_NUL */
81 "Begin Acc", /* 1 - NOP_ACC */
82 "Begin Nat", /* 2 - NOP_NAT */
83 "End Note ", /* 3 - NOP_END */
84 "Move Note", /* 4 - NOP_MVN */
85 "Move Beg ", /* 5 - NOP_MVB */
86 "Move End " /* 6 - NOP_MVE */
87};
88
89struct selbox sdboxes[] = {
90
91 { 0, 0, 175, 13, 0, sdboxfn}, /* 0 - Sec, Beat, Frame */
92 {176, 0, 231, 13, 1, sdboxfn}, /* 1 - Insert */
93 {232, 0, 439, 13, 2, sdboxfn}, /* 2 - Clock */
94 {440, 0, 511, 13, 3, sdboxfn}, /* 3 - Note Edit */
95
96 { 0, 238, 111, 251, 4, sdboxfn}, /* 4 - Assignment */
97 {112, 238, 167, 251, 5, sdboxfn}, /* 5 - Tune */
98 {168, 238, 247, 251, 6, entbh}, /* 6 - Tempo */
99 {248, 238, 319, 251, 7, entbh}, /* 7 - Interpolate */
100 {320, 238, 398, 251, 8, sdboxfn}, /* 8 - Stop/Next */
101 {400, 238, 455, 251, 9, sdboxfn}, /* 9 - In/Out */
102 {456, 238, 511, 251, 10, sdboxfn}, /* 10 - Output */
103
104 { 0, 252, 511, 307, 11, sdboxfn}, /* 11 - Grp, Trns, Dyn, Vel */
105
106 { 0, 308, 511, 335, 12, sdboxfn}, /* 12 - Ansrc, Anval */
107
108 { 0, 336, 215, 349, 13, sdboxfn}, /* 13 - Score Title */
109 {216, 336, 455, 349, 14, sdboxfn}, /* 14 - Rec Mode */
110 {456, 336, 511, 349, 15, sdboxfn}, /* 15 - Memory */
111
112 { 0, 14, 511, 237, 16, sdboxfn}, /* 16 - Note Display */
113
114 { 0, 0, 0, 0, 0, FN_NULL} /* end of table */
115};
116
117/*
118 =============================================================================
119 insect() -- return section number pointed to in section menu, or -1
120 =============================================================================
121*/
122
123int16_t insect(void)
124{
125 register int16_t col;
126
127 col = vtccol - 24;
128
129 if (col < 0)
130 return(-1);
131
132 sgoflag = col & 3;
133
134 if ((vtcrow < 19) OR (vtcrow > 20))
135 return(-1);
136
137 return((col >> 2) + (10 * (vtcrow - 19)));
138}
139
140/*
141 =============================================================================
142 svtdsp() -- display data for the virtual typewriter
143 =============================================================================
144*/
145
146void svtdsp(uint16_t *obj, uint16_t fg, uint16_t bg, int16_t row, int16_t col, int8_t *buf)
147{
148 (void)fg;
149 (void)bg;
150
151 if (v_regs[5] & 0x0180)
152 vbank(0);
153
154 vputs(obj, row - 16, col, buf, SDW13ATR);
155}
156
157/*
158 =============================================================================
159 svtstop() -- end vitrual typewriter data entry
160 =============================================================================
161*/
162
163void svtstop(void)
164{
165 sdmenu(-1);
166}
167
168/*
169 =============================================================================
170 bspscur() -- backspace the score display text cursor
171 =============================================================================
172*/
173
174void bspscur(void)
175{
176 register int16_t newcol;
177
178 if (infield(stcrow, stccol, curfet))
179 cfetp = infetp;
180 else
181 return;
182
183 newcol = stccol - 1;
184
185 if (newcol GE cfetp->flcol)
186 stcpos(stcrow, newcol);
187
188 cxval = CTOX(stccol);
189 cyval = RTOY(stcrow);
190}
191
192/*
193 =============================================================================
194 dsects() -- display list of section numbers
195 Highlight active sections and indicate SMPTE time-coded sections.
196 =============================================================================
197*/
198
199void dsects(void)
200{
201 register int16_t atr, row, col, i, j;
202 int8_t buf[8];
203 int8_t cl, cr, csl, csr;
204 int16_t begun;
205
206 register struct s_entry *sp;
207
208 if (v_regs[5] & 0x0180)
209 vbank(0);
210
211 row = 3;
212
213 for (i = 0; i < N_SECTS; i += 10) {
214
215 col = 24;
216
217 for (j = 0; j < 10; j++) {
218
219 if (stimes[curscor][i + j].sflags) { /* SMPTE time */
220
221 csl = '[';
222 csr = ']';
223
224 } else { /* no SMPTE time */
225
226 csl = '{';
227 csr = '}';
228 }
229
230 cl = ' ';
231 cr = ' ';
232
233 if (E_NULL NE seclist[curscor][i + j]) {
234
235 begun = TRUE;
236 atr = (SDBGMM | (SD_CHNG << 4));
237 cl = csl;
238
239 } else {
240
241 begun = FALSE;
242 atr = SDMENUBG;
243 }
244
245 sp = hplist[curscor][EH_SEND];
246
247 while (sp) {
248
249 if (sp->e_data1 EQ (i + j)) {
250
251 cr = begun ? csr : '}';
252 break;
253 }
254
255 sp = sp->e_up;
256 }
257
258 sprintf(buf, "%c%02d%c", cl, 1 + (i + j), cr);
259
260 vputs(obj8, row, col, buf, atr);
261 col += 4;
262 }
263
264 ++row;
265 }
266}
267
268/*
269 =============================================================================
270 dsgtmn() -- display group map source group number
271 =============================================================================
272*/
273
274void dsgtmn(int16_t n, int16_t f)
275{
276 int8_t buf[4];
277 int16_t atr, col;
278
279 sprintf(buf, "%02d", n + 1);
280
281 col = (3 * n) + 28;
282 atr = f ? (SDBGMM | (SD_CHNG <<4)) : SDMENUBG;
283
284 if (v_regs[5] & 0x0180)
285 vbank(0);
286
287 vputs(obj8, 6, col, buf, atr);
288}
289
290/*
291 =============================================================================
292 dsgtme() -- display group map destination group number
293 =============================================================================
294*/
295
296void dsgtme(int16_t n)
297{
298 int8_t buf[4];
299 int16_t col;
300
301 if (grptmap[n] EQ -1)
302 strcpy(buf, " ");
303 else
304 sprintf(buf, "%02d", grptmap[n] + 1);
305
306 col = (3 * n) + 28;
307
308 if (v_regs[5] & 0x0180)
309 vbank(0);
310
311 vputs(obj8, 7, col, buf, SDMENUBG);
312}
313
314/*
315 =============================================================================
316 dsgtmap() -- display group map and transposition value
317 =============================================================================
318*/
319
320void dsgtmap(void)
321{
322 int8_t buf[6];
323 register int16_t i;
324
325 if (v_regs[5] & 0x0180)
326 vbank(0);
327
328 sprintf(buf, "%c%02d", grptran < 0 ? '-' : '+', abs(grptran));
329
330 vputs(obj8, 7, 22, buf, SDMENUBG);
331
332 for (i = 0; i < 12; i++) {
333
334 dsgtmn(i, gtmsel EQ i);
335 dsgtme(i);
336 }
337}
338
339/*
340 =============================================================================
341 ingroup() -- return group number selected
342 =============================================================================
343*/
344
345int16_t ingroup(void)
346{
347 register int16_t col;
348
349 col = vtccol - 28;
350
351 if (col < 0)
352 return(-1);
353
354 if (2 EQ (col % 3))
355 return(-1);
356
357 return(col / 3);
358}
359
360/*
361 =============================================================================
362 sdmtxt() -- output text to the score area submenu
363 =============================================================================
364*/
365
366void sdmtxt(int16_t row, int16_t col, int8_t *txt, int16_t tag)
367{
368 (void)tag;
369
370 if ((v_regs[5] & 0x0180) NE 0x0100)
371 vbank(1);
372
373 vcputsv(obj11, 64, SD_TEXT, SDBG16, row, col, txt, 14);
374}
375
376/*
377 =============================================================================
378 showam() -- show menu of assignments
379 =============================================================================
380*/
381
382void showam(int16_t asg)
383{
384 register int16_t col, na, row;
385
386 if (asg EQ 1)
387 na = 48;
388 else
389 na = NASGS;
390
391 for (col = 2; col < 60; col += 15) {
392
393 if (asg GE na)
394 return;
395
396 (*itxput)(0, col, "No Assignment", 0);
397
398 for (row = 1; row < 15; row++) {
399
400 if (asg GE na)
401 return;
402
403 sprintf(bfs, "%02d %-10.10s", asg, asgtab[asg].a_name);
404 (*itxput)(row, col, bfs, 1);
405 ++asg;
406 }
407 }
408}
409
410/*
411 =============================================================================
412 showtm() -- show menu of tunings
413 =============================================================================
414*/
415
416void showtm(void)
417{
418 register int16_t row, tun;
419
420 tun = 0;
421
422 (*itxput)(0, 0, "N Name", 0);
423
424 for (row = 1; row < 11; row++) {
425
426 sprintf(bfs, "%d %-32.32s", tun, tunname[tun]);
427 (*itxput)(row, 0, bfs, 1);
428 ++tun;
429 }
430}
431
432/*
433 =============================================================================
434 showsm() -- show menu of scores
435 =============================================================================
436*/
437
438void showsm(void)
439{
440 register int16_t col, row, scr;
441
442 scr = 1;
443
444 for (col = 1; col < 46; col+= 22) {
445
446 if (scr > N_SCORES)
447 return;
448
449 (*itxput)(0, col, "No Score", 0);
450
451 for (row = 1; row < 15; row++) {
452
453 if (scr > N_SCORES)
454 return;
455
456 sprintf(bfs, "%02d %-16.16s", scr, scname[scr - 1]);
457 (*itxput)(row, col, bfs, 1);
458 ++scr;
459 }
460 }
461}
462
463/*
464 =============================================================================
465 scmenu() -- display a submenu in area 1 (score area)
466 =============================================================================
467*/
468
469void scmenu(int16_t n)
470{
471 register struct octent *op;
472
473 if (n GE 0) { /* put up a submenu */
474
475 itxput = sdmtxt; /* setup output function */
476
477 vbank(0);
478
479 v_odtab[0][0] |= V_BLA; /* turn off line objcect */
480 objclr(0);
481
482 v_odtab[1][0] |= V_BLA; /* turn off score object */
483 objclr(1);
484
485 v_odtab[2][0] |= V_BLA; /* turn off keyboard object */
486 objclr(2);
487
488 vbank(1); /* clear the window */
489 vbfill4(obj11, 128, 0, 0, 511, 223, exp_c(SDBG16));
490
491 vbank(0); /* turn on window object */
492 SetPri(11, 4);
493
494 switch (n) { /* fill the window */
495
496 case 0: /* instruments */
497
498 showim(); /* show the instruments */
499 break;
500
501 case 1: /* assignments */
502
503 showam(lastam); /* show the assignments */
504 stcpos(17, 11); /* position the cursor */
505
506 cxval = CTOX(11);
507 cyval = RTOY(17);
508
509 if (infield(stcrow, stccol, curfet))
510 cfetp = infetp;
511
512 break;
513
514 case 2: /* tunings */
515
516 showtm(); /* show the tunings */
517 stcpos(17, 19); /* position the cursor */
518
519 cxval = CTOX(19);
520 cyval = RTOY(17);
521
522 if (infield(stcrow, stccol, curfet))
523 cfetp = infetp;
524
525 break;
526
527 case 3: /* scores */
528
529 showsm(); /* show the scores */
530 stcpos(24, 7); /* position the cursor */
531
532 cxval = CTOX(7);
533 cyval = RTOY(24);
534
535 if (infield(stcrow, stccol, curfet))
536 cfetp = infetp;
537
538 break;
539
540 default: /* eh ? */
541
542 break;
543 }
544
545 } else { /* take down the submenu */
546
547 vbank(0);
548
549 v_odtab[4][0] |= V_BLA; /* turn off window object */
550 objclr(4);
551
552 op = &v_obtab[13]; /* turn on keyboard object */
553 objon(2, op->objy, op->ysize);
554 v_odtab[2][0] &= ~V_BLA;
555
556 op = &v_obtab[14]; /* turn on score object */
557 objon(1, op->objy, op->ysize);
558 v_odtab[1][0] &= ~V_BLA;
559
560 op = &v_obtab[15]; /* turn on line object */
561 objon(0, op->objy, op->ysize);
562 v_odtab[0][0] &= ~V_BLA;
563 }
564
565 scmctl = n; /* set new menu type */
566}
567
568/*
569 =============================================================================
570 sdmenu() -- display a submenu in area 2 (text areas)
571 =============================================================================
572*/
573
574void sdmenu(int16_t n)
575{
576 register int16_t i, wasup;
577
578 wasup = sdmctl; /* save previous menu type */
579 sdmctl = n; /* set new menu type */
580
581 if (n GE 0) { /* put up a menu */
582
583 submenu = TRUE; /* indicate there's a menu up */
584
585 sdmrow = stcrow; /* save underline cursor position */
586 sdmcol = stccol; /* ... */
587
588 memsetw(&sctctab[3][0], exp_c(SDBGMM), 64); /* recolor */
589 memsetw(&sctctab[4][0], exp_c(SDBGMM), 64);
590 memsetw(&sctctab[5][0], exp_c(SDBGMM), 64);
591
592 if (n EQ 4) { /* extra 2 lines for section menu */
593
594 memsetw(&sctctab[6][0], exp_c(SDBGMM), 64);
595 memsetw(&sctctab[7][0], exp_c(SDBGMM), 64);
596 }
597
598 stcclr(); /* re-color the cursor background */
599 stcpos(sdmrow, sdmcol); /* turn underline cursor back on */
600
601 if (infield(stcrow, stccol, curfet))
602 cfetp = infetp;
603
604 if (v_regs[5] & 0x0180)
605 vbank(0);
606
607 for (i = 0; i < 3; i++) /* top 3 lines of menu */
608 vputs(obj8, 3 + i, 0, sdmenus[n][i], SDMENUBG);
609
610 if (n EQ 4) { /* extra 2 lines for section menu */
611
612 vputs(obj8, 6, 0, sdmln3, SDMENUBG);
613 vputs(obj8, 7, 0, sdmln4, SDMENUBG);
614
615 secop = SOP_NUL; /* clear section operation code */
616
617 grptran = 0; /* reset transpose value */
618 gtmsel = -1; /* de-select source group */
619
620 for (i = 0; i < 12; i++) /* reset the map */
621 grptmap[i] = i;
622
623 dsects(); /* display list of sections */
624 dsgtmap(); /* display group map and transpose */
625
626 point = GLCplot; /* setup to plot on LCD */
627 GLCcurs(G_ON);
628
629 if (ismode NE IS_NULL) { /* cancel inst. mode */
630
631 ismode = IS_NULL;
632 pkctrl = oldpk;
633 sliders = oldsl;
634 swpt = oldsw;
635 lcdlbls();
636 }
637
638 if (gomode NE GO_NULL) { /* cancel goto mode */
639
640 gomode = GO_NULL;
641 pkctrl = oldpk;
642 lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 0);
643 }
644
645 if (asmode) { /* cancel assign mode */
646
647 asmode = 0;
648 pkctrl = oldpk;
649 swpt = oldsw;
650 lseg(ASGN_XL, ASGN_Y, ASGN_XR, ASGN_Y, 0);
651 }
652
653 if ((pkctrl EQ PK_PFRM) OR (pkctrl EQ PK_NOTE))
654 oldpk = pkctrl;
655
656 if (sliders NE LS_LIBR)
657 oldsl = sliders;
658
659 oldsw = swpt; /* put panel in group mode */
660 swpt = &t_ngrp;
661 pkctrl = PK_NGRP;
662 sliders = LS_NGRP;
663
664 lcdlbls();
665 setleds();
666 }
667
668 SetPri(TTCURS, TTCPRI); /* turn on menu cursor */
669 ttcpos(sdmlim[n][0], sdmlim[n][1]); /* position menu cursor */
670
671 } else { /* take down the menu */
672
673 submenu = FALSE; /* indicate menu has gone bye bye */
674
675 if (v_regs[5] & 0x0180)
676 vbank(0);
677
678 objclr(TTCPRI); /* turn off the menu cursor */
679 stcset(); /* restore underline cursor */
680 stcclr(); /* ... */
681 sdwin(11); /* redisplay window 11 data */
682
683 if (wasup EQ 4) {
684
685 sdwin(12); /* redisplay window 12 data */
686
687 stcpos(sdmrow, sdmcol); /* display underline cursor */
688
689 cxval = CTOX(sdmcol);
690 cyval = RTOY(sdmrow);
691
692 if (infield(stcrow, stccol, curfet))
693 cfetp = infetp;
694
695 pkctrl = oldpk; /* restore panel state */
696 sliders = oldsl;
697 swpt = oldsw;
698
699 lcdlbls(); /* refresh LCD */
700 setleds(); /* refresh LEDs */
701
702 } else {
703
704 stcpos(sdmrow, sdmcol); /* display underline cursor */
705
706 cxval = CTOX(sdmcol);
707 cyval = RTOY(sdmrow);
708
709 if (infield(stcrow, stccol, curfet))
710 cfetp = infetp;
711 }
712 }
713}
714
715/*
716 =============================================================================
717 hilitnt() -- setup for a note operation
718 =============================================================================
719*/
720
721void hilitnt(int16_t nop)
722{
723 noteop = nop; /* set note operation */
724 notesel = FALSE; /* indicate no note selected */
725 sdmenu(-1); /* take down the menu */
726 dnedmod(); /* update the note edit window */
727}
728
729/*
730 =============================================================================
731 hilitop() -- highlight a section operation and set secop
732 =============================================================================
733*/
734
735void hilitop(int16_t n)
736{
737 register int16_t row, lc, rc, col;
738
739 if (clkrun) /* don't do anything if clock is running */
740 return;
741
742 if (v_regs[5] & 0x0180)
743 vbank(0);
744
745 if (secop NE SOP_NUL) {
746
747 row = sdmht[secop][0];
748 lc = sdmht[secop][1];
749 rc = sdmht[secop][2];
750
751 for (col = lc; col LE rc; col++)
752 vputa(obj8, row, col, SDMENUBG);
753 }
754
755 secop = n;
756
757 row = sdmht[n][0];
758 lc = sdmht[n][1];
759 rc = sdmht[n][2];
760
761 for (col = lc; col LE rc; col++)
762 vputa(obj8, row, col, (SDBGMM | (SD_ENTR << 4)));
763}
764
765/*
766 =============================================================================
767 dosecop() -- do the current section operation
768 =============================================================================
769*/
770
771void dosecop(void)
772{
773 register int16_t sect;
774 register struct s_entry *ep;
775
776 if (clkrun OR (-1 EQ (sect = insect()))) {
777
778 secop = SOP_NUL;
779 return;
780 }
781
782 if (insmode) {
783
784 icancel();
785 dsimode();
786 }
787
788 switch (secop) {
789
790 case SOP_GO: /* GoTo */
791
792 if (sgoflag EQ 3) { /* GoTo End Section */
793
794 ep = hplist[curscor][EH_SEND];
795
796 while (ep) {
797
798 if (ep->e_data1 EQ sect) {
799
800 sc_goto(fc_val = ep->e_time);
801 break;
802 }
803
804 ep = ep->e_up;
805 }
806
807 } else { /* GoTo Begin Section */
808
809 if (E_NULL NE (ep = seclist[curscor][sect]))
810 sc_goto(fc_val = ep->e_time);
811 }
812
813 break;
814
815 case SOP_BGN: /* Begin */
816
817 if (NOT recsw) /* only in record mode */
818 break;
819
820 if (v_regs[5] & 0x0180)
821 vbank(0);
822
823 if (E_NULL NE (ep = seclist[curscor][sect])) {
824
825 eh_rmv(ep, EH_SBGN);
826 e_rmv(ep);
827 ep->e_time = t_cur;
828 p_cur = e_ins(ep, ep_adj(p_cur, 1, t_cur)->e_bak)->e_fwd;
829 eh_ins(ep, EH_SBGN);
830 se_exec(ep, D_FWD);
831
832 } else if (E_NULL NE (ep = e_alc(E_SIZE2))) {
833
834 ep->e_time = t_cur;
835 ep->e_type = EV_SBGN;
836 ep->e_data1 = sect;
837 p_cur = e_ins(ep, ep_adj(p_cur, 1, t_cur)->e_bak)->e_fwd;
838 eh_ins(ep, EH_SBGN);
839 seclist[curscor][sect] = ep;
840 se_exec(ep, D_FWD);
841 }
842
843 sc_refr(fc_val); /* refresh the screen */
844 break;
845
846 case SOP_END: /* End */
847
848 if (NOT recsw) /* only in record mode */
849 break;
850
851 if (v_regs[5] & 0x0180)
852 vbank(0);
853
854 if (E_NULL NE (ep = ehfind(EH_SEND, -1L, sect, -1))) {
855
856 eh_rmv(ep, EH_SEND);
857 e_rmv(ep);
858 ep->e_time = t_cur;
859 p_cur = e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
860 eh_ins(ep, EH_SEND);
861 se_exec(ep, D_FWD);
862
863 } else if (E_NULL NE (ep = e_alc(E_SIZE2))) {
864
865 ep->e_time = t_cur;
866 ep->e_type = EV_SEND;
867 ep->e_data1 = sect;
868 p_cur = e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
869 eh_ins(ep, EH_SEND);
870 se_exec(ep, D_FWD);
871 }
872
873 sc_refr(fc_val); /* refresh the screen */
874 break;
875
876 case SOP_MOV: /* Move */
877
878 if (NOT recsw) /* only in record mode */
879 break;
880
881 if (sec_mov(sect)) /* move the section */
882 break;
883
884 sc_refr(fc_val); /* refresh screen if successful */
885 break;
886
887 case SOP_CPY: /* Copy */
888
889 if (NOT recsw) /* only in record mode */
890 break;
891
892 if (sec_cpy(sect)) /* copy the section */
893 break;
894
895 sc_refr(fc_val); /* refresh screen if successful */
896 break;
897
898 case SOP_MRG: /* Merge */
899
900 if (NOT recsw) /* only in record mode */
901 break;
902
903 if (sec_mrg(sect)) /* merge the section */
904 break;
905
906 sc_refr(fc_val); /* refresh screen if successful */
907 break;
908
909 case SOP_GRP: /* ReGrp */
910
911 if (NOT recsw) /* only in record mode */
912 break;
913
914 if (sec_grp(sect)) /* regroup the section */
915 break;
916
917 sc_refr(fc_val); /* refresh screen if successful */
918 break;
919
920
921 case SOP_STC: /* SMPTE */
922
923 if (NOT recsw) /* only in record mode */
924 break;
925
926 break;
927
928 case SOP_DGR: /* Delete Gr */
929
930 if (NOT recsw) /* only in record mode */
931 break;
932
933 if (sec_dgr(sect)) /* delete note events */
934 break;
935
936 sc_refr(fc_val); /* refresh display if successful */
937 break;
938
939 case SOP_DEV: /* Delete Ev */
940
941 if (NOT recsw) /* only in record mode */
942 break;
943
944 if (sec_dev(sect)) /* delete non-note events */
945 break;
946
947 sc_refr(fc_val); /* refresh display if successful */
948 break;
949
950 case SOP_RMV: /* Remove */
951
952 if (NOT recsw) /* only in record mode */
953 break;
954
955 if (sec_rmv(sect)) /* remove section */
956 break;
957
958 sc_refr(fc_val); /* refresh display if successful */
959 break;
960 }
961
962 secop = SOP_NUL;
963}
964
965/*
966 =============================================================================
967 clkset() -- set the clock state
968 =============================================================================
969*/
970
971void clkset(int16_t st)
972{
973 clkrun = st;
974
975 switch (clksrc) {
976
977 case CK_LOCAL: /* Local */
978 case CK_SMPTE: /* SMPTE */
979
980 midiclk = FALSE;
981 pulsclk = FALSE;
982
983 if (st)
984 fc_sw = 1;
985 else
986 fc_sw = 0;
987
988 return;
989
990 case CK_MIDI: /* MIDI */
991
992 fc_sw = 0;
993 pulsclk = FALSE;
994
995 if (st)
996 midiclk = TRUE;
997 else
998 midiclk = FALSE;
999
1000 return;
1001
1002 case CK_PLS24: /* PLS24 */
1003 case CK_PLS48: /* PLS48 */
1004 case CK_PLS96: /* PLS96 */
1005
1006 fc_sw = 0;
1007 midiclk = FALSE;
1008
1009 if (st)
1010 pulsclk = TRUE;
1011 else
1012 pulsclk = FALSE;
1013
1014 return;
1015
1016 case CK_STEP: /* Step */
1017
1018 fc_sw = 0;
1019 midiclk = FALSE;
1020 pulsclk = FALSE;
1021
1022 return;
1023 }
1024}
1025
1026/*
1027 =============================================================================
1028 sdboxfn() -- process score display box hits
1029 =============================================================================
1030*/
1031
1032int16_t sdboxfn(int16_t n)
1033{
1034 register int16_t row, col, i;
1035 register struct s_entry *ep;
1036 int16_t atr, modewas;
1037
1038 (void)n;
1039
1040 row = hitcy / 14;
1041 col = hitcx >> 3;
1042
1043 switch (hitbox) {
1044
1045 case 0: /* signature, section, beat, frame */
1046
1047 if (col EQ 0) { /* signature */
1048
1049 if (clkrun) /* clock can't be running */
1050 return(FAILURE);
1051
1052 if (ac_code EQ N_SHARP)
1053 ac_code = N_FLAT;
1054 else
1055 ac_code = N_SHARP;
1056
1057 sc_refr(fc_val);
1058 return(SUCCESS);
1059
1060 } else if ((col GE 2) AND (col LE 4)) { /* section menu */
1061
1062 if (clkrun) /* clock can't be running */
1063 return(FAILURE);
1064
1065 if (sdmctl EQ -1) { /* menu not up yet */
1066
1067 sdmenu(4); /* put up the menu */
1068 return(SUCCESS);
1069
1070 } else { /* menu up */
1071
1072 if (vtcrow EQ 19) {
1073
1074 if ((vtccol GE 1) AND
1075 (vtccol LE 4)) { /* GoTo */
1076
1077 hilitop(SOP_GO);
1078 return(SUCCESS);
1079
1080 } else if ((vtccol GE 8) AND
1081 (vtccol LE 11)) { /* Move */
1082
1083 hilitop(SOP_MOV);
1084 return(SUCCESS);
1085
1086 } else if ((vtccol GE 15) AND
1087 (vtccol LE 19)) { /* SMPTE */
1088
1089 hilitop(SOP_STC);
1090 return(SUCCESS);
1091
1092 } else if ((vtccol GE 24) AND
1093 (vtccol LE 62)) { /* number */
1094
1095 if (-1 NE insect()) {
1096
1097 sdmenu(-1);
1098 dosecop();
1099 }
1100
1101 return(SUCCESS);
1102 }
1103
1104 } else if (vtcrow EQ 20) {
1105
1106 if ((vtccol GE 1) AND
1107 (vtccol LE 5)) { /* Begin */
1108
1109 hilitop(SOP_BGN);
1110 return(SUCCESS);
1111
1112 } else if ((vtccol GE 8) AND
1113 (vtccol LE 11)) { /* Copy */
1114
1115 hilitop(SOP_CPY);
1116 return(SUCCESS);
1117
1118 } else if ((vtccol GE 15) AND
1119 (vtccol LE 20)) { /* Del Gr */
1120
1121 hilitop(SOP_DGR);
1122 return(SUCCESS);
1123
1124 } else if ((vtccol GE 24) AND
1125 (vtccol LE 62)) { /* number */
1126
1127 if (-1 NE insect()) {
1128
1129 sdmenu(-1);
1130 dosecop();
1131 }
1132
1133 return(SUCCESS);
1134 }
1135
1136 } else if (vtcrow EQ 21) {
1137
1138 if ((vtccol GE 1) AND
1139 (vtccol LE 3)) { /* End */
1140
1141 hilitop(SOP_END);
1142 return(SUCCESS);
1143
1144 } else if ((vtccol GE 8) AND
1145 (vtccol LE 12)) { /* Merge */
1146
1147 hilitop(SOP_MRG);
1148 return(SUCCESS);
1149
1150 } else if ((vtccol GE 15) AND
1151 (vtccol LE 20)) { /* Del Ev */
1152
1153 hilitop(SOP_DEV);
1154 return(SUCCESS);
1155 }
1156
1157
1158 } else if (vtcrow EQ 22) {
1159
1160 if ((vtccol GE 8) AND
1161 (vtccol LE 12)) { /* ReGrp */
1162
1163 hilitop(SOP_GRP);
1164 return(SUCCESS);
1165
1166 } else if ((vtccol GE 15) AND
1167 (vtccol LE 20)) { /* Remove */
1168
1169 hilitop(SOP_RMV);
1170 return(SUCCESS);
1171
1172 } else if ((vtccol GE 28) AND
1173 (vtccol LE 62)) { /* number */
1174
1175 if (gtmsel GE 0)
1176 dsgtmn(gtmsel, FALSE);
1177
1178 if (-1 NE (gtmsel = ingroup()))
1179 dsgtmn(gtmsel, TRUE);
1180
1181 return(SUCCESS);
1182 }
1183
1184 } else if (vtcrow EQ 23) {
1185
1186 if ((vtccol GE 1) AND
1187 (vtccol LE 6)) { /* Escape */
1188
1189 secop = SOP_NUL;
1190 sdmenu(-1);
1191 return(SUCCESS);
1192
1193 } else if ((vtccol GE 22) AND
1194 (vtccol LE 24)) { /* Transpose */
1195
1196 return(entbh(-1));
1197 }
1198 }
1199 }
1200
1201 return(FAILURE);
1202
1203 } else
1204 return(entbh(-1));
1205
1206
1207 case 1: /* insert */
1208
1209 modewas = insmode; /* save old insert state */
1210
1211 if (insmode) /* toggle ... */
1212 icancel(); /* ... insert on -> off */
1213 else
1214 istart(); /* ... insert of -> on */
1215
1216 if (modewas NE insmode) /* only refresh if changed */
1217 sc_refr(fc_val);
1218
1219 dsimode(); /* update insert mode display */
1220 return(SUCCESS);
1221
1222 case 2: /* clock control, source */
1223
1224 if (col LE 33) { /* clock */
1225
1226 clkset(NOT clkrun);
1227 dsclk();
1228 return(SUCCESS);
1229
1230
1231 } else if ((col GE 35) AND (col LE 43)) { /* control */
1232
1233 if (sdmctl EQ -1) { /* menu not yet up */
1234
1235 sdmenu(3);
1236 return(SUCCESS);
1237
1238 } else { /* menu up */
1239
1240 if (vtcrow EQ 19) {
1241
1242 if ((vtccol GE 1) AND
1243 (vtccol LE 5)) {
1244
1245 clkctl = CK_LOCAL;
1246 sdmenu(-1);
1247 sdwin(2);
1248 return(SUCCESS);
1249 }
1250
1251 } else if (vtcrow EQ 20) {
1252
1253 if ((vtccol GE 1) AND
1254 (vtccol LE 5)) {
1255
1256 clkctl = CK_MIDI;
1257 sdmenu(-1);
1258 sdwin(2);
1259 return(SUCCESS);
1260 }
1261
1262 } else if (vtcrow EQ 21) {
1263
1264 if ((vtccol GE 1) AND
1265 (vtccol LE 5)) {
1266
1267 clkctl = CK_SMPTE;
1268 sdmenu(-1);
1269 sdwin(2);
1270 return(SUCCESS);
1271 }
1272 }
1273 }
1274
1275 return(FAILURE);
1276
1277 } else if (col GE 45) { /* source */
1278
1279 if (sdmctl EQ -1) { /* menu not yet up */
1280
1281 sdmenu(2);
1282 setleds();
1283 return(SUCCESS);
1284
1285 } else { /* menu up */
1286
1287 if (vtcrow EQ 19) {
1288
1289 if ((vtccol GE 1) AND
1290 (vtccol LE 5)) {
1291
1292 clksrc = CK_LOCAL;
1293 pkctrl = PK_PFRM;
1294 setleds();
1295 sdmenu(-1);
1296 sdwin(2);
1297 return(SUCCESS);
1298
1299 } else if ((vtccol GE 9) AND
1300 (vtccol LE 13)) {
1301
1302 clksrc = CK_PLS24;
1303 pkctrl = PK_PFRM;
1304 setleds();
1305 sdmenu(-1);
1306 sdwin(2);
1307 return(SUCCESS);
1308
1309 } else if ((vtccol GE 17) AND
1310 (vtccol LE 20)) {
1311
1312 clksrc = CK_STEP;
1313 pkctrl = PK_NOTE;
1314 stepenb = TRUE;
1315 setleds();
1316 sdmenu(-1);
1317 sdwin(2);
1318 return(SUCCESS);
1319 }
1320
1321
1322 } else if (vtcrow EQ 20) {
1323
1324 if ((vtccol GE 1) AND
1325 (vtccol LE 5)) {
1326
1327 clksrc = CK_MIDI;
1328 pkctrl = PK_PFRM;
1329 setleds();
1330 sdmenu(-1);
1331 sdwin(2);
1332 return(SUCCESS);
1333
1334 } else if ((vtccol GE 9) AND
1335 (vtccol LE 13)) {
1336
1337 clksrc = CK_PLS48;
1338 pkctrl = PK_PFRM;
1339 setleds();
1340 sdmenu(-1);
1341 sdwin(2);
1342 return(SUCCESS);
1343 }
1344
1345 } else if (vtcrow EQ 21) {
1346
1347 if ((vtccol GE 1) AND
1348 (vtccol LE 5)) {
1349
1350 clksrc = CK_SMPTE;
1351 pkctrl = PK_PFRM;
1352 setleds();
1353 sdmenu(-1);
1354 sdwin(2);
1355 return(SUCCESS);
1356
1357 } else if ((vtccol GE 9) AND
1358 (vtccol LE 13)) {
1359
1360 clksrc = CK_PLS96;
1361 pkctrl = PK_PFRM;
1362 setleds();
1363 sdmenu(-1);
1364 sdwin(2);
1365 return(SUCCESS);
1366 }
1367 }
1368 }
1369 }
1370
1371 return(FAILURE);
1372
1373
1374 case 3: /* note edit */
1375
1376 if (clkrun) /* clock can't be running */
1377 return(FAILURE);
1378
1379 if (scmctl NE -1)
1380 scmenu(-1);
1381
1382 if (sdmctl EQ -1) { /* menu not up */
1383
1384 sdmenu(1);
1385 noteop = NOP_NUL;
1386 return(SUCCESS);
1387
1388 } else { /* menu up - select operation */
1389
1390 if (vtcrow EQ 19) {
1391
1392 if ((vtccol GE 1) AND
1393 (vtccol LE 9)) { /* Begin Acc */
1394
1395 hilitnt(NOP_ACC);
1396 return(SUCCESS);
1397
1398 } else if ((vtccol GE 13) AND
1399 (vtccol LE 21)) { /* Move Note */
1400
1401 hilitnt(NOP_MVN);
1402 return(SUCCESS);
1403
1404 } else if ((vtccol GE 25) AND
1405 (vtccol LE 30)) { /* Escape */
1406
1407 hilitnt(NOP_NUL);
1408 return(SUCCESS);
1409
1410 }
1411
1412 return(FAILURE);
1413
1414 } else if (vtcrow EQ 20) {
1415
1416 if ((vtccol GE 1) AND
1417 (vtccol LE 9)) { /* Begin Nat */
1418
1419 hilitnt(NOP_NAT);
1420 return(SUCCESS);
1421
1422 } else if ((vtccol GE 13) AND
1423 (vtccol LE 22)) { /* Move Begin */
1424
1425 hilitnt(NOP_MVB);
1426 return(SUCCESS);
1427 }
1428
1429 return(FAILURE);
1430
1431 } else if (vtcrow EQ 21) {
1432
1433 if ((vtccol GE 1) AND
1434 (vtccol LE 8)) { /* End Note */
1435
1436 hilitnt(NOP_END);
1437 return(SUCCESS);
1438
1439 } else if ((vtccol GE 13) AND
1440 (vtccol LE 20)) { /* Move End */
1441
1442 hilitnt(NOP_MVE);
1443 return(SUCCESS);
1444 }
1445
1446 return(FAILURE);
1447
1448 } else
1449 return(FAILURE);
1450 }
1451
1452 return(FAILURE);
1453
1454
1455 case 4: /* assignments */
1456
1457 if (col LE 9) {
1458
1459 if (scmctl NE 1) { /* not up yet -- show page 1 */
1460
1461 lastam = 0;
1462 scmenu(1);
1463
1464 } else { /* up - switch pages */
1465
1466 if (lastam EQ 0) { /* show page 2 */
1467
1468 lastam = 60;
1469 scmenu(1);
1470
1471 } else { /* take down menu */
1472
1473 lastam = 0;
1474 scmenu(-1);
1475 }
1476 }
1477
1478 return(SUCCESS);
1479
1480 } else {
1481
1482 return(entbh(-1)); /* data entry */
1483 }
1484
1485 case 5: /* tunings */
1486
1487 if ((col GE 14) AND (col LE 17)) {
1488
1489 if (scmctl NE 2)
1490 scmenu(2); /* put up menu */
1491 else
1492 scmenu(-1); /* take down menu */
1493
1494 return(SUCCESS);
1495
1496 } else {
1497
1498 return(entbh(-1)); /* data entry */
1499 }
1500
1501 case 8: /* stop/next */
1502
1503 if ((col GE 40) AND (col LE 43)) { /* stop */
1504
1505 if (recsw) {
1506
1507 if (v_regs[5] & 0x0180)
1508 vbank(0);
1509
1510 if (E_NULL NE (ep = findev(p_cur, t_cur, EV_STOP, -1, -1))) {
1511
1512 se_exec(ep, D_FWD);
1513
1514 } else if (E_NULL NE (ep = e_alc(E_SIZE1))) {
1515
1516 ep->e_time = t_cur;
1517 ep->e_type = EV_STOP;
1518 p_cur= e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
1519 se_exec(ep, D_FWD);
1520 ctrsw = TRUE;
1521 se_disp(ep, D_FWD, gdstbc, 1);
1522 scupd();
1523 }
1524 }
1525
1526 } else if ((col GE 45) AND (col LE 48)) { /* next */
1527
1528 if (recsw) {
1529
1530 if (v_regs[5] & 0x0180)
1531 vbank(0);
1532
1533 if (E_NULL NE (ep = findev(p_cur, t_cur, EV_NEXT, -1, -1))) {
1534
1535 se_exec(ep, D_FWD);
1536
1537 } else if (E_NULL NE (ep = e_alc(E_SIZE1))) {
1538
1539 ep->e_time = t_cur;
1540 ep->e_type = EV_NEXT;
1541 p_cur= e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
1542 se_exec(ep, D_FWD);
1543 ctrsw = TRUE;
1544 se_disp(ep, D_FWD, gdstbc, 1);
1545 scupd();
1546 }
1547 }
1548
1549 }
1550
1551 return(SUCCESS);
1552
1553
1554 case 9: /* punch in/out */
1555
1556 if ((col GE 50) AND (col LE 51)) { /* punch in */
1557
1558 if (recsw) {
1559
1560 if (v_regs[5] & 0x0180)
1561 vbank(0);
1562
1563 if (E_NULL NE (ep = findev(p_cur, t_cur, EV_STOP, 1, -1))) {
1564
1565 se_exec(ep, D_FWD);
1566
1567 } else if (E_NULL NE (ep = e_alc(E_SIZE1))) {
1568
1569 ep->e_time = t_cur;
1570 ep->e_type = EV_PNCH;
1571 ep->e_data1 = 1;
1572 p_cur= e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
1573 se_exec(ep, D_FWD);
1574 ctrsw = TRUE;
1575 se_disp(ep, D_FWD, gdstbc, 1);
1576 scupd();
1577 }
1578 }
1579
1580 } else if ((col GE 53) AND (col LE 55)) { /* punch out */
1581
1582 if (recsw) {
1583
1584 if (v_regs[5] & 0x0180)
1585 vbank(0);
1586
1587 if (E_NULL NE (ep = findev(p_cur, t_cur, EV_PNCH, 0, -1))) {
1588
1589 se_exec(ep, D_FWD);
1590
1591 } else if (E_NULL NE (ep = e_alc(E_SIZE1))) {
1592
1593 ep->e_time = t_cur;
1594 ep->e_type = EV_PNCH;
1595 ep->e_data1 = 0;
1596 p_cur= e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
1597 se_exec(ep, D_FWD);
1598 ctrsw = TRUE;
1599 se_disp(ep, D_FWD, gdstbc, 1);
1600 scupd();
1601 }
1602 }
1603
1604 }
1605
1606 return(SUCCESS);
1607
1608 case 10: /* Output */
1609
1610 return(SUCCESS);
1611
1612 case 11: /* group/ins, trans, dyn/loc, velocity */
1613
1614 if ((row EQ 18) AND (col LE 3)) { /* inst. menu */
1615
1616 if (scmctl NE 0)
1617 scmenu(0); /* put up the menu */
1618 else
1619 scmenu(-1); /* take down the menu */
1620
1621 return(SUCCESS);
1622
1623 } else if ((row EQ 21) AND (col LE 3)) { /* velocity flag */
1624
1625 velflag = NOT velflag;
1626 ds_vmod();
1627 return(SUCCESS);
1628
1629 } else
1630 return(entbh(-1)); /* inst. number */
1631
1632
1633 case 12: /* analog source, value */
1634
1635 if ((row EQ 23) AND (col LE 4)) { /* display enable */
1636
1637 angroup = -angroup;
1638
1639 if (angroup < 0)
1640 atr = SDW12ATR;
1641 else
1642 atr = (SD_CHNG << 4) | SDBG12;
1643
1644 if (v_regs[5] & 0x0180)
1645 vbank(0);
1646
1647 for (i = 0; i < 4; i++)
1648 vputa(obj8, 7, i, atr);
1649
1650 return(SUCCESS);
1651
1652 } else if ((row EQ 22) AND (col LE 4)) { /* r/p source */
1653
1654 ancmsw = NOT ancmsw;
1655
1656 if (ancmsw)
1657 atr = (SD_CHNG << 4) | SDBG12;
1658 else
1659 atr = SDW12ATR;
1660
1661 if (v_regs[5] & 0x0180)
1662 vbank(0);
1663
1664 for (i = 0; i < 4; i++)
1665 vputa(obj8, 6, i, atr);
1666
1667 return(SUCCESS);
1668
1669 } else {
1670
1671 return(entbh(-1));
1672 }
1673
1674 case 13: /* score number and title */
1675
1676 if (col LE 4) { /* score menu */
1677
1678 if (scmctl NE 3)
1679 scmenu(3); /* put up menu */
1680 else
1681 scmenu(-1); /* take down menu */
1682
1683 return(SUCCESS);
1684
1685 } else if ((col GE 10) AND (col LE 25)) { /* score name */
1686
1687 if (sdmctl NE 0) {
1688
1689 sdmenu(0);
1690
1691 vtsetup(obj8, svtdsp, 10, scname[curscor], 19, 1,
1692 advscur, bspscur, nokey, nokey, svtstop,
1693 SDW13DEA, SDBG13);
1694
1695 } else {
1696
1697 vtyper();
1698 }
1699
1700 return(SUCCESS);
1701
1702 } else
1703 return(entbh(-1));
1704
1705 case 14: /* rec mode */
1706
1707 if ((col GE 31) AND (col LE 34)) { /* Play */
1708
1709 recsw = FALSE;
1710 dsrpmod();
1711 return(SUCCESS);
1712
1713 } else if ((col GE 36) AND (col LE 40)) { /* Recrd */
1714
1715 recsw = TRUE;
1716 dsrpmod();
1717 return(SUCCESS);
1718
1719 } else if ((col GE 42) AND (col LE 47)) { /* OvrDub */
1720
1721 dubsw = NOT dubsw;
1722 dsrpmod();
1723 return(SUCCESS);
1724
1725 } else if ((col GE 49) AND (col LE 55)) { /* PunchIn */
1726
1727 pchsw = NOT pchsw;
1728 dsrpmod();
1729 return(SUCCESS);
1730
1731 }
1732
1733 return(FAILURE);
1734
1735 case 16: /* note display */
1736
1737 if (NOP_NUL NE noteop)
1738 donote();
1739
1740 return(SUCCESS);
1741 }
1742
1743 return(FAILURE);
1744}
1745
Note: See TracBrowser for help on using the repository browser.