[3ae31e9] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | etwavs.c -- waveshape editor - waveshape number 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 |
|
---|
| 17 | extern short advwcur();
|
---|
| 18 |
|
---|
| 19 | extern unsigned *waveob;
|
---|
| 20 |
|
---|
| 21 | extern short stccol, curwave, curvce, curwslt;
|
---|
| 22 |
|
---|
| 23 | extern short wsnmod[12][2];
|
---|
| 24 |
|
---|
| 25 | extern short wdbox[][8];
|
---|
| 26 |
|
---|
| 27 | extern char dspbuf[];
|
---|
| 28 |
|
---|
| 29 | /* |
---|
| 30 |
|
---|
| 31 | */
|
---|
| 32 |
|
---|
| 33 | /*
|
---|
| 34 | =============================================================================
|
---|
| 35 | et_wavs() -- load the edit buffer
|
---|
| 36 | =============================================================================
|
---|
| 37 | */
|
---|
| 38 |
|
---|
| 39 | short
|
---|
| 40 | et_wavs(n)
|
---|
| 41 | short n;
|
---|
| 42 | {
|
---|
| 43 | sprintf(ebuf, "%02d", curwave + 1);
|
---|
| 44 | ebflag = TRUE;
|
---|
| 45 |
|
---|
| 46 | return(SUCCESS);
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | /*
|
---|
| 50 | =============================================================================
|
---|
| 51 | ef_wavs() -- parse (unload) the edit buffer
|
---|
| 52 | =============================================================================
|
---|
| 53 | */
|
---|
| 54 |
|
---|
| 55 | short
|
---|
| 56 | ef_wavs(n)
|
---|
| 57 | short n;
|
---|
| 58 | {
|
---|
| 59 | register short i, tmpval;
|
---|
| 60 |
|
---|
| 61 | ebuf[2] = '\0'; /* terminate the string in ebuf */
|
---|
| 62 | ebflag = FALSE;
|
---|
| 63 |
|
---|
| 64 | tmpval = 0;
|
---|
| 65 |
|
---|
| 66 | for (i = 0; i < 2; i++) /* convert from ASCII to binary */
|
---|
| 67 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
---|
| 68 |
|
---|
| 69 | if ((tmpval GT NUMWAVS) OR (tmpval EQ 0))
|
---|
| 70 | return(FAILURE);
|
---|
| 71 |
|
---|
| 72 | wsnmod[curvce][curwslt] = TRUE;
|
---|
| 73 | curwave = tmpval - 1;
|
---|
| 74 | return(SUCCESS);
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | /* |
---|
| 78 |
|
---|
| 79 | */
|
---|
| 80 |
|
---|
| 81 | /*
|
---|
| 82 | =============================================================================
|
---|
| 83 | rd_wavs() -- (re)display the field
|
---|
| 84 | =============================================================================
|
---|
| 85 | */
|
---|
| 86 |
|
---|
| 87 | short
|
---|
| 88 | rd_wavs(nn)
|
---|
| 89 | short nn;
|
---|
| 90 | {
|
---|
| 91 | register short n;
|
---|
| 92 | register unsigned cx;
|
---|
| 93 |
|
---|
| 94 | cx = exp_c(wsnmod[curvce][curwslt] ? WS_CHGC : wdbox[n][4]);
|
---|
| 95 | n = nn & 0x00FF;
|
---|
| 96 |
|
---|
| 97 | sprintf(dspbuf, "%02d", curwave + 1);
|
---|
| 98 |
|
---|
| 99 | vbank(0);
|
---|
| 100 | vcputsv(waveob, 64, cx, wdbox[n][5],
|
---|
| 101 | wdbox[n][6], wdbox[n][7] + WAVE_OFF, dspbuf, 14);
|
---|
| 102 |
|
---|
| 103 | return(SUCCESS);
|
---|
| 104 | }
|
---|
| 105 |
|
---|
| 106 | /*
|
---|
| 107 | =============================================================================
|
---|
| 108 | nd_wavs() -- handle new data entry
|
---|
| 109 | =============================================================================
|
---|
| 110 | */
|
---|
| 111 |
|
---|
| 112 | short
|
---|
| 113 | nd_wavs(nn, k)
|
---|
| 114 | short nn;
|
---|
| 115 | register short k;
|
---|
| 116 | {
|
---|
| 117 | register short ec, n;
|
---|
| 118 |
|
---|
| 119 | n = nn & 0xFF;
|
---|
| 120 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
| 121 | ebuf[ec] = k + '0';
|
---|
| 122 | ebuf[2] = '\0';
|
---|
| 123 |
|
---|
| 124 | dspbuf[0] = k + '0';
|
---|
| 125 | dspbuf[1] = '\0';
|
---|
| 126 |
|
---|
| 127 | vbank(0);
|
---|
| 128 | vcputsv(waveob, 64, WS_ENTRY, wdbox[n][5],
|
---|
| 129 | wdbox[n][6], stccol, dspbuf, 14);
|
---|
| 130 |
|
---|
| 131 | advwcur();
|
---|
| 132 | return(SUCCESS);
|
---|
| 133 | }
|
---|
| 134 |
|
---|