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