[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | etwvce.c -- waveshape editor - voice field handlers
|
---|
| 4 | Version 8 -- 1987-12-11 -- 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 "wsdsp.h"
|
---|
| 16 |
|
---|
[0580615] | 17 | extern void advwcur(void);
|
---|
[f40a309] | 18 |
|
---|
[7258c6a] | 19 | extern uint16_t *waveob;
|
---|
[f40a309] | 20 |
|
---|
[7258c6a] | 21 | extern int16_t stcrow, stccol, curvce;
|
---|
[f40a309] | 22 |
|
---|
[7258c6a] | 23 | extern int16_t wdbox[][8];
|
---|
[f40a309] | 24 |
|
---|
[7258c6a] | 25 | extern int8_t dspbuf[];
|
---|
[f40a309] | 26 |
|
---|
| 27 | /* |
---|
| 28 |
|
---|
| 29 | */
|
---|
| 30 |
|
---|
| 31 | /*
|
---|
| 32 | =============================================================================
|
---|
| 33 | et_wvce() -- load the edit buffer
|
---|
| 34 | =============================================================================
|
---|
| 35 | */
|
---|
[7258c6a] | 36 |
|
---|
[f40a309] | 37 | int16_t et_wvce(int16_t n)
|
---|
| 38 | {
|
---|
| 39 | sprintf(ebuf, "%02d", curvce + 1);
|
---|
| 40 | ebflag = TRUE;
|
---|
| 41 |
|
---|
| 42 | return(SUCCESS);
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | /*
|
---|
| 46 | =============================================================================
|
---|
| 47 | ef_wvce() -- parse (unload) the edit buffer
|
---|
| 48 | =============================================================================
|
---|
| 49 | */
|
---|
[7258c6a] | 50 |
|
---|
[f40a309] | 51 | int16_t ef_wvce(int16_t n)
|
---|
[7258c6a] | 52 | {
|
---|
[f40a309] | 53 | register int16_t i, tmpval;
|
---|
| 54 |
|
---|
| 55 | ebuf[2] = '\0'; /* terminate the string in ebuf */
|
---|
| 56 | ebflag = FALSE;
|
---|
| 57 | tmpval = 0;
|
---|
| 58 |
|
---|
| 59 | for (i = 0; i < 2; i++) /* convert from ASCII to binary */
|
---|
| 60 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
---|
| 61 |
|
---|
| 62 | if ((tmpval EQ 0) OR (tmpval GT 12))
|
---|
| 63 | return(FAILURE);
|
---|
| 64 |
|
---|
| 65 | newvce(tmpval - 1);
|
---|
| 66 | wwins();
|
---|
| 67 | return(SUCCESS);
|
---|
| 68 | }
|
---|
| 69 |
|
---|
| 70 | /* |
---|
| 71 |
|
---|
| 72 | */
|
---|
| 73 |
|
---|
| 74 | /*
|
---|
| 75 | =============================================================================
|
---|
| 76 | rd_wvce() -- (re)display the field
|
---|
| 77 | =============================================================================
|
---|
[7258c6a] | 78 | */
|
---|
[f40a309] | 79 |
|
---|
[7258c6a] | 80 | int16_t rd_wvce(int16_t nn)
|
---|
[f40a309] | 81 | {
|
---|
| 82 | register int16_t n;
|
---|
| 83 |
|
---|
| 84 | n = nn & 0xFF;
|
---|
| 85 | sprintf(dspbuf, "%02d", curvce + 1);
|
---|
| 86 |
|
---|
| 87 | vbank(0);
|
---|
| 88 | vcputsv(waveob, 64, wdbox[n][4], wdbox[n][5],
|
---|
| 89 | wdbox[n][6], wdbox[n][7] + WVCE_OFF, dspbuf, 14);
|
---|
| 90 |
|
---|
| 91 | return(SUCCESS);
|
---|
| 92 | }
|
---|
| 93 |
|
---|
| 94 | /*
|
---|
| 95 | =============================================================================
|
---|
| 96 | nd_wvce() -- handle new data entry
|
---|
| 97 | =============================================================================
|
---|
[7258c6a] | 98 | */
|
---|
[f40a309] | 99 |
|
---|
[7258c6a] | 100 | int16_t nd_wvce(int16_t nn, int16_t k)
|
---|
[f40a309] | 101 | {
|
---|
| 102 | register int16_t ec, n;
|
---|
| 103 |
|
---|
| 104 | n = nn & 0xFF;
|
---|
| 105 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
| 106 | ebuf[ec] = k + '0';
|
---|
| 107 | ebuf[2] = '\0';
|
---|
| 108 |
|
---|
| 109 | dspbuf[0] = k + '0';
|
---|
| 110 | dspbuf[1] = '\0';
|
---|
| 111 |
|
---|
| 112 | vbank(0);
|
---|
| 113 | vcputsv(waveob, 64, WS_ENTRY, wdbox[n][5],
|
---|
| 114 | stcrow, stccol, dspbuf, 14);
|
---|
| 115 |
|
---|
| 116 | advwcur();
|
---|
| 117 | return(SUCCESS);
|
---|
| 118 | }
|
---|