From: "(Joerg Schaefer)" <joscha@atab.lahn.de>
Subject: Patch: xbiff++ with sound on Linux
Date: 2 Jan 1994 18:03:20 +0200 [thread overview]
Message-ID: <2g6r88$349@klaava.Helsinki.FI> (raw)
Hello!
I've made little patches, so that xbiff++ will support the
sound-option on Linux.
Here's the xbiff++.Linux.lsm:
Begin2
Title =xbiff++.Linux - Little patches to support sound on Linux
Version =1
Desc1 =This is a little, (very) simply patch, that supports the
Desc2 =facility of xbiff++ for sound on Linux.
Author =Joerg Schaefer
AuthorEmail =joscha@atab.lahn.de
Site1 =If someone put it on a site, it will be there.
Required1 =The xbiff++-Sources found in X11/contrib
Required2 =A soundcard and the appropriate driver with a /dev/audio-Device
CopyPolicy1 =free but without warranty
CopyPolicy2 =xbiff++ is (c) by M.I.T; Author is Jim Fulton, MIT X Consortium
Keywords =xbiff, xbiff++, mail, X, sound
Comment1 =This is intended for everybody who like sounds when receiving
Comment2 =eMails. The patch is not perfect, but it works for me.
Comment3 =I've tested it with a SB pro, snd-drv 2.1 and Linux 99.14.
EnteredBy =joscha@atab.lahn.de
End
And here is the shar-file with README.linux and the patch.
Unshar it in your xbiff++-Sourcedirectory:
---------------------------------cut here 8<------------------------------
#! /bin/sh
# 0. this is shell archive
# 1. Remove everything above the #! /bin/sh line
# 2. Save the resulting text in a file
# 3. Execute the file with /bin/sh (not csh)
# 4. Or use your favorite variant of unshar
# 5. To overwrite existing files use "sh -c"
#
# Created by: joscha@atab on Wed Dec 29 15:37:41 MET 1993
# This archive contains:
# README.linux
# xbiff++.Linux
# xbiff++.Linux.lsm
if test -f README.linux -a "$1" != "-c" ; then
echo "will not overwrite README.linux"
else
echo " x - README.linux (1039 bytes)"
sed 's/^X//' > README.linux << \CEST_TOUT
XThis is README.linux for xbiff++
XLast modified: Wed Dec 29 15:09:54 MET 1993
X
XI've made some little changes to support sound on Linux-Consoles.
XThe changes are in Imakefile, SSMailbox.c and play.c.
X
XThe code is very stupid. It doesn't check if xbiff++ is running on the
Xconsole or not.
Xplay_sound_file simply opens the soundfile and /dev/audio and copy byte
Xby byte from the soundfile to the audiodevice. If opening fails, the
Xstandartbell rings. There is no support for -volume.
XMaybe someone else want to built a better "play_sound_file" ?
X
XI've made two other little changes in strsep.c and strtok.h to get xbif++
Xcompiled on my linux-box.
X
XThe code ist not very well tested, but it works for me. Do with it
Xwhat you like and use it at your own risk!
X
XTo apply the patches enter "patch -p0 < xbiff++.Linux" .
X
Xxbiff++ could be found in X11/contrib.
X
XIf you like the patch or if you have some suggestions or an better
Xpatch (I think there is one :-), feel free to drop me an email.
X
XHave fun
X Joerg
X
XJoerg Schaefer (joscha@atab.lahn.de)
CEST_TOUT
if test `wc -c < README.linux` -ne 1039 ; then
echo "file README.linux has been corrupted (should be 1039 bytes)"
fi
fi
if test -f xbiff++.Linux -a "$1" != "-c" ; then
echo "will not overwrite xbiff++.Linux"
else
echo " x - xbiff++.Linux (5491 bytes)"
sed 's/^X//' > xbiff++.Linux << \CEST_TOUT
Xdiff --recursive --new-file --unified ../xbiff++.ori/Imakefile ./Imakefile
X--- ../xbiff++.ori/Imakefile Thu Feb 25 01:16:30 1993
X+++ ./Imakefile Wed Dec 29 14:53:48 1993
X@@ -1,9 +1,18 @@
X
X /* Uncomment the following line to compile this for SunOS 4.0.3.
X- This file should do the right thing for all other systems.
X */
X /* #define SUNOS4_0_3 */
X
X+/* Wed Dec 29 14:25:51 MET 1993
X+ Joerg Schaefer (joscha@atab.lahn.de)
X+ Support for sound on Linux. See README.linux for more details.
X+
X+ Uncomment the following line to compile this for Linux with
X+ sounddriver enabled and an existing /dev/audio.
X+ This file should do the right thing for all other systems.
X+ */
X+#define LINUX_SOUND
X+
X
X #ifdef SparcArchitecture
X # define SPARC_SRCS play.c
X@@ -26,15 +35,25 @@
X # define SPARC_DEFS
X #endif
X
X- DEPLIBS = XawClientDepLibs
X+#ifdef LINUX_SOUND
X+# define LINUX_SRCS play.c
X+# define LINUX_OBJS play.o
X+# define LINUX_DEFS -DLINUX_SOUND
X+#else
X+# define LINUX_SRCS
X+# define LINUX_OBJS
X+# define LINUX_DEFS
X+#endif
X+
X+DEPLIBS = XawClientDepLibs
X LOCAL_LIBRARIES = XawClientLibs
X- SRCS = xbiff.c SSMailbox.c regexp.c regsub.c strtoken.c strsep.c locate.c readgif.c SPARC_SRCS
X- OBJS = xbiff.o SSMailbox.o regexp.o regsub.o strtoken.o strsep.o locate.o readgif.o SPARC_OBJS
X- INCLUDES = $(TOP_INCLUDES) SPARC_INCL
X- SYS_LIBRARIES = SPARC_LIBS -lm
X- DEFINES = -DSHAPE SPARC_DEFS
X- CDEBUGFLAGS = -g
X- LDOPTIONS = -L$(USRLIBDIR) $(CDEBUGFLAGS) $(CCOPTIONS)
X+SRCS = xbiff.c SSMailbox.c regexp.c regsub.c strtoken.c strsep.c locate.c readgif.c SPARC_SRCS LINUX_SRCS
X+OBJS = xbiff.o SSMailbox.o regexp.o regsub.o strtoken.o strsep.o locate.o readgif.o SPARC_OBJS LINUX_OBJS
X+INCLUDES = $(TOP_INCLUDES) SPARC_INCL
X+SYS_LIBRARIES = SPARC_LIBS -lm
X+DEFINES = -DSHAPE SPARC_DEFS LINUX_DEFS
X+CDEBUGFLAGS = -O2
X+LDOPTIONS = -L$(USRLIBDIR) $(CDEBUGFLAGS) $(CCOPTIONS)
X
X ComplexProgramTarget(xbiff++)
X
Xdiff --recursive --new-file --unified ../xbiff++.ori/SSMailbox.c ./SSMailbox.c
X--- ../xbiff++.ori/SSMailbox.c Tue Jul 9 01:51:21 1991
X+++ ./SSMailbox.c Wed Dec 29 14:53:48 1993
X@@ -14,6 +14,7 @@
X * without express or implied warranty.
X *
X * Author: Jim Fulton, MIT X Consortium
X+ * Modified 29-Dec-94 by Joerg Schaefer (for Linux, see README.linux)
X *
X * I recommend that you use the new mailfull and mailempty bitmaps instead of
X * the ugly mailboxes:
X@@ -20,6 +21,7 @@
X *
X * XBiff*fullPixmap: mailfull
X * XBiff*emptyPixmap: mailempty
X+ *
X */
X
X #include <stdio.h> /* for printing error messages */
X@@ -974,12 +976,18 @@
X char *sound;
X int volume;
X {
X-#ifdef sparc
X+#ifdef sparc
X if (! w->ssmailbox.not_on_console)
X play_sound_file (sound, volume);
X else
X-#endif
X+#else
X+# ifdef LINUX_SOUND /* js */
X+ if (! play_sound_file (sound, volume))
X+ XBell (XtDisplay (w), w->ssmailbox.volume);
X+# else
X XBell (XtDisplay (w), w->ssmailbox.volume);
X+# endif /* endif LINUX_SOUND */
X+#endif /* sparc */
X }
X
X XImage *LocateBitmapFile();
Xdiff --recursive --new-file --unified ../xbiff++.ori/play.c ./play.c
X--- ../xbiff++.ori/play.c Thu Feb 25 01:13:13 1993
X+++ ./play.c Wed Dec 29 14:53:48 1993
X@@ -4,6 +4,7 @@
X **
X ** Modified 24-May-91 by Jamie Zawinski (for Lucid Emacs.)
X ** Modified 17-Dec-92 by Jamie Zawinski (largely rewritten for SunOS 4.1.3.)
X+ ** Modified 29-Dec-94 by Joerg Schaefer (for Linux, see README.linux)
X **
X ** Permission to use, copy, modify, and distribute this software and its
X ** documentation for any purpose and without fee is hereby granted, provided
X@@ -24,6 +25,8 @@
X #include <sys/fcntl.h>
X #include <sys/file.h>
X
X+#ifndef LINUX_SOUND
X+
X #include <multimedia/libaudio.h>
X #include <multimedia/audio_device.h>
X
X@@ -329,3 +332,31 @@
X else
X exit (1);
X }
X+#else /* LINUX_SOUND */
X+
X+int play_sound_file (char *sound_file, int volume)
X+{
X+ FILE *audiop, *soundp;
X+ int c;
X+
X+ soundp=fopen(sound_file, "r");
X+ if (soundp == NULL)
X+ return 0;
X+
X+ audiop=fopen("/dev/audio","w");
X+ if (audiop == NULL)
X+ {
X+ fclose(soundp);
X+ return 0;
X+ }
X+
X+ while ( (c=fgetc(soundp)) != EOF)
X+ fputc(c,audiop);
X+
X+ fclose(soundp);
X+ fclose(audiop);
X+
X+ return 1;
X+}
X+
X+#endif /* LINUX_SOUND */
Xdiff --recursive --new-file --unified ../xbiff++.ori/strsep.c ./strsep.c
X--- ../xbiff++.ori/strsep.c Sat Mar 16 23:46:43 1991
X+++ ./strsep.c Wed Dec 29 14:53:48 1993
X@@ -13,6 +13,8 @@
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X+ *
X+ * Modified 29-Dec-94 by Joerg Schaefer (for Linux, see README.linux)
X */
X
X #include <string.h>
X@@ -34,6 +36,7 @@
X * from delim. Writes NULs into s to end tokens. delim need not
X * remain constant from call to call.
X */
X+#ifndef linux
X char *
X strsep(s, delim)
X char *s;
X@@ -45,4 +48,4 @@
X last = s;
X return (strtoken(&last, delim, 0));
X }
X-
X+#endif
Xdiff --recursive --new-file --unified ../xbiff++.ori/strtok.h ./strtok.h
X--- ../xbiff++.ori/strtok.h Sat Mar 16 23:46:43 1991
X+++ ./strtok.h Wed Dec 29 14:53:49 1993
X@@ -1,4 +1,10 @@
X+/*
X+ ** Modified 29-Dec-94 by Joerg Schaefer (for Linux, see README.linux)
X+*/
X+
X+#ifndef linux
X extern char *strtok(/* char *s, const char *delim */);
X extern char *strtoken(/* char **stringp, const char *delim, int skip */);
X extern char *strsep(/* char *s, const char *delim */);
X
X+#endif
CEST_TOUT
if test `wc -c < xbiff++.Linux` -ne 5491 ; then
echo "file xbiff++.Linux has been corrupted (should be 5491 bytes)"
fi
fi
if test -f xbiff++.Linux.lsm -a "$1" != "-c" ; then
echo "will not overwrite xbiff++.Linux.lsm"
else
echo " x - xbiff++.Linux.lsm (889 bytes)"
sed 's/^X//' > xbiff++.Linux.lsm << \CEST_TOUT
XBegin2
XTitle =xbiff++.Linux - Little patches to support sound on Linux
XVersion =1
XDesc1 =This is a little, (very) simply patch, that supports the
XDesc2 =facility of xbiff++ for sound on Linux.
XAuthor =Joerg Schaefer
XAuthorEmail =joscha@atab.lahn.de
XSite1 =If someone put it on a site, it will be there.
XRequired1 =The xbiff++-Sources found in X11/contrib
XRequired2 =A soundcard and the appropriate driver with a /dev/audio-Device
XCopyPolicy1 =free but without warranty
XCopyPolicy2 =xbiff++ is (c) by M.I.T; Author is Jim Fulton, MIT X Consortium
XKeywords =xbiff, xbiff++, mail, X
XComment1 =This is intended for everybody who like sounds when receiving
XComment2 =eMails. The patch is not perfect, but it works for me.
XComment3 =I've tested it with a SB pro, snd-drv 2.1 and Linux 99.14.
XEnteredBy =joscha@atab.lahn.de
XEnd
CEST_TOUT
if test `wc -c < xbiff++.Linux.lsm` -ne 889 ; then
echo "file xbiff++.Linux.lsm has been corrupted (should be 889 bytes)"
fi
fi
echo part00 done.
exit 0
---------------------------------cut here 8<------------------------------
--
Joerg Schaefer -=- joscha@atab.lahn.de -=- D-35396 Giessen-Wieseck
--
Mail submissions for comp.os.linux.announce to: linux-announce@tc.cornell.edu
PLEASE remember Keywords: and a short description of the software.
reply other threads:[~1994-01-02 16:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox