Lines 1-390
Link Here
|
1 |
--- setad.c.orig Tue May 18 09:43:30 2004 |
|
|
2 |
+++ setad.c Thu Jul 8 14:17:52 2004 |
3 |
@@ -16,11 +16,11 @@ |
4 |
#define ABOVE_MAX_SPEED 768000 |
5 |
#if SND_DEV == 1 |
6 |
#define DEVNAME_SIZE 12 |
7 |
-char devname[DEVNAME_SIZE]="/dev/dsp "; |
8 |
+char dev_name[DEVNAME_SIZE]="/dev/dsp "; |
9 |
#define DEVNAMPOS 8 |
10 |
#else |
11 |
#define DEVNAME_SIZE 18 |
12 |
-char devname[DEVNAME_SIZE]="/dev/sound/dsp "; |
13 |
+char dev_name[DEVNAME_SIZE]="/dev/sound/dsp "; |
14 |
#define DEVNAMPOS 14 |
15 |
#endif |
16 |
|
17 |
@@ -36,7 +36,7 @@ |
18 |
sync(); |
19 |
} |
20 |
|
21 |
-void make_devname(int n) |
22 |
+void make_dev_name(int n) |
23 |
{ |
24 |
int k,num,m; |
25 |
if(n < 0)end_program(9235); |
26 |
@@ -47,13 +47,13 @@ |
27 |
m=num/10; |
28 |
if(m > 0) |
29 |
{ |
30 |
- devname[k]=m+'0'; |
31 |
+ dev_name[k]=m+'0'; |
32 |
k++; |
33 |
} |
34 |
-devname[k]=num-m*10+'0'; |
35 |
-if(devname[k]<'0')devname[k]=0; |
36 |
+dev_name[k]=num-m*10+'0'; |
37 |
+if(dev_name[k]<'0')dev_name[k]=0; |
38 |
k++; |
39 |
-devname[k]=0; |
40 |
+dev_name[k]=0; |
41 |
} |
42 |
|
43 |
void set_da_parms(void) |
44 |
@@ -148,14 +148,14 @@ |
45 |
if(disksave_flag == 2 || network_flag == 2)return; |
46 |
if( (ui.input_mode&NO_DUPLEX) != 0 && audio_out != -1)return; |
47 |
if( (audio_in) != -1)end_program(1000); |
48 |
-make_devname(ui.ad_device_no&255); |
49 |
-audio_in=open( devname ,ui.ad_device_mode , 0); |
50 |
+make_dev_name(ui.ad_device_no&255); |
51 |
+audio_in=open( dev_name ,ui.ad_device_mode , 0); |
52 |
if(audio_in == -1)end_program(1007); |
53 |
if(ui.ad_device_no > 255) |
54 |
{ |
55 |
i=ui.ad_device_no/255-1; |
56 |
- make_devname(i); |
57 |
- audio_in2=open( devname ,ui.ad_device_mode , 0); |
58 |
+ make_dev_name(i); |
59 |
+ audio_in2=open( dev_name ,ui.ad_device_mode , 0); |
60 |
if(audio_in2 == -1)end_program(1174); |
61 |
} |
62 |
if(ui.ad_frag != 0) |
63 |
@@ -238,8 +238,8 @@ |
64 |
if(disksave_flag >=2) |
65 |
{ |
66 |
if(audio_in != -1)end_program(9865); |
67 |
- make_devname(ui.ad_device_no&255); |
68 |
- audio_out=open( devname ,O_WRONLY , 0); |
69 |
+ make_dev_name(ui.ad_device_no&255); |
70 |
+ audio_out=open( dev_name ,O_WRONLY , 0); |
71 |
if(audio_out == -1)end_program(1086); |
72 |
goto set_da; |
73 |
} |
74 |
@@ -275,8 +275,8 @@ |
75 |
} |
76 |
else |
77 |
{ |
78 |
- make_devname(ui.da_device_no); |
79 |
- audio_out=open( devname ,O_WRONLY|O_NONBLOCK , 0); |
80 |
+ make_dev_name(ui.da_device_no); |
81 |
+ audio_out=open( dev_name ,O_WRONLY|O_NONBLOCK , 0); |
82 |
if(audio_out == -1)end_program(1017); |
83 |
set_da:; |
84 |
// Set a small fragment size so we can stop playing quickly. |
85 |
@@ -397,24 +397,24 @@ |
86 |
for(device_no=0; device_no<MAX_DEVNAMES; device_no++) |
87 |
{ |
88 |
dev_flag[device_no]=0; |
89 |
- make_devname(device_no); |
90 |
- fprintf(sndlog,"Checking %s\n",devname); |
91 |
+ make_dev_name(device_no); |
92 |
+ fprintf(sndlog,"Checking %s\n",dev_name); |
93 |
flush_sync(); |
94 |
for(mode=0; mode<3; mode++) |
95 |
{ |
96 |
k=1<<mode; |
97 |
sprintf(s, |
98 |
"Trying to open %s %s. Device defective if system hangs here. Read %s ", |
99 |
- devname, devmode_txt[mode],logfile_name); |
100 |
+ dev_name, devmode_txt[mode],logfile_name); |
101 |
flush_sync(); |
102 |
settextcolor(12); |
103 |
xytext(0,line+1,s); |
104 |
settextcolor(7); |
105 |
- audio_out=open( devname, devmodes[mode]|O_NONBLOCK, 0); |
106 |
+ audio_out=open( dev_name, devmodes[mode]|O_NONBLOCK, 0); |
107 |
if(audio_out != -1) |
108 |
{ |
109 |
for(nn=0; nn<80; nn++)fprintf(sndlog,"-"); |
110 |
- fprintf(sndlog,"\n%s opened as %s ",devname, devmode_txt[mode]); |
111 |
+ fprintf(sndlog,"\n%s opened as %s ",dev_name, devmode_txt[mode]); |
112 |
flush_sync(); |
113 |
rdwr_fmt=16; |
114 |
rdwr_channels=0; |
115 |
@@ -575,7 +575,7 @@ |
116 |
if( (dev_flag[device_no]&1) == 1) |
117 |
{ |
118 |
sprintf(ss,"\n%02d:%12s %7d Hz %d Chan. %d bit", |
119 |
- device_no,devname,dev_rd_speed[device_no], |
120 |
+ device_no,dev_name,dev_rd_speed[device_no], |
121 |
dev_rd_channels[device_no], |
122 |
dev_rd_bits[device_no]); |
123 |
} |
124 |
@@ -584,7 +584,7 @@ |
125 |
if( (dev_flag[device_no]&2) == 2) |
126 |
{ |
127 |
sprintf(ss,"\n%02d:%12s %7d Hz %d Chan. %d bit", |
128 |
- device_no,devname,dev_wr_speed[device_no], |
129 |
+ device_no,dev_name,dev_wr_speed[device_no], |
130 |
dev_wr_channels[device_no], |
131 |
dev_wr_bits[device_no]); |
132 |
} |
133 |
@@ -631,11 +631,11 @@ |
134 |
color=0x17; |
135 |
sprintf(&ss[maxcolumn], |
136 |
"\n%02d:%12s %7d Hz %d Chan. %d bit %s", |
137 |
- device_no,devname,dev_wr_speed[device_no], |
138 |
+ device_no,dev_name,dev_wr_speed[device_no], |
139 |
dev_wr_channels[device_no], |
140 |
dev_wr_bits[device_no],devmode_txt[1]); |
141 |
sprintf(ss,"\n%02d:%12s %7d Hz %d Chan. %d bit %s", |
142 |
- device_no,devname,dev_rd_speed[device_no], |
143 |
+ device_no,dev_name,dev_rd_speed[device_no], |
144 |
dev_rd_channels[device_no], |
145 |
dev_rd_bits[device_no],devmode_txt[0]); |
146 |
} |
147 |
@@ -649,17 +649,17 @@ |
148 |
color=0x17; |
149 |
sprintf(&ss[2*maxcolumn], |
150 |
"\n%02d:%12s %7d Hz %d Chan. %d bit %s", |
151 |
- device_no,devname,dev_wr_speed[device_no], |
152 |
+ device_no,dev_name,dev_wr_speed[device_no], |
153 |
dev_wr_channels[device_no], |
154 |
dev_wr_bits[device_no],devmode_txt[1]); |
155 |
sprintf(&ss[maxcolumn], |
156 |
"\n%02d:%12s %7d Hz %d Chan. %d bit %s", |
157 |
- device_no,devname,dev_rd_speed[device_no], |
158 |
+ device_no,dev_name,dev_rd_speed[device_no], |
159 |
dev_rd_channels[device_no], |
160 |
dev_rd_bits[device_no],devmode_txt[0]); |
161 |
sprintf(ss, |
162 |
"\n%02d:%12s %7d Hz %d Chan. %d bit %s", |
163 |
- device_no,devname,dev_rdwr_speed[device_no], |
164 |
+ device_no,dev_name,dev_rdwr_speed[device_no], |
165 |
dev_rdwr_channels[device_no], |
166 |
dev_rdwr_bits[device_no],devmode_txt[2]); |
167 |
} |
168 |
@@ -672,12 +672,12 @@ |
169 |
color=0x17; |
170 |
sprintf(&ss[maxcolumn], |
171 |
"\n%02d:%12s %7d Hz %d Chan. %d bit %s", |
172 |
- device_no,devname,dev_wr_speed[device_no], |
173 |
+ device_no,dev_name,dev_wr_speed[device_no], |
174 |
dev_wr_channels[device_no], |
175 |
dev_wr_bits[device_no],devmode_txt[1]); |
176 |
sprintf(ss, |
177 |
"\n%02d:%12s %7d Hz %d Chan. %d bit %s %s", |
178 |
- device_no,devname,dev_rd_speed[device_no], |
179 |
+ device_no,dev_name,dev_rd_speed[device_no], |
180 |
dev_rd_channels[device_no], dev_rd_bits[device_no], |
181 |
devmode_txt[0],devmode_txt[2]); |
182 |
} |
183 |
@@ -686,12 +686,12 @@ |
184 |
color=0x1d; |
185 |
sprintf(&ss[maxcolumn], |
186 |
"\n%02d:%12s %7d Hz %d Chan. %d bit %s %s", |
187 |
- device_no,devname,dev_wr_speed[device_no], |
188 |
+ device_no,dev_name,dev_wr_speed[device_no], |
189 |
dev_wr_channels[device_no], dev_wr_bits[device_no], |
190 |
devmode_txt[1],devmode_txt[2]); |
191 |
sprintf(ss, |
192 |
"\n%02d:%12s %7d Hz %d Chan. %d bit %s", |
193 |
- device_no,devname,dev_rd_speed[device_no], |
194 |
+ device_no,dev_name,dev_rd_speed[device_no], |
195 |
dev_rd_channels[device_no], dev_rd_bits[device_no], |
196 |
devmode_txt[0]); |
197 |
} |
198 |
@@ -777,8 +777,8 @@ |
199 |
} |
200 |
} |
201 |
vga_clear(); |
202 |
-make_devname(ui.ad_device_no); |
203 |
-fprintf(sndlog,"\n\n %s selected by user for input.",devname); |
204 |
+make_dev_name(ui.ad_device_no); |
205 |
+fprintf(sndlog,"\n\n %s selected by user for input.",dev_name); |
206 |
fprintf(sndlog," dev_flag=%d",dev_flag[ui.ad_device_no]); |
207 |
flush_sync(); |
208 |
// High end users might need two devices to read four A/D channels. |
209 |
@@ -819,8 +819,8 @@ |
210 |
if(vga_inkey != 'Y')goto gt_dual; |
211 |
vga_clear(); |
212 |
fprintf(sndlog,"\nUser wants to try to open two read devices"); |
213 |
- make_devname(ui.ad_device_no); |
214 |
- audio_in=open( devname, O_RDONLY, 0); |
215 |
+ make_dev_name(ui.ad_device_no); |
216 |
+ audio_in=open( dev_name, O_RDONLY, 0); |
217 |
if(audio_in == -1)end_program(1102); |
218 |
// Check for DSP_CAP_TRIGGER capability |
219 |
if(ioctl(audio_in, SNDCTL_DSP_GETCAPS,&caps) == -1)end_program(1182); |
220 |
@@ -834,14 +834,14 @@ |
221 |
if(ioctl(audio_in, SNDCTL_DSP_CHANNELS, &j) == -1)end_program(1185); |
222 |
if(j != 2)end_program(1186); |
223 |
} |
224 |
- make_devname(i); |
225 |
- audio_in2=open( devname, O_RDONLY|O_NONBLOCK, 0); |
226 |
+ make_dev_name(i); |
227 |
+ audio_in2=open( dev_name, O_RDONLY|O_NONBLOCK, 0); |
228 |
if(audio_in2 != -1) |
229 |
{ |
230 |
line++; |
231 |
- fprintf(sndlog,"\n%s opened as second read device",devname); |
232 |
+ fprintf(sndlog,"\n%s opened as second read device",dev_name); |
233 |
sprintf(s,"\n%02d:%12s %7d Hz %d Chan. %d bit", |
234 |
- i,devname,dev_rd_speed[i], dev_rd_channels[i], |
235 |
+ i,dev_name,dev_rd_speed[i], dev_rd_channels[i], |
236 |
dev_rd_bits[i]); |
237 |
xytext(0,line,s); |
238 |
close(audio_in2); |
239 |
@@ -866,13 +866,13 @@ |
240 |
goto get_addev2; |
241 |
} |
242 |
// We store the second A/D device in the second byte of ad_device_no |
243 |
- make_devname(i); |
244 |
+ make_dev_name(i); |
245 |
ui.ad_device_no+=256*(i+1); |
246 |
for(i=0; i<MAX_DEVNAMES; i++) |
247 |
{ |
248 |
dev_flag[i]&=255; |
249 |
} |
250 |
- audio_in2=open( devname, O_RDONLY|O_NONBLOCK, 0); |
251 |
+ audio_in2=open( dev_name, O_RDONLY|O_NONBLOCK, 0); |
252 |
if(audio_in2 == -1)end_program(1172); |
253 |
// Check for DSP_CAP_TRIGGER capability |
254 |
if(ioctl(audio_in2, SNDCTL_DSP_GETCAPS,&caps) == -1)end_program(1182); |
255 |
@@ -883,7 +883,7 @@ |
256 |
close(audio_in2); |
257 |
goto skip_dual_devices; |
258 |
} |
259 |
- fprintf(sndlog,"\n %s is second input device.",devname); |
260 |
+ fprintf(sndlog,"\n %s is second input device.",dev_name); |
261 |
ui.input_mode=TWO_CHANNELS+IQ_DATA; |
262 |
ui.rx_channels=2; |
263 |
ui.ad_channels=4; |
264 |
@@ -894,7 +894,7 @@ |
265 |
} |
266 |
// Now that we decided what device to use for input, open it and let |
267 |
// the user decide how to use it. |
268 |
-make_devname(ui.ad_device_no); |
269 |
+make_dev_name(ui.ad_device_no); |
270 |
flush_sync(); |
271 |
ui.ad_device_mode=O_RDONLY; |
272 |
mode=0; |
273 |
@@ -903,7 +903,7 @@ |
274 |
if( (1 & dev_flag[ui.ad_device_no]) != 0) |
275 |
{ |
276 |
gt_rdo:; |
277 |
- sprintf(s,"Open %s as RDONLY or RDWR? (O/W)\n=>",devname); |
278 |
+ sprintf(s,"Open %s as RDONLY or RDWR? (O/W)\n=>",dev_name); |
279 |
xytext(10,10,s); |
280 |
vga_inkey=vga_getkey(); |
281 |
clean_vga_inkey(); |
282 |
@@ -925,9 +925,9 @@ |
283 |
} |
284 |
flush_sync(); |
285 |
vga_clear(); |
286 |
-sprintf(s,"For analog input: %s opened in %s mode",devname,devmode_txt[mode]); |
287 |
+sprintf(s,"For analog input: %s opened in %s mode",dev_name,devmode_txt[mode]); |
288 |
xytext(0,0,s); |
289 |
-audio_in=open( devname, ui.ad_device_mode, 0); |
290 |
+audio_in=open( dev_name, ui.ad_device_mode, 0); |
291 |
if(audio_in == -1)end_program(1038); |
292 |
j=dev_rd_channels[ui.ad_device_no]; |
293 |
xytext(0,10,"Select radio interface:"); |
294 |
@@ -1123,7 +1123,7 @@ |
295 |
|
296 |
|
297 |
settextcolor(12); |
298 |
-sprintf(s,"Trying to read %s",devname); |
299 |
+sprintf(s,"Trying to read %s",dev_name); |
300 |
xytext(10,10,s); |
301 |
xytext(0,12,"If you see this message for more than 2 seconds READ failed"); |
302 |
xytext(0,13,"Then try another device"); |
303 |
@@ -1176,7 +1176,7 @@ |
304 |
} |
305 |
fprintf(sndlog,"\nRead test OK"); |
306 |
for(i=10; i<14; i++)xytext(0,i,ss); |
307 |
-sprintf(s,"Now trying to open a second device while %s is open",devname); |
308 |
+sprintf(s,"Now trying to open a second device while %s is open",dev_name); |
309 |
xytext(0,6,s); |
310 |
xytext(0,7,"This may cause your system to hang. Try ctrlC to exit (or reboot)"); |
311 |
xytext(0,8,"Try another input device or install another sound system."); |
312 |
@@ -1192,9 +1192,9 @@ |
313 |
read(audio_in, testbuff, 1024); |
314 |
if(ioctl(audio_in,SNDCTL_DSP_GETISPACE,&ad_info) == -1)end_program(1093); |
315 |
} |
316 |
- make_devname(i); |
317 |
+ make_dev_name(i); |
318 |
cn=0; |
319 |
- sprintf(s,"%02d:%12s",i,devname); |
320 |
+ sprintf(s,"%02d:%12s",i,dev_name); |
321 |
xytext(0,line,s); |
322 |
column=0; |
323 |
while(s[column] != 0)column++; |
324 |
@@ -1206,7 +1206,7 @@ |
325 |
if( (ui.input_mode&DWORD_INPUT) != 0 || ui.ad_channels > 2) |
326 |
{ |
327 |
sprintf(&s[column], |
328 |
- " RDWR useless (too many bits or channels) %d: %s",i,devname); |
329 |
+ " RDWR useless (too many bits or channels) %d: %s",i,dev_name); |
330 |
dev_flag[i]=0; |
331 |
} |
332 |
else |
333 |
@@ -1224,10 +1224,10 @@ |
334 |
dev_flag[i]&=0xffff-4; |
335 |
if( (dev_flag[i]&2) != 0 ) |
336 |
{ |
337 |
- audio_out=open( devname, O_WRONLY|O_NONBLOCK, 0); |
338 |
+ audio_out=open( dev_name, O_WRONLY|O_NONBLOCK, 0); |
339 |
if(audio_out != -1) |
340 |
{ |
341 |
- fprintf(sndlog,"\n%s opened as WRONLY",devname); |
342 |
+ fprintf(sndlog,"\n%s opened as WRONLY",dev_name); |
343 |
flush_sync(); |
344 |
if(ioctl(audio_in, SNDCTL_DSP_GETISPACE, |
345 |
&ad_info) == -1)end_program(1094); |
346 |
@@ -1380,17 +1380,17 @@ |
347 |
line=0; |
348 |
for(i=0; i<MAX_DEVNAMES; i++) |
349 |
{ |
350 |
- make_devname(i); |
351 |
- fprintf(sndlog,"\n%s ",devname); |
352 |
+ make_dev_name(i); |
353 |
+ fprintf(sndlog,"\n%s ",dev_name); |
354 |
cn=0; |
355 |
- sprintf(s,"%02d:%12s",i,devname); |
356 |
+ sprintf(s,"%02d:%12s",i,dev_name); |
357 |
xytext(0,line,s); |
358 |
column=0; |
359 |
while(s[column] != 0)column++; |
360 |
- audio_out=open( devname, O_WRONLY|O_NONBLOCK, 0); |
361 |
+ audio_out=open( dev_name, O_WRONLY|O_NONBLOCK, 0); |
362 |
if(audio_out != -1) |
363 |
{ |
364 |
- fprintf(sndlog,"\n%s opened as WRONLY with no input open.",devname); |
365 |
+ fprintf(sndlog,"\n%s opened as WRONLY with no input open.",dev_name); |
366 |
flush_sync(); |
367 |
j=AFMT_U8; |
368 |
if(ioctl(audio_out, SNDCTL_DSP_SETFMT, &j) == -1) |
369 |
@@ -1528,8 +1528,8 @@ |
370 |
ui.da_device_no=j; |
371 |
if( (6 & dev_flag[ui.da_device_no]) == 0) goto get_dadev; |
372 |
} |
373 |
-make_devname(ui.da_device_no); |
374 |
-fprintf(sndlog,"\nUser selected %s for output.",devname); |
375 |
+make_dev_name(ui.da_device_no); |
376 |
+fprintf(sndlog,"\nUser selected %s for output.",dev_name); |
377 |
for(i=6; i<=line; i++)xytext(0,i,ss); |
378 |
xytext(0,8,"Use close and reopen for D/A when"); |
379 |
xytext(0,9,"a new signal is selected? (Y/N)"); |
380 |
@@ -1563,8 +1563,8 @@ |
381 |
} |
382 |
else |
383 |
{ |
384 |
- audio_out=open( devname ,O_WRONLY , 0); |
385 |
- sprintf(s,"\nUsing %s for output",devname); |
386 |
+ audio_out=open( dev_name ,O_WRONLY , 0); |
387 |
+ sprintf(s,"\nUsing %s for output",dev_name); |
388 |
xytext(0,6,s); |
389 |
if(audio_out == -1)end_program(1068); |
390 |
da_wrbuf = NULL; |