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