[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | etivce.c -- instrument editor - voice number field handlers
|
---|
| 4 | Version 12 -- 1987-12-09 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
[6262b5c] | 8 | #include "all.h"
|
---|
[e225e77] | 9 |
|
---|
[f40a309] | 10 | #define VCE_OFF 6
|
---|
| 11 |
|
---|
[0580615] | 12 | extern void advicur(void);
|
---|
[7258c6a] | 13 | extern void newvce(int16_t voice);
|
---|
[f40a309] | 14 |
|
---|
[e225e77] | 15 | extern void allwins(void);
|
---|
| 16 |
|
---|
[7258c6a] | 17 | extern uint16_t *instob;
|
---|
[f40a309] | 18 |
|
---|
[7258c6a] | 19 | extern int16_t stccol, curvce;
|
---|
[f40a309] | 20 |
|
---|
[7258c6a] | 21 | extern int16_t idbox[][8];
|
---|
[f40a309] | 22 |
|
---|
[7258c6a] | 23 | extern int8_t dspbuf[];
|
---|
[f40a309] | 24 |
|
---|
| 25 | /* |
---|
| 26 |
|
---|
| 27 | */
|
---|
| 28 |
|
---|
| 29 | /*
|
---|
| 30 | =============================================================================
|
---|
| 31 | et_ivce() -- load the edit buffer
|
---|
| 32 | =============================================================================
|
---|
| 33 | */
|
---|
[7258c6a] | 34 |
|
---|
[f40a309] | 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 | =============================================================================
|
---|
[7258c6a] | 51 | */
|
---|
[f40a309] | 52 |
|
---|
[7258c6a] | 53 | int16_t ef_ivce(int16_t n)
|
---|
[f40a309] | 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
|
---|
[7258c6a] | 80 | =============================================================================
|
---|
[f40a309] | 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 | =============================================================================
|
---|
[7258c6a] | 103 | nd_ivce() -- handle new data entry
|
---|
[f40a309] | 104 | =============================================================================
|
---|
[7258c6a] | 105 | */
|
---|
[f40a309] | 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();
|
---|
[6262b5c] | 124 |
|
---|
| 125 | return(SUCCESS);
|
---|
| 126 | }
|
---|
| 127 |
|
---|
| 128 |
|
---|