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