home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-05-07 | 35.2 KB | 1,285 lines |
- Newsgroups: comp.sources.unix
- From: guido.van.rossum@cwi.nl (Guido van Rossum)
- Subject: v26i234: radio - UDP broadcast/receive utilities for audio data, V2.0, Patch03
- Sender: unix-sources-moderator@efficacy.home.vix.com
- Approved: WhoAmI@efficacy.home.vix.com
-
- Submitted-By: guido.van.rossum@cwi.nl (Guido van Rossum)
- Posting-Number: Volume 26, Issue 234
- Archive-Name: radio2.0.2/patch03
-
- [ radio2.0.2 was posted at patchlevel 2, so this is the first patch to it.
- --vix ]
-
- Archive-name: radio-2.0/patch03
- Submitted-by: Guido van Rossum <guido@cwi.nl>
-
- This is official patch number 3 for radio version 2.0, bringing it up
- to patch level 3, or version 2.0.3. See the blurb a little further
- below if you don't know what radio is.
-
- Changes in 2.0 patchlevel 3:
-
- - Broadcast no longer uses "-b address" to indicate the IP address to
- send to; address must be passed as arguments, after all options.
- Addresses have an optional :port suffix to override the port specified
- with -p (or the default of 54321).
-
- - Radio can now also be used with DEC CRL's AudioFile server or with DEC
- LoFi hardware (these options require additional software available
- elsewhere). When compiled for AudioFile, broadcast can optionally
- record data directly from the server.
-
- - Bugfix when switching stations under tuner control when using
- multicast.
-
- - Minor clarifications to man pages, etc.
-
- - Copyrights updated.
-
- ******************
- * What is radio? *
- ******************
-
- If you have a local area network full of workstations with audio
- capabilities and at least one FM/AM radio or other audio source, you
- can broadcast the audio over the network, and let other users listen
- to it.
-
- This software works for Sun Sparcs running SunOS 4.0 or 4.1, for SGI
- Indigo or Personal IRIS 4D/30 or 4D/35 workstations running SGI IRIX
- 4.0 or 3.3.2, NeXT workstations (running version 2.1), DECstations
- equipped with DEC lofi, and machines running the Audio File audio
- server from DEC CRL. At CWI, versions of it have been in continuous
- use on a mix of Sun and SGI system types for almost two years; version
- 1.0 (patchlevel 4) was last tested on a NeXT. (I've heard that the
- program doesn't work on NeXT 3.1; if you fix it please send me the
- changes!)
-
- Man pages for "radio" and "broadcast" are provided.
-
- The implementation continuously transmits UDP broadcast packets of
- 1400 bytes each (i.e. less than six per second), which contain the
- data in U-LAW format (8000 samples/second, 1 byte/sample,
- logarithmically encoded). On a typical ethernet, this uses about 1
- percent of the net available bandwith. Some loss of UDP packets is
- tolerated by the receiving program (this is heard as short
- interruptions of the sound). Every now and then, a short "station
- call" packet is transmitted as well, for the benefit of advanced
- listening programs.
-
- If you missed a part of the posting of radio, you can ftp the whole
- source from ftp.cwi.nl [192.16.184.180], file /pub/radio2.0.*.tar.Z,
- or from the comp.sources.unix archives.
-
- Enjoy,
-
- --Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
-
-
- diff -c1 pl2/Makefile pl3/Makefile
- *** pl2/Makefile Sun Feb 21 18:29:23 1993
- --- pl3/Makefile Fri May 7 16:28:59 1993
- ***************
- *** 1,4 ****
- # /***********************************************************
- ! # Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
- ! # Netherlands.
- #
- --- 1,4 ----
- # /***********************************************************
- ! # Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
- ! # Amsterdam, The Netherlands.
- #
- ***************
- *** 27,29 ****
- @echo 'You must use "make sun4.0", "make sun4.1",'
- ! @echo '"make next" or "make sgi"'
- exit 1
- --- 27,30 ----
- @echo 'You must use "make sun4.0", "make sun4.1",'
- ! @echo '"make next", "make sgi", "make lofi" or'
- ! @echo '"make audiofile"'
- exit 1
- ***************
- *** 46,48 ****
- sgi: # For SGI IRIX 4.0
- ! make all recordulaw recordlinear playulaw LIBS='-lX11 -laudio'
-
- --- 47,50 ----
- sgi: # For SGI IRIX 4.0
- ! make all recordulaw recordlinear playulaw \
- ! CFLAGS='-O' LIBS='-lX11 -laudio'
-
- ***************
- *** 50,51 ****
- --- 52,72 ----
- make all sndulaw
- +
- + # Where are the (mini) LoFi include files and libraries?
- + LOFI= ./LoFiLib
- + LOFIINCLUDE= -I$(LOFI)
- + LOFILIBDIRS= -L$(LOFI)
- +
- + lofi:
- + make all CFLAGS="-g -Ddec_lofi $(LOFIINCLUDE)" \
- + LIBS="$(LOFILIBDIRS) -lminilofi -lm"
- +
- + # Where are the AF include files and libraries?
- + AF= /ufs/guido/src/af/AF
- + AFINCLUDE= -I$(AF)/include -I$(AF)
- + AFLIBDIRS= -L$(AF)/lib/AF -L$(AF)/lib/AFUtil
- +
- + audiofile:
- + make all CFLAGS="-g -Daudiofile $(AFINCLUDE)" \
- + LIBS="$(AFLIBDIRS) -lAF -lAFUtil -lm"
- +
-
- diff -c1 pl2/README pl3/README
- *** pl2/README Sun Feb 21 18:24:21 1993
- --- pl3/README Fri May 7 16:28:59 1993
- ***************
- *** 3,5 ****
-
- ! This is Radio version 2.0, patchlevel 2 (a.k.a. 2.0.2).
-
- --- 3,5 ----
-
- ! This is Radio version 2.0, patchlevel 3 (a.k.a. 2.0.3).
-
- ***************
- *** 12,18 ****
- Indigo or Personal IRIS 4D/30 or 4D/35 workstations running SGI IRIX
- ! 4.0 or 3.3.2, and for NeXT workstations (running version 2.1). At
- ! CWI, versions of it have been in continuous use on a mix of Sun and
- ! SGI system types for almost two years; version 1.0 (patchlevel 4) was
- ! last tested on a NeXT. (I've heard that the program doesn't work on
- ! NeXT 3.1; if you fix it please send me the changes!)
-
- --- 12,20 ----
- Indigo or Personal IRIS 4D/30 or 4D/35 workstations running SGI IRIX
- ! 4.0 or 3.3.2, NeXT workstations (running version 2.1), DECstations
- ! equipped with DEC lofi, and machines running the Audio File audio
- ! server from DEC CRL. At CWI, versions of it have been in continuous
- ! use on a mix of Sun and SGI system types for almost two years; version
- ! 1.0 (patchlevel 4) was last tested on a NeXT. (I've heard that the
- ! program doesn't work on NeXT 3.1; if you fix it please send me the
- ! changes!)
-
- ***************
- *** 37,45 ****
-
- ! If you have Motif, you may be interested in the "tuner" program
- ! (version 1.3) by Jack Jansen. This is a window-based interface that
- ! shows the different broadcasting stations at your site and lets you
- ! tune your radio process to the station of your choice. It will be
- ! posted to comp.sources.x around the same time as radio 2.0; you can
- also ftp it from site ftp.cwi.nl [192.16.184.180], file
- ! /pub/tuner1.3.tar.Z.
-
- --- 39,47 ----
-
- ! If you have Motif, you may be interested in the "tuner" program by
- ! Jack Jansen. This is a window-based interface that shows the
- ! different broadcasting stations at your site and lets you tune your
- ! radio process to the station of your choice. It was posted to
- ! comp.sources.<something> around the same time as radio 2.0.2; you can
- also ftp it from site ftp.cwi.nl [192.16.184.180], file
- ! /pub/tuner1.*.tar.Z, or from the comp.sources.unix archives.
-
- ***************
- *** 46,48 ****
- If you missed a part of the posting of radio, you can ftp the whole
- ! source from ftp.cwi.nl [192.16.184.180], file /pub/radio2.0.tar.Z.
-
- --- 48,50 ----
- If you missed a part of the posting of radio, you can ftp the whole
- ! source from ftp.cwi.nl [192.16.184.180], file /pub/radio2.0.*.tar.Z.
-
- ***************
- *** 51,52 ****
- --- 53,75 ----
-
- + Changes in 2.0 patchlevel 3
- + ---------------------------
- +
- + Broadcast no longer uses "-b address" to indicate the IP address to
- + send to; address must be passed as arguments, after all options.
- + Addresses have an optional :port suffix to override the port specified
- + with -p (or the default of 54321).
- +
- + Radio can now also be used with DEC CRL's AudioFile server or with DEC
- + LoFi hardware (these options require additional software available
- + elsewhere). When compiled for AudioFile, broadcast can optionally
- + record data directly from the server.
- +
- + Bugfix when switching stations under tuner control when using
- + multicast.
- +
- + Minor clarifications to man pages, etc.
- +
- + Copyrights updated.
- +
- +
- Changes in 2.0 patchlevel 2
- ***************
- *** 197,198 ****
- --- 220,240 ----
-
- + For a DECStation with LoFi hardware, you need to fetch either the LoFi
- + library by <gnn@cs.utwente.nl> or the DEC CRL AudioFile software
- + distribution. LoFiLib is available for ftp from pegasus.cs.utwente.nl
- + in /pub/audio/libminilofi.tar.Z. AudioFile is available for ftp from
- + crl.dec.com in /pub/DEC/AF/AF2R2.tar.Z. Also get the patches from the
- + same directory. AudioFile runs on several different kinds of
- + hardware, including almost all DEC hardware. It is one or more orders
- + of magnitude bigger than LoFiLib.
- +
- + To build for LoFiLib, build LoFiLib first (there is a README in there
- + detailing that process). Edit the variable LOFI in the Makefile here
- + to point to the LoFiLib directory. Then do "make lofi".
- +
- + To build with AudioFile, build the AudioFile client library and server
- + first. Edit the variable AF in the Makefile here to point to the root
- + of the AudioFile tree; or edit the variables AFINCLUDES and AFLIBDIRS
- + to point to the installed include files and libraries respectively.
- + Then do "make audiofile".
- +
- Install the "radio" program on a convenient public place (where
- ***************
- *** 239,242 ****
-
- By default this broadcasts on the local ethernet. You can specify one
- ! or more -b options to broadcast, passing it explicit IP broadcast
- addresses (last byte 0 or 255, depending on local convention). You can
- --- 281,289 ----
-
- + On Audio File you start transmissions as follows:
- +
- + broadcast -s -p port
- +
- +
- By default this broadcasts on the local ethernet. You can specify one
- ! or more arguments to broadcast, passing it explicit IP broadcast
- addresses (last byte 0 or 255, depending on local convention). You can
- ***************
- *** 366,369 ****
-
- ! Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
- ! Netherlands.
-
- --- 413,416 ----
-
- ! Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
- ! Amsterdam, The Netherlands.
-
- diff -c1 pl2/adpcm.c pl3/adpcm.c
- *** pl2/adpcm.c Sun Feb 21 18:24:24 1993
- --- pl3/adpcm.c Fri May 7 16:29:00 1993
- ***************
- *** 1,4 ****
- /***********************************************************
- ! Copyright 1992 by Stichting Mathematisch Centrum, Amsterdam, The
- ! Netherlands.
-
- --- 1,4 ----
- /***********************************************************
- ! Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
- ! Amsterdam, The Netherlands.
-
- diff -c1 pl2/broadcast.c pl3/broadcast.c
- *** pl2/broadcast.c Sun Feb 21 18:24:26 1993
- --- pl3/broadcast.c Fri May 7 16:29:00 1993
- ***************
- *** 1,4 ****
- /***********************************************************
- ! Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
- ! Netherlands.
-
- --- 1,4 ----
- /***********************************************************
- ! Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
- ! Amsterdam, The Netherlands.
-
- ***************
- *** 35,38 ****
- -A ADPCM encoding without state, even worse sound
- - -b ipaddr IP address to broadcast to; may be repeated
- - (default broadcast on local net)
- -c port listen to this control port (default 54319)
- --- 35,36 ----
- ***************
- *** 48,49 ****
- --- 46,53 ----
- -P file program file (default /ufs/<username>/CD)
- + -s server mode (Audio File Only)
- +
- + The rest of the arguments are addresses to broadcast to. These can be
- + IP unicast, multicast or broadcast addresses, optionally followed by
- + ':port' to signify that a different port from the default should be
- + used.
- */
- ***************
- *** 57,58 ****
- --- 61,63 ----
- #include <fcntl.h>
- + #include <string.h>
-
- ***************
- *** 87,88 ****
- --- 92,109 ----
-
- + #ifdef USE_AF
- + #include <AF/AFlib.h>
- +
- + #define TRUE 1
- + #define FALSE 0
- +
- + ATime now;
- + AFAudioConn *aud;
- + AC audio_context;
- + AFSetACAttributes attributes;
- +
- + int device;
- +
- + int server = FALSE;
- + #endif /* USE_AF */
- +
- extern int optind;
- ***************
- *** 101,103 ****
-
- ! int port = RCVPORT;
- char *name = 0;
- --- 122,124 ----
-
- ! int dftport = RCVPORT;
- char *name = 0;
- ***************
- *** 112,113 ****
- --- 133,137 ----
-
- + /* Forward functions */
- + void open_microphone();
- +
- char *
- ***************
- *** 133,135 ****
- int
- ! makeinfo()
- {
- --- 157,160 ----
- int
- ! makeinfo(port)
- ! short port;
- {
- ***************
- *** 159,161 ****
- void
- ! sendinfo(s, addr, addrsize)
- int s; /* Socket */
- --- 184,186 ----
- void
- ! sendinfo(s, addr, addrsize, port)
- int s; /* Socket */
- ***************
- *** 163,166 ****
- int addrsize;
- {
- ! int n = makeinfo();
- if (sendto(s, infostring, n, 0, addr, addrsize) < 0)
- --- 188,192 ----
- int addrsize;
- + short port;
- {
- ! int n = makeinfo(port);
- if (sendto(s, infostring, n, 0, addr, addrsize) < 0)
- ***************
- *** 203,208 ****
- /* Always change these two macros and the following switch together! */
- ! #define OPTIONS "Aab:c:dlm:np:tL:N:P:"
- #define USAGE \
- ! "usage: %s [-A] [-a] [-b broadcastaddr] ... [-c ctlport] [-d] [-l]\n\
- ! \t[-m ttl] [-n] [-p port] [-t]\n\t[-N name] [-L logfile] [-P programfile]\n"
-
- --- 229,234 ----
- /* Always change these two macros and the following switch together! */
- ! #define OPTIONS "Aac:dlm:np:tL:N:P:s"
- #define USAGE \
- ! "usage: %s [-A] [-a] [-c ctlport] [-d] [-l] [-m ttl] [-n] [-p port]\n\
- ! \t[-s] [-t] [-N name] [-L logfile] [-P programfile] [address[:port] ...]\n"
-
- ***************
- *** 220,236 ****
- break;
- - case 'b':
- - if (nbcaddr >= NBCADDR) {
- - fprintf(stderr,
- - "%s: too many -b options (max %d)\n",
- - progname, NBCADDR);
- - exit(2);
- - }
- - if (setipaddr(optarg, &bcaddr[nbcaddr]) < 0) {
- - fprintf(stderr,
- - "%s: bad broadcast address '%s'\n",
- - progname, broadcastaddr);
- - exit(2);
- - }
- - nbcaddr++;
- - break;
- case 'c':
- --- 246,247 ----
- ***************
- *** 255,257 ****
- case 'p':
- ! port = atoi(optarg);
- break;
- --- 266,268 ----
- case 'p':
- ! dftport = atoi(optarg);
- break;
- ***************
- *** 269,270 ****
- --- 280,286 ----
- break;
- + #ifdef USE_AF
- + case 's':
- + server = TRUE;
- + break;
- + #endif /* USE_AF */
- }
- ***************
- *** 288,289 ****
- --- 304,310 ----
-
- + #ifdef USE_AF
- + if(server)
- + open_microphone();
- + #endif /* USE_AF */
- +
- s = opensock("data", (char *)NULL, SENDPORT, (char *)NULL, 0, 1);
- ***************
- *** 290,294 ****
-
- ! if (nbcaddr == 0) {
- #if defined(HAVE_MCAST) && defined (DEFMCAST)
- ! if (setipaddr(DEFMCAST, &bcaddr[nbcaddr]) < 0) {
- fprintf(stderr,
- --- 311,315 ----
-
- ! if (optind == argc) {
- #if defined(HAVE_MCAST) && defined (DEFMCAST)
- ! if (setfulladdr(s, DEFMCAST, &bcaddr[0]) < 0) {
- fprintf(stderr,
- ***************
- *** 299,301 ****
- #else
- ! configure(s, &bcaddr[0]);
- #endif
- --- 320,322 ----
- #else
- ! setfulladdr(s, "", &bcaddr[0]);
- #endif
- ***************
- *** 302,304 ****
- --- 323,344 ----
- nbcaddr = 1;
- + } else {
- + while (optind < argc) {
- + if (nbcaddr >= NBCADDR) {
- + fprintf(stderr,
- + "%s: too many addresses (max %d)\n",
- + progname, NBCADDR);
- + exit(2);
- + }
- + if (setfulladdr(s, argv[optind],
- + &bcaddr[nbcaddr]) < 0) {
- + fprintf(stderr,
- + "%s: bad broadcast address '%s'\n",
- + progname, broadcastaddr);
- + exit(2);
- + }
- + nbcaddr++;
- + optind++;
- + }
- }
- +
-
- ***************
- *** 305,307 ****
- for (i = 0; i < nbcaddr; i++) {
- - bcaddr[i].sin_port = htons(port);
- bcaddr[i].sin_family = AF_INET;
- --- 345,346 ----
- ***************
- *** 349,351 ****
- buf = tmp_buf;
- ! n = fread(buf, 1, BUFFERSIZE, stdin);
- }
- --- 388,419 ----
- buf = tmp_buf;
- ! #ifdef USE_AF
- ! if(server)
- ! {
- ! static ATime next_time;
- ! ATime now;
- ! int dt;
- ! if (next_time == 0)
- ! next_time = AFGetTime(audio_context);
- ! n = BUFFERSIZE;
- ! now = AFRecordSamples(audio_context,
- ! next_time, n,
- ! buf, ABlock);
- ! next_time += n;
- ! dt = now - next_time;
- ! /* If next_time is not within 4000
- ! samples of the current time, adapt it.
- ! The current packet may be lost,
- ! but at least the next one will be
- ! alright, and we have saved a server
- ! round trip. */
- ! if (dt < -4000 || dt > 4000) {
- ! if (pdebug)
- ! fprintf(stderr,
- ! "Adapting (%d)\n", dt);
- ! next_time = now;
- ! }
- ! }
- ! else
- ! #endif /* USE_AF */
- ! n = fread(buf, 1, BUFFERSIZE, stdin);
- }
- ***************
- *** 418,423 ****
- for (i = 0; i < nbcaddr; i++) {
- sendinfo(s, &infoaddr[i],
- ! sizeof infoaddr[i]);
- sendinfo(s, &bcaddr[i],
- ! sizeof bcaddr[i]);
- }
- --- 486,492 ----
- for (i = 0; i < nbcaddr; i++) {
- + short port = ntohs(bcaddr[i].sin_port);
- sendinfo(s, &infoaddr[i],
- ! sizeof infoaddr[i], port);
- sendinfo(s, &bcaddr[i],
- ! sizeof bcaddr[i], port);
- }
- ***************
- *** 538,539 ****
- --- 607,701 ----
- return (dead > DEADTIME);
- + }
- +
- + #ifdef USE_AF
- + void open_microphone()
- + {
- +
- + extern char *progname;
- +
- + extern int device;
- +
- + extern AFAudioConn *aud;
- + extern AC audio_context;
- + extern AFSetACAttributes attributes;
- +
- + if((aud = AFOpenAudioConn("")) == NULL)
- + {
- + fprintf(stderr, "%s: can't open connection.\n", progname);
- + exit(1);
- + }
- +
- + /* set up audio context, find sample size and sample rate */
- +
- + device = FindDefaultDevice(aud);
- +
- + if(device < 0)
- + {
- + fprintf(stderr, "broadcast: unable find a suitable device.\n");
- + exit(1);
- + }
- +
- + attributes.preempt = Mix;
- + attributes.start_timeout = 0;
- + attributes.end_silence = 0;
- + attributes.play_gain = 0;
- + attributes.rec_gain = 0;
- +
- + audio_context = AFCreateAC(aud, device, ACPlayGain, &attributes);
- +
- + }
- +
- + /* This routine searches for a suitable device to play 8kHz uLaw
- + encoded audio on. */
- +
- + int FindDefaultDevice(aud)
- + AFAudioConn *aud;
- + {
- + AFDeviceDescriptor *aDev;
- + int i;
- +
- + for(i=0; i<ANumberOfAudioDevices(aud); i++) {
- + aDev = AAudioDeviceDescriptor(aud, i);
- + if(aDev->inputsFromPhone == 0 &&
- + aDev->outputsToPhone == 0 &&
- + aDev->playSampleFreq == 8000 &&
- + aDev->playBufType == MU255)
- + return i;
- + }
- + return -1;
- + }
- + #endif /* USE_AF */
- +
- + /*
- + * setfulladdr - Set address and port.
- + */
- + int
- + setfulladdr(s, name, addr_ret)
- + int s;
- + char *name;
- + struct sockaddr_in *addr_ret;
- + {
- + char *pname;
- + short port;
- +
- + if ((pname=strchr(name, ':'))) /* Find optional port part */
- + *pname++ = '\0';
- + else
- + pname = 0;
- +
- + if (*name == '\0') /* Use default bcast address */
- + configure(s, addr_ret);
- + else { /* otherwise use given address */
- + if (setipaddr(name, addr_ret) < 0)
- + return -1;
- + }
- +
- + addr_ret->sin_family = AF_INET;
- + if (pname) { /* If port present use that */
- + port = atoi(pname);
- + addr_ret->sin_port = htons(port);
- + } else { /* otherwise use default */
- + addr_ret->sin_port = htons(dftport);
- + }
- + return 0;
- }
- diff -c1 pl2/broadcast.man pl3/broadcast.man
- *** pl2/broadcast.man Sun Feb 21 18:24:25 1993
- --- pl3/broadcast.man Fri May 7 16:29:00 1993
- ***************
- *** 10,13 ****
- ] [
- - .BI "\-b " addr
- - ] ... [
- .BI "\-c " port
- --- 10,11 ----
- ***************
- *** 31,33 ****
- --- 29,37 ----
- .BI "\P " programfile
- + ] [
- + .BI \-s
- ]
- + [
- + .IR addr [ :port ]
- + \&... ]
- +
- .SH DESCRIPTION
- ***************
- *** 68,78 ****
- .TP 10
- - .BI "\-b " addr
- - IP address to send to. The default is either the local net broadcast address
- - or a multicast address assigned to radio if the host supports IP multicasts.
- - The address may be a host name (for unicast), an IP broadcast address,
- - or an IP multicast address (addresses beginning with 224).
- - More than one
- - .B \-b
- - option may be given; the data is sent to each address.
- - .TP 10
- .BI "\-c " port
- --- 72,73 ----
- ***************
- *** 102,104 ****
- .BI "\-p " port
- ! Transmit to this UDP port number (default 54321).
- .TP 10
- --- 97,108 ----
- .BI "\-p " port
- ! Transmit to this UDP port number (default 54321). When there is
- ! than one transmission station on a single local area network, each
- ! should use a different port number, else radio listeners will hear
- ! interference (since they choose the station by its port number). If
- ! you choose ascending port numbers starting with the default, radio
- ! listeners can use the shorthand
- ! .BR "\-p 1" ,
- ! .BR "\-p 2" ,
- ! .BR "\-p 3"
- ! and so on.
- .TP 10
- ***************
- *** 126,127 ****
- --- 130,164 ----
- Default is $HOME/.CD.
- + .PP
- + The information passed with
- + .BR \-L ,
- + .BR \-N
- + and
- + .BR \-P
- + options (in the latter case the contents of the file) is regularly
- + transmitted in the form of a ``station call packet''. Station call
- + packets are ignored by the receiving radio program, but may be picked
- + up by other programs to inform interested listeners, e.g.
- + .IR tuner (1)
- + and
- + .IR ektuner (1).
- + .PP
- + The remaining arguments are IP addresses to send to.
- + The default is either the local net broadcast address
- + or a multicast address assigned to radio if the host supports IP multicasts.
- + The address may be a host name (for unicast), an IP broadcast address
- + (addresses ending in either 0 or 255, depending on local convention)
- + or an IP multicast address (addresses beginning with 224). Optionally,
- + the address may be followed by a colon and a port number specifying
- + that the given port should be used when transmitting to this address.
- + Normally data is transmitted to the default port or the port given
- + with the
- + .B \-p
- + option.
- + More than one address may be given; the data is sent to each address.
- + .TP 10
- + .BI \-s
- + Start up in Audio File server mode. If the program is compiled to
- + work with the Audio File system from DEC CRL this will tell the
- + program to read from the local server directly instead of from the
- + stdin.
- .SH TYPICAL USAGE
- ***************
- *** 176,178 ****
- .IP
- ! broadcast -b A.0 -b B.1
- .PP
- --- 213,215 ----
- .IP
- ! broadcast A.0 B.1
- .PP
- ***************
- *** 180,182 ****
- .IP
- ! radio -l B.1 -r A.1 -f | broadcast -b B.0
- .PP
- --- 217,219 ----
- .IP
- ! radio -l B.1 -r A.1 -f | broadcast B.0
- .PP
- ***************
- *** 186,189 ****
- If the gateway lets UDP broadcast packets through, no forwarding is
- ! necessary; running ``broadcast -b A.0 -b B.0'' on host A.1 is
- sufficient.
- .SH AUTHOR
- --- 223,238 ----
- If the gateway lets UDP broadcast packets through, no forwarding is
- ! necessary; running ``broadcast A.0 B.0'' on host A.1 is
- sufficient.
- + .SH NOTE
- + On some systems it is not possible to have multiple receivers
- + listening to the same port on the same system. If you need this
- + functionality, for instance because you want to capture the news with
- + a dedicated program while still listening to the radio yourself, you
- + can use the folowing setup. Assume A is your local host and B the
- + local net:
- + .IP
- + broadcast B A:12000
- + .PP
- + This will allow you to listen to the radio on the default port (like
- + everyone else on the net) and your capture program to listen to port 12000.
- .SH AUTHOR
- ***************
- *** 191,198 ****
- .SH VERSION
- ! This manual page documents broadcast version 2.0, patchlevel 0.
- .SH SEE ALSO
- ! radio(1)
- .SH COPYRIGHT
- ! Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
- ! Netherlands.
-
- --- 240,247 ----
- .SH VERSION
- ! This manual page documents broadcast version 2.0, patchlevel 3.
- .SH SEE ALSO
- ! radio(1), tuner(1), ektuner(1)
- .SH COPYRIGHT
- ! Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
- ! Amsterdam, The Netherlands.
-
- diff -c1 pl2/checkradio.py pl3/checkradio.py
- *** pl2/checkradio.py Sun Feb 21 18:24:25 1993
- --- pl3/checkradio.py Fri May 7 16:29:01 1993
- ***************
- *** 1,4 ****
- # /***********************************************************
- ! # Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
- ! # Netherlands.
- #
- --- 1,4 ----
- # /***********************************************************
- ! # Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
- ! # Amsterdam, The Netherlands.
- #
- diff -c1 pl2/nielsen.py pl3/nielsen.py
- *** pl2/nielsen.py Sun Feb 21 18:24:22 1993
- --- pl3/nielsen.py Fri May 7 16:29:01 1993
- ***************
- *** 3,6 ****
- # /***********************************************************
- ! # Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
- ! # Netherlands.
- #
- --- 3,6 ----
- # /***********************************************************
- ! # Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
- ! # Amsterdam, The Netherlands.
- #
- diff -c1 pl2/patchlevel.h pl3/patchlevel.h
- *** pl2/patchlevel.h Sun Feb 21 18:24:22 1993
- --- pl3/patchlevel.h Fri May 7 16:29:01 1993
- ***************
- *** 1 ****
- ! #define PATCHLEVEL 2
- --- 1 ----
- ! #define PATCHLEVEL 3
- diff -c1 pl2/playulaw.c pl3/playulaw.c
- *** pl2/playulaw.c Sun Feb 21 18:24:22 1993
- --- pl3/playulaw.c Fri May 7 16:29:01 1993
- ***************
- *** 1,4 ****
- /***********************************************************
- ! Copyright 1991 by Stichting Mathematisch Centrum, Amsterdam, The
- ! Netherlands.
-
- --- 1,4 ----
- /***********************************************************
- ! Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
- ! Amsterdam, The Netherlands.
-
- diff -c1 pl2/radio.c pl3/radio.c
- *** pl2/radio.c Sun Feb 21 18:24:27 1993
- --- pl3/radio.c Fri May 7 16:29:02 1993
- ***************
- *** 1,4 ****
- /***********************************************************
- ! Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
- ! Netherlands.
-
- --- 1,4 ----
- /***********************************************************
- ! Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
- ! Amsterdam, The Netherlands.
-
- ***************
- *** 110,111 ****
- --- 110,136 ----
-
- + #ifdef USE_LOFI
- +
- + #include "lofi.h"
- + #include "lofiMap.h"
- + #include "codec.h"
- + #include "ringbuffers.h"
- + #include "libst.h"
- +
- + #define DEVLOFI "/dev/lofi"
- +
- + #endif /* USE_LOFI */
- +
- + #ifdef USE_AF
- +
- + #include <AF/AFlib.h>
- + #include <math.h>
- +
- + int device;
- +
- + AFAudioConn *aud;
- + AC audio_context;
- + AFSetACAttributes attributes;
- +
- + #endif /* USE_AF */
- +
- #ifdef CHECK_X_SERVER
- ***************
- *** 126,127 ****
- --- 151,156 ----
-
- + #ifdef USE_LOFI
- + struct lofiPhysDevice *outdev;
- + #endif /* USE_LOFI */
- +
- /* Forward functions */
- ***************
- *** 164,165 ****
- --- 193,206 ----
- #endif
- + #ifdef USE_LOFI
- + DSPTime ptime;
- + int first_time = 1, status = FALSE;
- + int i;
- + char *np, *p;
- + short obuf[BUFFERSIZE];
- + #endif
- + #ifdef USE_AF
- + extern int device;
- + extern AC audio_context;
- + extern AFSetACAttributes attributes;
- + #endif /* USE_AF */
-
- ***************
- *** 358,359 ****
- --- 399,401 ----
- SENDPORT, 0);
- + #ifdef HAVE_MCAST
- if (mcastgrp)
- ***************
- *** 360,361 ****
- --- 402,406 ----
- setmcast(s, mcastgrp);
- + else if (defmcast)
- + setmcast(s, defmcast);
- + #endif
- break;
- ***************
- *** 501,502 ****
- --- 546,578 ----
- #endif /* USE_SUN */
- + #ifdef USE_LOFI
- + if(!filter)
- + lofiWriteNow(outdev, buf, n, CODEC_SECONDARY);
- + #endif /* USE_LOFI */
- + #ifdef USE_AF
- + if(!filter)
- + {
- + static ATime next_time;
- + ATime now;
- + int dt;
- + if (next_time == 0)
- + next_time = AFGetTime(audio_context)
- + + 8000;
- + now = AFPlaySamples(audio_context,
- + next_time, n, buf);
- + next_time += n;
- + dt = next_time - now;
- + /* If next_time is not within 4000-12000
- + samples in the future, adapt it.
- + The current packet may be lost,
- + but at least the next one will be
- + alright, and we have saved a server
- + round trip. */
- + if (dt < 4000 || dt > 12000) {
- + if (pdebug)
- + fprintf(stderr,
- + "Adapting (%d)\n", dt);
- + next_time = now+8000;
- + }
- + }
- + #endif /* USE_AF */
- if (filter || tee) {
- ***************
- *** 678,680 ****
- --- 754,863 ----
-
- + #ifdef USE_LOFI
- + void open_speaker()
- + {
- + int status;
- + extern struct lofiPhysDevice *outdev;
- +
- + /* Open the devlofi device */
- +
- + outdev = lofiOpen(DEVLOFI);
- + if(outdev == NULL)
- + {
- + fprintf(stderr, "Could not open lofi %s\n", DEVLOFI);
- + exit(1);
- + }
- +
- + /* Set up the lofi hardware for playing from the internal
- + speaker. */
- +
- + status = lofiHWInit(outdev,
- + NULL, /* let it find it's own lod file */
- + 0, /* Primary codec output */
- + CODEC_SPEAKER, /* Secondary codec output */
- + 0, /* Primary codec input */
- + 0, /* Secondary codec input */
- + FALSE);
- +
- + if(volume >0)
- + lofiSetOutputVolume(outdev, CODEC_SPEAKER, volume / 10);
-
- + if(status == FALSE)
- + {
- + fprintf(stderr,"Could not init the hardware,is AUDIO_ROOT set?\n");
- + lofiClose(outdev);
- + exit(1);
- + }
- +
- + }
- +
- + void close_speaker()
- + {
- + extern struct lofiPhysDevice *outdev;
- + lofiClose(outdev);
- +
- + }
- +
- + #endif /* USE_LOFI */
- +
- + #ifdef USE_AF
- + void open_speaker()
- + {
- +
- + int outcur, outmin, outmax, steps;
- +
- + extern int device;
- +
- + extern AFAudioConn *aud;
- + extern AC audio_context;
- + extern AFSetACAttributes attributes;
- +
- + if((aud = AFOpenAudioConn("")) == NULL)
- + {
- + fprintf(stderr, "radio: can't open connection.\n");
- + exit(1);
- + }
- +
- + /* set up audio context, find sample size and sample rate */
- +
- + device = FindDefaultDevice(aud);
- +
- + if(device < 0)
- + {
- + fprintf(stderr, "radio: unable find a suitable device.\n");
- + exit(1);
- + }
- +
- + attributes.preempt = Mix;
- + attributes.start_timeout = 0;
- + attributes.end_silence = 0;
- + attributes.rec_gain = 0;
- +
- + audio_context = AFCreateAC(aud, device, ACPlayGain, &attributes);
- +
- + outcur = AFQueryOutputGain(audio_context, &outmin, &outmax);
- +
- + if(volume == 0)
- + AFSetOutputGain(audio_context, outmin);
- + else
- + if(volume > 0)
- + {
- + steps = outmax - outmin;
- + AFSetOutputGain(audio_context, outmin + (steps * volume /100));
- + }
- + else
- + AFSetOutputGain(audio_context, 0);
- +
- + }
- +
- + void close_speaker()
- + {
- + extern AFAudioConn *aud;
- + extern AC audio_context;
- +
- + AFFreeAC(audio_context);
- + AFCloseAudioConn(aud);
- + }
- +
- + #endif /* USE_LOFI */
- +
- void checkalive()
- ***************
- *** 732 ****
- --- 915,938 ----
- }
- +
- + #ifdef USE_AF
- +
- + /* This routine searches for a suitable device to play 8kHz uLaw
- + encoded audio on. */
- +
- + int FindDefaultDevice(aud)
- + AFAudioConn *aud;
- + {
- + AFDeviceDescriptor *aDev;
- + int i;
- +
- + for(i=0; i<ANumberOfAudioDevices(aud); i++) {
- + aDev = AAudioDeviceDescriptor(aud, i);
- + if(aDev->inputsFromPhone == 0 &&
- + aDev->outputsToPhone == 0 &&
- + aDev->playSampleFreq == 8000 &&
- + aDev->playBufType == MU255)
- + return i;
- + }
- + return -1;
- + }
- + #endif /* USE_AF */
- diff -c1 pl2/radio.h pl3/radio.h
- *** pl2/radio.h Sun Feb 21 18:24:23 1993
- --- pl3/radio.h Fri May 7 16:29:02 1993
- ***************
- *** 1,4 ****
- /***********************************************************
- ! Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
- ! Netherlands.
-
- --- 1,4 ----
- /***********************************************************
- ! Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
- ! Amsterdam, The Netherlands.
-
- ***************
- *** 60,61 ****
- --- 60,62 ----
- #ifdef sgi
- + #ifndef audiofile
- #define USE_AL
- ***************
- *** 62,63 ****
- --- 63,65 ----
- #define CHECK_X_SERVER
- + #endif
- #define HAVE_MCAST
- ***************
- *** 73,74 ****
- --- 75,84 ----
- #define USE_NX
- + #endif
- +
- + #ifdef dec_lofi
- + #define USE_LOFI
- + #endif
- +
- + #ifdef audiofile
- + #define USE_AF
- #endif
- diff -c1 pl2/radio.man pl3/radio.man
- *** pl2/radio.man Sun Feb 21 18:24:25 1993
- --- pl3/radio.man Fri May 7 16:29:02 1993
- ***************
- *** 41,44 ****
- Obviously, this requires a workstation with audio hardware; currently
- ! the program works on SGI Indigo and 4D/35 workstations, Sun Sparcs, and
- ! all NeXTs.
- .PP
- --- 41,45 ----
- Obviously, this requires a workstation with audio hardware; currently
- ! the program works on SGI Indigo and 4D/35 workstations, Sun Sparcs,
- ! all NeXTs, DECStations equipped with DEC LoFi, and any machine running
- ! the Audio File server from DEC CRL.
- .PP
- ***************
- *** 132,139 ****
- .SH VERSION
- ! This manual page documents radio version 2.0, patchlevel 1.
- .SH SEE ALSO
- ! broadcast(1)
- .SH COPYRIGHT
- ! Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
- ! Netherlands.
-
- --- 133,140 ----
- .SH VERSION
- ! This manual page documents radio version 2.0, patchlevel 3.
- .SH SEE ALSO
- ! broadcast(1), tuner(1), ektuner(1)
- .SH COPYRIGHT
- ! Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
- ! Amsterdam, The Netherlands.
-
- diff -c1 pl2/recordlinear.c pl3/recordlinear.c
- *** pl2/recordlinear.c Sun Feb 21 18:24:23 1993
- --- pl3/recordlinear.c Fri May 7 16:29:03 1993
- ***************
- *** 1,4 ****
- /***********************************************************
- ! Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
- ! Netherlands.
-
- --- 1,4 ----
- /***********************************************************
- ! Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
- ! Amsterdam, The Netherlands.
-
- diff -c1 pl2/recordulaw.c pl3/recordulaw.c
- *** pl2/recordulaw.c Sun Feb 21 18:24:25 1993
- --- pl3/recordulaw.c Fri May 7 16:29:03 1993
- ***************
- *** 1,4 ****
- /***********************************************************
- ! Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
- ! Netherlands.
-
- --- 1,4 ----
- /***********************************************************
- ! Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
- ! Amsterdam, The Netherlands.
-
- diff -c1 pl2/socklib.c pl3/socklib.c
- *** pl2/socklib.c Sun Feb 21 18:24:23 1993
- --- pl3/socklib.c Fri May 7 16:29:03 1993
- ***************
- *** 1,4 ****
- /***********************************************************
- ! Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
- ! Netherlands.
-
- --- 1,4 ----
- /***********************************************************
- ! Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
- ! Amsterdam, The Netherlands.
-
- diff -c1 pl2/stations.py pl3/stations.py
- *** pl2/stations.py Sun Feb 21 18:24:24 1993
- --- pl3/stations.py Fri May 7 16:29:03 1993
- ***************
- *** 3,6 ****
- # /***********************************************************
- ! # Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
- ! # Netherlands.
- #
- --- 3,6 ----
- # /***********************************************************
- ! # Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
- ! # Amsterdam, The Netherlands.
- #
- diff -c1 pl2/ttytuner.py pl3/ttytuner.py
- *** pl2/ttytuner.py Sun Feb 21 18:24:25 1993
- --- pl3/ttytuner.py Fri May 7 16:29:04 1993
- ***************
- *** 3,6 ****
- # /***********************************************************
- ! # Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
- ! # Netherlands.
- #
- --- 3,6 ----
- # /***********************************************************
- ! # Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
- ! # Amsterdam, The Netherlands.
- #
- diff -c1 pl2/ulawadpcm.c pl3/ulawadpcm.c
- *** pl2/ulawadpcm.c Sun Feb 21 18:24:26 1993
- --- pl3/ulawadpcm.c Fri May 7 16:29:04 1993
- ***************
- *** 1,4 ****
- /***********************************************************
- ! Copyright 1992 by Stichting Mathematisch Centrum, Amsterdam, The
- ! Netherlands.
-
- --- 1,4 ----
- /***********************************************************
- ! Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
- ! Amsterdam, The Netherlands.
-
-