| 1 | /*
|
|---|
| 2 | =============================================================================
|
|---|
| 3 | etivce.c -- instrument editor - voice number field handlers
|
|---|
| 4 | Version 12 -- 1987-12-09 -- D.N. Lynx Crowe
|
|---|
| 5 | =============================================================================
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #include "all.h"
|
|---|
| 9 |
|
|---|
| 10 | #define VCE_OFF 6
|
|---|
| 11 |
|
|---|
| 12 | extern void advicur(void);
|
|---|
| 13 | extern void newvce(int16_t voice);
|
|---|
| 14 |
|
|---|
| 15 | extern void allwins(void);
|
|---|
| 16 |
|
|---|
| 17 | extern uint16_t *instob;
|
|---|
| 18 |
|
|---|
| 19 | extern int16_t stccol, curvce;
|
|---|
| 20 |
|
|---|
| 21 | extern int16_t idbox[][8];
|
|---|
| 22 |
|
|---|
| 23 | extern int8_t dspbuf[];
|
|---|
| 24 |
|
|---|
| 25 | /* |
|---|
| 26 |
|
|---|
| 27 | */
|
|---|
| 28 |
|
|---|
| 29 | /*
|
|---|
| 30 | =============================================================================
|
|---|
| 31 | et_ivce() -- load the edit buffer
|
|---|
| 32 | =============================================================================
|
|---|
| 33 | */
|
|---|
| 34 |
|
|---|
| 35 | int16_t et_ivce(int16_t n)
|
|---|
| 36 | {
|
|---|
| 37 | sprintf(ebuf, "%02d", curvce + 1);
|
|---|
| 38 | ebflag = TRUE;
|
|---|
| 39 |
|
|---|
| 40 | return(SUCCESS);
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 43 | /* |
|---|
| 44 |
|
|---|
| 45 | */
|
|---|
| 46 |
|
|---|
| 47 | /*
|
|---|
| 48 | =============================================================================
|
|---|
| 49 | ef_ivce() -- parse (unload) the edit buffer
|
|---|
| 50 | =============================================================================
|
|---|
| 51 | */
|
|---|
| 52 |
|
|---|
| 53 | int16_t ef_ivce(int16_t n)
|
|---|
| 54 | {
|
|---|
| 55 | register int16_t i, tmpval;
|
|---|
| 56 |
|
|---|
| 57 | ebuf[2] = '\0'; /* terminate the string in ebuf */
|
|---|
| 58 | ebflag = FALSE;
|
|---|
| 59 |
|
|---|
| 60 | tmpval = 0;
|
|---|
| 61 |
|
|---|
| 62 | for (i = 0; i < 2; i++) /* convert from ASCII to binary */
|
|---|
| 63 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
|---|
| 64 |
|
|---|
| 65 | if ((tmpval EQ 0) OR (tmpval GT 12))
|
|---|
| 66 | return(FAILURE);
|
|---|
| 67 |
|
|---|
| 68 | newvce(tmpval - 1);
|
|---|
| 69 | allwins();
|
|---|
| 70 | return(SUCCESS);
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | /* |
|---|
| 74 |
|
|---|
| 75 | */
|
|---|
| 76 |
|
|---|
| 77 | /*
|
|---|
| 78 | =============================================================================
|
|---|
| 79 | rd_ivce() -- (re)display the field
|
|---|
| 80 | =============================================================================
|
|---|
| 81 | */
|
|---|
| 82 |
|
|---|
| 83 | int16_t rd_ivce(int16_t n)
|
|---|
| 84 | {
|
|---|
| 85 | /* convert to ASCII */
|
|---|
| 86 |
|
|---|
| 87 | sprintf(dspbuf, "%02d", curvce + 1);
|
|---|
| 88 |
|
|---|
| 89 | vbank(0); /* display the value */
|
|---|
| 90 |
|
|---|
| 91 | vcputsv(instob, 64, idbox[n][4], idbox[n][5],
|
|---|
| 92 | idbox[n][6], idbox[n][7] + VCE_OFF, dspbuf, 14);
|
|---|
| 93 |
|
|---|
| 94 | return(SUCCESS);
|
|---|
| 95 | }
|
|---|
| 96 |
|
|---|
| 97 | /* |
|---|
| 98 |
|
|---|
| 99 | */
|
|---|
| 100 |
|
|---|
| 101 | /*
|
|---|
| 102 | =============================================================================
|
|---|
| 103 | nd_ivce() -- handle new data entry
|
|---|
| 104 | =============================================================================
|
|---|
| 105 | */
|
|---|
| 106 |
|
|---|
| 107 | int16_t nd_ivce(int16_t n, int16_t k)
|
|---|
| 108 | {
|
|---|
| 109 | register int16_t ec;
|
|---|
| 110 |
|
|---|
| 111 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
|---|
| 112 | ebuf[ec] = k + '0';
|
|---|
| 113 | ebuf[2] = '\0';
|
|---|
| 114 |
|
|---|
| 115 | dspbuf[0] = k + '0';
|
|---|
| 116 | dspbuf[1] = '\0';
|
|---|
| 117 |
|
|---|
| 118 | vbank(0);
|
|---|
| 119 |
|
|---|
| 120 | vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
|
|---|
| 121 | idbox[n][6], stccol, dspbuf, 14);
|
|---|
| 122 |
|
|---|
| 123 | advicur();
|
|---|
| 124 |
|
|---|
| 125 | return(SUCCESS);
|
|---|
| 126 | }
|
|---|
| 127 |
|
|---|
| 128 |
|
|---|