comparison src/esd.c @ 564:001628b7a5b3

[xemacs-hg @ 2001-05-24 09:37:25 by yoshiki] Fix broken build on Linux. * buffer.c (Qtext_conversion_error): Moved from file-coding.c so that --with-file-coding=no will compile corectly. * buffer.c (syms_of_buffer): Define Qtext_conversion_error. Also moved from file-coding.c * file-coding.c (Qtext_conversion_error): Moved to buffer.c * file-coding.c (syms_of_file_coding): Moved Qtext_conversion_error initialization to buffer.c * emodules.c (Qdll_error): New error. * emodules.c (syms_of_module): Declare Qdll_error. * esd.c (esd_play_sound_data): sound_warn accepts only one arg. * miscplay.c (sndcnv8S_2mono): * miscplay.c (sndcnv2monounsigned): * miscplay.c (int2ulaw): * miscplay.c (sndcnv2byteLE): * miscplay.c (sndcnv2byteBE): * miscplay.c (sndcnv2monobyteLE): * miscplay.c (sndcnv2monobyteBE): Replace signed Char_Binary with Char_Binary. There's no type called signed char in C. Also remove audio: from error message. sound_warn and sound_perror prepends them.
author yoshiki
date Thu, 24 May 2001 09:37:30 +0000
parents 183866b06e0b
children 13e3d7ae7155
comparison
equal deleted inserted replaced
563:183866b06e0b 564:001628b7a5b3
59 return 0; 59 return 0;
60 60
61 ffmt = analyze_format(data,&fmt,&speed,&tracks,&parsesndfile); 61 ffmt = analyze_format(data,&fmt,&speed,&tracks,&parsesndfile);
62 62
63 if (ffmt != fmtRaw && ffmt != fmtSunAudio && ffmt != fmtWave) { 63 if (ffmt != fmtRaw && ffmt != fmtSunAudio && ffmt != fmtWave) {
64 sound_warn("audio: Unsupported file format (neither RAW, nor Sun/DECAudio, nor WAVE)"); 64 sound_warn("Unsupported file format (neither RAW, nor Sun/DECAudio, nor WAVE)");
65 return 0; 65 return 0;
66 } 66 }
67 67
68 /* convert header information into ESD flags */ 68 /* convert header information into ESD flags */
69 flags = ESD_STREAM|ESD_PLAY; 69 flags = ESD_STREAM|ESD_PLAY;
83 sndcnv = sndcnv16swap; /* ESD wants little endian */ 83 sndcnv = sndcnv16swap; /* ESD wants little endian */
84 case AFMT_S16_LE: 84 case AFMT_S16_LE:
85 flags |= ESD_BITS16; 85 flags |= ESD_BITS16;
86 break; 86 break;
87 default: 87 default:
88 sound_warn ("audio: byte format %d unimplemented", fmt); 88 {
89 return 0; 89 Extbyte warn_buf[255];
90 sprintf (warn_buf, "byte format %d unimplemented", fmt);
91 sound_warn (warn_buf);
92 return 0;
93 }
90 } 94 }
91 switch (tracks) 95 switch (tracks)
92 { 96 {
93 case 1: flags |= ESD_MONO; break; 97 case 1: flags |= ESD_MONO; break;
94 case 2: flags |= ESD_STEREO; break; 98 case 2: flags |= ESD_STEREO; break;
95 default: 99 default:
96 sound_warn ("audio: %d channels - only 1 or 2 supported", tracks); 100 {
97 return 0; 101 Extbyte warn_buf[255];
102 sprintf (warn_buf, "%d channels - only 1 or 2 supported", tracks);
103 sound_warn (warn_buf);
104 return 0;
105 }
98 } 106 }
99 107
100 sock = esd_play_stream(flags, speed, NULL, "xemacs"); 108 sock = esd_play_stream(flags, speed, NULL, "xemacs");
101 if (sock < 0) 109 if (sock < 0)
102 return 0; 110 return 0;
106 for (pptr = data; (prtn = parsesndfile((void **)&pptr,&length, 114 for (pptr = data; (prtn = parsesndfile((void **)&pptr,&length,
107 (void **)&optr)) > 0; ) 115 (void **)&optr)) > 0; )
108 for (cptr = optr; (crtn = sndcnv((void **)&cptr,&prtn, 116 for (cptr = optr; (crtn = sndcnv((void **)&cptr,&prtn,
109 (void **)&sptr)) > 0; ) { 117 (void **)&sptr)) > 0; ) {
110 if ((wrtn = write(sock,sptr,crtn)) < 0) { 118 if ((wrtn = write(sock,sptr,crtn)) < 0) {
111 sound_perror ("audio: write error"); 119 sound_perror ("write error");
112 goto END_OF_PLAY; 120 goto END_OF_PLAY;
113 } 121 }
114 if (wrtn != crtn) { 122 if (wrtn != crtn) {
115 sound_warn ("audio: only wrote %d of %d bytes", wrtn, crtn); 123 Extbyte warn_buf[255];
124 sprintf (warn_buf , "only wrote %d of %d bytes", wrtn, crtn);
125 sound_warn (warn_buf);
116 goto END_OF_PLAY; 126 goto END_OF_PLAY;
117 } 127 }
118 } 128 }
119 129
120 if (ffmt == fmtWave) 130 if (ffmt == fmtWave)