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

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

Zero redundant declarations.

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