ESD patch for wmsound (fwd)
- From: Shing-Gene Yung <shing cz3 nus edu sg>
- To: gnome-list gnome org
- Subject: ESD patch for wmsound (fwd)
- Date: Wed, 6 Jan 1999 11:49:37 +0800 (SGT)
Hi,
I made a quick patch to wmsound-0.9.0 to use ESD instead of direct to
/dev/dsp. The changes are in lib/Sound.c and the Imakefiles.
(I've also cc-ed this to the maintainer and the wmaker-list)
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 Wed Jan 6 11:14:57 1999
+++ lib/Sound.c Wed Jan 6 11:15:07 1999
@@ -39,6 +39,10 @@
#include "Sound.h"
+#ifdef ESD
+#include <esd.h>
+#endif
+
int sPlayFile (char *sound_file, char *audiodev)
{
@@ -71,6 +75,7 @@
unsigned char *inbuff;
struct stat flstat;
au_info auheader;
+ esd_format_t esdformat;
chk_st = stat(sound_file, &flstat);
if (chk_st > 0) {
@@ -94,6 +99,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 +145,7 @@
if (ioctl(audiofd, SNDCTL_DSP_SYNC, NULL) < 0) {
/* Do nothing for now */
}
+#endif
if (datalen > 4096) {
wrbytes = 4096;
@@ -185,6 +201,7 @@
unsigned char *inbuff;
riff_info riffheader;
wavheader headerinfo;
+ esd_format_t esdformat;
fstream = fopen(sound_file, "rb");
if (!fstream) {
@@ -221,6 +238,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 +283,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]