1
by Steffen Joeris
Import upstream version 1.12 |
1 |
diff -C 2 -P orig/freq.h source/freq.h
|
2 |
*** orig/freq.h Sun Mar 10 13:42:26 1996 |
|
3 |
--- source/freq.h Sat Jun 7 23:55:57 1997
|
|
4 |
*************** |
|
5 |
*** 1,3 **** |
|
6 |
! #define VERSION "v.5.1"
|
|
7 |
#define COPYRIGHT "1996" |
|
8 |
||
9 |
--- 1,3 ----
|
|
10 |
! #define VERSION "v.5.1.o2"
|
|
11 |
#define COPYRIGHT "1996" |
|
12 |
||
13 |
*************** |
|
14 |
*** 26,30 **** |
|
15 |
||
16 |
#ifdef DEBUG_OUTPUT |
|
17 |
! #define DOUT(string) puts(string)
|
|
18 |
#else |
|
19 |
#define DOUT(string) {} |
|
20 |
--- 26,30 ----
|
|
21 |
||
22 |
#ifdef DEBUG_OUTPUT |
|
23 |
! #define DOUT(string) fprintf(stderr, "%s\n", string)
|
|
24 |
#else |
|
25 |
#define DOUT(string) {} |
|
26 |
*************** |
|
27 |
*** 136,139 **** |
|
28 |
--- 136,142 ----
|
|
29 |
#define SC_LINUX 1 |
|
30 |
#endif |
|
31 |
+ #ifdef OSCOPE
|
|
32 |
+ #define SC_OSCOPE 2
|
|
33 |
+ #endif
|
|
34 |
#else /* UNIX */ |
|
35 |
#define SC_SB8 0 |
|
36 |
*************** |
|
37 |
*** 152,155 **** |
|
38 |
--- 155,159 ----
|
|
39 |
#define SC_LINUX_NAME "LINUX" |
|
40 |
#define SC_MULAW_NAME "MULAW" |
|
41 |
+ #define SC_OSCOPE_NAME "OSCOPE"
|
|
42 |
||
43 |
/* Default soundcard */ |
|
44 |
*************** |
|
45 |
*** 225,227 **** |
|
46 |
#endif |
|
47 |
||
48 |
!
|
|
49 |
--- 229,234 ----
|
|
50 |
#endif |
|
51 |
||
52 |
! /* Function in SC_OSCOPE.C */
|
|
53 |
! #ifdef SC_OSCOPE
|
|
54 |
! void init_oscope_sc(void);
|
|
55 |
! #endif
|
|
56 |
diff -C 2 -P orig/freq.c source/freq.c
|
|
57 |
*** orig/freq.c Sun Mar 10 13:42:24 1996 |
|
58 |
--- source/freq.c Sat Jun 7 23:55:57 1997
|
|
59 |
*************** |
|
60 |
*** 116,119 **** |
|
61 |
--- 116,120 ----
|
|
62 |
int barmode=1; /* Flag for bar display or dot display */ |
|
63 |
int done=0; /* Flag indicating program should exit*/ |
|
64 |
+ FILE *where; /* where to send final messages */
|
|
65 |
||
66 |
int main(int argc,char *argv[],char *environ[]) |
|
67 |
*************** |
|
68 |
*** 138,143 **** |
|
69 |
else |
|
70 |
{ |
|
71 |
! strncpy(ini_file,"freq.ini",sizeof(ini_file));
|
|
72 |
! first=1;
|
|
73 |
} |
|
74 |
||
75 |
--- 139,149 ----
|
|
76 |
else |
|
77 |
{ |
|
78 |
! #ifdef SC_OSCOPE
|
|
79 |
! if (strstr(argv[0], "ofreq"))
|
|
80 |
! strncpy(ini_file, INIPATH, sizeof(ini_file));
|
|
81 |
! else
|
|
82 |
! #endif
|
|
83 |
! strncpy(ini_file,"freq.ini",sizeof(ini_file));
|
|
84 |
! first=1;
|
|
85 |
} |
|
86 |
||
87 |
*************** |
|
88 |
*** 827,831 **** |
|
89 |
cleanup_graphics(); |
|
90 |
||
91 |
! printf("You have been using Freq " VERSION);
|
|
92 |
#ifdef SC_PAS16 |
|
93 |
if(Soundcard==SC_PAS16) printf(" in ProAudio Spectrum 16-bit mode."); |
|
94 |
--- 833,842 ----
|
|
95 |
cleanup_graphics(); |
|
96 |
||
97 |
! where = stdout;
|
|
98 |
! #ifdef SC_OSCOPE
|
|
99 |
! if(Soundcard==SC_OSCOPE)
|
|
100 |
! where = stderr;
|
|
101 |
! #endif
|
|
102 |
! fprintf(where, "You have been using Freq " VERSION);
|
|
103 |
#ifdef SC_PAS16 |
|
104 |
if(Soundcard==SC_PAS16) printf(" in ProAudio Spectrum 16-bit mode."); |
|
105 |
*************** |
|
106 |
*** 846,850 **** |
|
107 |
if(Soundcard==SC_MULAW) printf(" in 8-bit mu-law audio driver mode."); |
|
108 |
#endif |
|
109 |
! puts("\nCopyright (C) " COPYRIGHT " Philip VanBaren");
|
|
110 |
return(0); |
|
111 |
} |
|
112 |
--- 857,864 ----
|
|
113 |
if(Soundcard==SC_MULAW) printf(" in 8-bit mu-law audio driver mode."); |
|
114 |
#endif |
|
115 |
! #ifdef SC_OSCOPE
|
|
116 |
! if(Soundcard==SC_OSCOPE) fprintf(where, " in 8-bit xoscope pipe mode.");
|
|
117 |
! #endif
|
|
118 |
! fprintf(where, "\nCopyright (C) " COPYRIGHT " Philip VanBaren\n");
|
|
119 |
return(0); |
|
120 |
} |
|
121 |
diff -C 2 -P orig/makefile.srgp_linux source/makefile.srgp_linux
|
|
122 |
*** orig/makefile.srgp_linux Sun Mar 10 13:42:26 1996 |
|
123 |
--- source/makefile.srgp_linux Sat Jun 7 23:55:57 1997
|
|
124 |
*************** |
|
125 |
*** 38,42 **** |
|
126 |
INCLUDE= |
|
127 |
||
128 |
! DEFINES=-DUNIX -DLINUX_MIXER -DSRGP
|
|
129 |
||
130 |
# order is important |
|
131 |
--- 38,42 ----
|
|
132 |
INCLUDE= |
|
133 |
||
134 |
! DEFINES=-DUNIX -DLINUX_MIXER -DSRGP -DOSCOPE '-DINIPATH="/usr/local/lib/oscope/ofreq.ini"'
|
|
135 |
||
136 |
# order is important |
|
137 |
*************** |
|
138 |
*** 45,49 **** |
|
139 |
CC=gcc $(DEBUG) $(OPT) $(DEFINES) $(INCLUDE) $(FLAGS) |
|
140 |
||
141 |
! FREQOBJS=freq.o procinp.o setupsub.o realfft.o passdata.o sc_linux.o sc_mulaw.o gr_srgp.o
|
|
142 |
FREQSRCS=$(FREQOBJS:.o=.c) |
|
143 |
||
144 |
--- 45,49 ----
|
|
145 |
CC=gcc $(DEBUG) $(OPT) $(DEFINES) $(INCLUDE) $(FLAGS) |
|
146 |
||
147 |
! FREQOBJS=freq.o procinp.o setupsub.o realfft.o passdata.o sc_oscope.o sc_linux.o sc_mulaw.o gr_srgp.o
|
|
148 |
FREQSRCS=$(FREQOBJS:.o=.c) |
|
149 |
||
150 |
diff -C 2 -P orig/procinp.c source/procinp.c
|
|
151 |
*** orig/procinp.c Sun Mar 10 13:42:26 1996 |
|
152 |
--- source/procinp.c Mon Jun 2 18:00:39 1997
|
|
153 |
*************** |
|
154 |
*** 554,558 **** |
|
155 |
else if(c=='R' || c=='r') /* Change the sampling rate */ |
|
156 |
{ |
|
157 |
! char in[6];
|
|
158 |
draw_bar(WINDOW_LEFT-5,MGY-1,WINDOW_RIGHT+5,MGY+_font_height,0); |
|
159 |
draw_text_left(MGX-80,MGY,"Sampling rate: "); |
|
160 |
--- 554,558 ----
|
|
161 |
else if(c=='R' || c=='r') /* Change the sampling rate */ |
|
162 |
{ |
|
163 |
! char in[9];
|
|
164 |
draw_bar(WINDOW_LEFT-5,MGY-1,WINDOW_RIGHT+5,MGY+_font_height,0); |
|
165 |
draw_text_left(MGX-80,MGY,"Sampling rate: "); |
|
166 |
*************** |
|
167 |
*** 565,570 **** |
|
168 |
||
169 |
SampleRate=atol(in); |
|
170 |
! if(SampleRate<5000L) SampleRate=5000L;
|
|
171 |
! if(SampleRate>88200L) SampleRate=88200L;
|
|
172 |
||
173 |
reset_soundcard(); |
|
174 |
--- 565,570 ----
|
|
175 |
||
176 |
SampleRate=atol(in); |
|
177 |
! if(SampleRate<1000L) SampleRate=1000L;
|
|
178 |
! if(SampleRate>20000000L) SampleRate=20000000L;
|
|
179 |
||
180 |
reset_soundcard(); |
|
181 |
diff -C 2 -P orig/sc_oscope.c source/sc_oscope.c
|
|
182 |
*** orig/sc_oscope.c Wed Dec 31 16:00:00 1969 |
|
183 |
--- source/sc_oscope.c Sat Jun 7 23:58:48 1997
|
|
184 |
*************** |
|
185 |
*** 0 **** |
|
186 |
--- 1,127 ----
|
|
187 |
+ /*
|
|
188 |
+ * Routines for sampling from stdin/stdout pipe to xoscope
|
|
189 |
+ *
|
|
190 |
+ * Copyright (C) 1996 Tim Witham <twitham@pcocd2.intel.com>
|
|
191 |
+ *
|
|
192 |
+ * This program is free software; you can redistribute it and/or modify
|
|
193 |
+ * it under the terms of the GNU General Public License as published by
|
|
194 |
+ * the Free Software Foundation; either version 2 of the License, or
|
|
195 |
+ * (at your option) any later version.
|
|
196 |
+ *
|
|
197 |
+ * This program is distributed in the hope that it will be useful,
|
|
198 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
199 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
200 |
+ * GNU General Public License for more details.
|
|
201 |
+ *
|
|
202 |
+ * You should have received a copy of the GNU General Public License
|
|
203 |
+ * along with this program; if not, write to the Free Software
|
|
204 |
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
205 |
+ */
|
|
206 |
+
|
|
207 |
+ #include "freq.h"
|
|
208 |
+
|
|
209 |
+ #ifdef SC_OSCOPE
|
|
210 |
+
|
|
211 |
+ #include <stdio.h>
|
|
212 |
+ #include <stdlib.h>
|
|
213 |
+ #include <unistd.h>
|
|
214 |
+ #include <fcntl.h>
|
|
215 |
+ #include <sys/soundcard.h>
|
|
216 |
+ #include <sys/ioctl.h>
|
|
217 |
+ #include "extern.h"
|
|
218 |
+
|
|
219 |
+ /* Function prototypes */
|
|
220 |
+ void reset_oscope_sc(void);
|
|
221 |
+ void halt_oscope_sc(void);
|
|
222 |
+ void cleanup_oscope_sc(void);
|
|
223 |
+ void recordblock_oscope_sc(void *buffer);
|
|
224 |
+ void set_mixer_oscope_sc(int mix,int level);
|
|
225 |
+
|
|
226 |
+ int channel_oscope_sc=0; /* input channel, changed by "mixing" */
|
|
227 |
+
|
|
228 |
+ void init_oscope_sc(void)
|
|
229 |
+ {
|
|
230 |
+ DOUT("Setting up soundcard pointers");
|
|
231 |
+ reset_soundcard=reset_oscope_sc;
|
|
232 |
+ halt_soundcard=halt_oscope_sc;
|
|
233 |
+ cleanup_soundcard=cleanup_oscope_sc;
|
|
234 |
+ recordblock=recordblock_oscope_sc;
|
|
235 |
+ set_mixer=set_mixer_oscope_sc;
|
|
236 |
+ mixers=1;
|
|
237 |
+ mic_level=1;
|
|
238 |
+
|
|
239 |
+ /* If the audio device (sample depth) is undefined, define the default */
|
|
240 |
+ if(audio_device==NULL)
|
|
241 |
+ audio_device="640";
|
|
242 |
+
|
|
243 |
+ DOUT("Setting the DSP device bits per sample to 8");
|
|
244 |
+ sample_size=8;
|
|
245 |
+ }
|
|
246 |
+
|
|
247 |
+ void reset_oscope_sc(void)
|
|
248 |
+ {
|
|
249 |
+ int i;
|
|
250 |
+
|
|
251 |
+ DOUT("Initializing the buffers");
|
|
252 |
+ /* Reset the buffer pointers */
|
|
253 |
+ queue_buffer=0; /* Pointer to next buffer to be queued */
|
|
254 |
+ record_buffer=0; /* Pointer to next buffer to be filled */
|
|
255 |
+ process_buffer=0; /* Pointer to next buffer to be FFTed */
|
|
256 |
+
|
|
257 |
+ for(i=0;i<BUFFERS;i++)
|
|
258 |
+ flag[i]=0;
|
|
259 |
+ /*
|
|
260 |
+ * This function starts the DMA process.
|
|
261 |
+ */
|
|
262 |
+ recordblock_oscope_sc(buffer[queue_buffer]);
|
|
263 |
+ if(++queue_buffer>=BUFFERS)
|
|
264 |
+ queue_buffer=0;
|
|
265 |
+ }
|
|
266 |
+
|
|
267 |
+
|
|
268 |
+ void halt_oscope_sc(void) {}
|
|
269 |
+
|
|
270 |
+ void cleanup_oscope_sc(void) {}
|
|
271 |
+
|
|
272 |
+ void recordblock_oscope_sc(void *buffer)
|
|
273 |
+ {
|
|
274 |
+ static int i, j, samples_per_screen;
|
|
275 |
+ static unsigned char FAR *in, *inmax; /* signal I/O buffers and pointers */
|
|
276 |
+ static short buff, out=0;
|
|
277 |
+
|
|
278 |
+ in = buffer;
|
|
279 |
+ inmax = buffer + fftlen;
|
|
280 |
+ samples_per_screen = atoi(audio_device);
|
|
281 |
+ for (j=0 ; j<samples_per_screen ; j++) {
|
|
282 |
+ if ((i = read(0, &buff, sizeof(short))) != sizeof(short))
|
|
283 |
+ exit(i);
|
|
284 |
+ if (!channel_oscope_sc) /* grab channel 1 ... */
|
|
285 |
+ *(in++) = buff * 100 / 125 + 128;
|
|
286 |
+ if ((i = read(0, &buff, sizeof(short))) != sizeof(short))
|
|
287 |
+ exit(i);
|
|
288 |
+ if (channel_oscope_sc) /* ... or channel 2 */
|
|
289 |
+ *(in++) = buff * 100 / 125 + 128;
|
|
290 |
+ if (in >= inmax) {
|
|
291 |
+ in = inmax;
|
|
292 |
+ /* Toggle the buffer-filled flag */
|
|
293 |
+ if(!flag[record_buffer]) {
|
|
294 |
+ flag[record_buffer]=1;
|
|
295 |
+ if (++record_buffer>=BUFFERS)
|
|
296 |
+ record_buffer=0;
|
|
297 |
+ }
|
|
298 |
+ }
|
|
299 |
+ if ((i = write(1, &out, sizeof(short))) != sizeof(short))
|
|
300 |
+ exit(i);
|
|
301 |
+ }
|
|
302 |
+ }
|
|
303 |
+
|
|
304 |
+ /* "mixing" in this context means toggle channel 1 or 2 as the input */
|
|
305 |
+ void set_mixer_oscope_sc(int mix,int level)
|
|
306 |
+ {
|
|
307 |
+ DOUT("Setting the oscope input channel");
|
|
308 |
+ channel_oscope_sc = !channel_oscope_sc;
|
|
309 |
+ mic_level=channel_oscope_sc + 1;
|
|
310 |
+ update_header();
|
|
311 |
+ }
|
|
312 |
+
|
|
313 |
+ #endif /* SC_OSCOPE */
|
|
314 |
diff -C 2 -P orig/setupsub.c source/setupsub.c
|
|
315 |
*** orig/setupsub.c Sun Mar 10 13:42:26 1996 |
|
316 |
--- source/setupsub.c Sat Jun 7 23:55:58 1997
|
|
317 |
*************** |
|
318 |
*** 362,367 **** |
|
319 |
--- 362,372 ----
|
|
320 |
puts("-Cnumber selects the soundcard (0=SB, 1=PAS, 2=VESA, 3=SB16)."); |
|
321 |
#else /* UNIX */ |
|
322 |
+ #ifdef SC_OSCOPE
|
|
323 |
+ puts("-Cnumber selects the soundcard (0=AU, 1=DSP 2=OSCOPE).");
|
|
324 |
+ puts("-Ddevice selects the DSP device, or # of samples per screen width w/-C2.");
|
|
325 |
+ #else /* SC_OSCOPE */
|
|
326 |
puts("-Cnumber selects the soundcard (0=AU, 1=DSP)."); |
|
327 |
puts("-Ddevice selects the DSP device."); |
|
328 |
+ #endif /* SC_OSCOPE */
|
|
329 |
puts("-Xdevice selects the Mixer device."); |
|
330 |
#endif /* UNIX */ |
|
331 |
*************** |
|
332 |
*** 438,443 **** |
|
333 |
if(ys<0.01) ys=0.01; |
|
334 |
||
335 |
! if(SampleRate>88200L) SampleRate=88200L;
|
|
336 |
! if(SampleRate<5000L) SampleRate=5000L;
|
|
337 |
||
338 |
if(fftlen<8) fftlen=8; |
|
339 |
--- 443,448 ----
|
|
340 |
if(ys<0.01) ys=0.01; |
|
341 |
||
342 |
! if(SampleRate>20000000L) SampleRate=20000000L;
|
|
343 |
! if(SampleRate<1000L) SampleRate=1000L;
|
|
344 |
||
345 |
if(fftlen<8) fftlen=8; |
|
346 |
*************** |
|
347 |
*** 479,482 **** |
|
348 |
--- 484,491 ----
|
|
349 |
init_mulaw_sc(); |
|
350 |
#endif |
|
351 |
+ #ifdef SC_OSCOPE
|
|
352 |
+ if(Soundcard==SC_OSCOPE)
|
|
353 |
+ init_oscope_sc();
|
|
354 |
+ #endif
|
|
355 |
if(reset_soundcard==NULL) |
|
356 |
{ |
|
357 |
*************** |
|
358 |
*** 501,504 **** |
|
359 |
--- 510,516 ----
|
|
360 |
printf(" %s (%d)\n",SC_LINUX_NAME,SC_LINUX); |
|
361 |
#endif |
|
362 |
+ #ifdef SC_OSCOPE
|
|
363 |
+ printf(" %s (%d)\n",SC_OSCOPE_NAME,SC_OSCOPE);
|
|
364 |
+ #endif
|
|
365 |
exit(1); |
|
366 |
} |
|
367 |
*************** |
|
368 |
*** 548,551 **** |
|
369 |
--- 560,567 ----
|
|
370 |
return SC_LINUX; |
|
371 |
#endif |
|
372 |
+ #ifdef SC_OSCOPE
|
|
373 |
+ if(strncmp(name,SC_OSCOPE_NAME,strlen(SC_OSCOPE_NAME))==0)
|
|
374 |
+ return SC_OSCOPE;
|
|
375 |
+ #endif
|
|
376 |
return(-1); /* If none match, return failure */ |
|
377 |
} |
|
378 |
*************** |
|
379 |
*** 1120,1125 **** |
|
380 |
if(mixers) |
|
381 |
{ |
|
382 |
! sprintf(ach,"Mic:%3d Ext:%3d CD:%3d",mic_level,ext_level,int_level);
|
|
383 |
! draw_text_left(LVX,LVY,ach);
|
|
384 |
} |
|
385 |
} |
|
386 |
--- 1136,1146 ----
|
|
387 |
if(mixers) |
|
388 |
{ |
|
389 |
! #ifdef SC_OSCOPE
|
|
390 |
! if (Soundcard==SC_OSCOPE)
|
|
391 |
! sprintf(ach," xoscope channel %d ",mic_level);
|
|
392 |
! else
|
|
393 |
! #endif
|
|
394 |
! sprintf(ach,"Mic:%3d Ext:%3d CD:%3d",mic_level,ext_level,int_level);
|
|
395 |
! draw_text_left(LVX,LVY,ach);
|
|
396 |
} |
|
397 |
} |
|
398 |
*************** |
|
399 |
*** 1160,1164 **** |
|
400 |
draw_text_left(36,74,"'C' Toggle B&W/color display"); |
|
401 |
draw_text_left(340,62,"'V' Refresh display"); |
|
402 |
! draw_text_left(300,74,"(),[],{} Adjust mic,ext,CD input level");
|
|
403 |
} |
|
404 |
else |
|
405 |
--- 1181,1190 ----
|
|
406 |
draw_text_left(36,74,"'C' Toggle B&W/color display"); |
|
407 |
draw_text_left(340,62,"'V' Refresh display"); |
|
408 |
! #ifdef SC_OSCOPE
|
|
409 |
! if (Soundcard==SC_OSCOPE)
|
|
410 |
! draw_text_left(300,74,"(),[],{} Toggle xoscope input channel ");
|
|
411 |
! else
|
|
412 |
! #endif
|
|
413 |
! draw_text_left(300,74,"(),[],{} Adjust mic,ext,CD input level");
|
|
414 |
} |
|
415 |
else |