source: buchla-68k/ram/scselbx.c

Last change on this file was 72741f4, checked in by Thomas Lopatic <thomas@…>, 6 years ago

Fixed incompatible pointers.

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