Mercurial > hg > xemacs-beta
comparison src/linuxplay.c @ 70:131b0175ea99 r20-0b30
Import from CVS: tag r20-0b30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:02:59 +0200 |
parents | e04119814345 |
children | 0d2f883870bc |
comparison
equal
deleted
inserted
replaced
69:804d1389bcd6 | 70:131b0175ea99 |
---|---|
59 #include <config.h> | 59 #include <config.h> |
60 #endif | 60 #endif |
61 | 61 |
62 #include <errno.h> | 62 #include <errno.h> |
63 #include <fcntl.h> | 63 #include <fcntl.h> |
64 #ifdef __FreeBSD__ | 64 #include <linux/soundcard.h> |
65 # include <machine/soundcard.h> | |
66 #else | |
67 # include <linux/soundcard.h> | |
68 #endif | |
69 #include <stdio.h> | 65 #include <stdio.h> |
70 #include <stdlib.h> | 66 #include <stdlib.h> |
71 #include <string.h> | 67 #include <string.h> |
72 #include <sys/fcntl.h> | 68 #include <sys/fcntl.h> |
73 #include <sys/file.h> | 69 #include <sys/file.h> |
90 #else | 86 #else |
91 #define UNUSED(x) | 87 #define UNUSED(x) |
92 #define __inline__ | 88 #define __inline__ |
93 #endif | 89 #endif |
94 | 90 |
95 static void (*sighup_handler)(int); | 91 static __sighandler_t sighup_handler; |
96 static void (*sigint_handler)(int); | 92 static __sighandler_t sigint_handler; |
97 | 93 |
98 /* Maintain global variable for keeping parser state information; this struct | 94 /* Maintain global variable for keeping parser state information; this struct |
99 is set to zero before the first invocation of the parser. The use of a | 95 is set to zero before the first invocation of the parser. The use of a |
100 global variable prevents multiple concurrent executions of this code, but | 96 global variable prevents multiple concurrent executions of this code, but |
101 this does not happen anyways... */ | 97 this does not happen anyways... */ |
295 chunk; so, let's ignore this... */ | 291 chunk; so, let's ignore this... */ |
296 if (parsestate.wave.chunklength) | 292 if (parsestate.wave.chunklength) |
297 parsestate.wave.state = wvSkipChunk; } | 293 parsestate.wave.state = wvSkipChunk; } |
298 else if (rq) | 294 else if (rq) |
299 /* align data length to a multiple of datasize; keep additional data | 295 /* align data length to a multiple of datasize; keep additional data |
300 in "leftover" buffer --- this is necessary to ensure proper | 296 in "leftover" buffer --- this is neccessary to ensure proper |
301 functioning of the sndcnv... routines */ | 297 functioning of the sndcnv... routines */ |
302 waverequire(data,sz,rq); | 298 waverequire(data,sz,rq); |
303 return(count); } | 299 return(count); } |
304 case wvFatalNotify: | 300 case wvFatalNotify: |
305 warn("Irrecoverable error while parsing WAVE file"); | 301 warn("Irrecoverable error while parsing WAVE file"); |
984 | 980 |
985 /* The VoxWare-SDK discourages direct manipulation of the mixer device as | 981 /* The VoxWare-SDK discourages direct manipulation of the mixer device as |
986 this could lead to problems, when multiple sound cards are installed */ | 982 this could lead to problems, when multiple sound cards are installed */ |
987 mix_fd = audio_fd; | 983 mix_fd = audio_fd; |
988 | 984 |
989 sighup_handler = signal(SIGHUP, sighandler); | 985 sighup_handler = signal(SIGHUP,(__sighandler_t)sighandler); |
990 sigint_handler = signal(SIGINT, sighandler); | 986 sigint_handler = signal(SIGINT,(__sighandler_t)sighandler); |
991 | 987 |
992 if (!audio_init(mix_fd,audio_fd,fmt,speed,tracks,&volume,&sndcnv)) | 988 if (!audio_init(mix_fd,audio_fd,fmt,speed,tracks,&volume,&sndcnv)) |
993 goto END_OF_PLAY; | 989 goto END_OF_PLAY; |
994 audio_vol = volume; | 990 audio_vol = volume; |
995 | 991 |
996 /* Initialize global parser state information to zero */ | 992 /* Initialize global parser state information to zero */ |
997 memset(&parsestate,0,sizeof(parsestate)); | 993 memset(&parsestate,0,sizeof(parsestate)); |
998 | 994 |
999 /* Mainloop: read a block of data, parse its contents, perform all | 995 /* Mainloop: read a block of data, parse its contents, perform all |
1000 the necessary conversions and output it to the sound | 996 the neccessary conversions and output it to the sound |
1001 device; repeat until all data has been processed */ | 997 device; repeat until all data has been processed */ |
1002 rrtn = length; | 998 rrtn = length; |
1003 do { | 999 do { |
1004 for (pptr = data; (prtn = parsesndfile((void **)&pptr,&rrtn, | 1000 for (pptr = data; (prtn = parsesndfile((void **)&pptr,&rrtn, |
1005 (void **)&optr)) > 0; ) | 1001 (void **)&optr)) > 0; ) |