Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!mit-eddie!bloom-beacon!POSEUR.JPL.NASA.GOV!earle From: earle@POSEUR.JPL.NASA.GOV (Greg Earle - Sun JPL on-site Software Support) Newsgroups: comp.windows.x Subject: SunOS 4.1.x diffs for SPARCstation audio version of `oclock' Message-ID: <9012130847.AA21499@poseur.JPL.NASA.GOV> Date: 13 Dec 90 08:47:21 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 122 I pulled the SPARCstation audio-ized version of `oclock' from expo's contrib directory (much thanks to Mike Wagner - wagner@cadillac.Siemens.COM - for this!) and built it under SunOS 4.1.1, but found that the code to handle playing the audio file (from Jef Poskanser's PD SPARCstation audio toolkit) was written for the original SunOS 4.0.3c audio interface. A couple of days of whacking and I think I've got it fairly ship-shape. A small bit of code was shamelessly pilfered from the 4.1.1 /usr/demo/SOUND/play program, because of the new 4.1.x audio interface changes. I took the sample audio files and stored them in /usr/local/lib/X11/oclock; here are the .Xdefaults/.Xresources resources that I am using (as an example): Clock*Background: grey Clock*BorderColor: yellow Clock*hour: black Clock*jewel: coral Clock*minute: black Clock*hourSound: /usr/local/lib/X11/oclock/BigBen.au Clock*quarterPastSound: /usr/local/lib/X11/oclock/GrandfatherClock.au Clock*halfPastSound: /usr/local/lib/X11/oclock/GrandfatherClock.au Clock*quarterOfSound: /usr/local/lib/X11/oclock/GrandfatherClock.au Clock*chimeSound: /usr/local/lib/X11/oclock/TowerClock.au Clock*volumeSound: 90 Here are the diffs that I've come up with; it changes the Imakefile to define `SUNOS4_1'. So, after applying these diffs, if you are running 4.1, leave everything alone and gen a Makefile with `xmkmf' or `imake' and compile. If you're still running 4.0.3c, remove the `-DSUNOS4_1' from the Imakefile before gen'ing the Makefile. *** Imakefile.orig Thu Feb 1 06:55:17 1990 --- Imakefile Thu Dec 13 00:37:11 1990 *************** *** 3,9 **** #endif ! DEFINES = ExtensionDefines ! INCLUDES = -I$(TOP) -I$(TOP)/X11 ! SYS_LIBRARIES = -lm DEPLIBS = $(DEPXTOOLLIB) $(DEPXMULIB) $(DEPEXTENSIONLIB) $(DEPXLIB) LOCAL_LIBRARIES = $(XTOOLLIB) $(XMULIB) $(EXTENSIONLIB) $(XLIB) --- 3,9 ---- #endif ! DEFINES = ExtensionDefines -DSUNOS4_1 ! INCLUDES = -I$(TOP) -I$(TOP)/X11 -I/usr/demo/SOUND ! SYS_LIBRARIES = -L/usr/demo/SOUND -laudio -lm DEPLIBS = $(DEPXTOOLLIB) $(DEPXMULIB) $(DEPEXTENSIONLIB) $(DEPXLIB) LOCAL_LIBRARIES = $(XTOOLLIB) $(XMULIB) $(EXTENSIONLIB) $(XLIB) *** libsst.h.orig Thu Feb 1 06:52:25 1990 --- libsst.h Wed Dec 12 01:35:12 1990 *************** *** 12,16 **** --- 12,24 ---- #include + #ifdef SUNOS4_1 + #define AUDIO_4_0_3_COMPAT + #define AUDIO_CHIP + #include + #include + #include + #else #include + #endif #include *** play.c.orig Thu Feb 1 06:52:16 1990 --- play.c Thu Dec 13 00:24:59 1990 *************** *** 43,46 **** --- 43,78 ---- return( 1 ); } + #ifdef SUNOS4_1 + { + int err; + Audio_hdr Dev_hdr; + Audio_hdr File_hdr; + + err = audio_get_play_config( sst_fd, &Dev_hdr ); + + if ( err != AUDIO_SUCCESS ) + { + perror( "Not a valid audio device" ); + return( 1 ); + } + + err = audio_read_filehdr( file_fd, &File_hdr, (char *) NULL, 0 ); + + if ( err != AUDIO_SUCCESS ) + { + perror( "Not a valid audio file" ); + return( 1 ); + } + + /* Shameless pilfered from /usr/demo/SOUND/play.c */ + if ( audio_cmp_hdr(&Dev_hdr, &File_hdr) != 0 ) { + if ( audio_drain( sst_fd, FALSE) != AUDIO_SUCCESS) { + perror( "draining audio device" ); + return( 1 ); + } + /* Fancy code to reconfigure audio device for given file header omitted */ + } + } + #endif for ( ; ; ) *************** *** 75,78 **** --- 107,116 ---- close(file_fd); + #ifdef SUNOS4_1 + if ( audio_drain( sst_fd, FALSE) != AUDIO_SUCCESS) { + perror( "draining audio device" ); + return( 1 ); + } + #endif sst_close( sst_fd ); (void) signal( SIGHUP, sighup_handler );