ESD patch for wmsound II (update)
- From: Shing-Gene Yung <shing cz3 nus edu sg>
- To: wmaker linuxcenter com, southgat frontiernet net, gnome-list gnome org
- Subject: ESD patch for wmsound II (update)
- Date: Thu, 7 Jan 1999 10:12:46 +0800 (SGT)
Hi,
I missed out a couple of #ifdefs in the patch (thanks to Alban Hertroys for
pointing it out..) so here's an updated one.
rgds,
--shing
--- src/Imakefile.orig Wed Jan 6 11:09:44 1999
+++ src/Imakefile Wed Jan 6 11:09:52 1999
@@ -11,7 +11,10 @@
TIFFLIB = -ltiff
#endif
-WMSOUNDLIB = -L../lib -lwmsnd
+XCOMM comment out the next line if you don't want to use esd
+ESDLIB = -lesd -laudiofile
+
+WMSOUNDLIB = -L../lib -lwmsnd $(ESDLIB)
GRAPHLIBS = $(TIFFLIB) -ljpeg -lgif -lpng -lz
WINGSLIBS = -L/usr/X11R6/lib \
-L/usr/local/lib \
--- utils/Imakefile.orig Wed Jan 6 11:10:36 1999
+++ utils/Imakefile Wed Jan 6 11:10:46 1999
@@ -11,7 +11,10 @@
TIFFLIB = -ltiff
#endif
-WMSOUNDLIB = -L../lib -lwmsnd
+XCOMM comment out the next line if you don't want to use esd
+ESDLIB = -lesd -laudiofile
+
+WMSOUNDLIB = -L../lib -lwmsnd $(ESDLIB)
GRAPHLIBS = $(TIFFLIB) -ljpeg -lgif -lpng -lz
WINGSLIBS = -L/usr/X11R6/lib \
-L/usr/local/lib \
--- lib/Imakefile.orig Wed Jan 6 11:08:38 1999
+++ lib/Imakefile Wed Jan 6 11:09:27 1999
@@ -5,6 +5,9 @@
STD_INCLUDES = -I/usr/X11R6/include -I/usr/local/include
+XCOMM comment out the next line if you don't want to use esd
+EXTRA_DEFINES = -DESD
+
WMSOUND_SRCS = PLFunctions.c Sound.c wmsnd.c
WMSOUND_OBJS = PLFunctions.o Sound.o wmsnd.o
WMSOUND_HEADER = wmsnd.h
--- lib/Sound.c.orig Thu Jan 7 10:03:11 1999
+++ lib/Sound.c Thu Jan 7 10:06:31 1999
@@ -39,6 +39,10 @@
#include "Sound.h"
+#ifdef ESD
+#include <esd.h>
+#endif
+
int sPlayFile (char *sound_file, char *audiodev)
{
@@ -71,6 +75,9 @@
unsigned char *inbuff;
struct stat flstat;
au_info auheader;
+#ifdef ESD
+ esd_format_t esdformat;
+#endif
chk_st = stat(sound_file, &flstat);
if (chk_st > 0) {
@@ -94,6 +101,16 @@
}
datalen = (dword)flstat.st_size - auheader.hdr_size;
+#ifdef ESD
+ if (auheader.channels > 1) {
+ esdformat = (ESD_BITS8 | ESD_STEREO);
+ }
+ else {
+ esdformat = (ESD_BITS8 | ESD_MONO);
+ }
+ work_int = (int)auheader.sample_rate;
+ audiofd = esd_play_stream_fallback(esdformat,work_int,NULL,"wmsound");
+#else
audiofd = open(audiodev, O_WRONLY, 0);
if (audiofd == -1) {
fclose(fstream);
@@ -130,6 +147,7 @@
if (ioctl(audiofd, SNDCTL_DSP_SYNC, NULL) < 0) {
/* Do nothing for now */
}
+#endif
if (datalen > 4096) {
wrbytes = 4096;
@@ -185,6 +203,9 @@
unsigned char *inbuff;
riff_info riffheader;
wavheader headerinfo;
+#ifdef ESD
+ esd_format_t esdformat;
+#endif
fstream = fopen(sound_file, "rb");
if (!fstream) {
@@ -221,6 +242,16 @@
datalen = Read_LE_DWORD(fstream);
+#ifdef ESD
+ if (headerinfo.bitsperchan == 16) esdformat = ESD_BITS16;
+ else esdformat = ESD_BITS8;
+
+ if (headerinfo.channels > 1) esdformat |= ESD_STEREO;
+ else esdformat |= ESD_MONO;
+
+ work_int = (int)headerinfo.sampleps;
+ audiofd = esd_play_stream_fallback(esdformat,work_int,NULL,"wmsound");
+#else
audiofd = open(audiodev, O_WRONLY, 0);
if (audiofd == -1) {
fclose(fstream);
@@ -256,6 +287,7 @@
if (ioctl(audiofd, SNDCTL_DSP_SYNC, NULL) < 0) {
/* Do nothing for now */
}
+#endif
if (datalen > 4096) {
wrbytes = 4096;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]