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