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