Mercurial > SDL_sound_CoreAudio
annotate decoders/voc.c @ 175:865c17682d8f
Updated.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Wed, 05 Dec 2001 10:04:48 +0000 |
parents | 1df5c106504e |
children | 47cc2de2ae36 |
rev | line source |
---|---|
14 | 1 /* |
2 * SDL_sound -- An abstract sound format decoding API. | |
3 * Copyright (C) 2001 Ryan C. Gordon. | |
4 * | |
5 * This library is free software; you can redistribute it and/or | |
6 * modify it under the terms of the GNU Lesser General Public | |
7 * License as published by the Free Software Foundation; either | |
8 * version 2.1 of the License, or (at your option) any later version. | |
9 * | |
10 * This library is distributed in the hope that it will be useful, | |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 * Lesser General Public License for more details. | |
14 * | |
15 * You should have received a copy of the GNU Lesser General Public | |
16 * License along with this library; if not, write to the Free Software | |
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 */ | |
19 | |
20 /* | |
21 * VOC decoder for SDL_sound. | |
22 * | |
23 * This driver handles Creative Labs VOC audio data...this is a legacy format, | |
24 * but there's some game ports that could make use of such a decoder. Plus, | |
25 * VOC is fairly straightforward to decode, so this is a more complex, but | |
26 * still palatable example of an SDL_sound decoder. Y'know, in case the | |
27 * RAW decoder didn't do it for you. :) | |
28 * | |
29 * This code was ripped from a decoder I had written for SDL_mixer, which was | |
30 * largely ripped from sox v12.17.1's voc.c. | |
31 * | |
32 * SDL_mixer: http://www.libsdl.org/projects/SDL_mixer/ | |
33 * sox: http://www.freshmeat.net/projects/sox/ | |
34 * | |
35 * Please see the file LICENSE in the source's root directory. | |
36 * | |
37 * This file written by Ryan C. Gordon. (icculus@clutteredmind.org) | |
38 */ | |
39 | |
106
40de367eb59e
Changing my include structure to do this right.
Ryan C. Gordon <icculus@icculus.org>
parents:
104
diff
changeset
|
40 #if HAVE_CONFIG_H |
40de367eb59e
Changing my include structure to do this right.
Ryan C. Gordon <icculus@icculus.org>
parents:
104
diff
changeset
|
41 # include <config.h> |
40de367eb59e
Changing my include structure to do this right.
Ryan C. Gordon <icculus@icculus.org>
parents:
104
diff
changeset
|
42 #endif |
100
6d9fdec2f708
added config.h, added --enable-debug flag, various other changes to the build system
fingolfin
parents:
64
diff
changeset
|
43 |
114
dd95a12539fd
Changed an #if defined to #ifdef, for consistency with the other
Ryan C. Gordon <icculus@icculus.org>
parents:
106
diff
changeset
|
44 #ifdef SOUND_SUPPORTS_VOC |
104
103cfcb3c014
Updated to fix build system problem.
Ryan C. Gordon <icculus@icculus.org>
parents:
100
diff
changeset
|
45 |
14 | 46 #include <stdio.h> |
47 #include <stdlib.h> | |
48 #include <string.h> | |
49 #include <assert.h> | |
50 | |
106
40de367eb59e
Changing my include structure to do this right.
Ryan C. Gordon <icculus@icculus.org>
parents:
104
diff
changeset
|
51 #include "SDL_sound.h" |
40de367eb59e
Changing my include structure to do this right.
Ryan C. Gordon <icculus@icculus.org>
parents:
104
diff
changeset
|
52 |
40de367eb59e
Changing my include structure to do this right.
Ryan C. Gordon <icculus@icculus.org>
parents:
104
diff
changeset
|
53 #define __SDL_SOUND_INTERNAL__ |
40de367eb59e
Changing my include structure to do this right.
Ryan C. Gordon <icculus@icculus.org>
parents:
104
diff
changeset
|
54 #include "SDL_sound_internal.h" |
40de367eb59e
Changing my include structure to do this right.
Ryan C. Gordon <icculus@icculus.org>
parents:
104
diff
changeset
|
55 |
47
ea58bc3b15d7
Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
32
diff
changeset
|
56 static int VOC_init(void); |
ea58bc3b15d7
Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
32
diff
changeset
|
57 static void VOC_quit(void); |
14 | 58 static int VOC_open(Sound_Sample *sample, const char *ext); |
59 static void VOC_close(Sound_Sample *sample); | |
60 static Uint32 VOC_read(Sound_Sample *sample); | |
61 | |
149
1df5c106504e
Decoders can now list multiple file extensions.
Ryan C. Gordon <icculus@icculus.org>
parents:
114
diff
changeset
|
62 static const char *extensions_voc[] = { "VOC", NULL }; |
14 | 63 const Sound_DecoderFunctions __Sound_DecoderFunctions_VOC = |
64 { | |
65 { | |
149
1df5c106504e
Decoders can now list multiple file extensions.
Ryan C. Gordon <icculus@icculus.org>
parents:
114
diff
changeset
|
66 extensions_voc, |
14 | 67 "Creative Labs Voice format", |
68 "Ryan C. Gordon <icculus@clutteredmind.org>", | |
69 "http://www.icculus.org/SDL_sound/" | |
70 }, | |
71 | |
47
ea58bc3b15d7
Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
32
diff
changeset
|
72 VOC_init, /* init() method */ |
ea58bc3b15d7
Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
32
diff
changeset
|
73 VOC_quit, /* quit() method */ |
ea58bc3b15d7
Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
32
diff
changeset
|
74 VOC_open, /* open() method */ |
ea58bc3b15d7
Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
32
diff
changeset
|
75 VOC_close, /* close() method */ |
ea58bc3b15d7
Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
32
diff
changeset
|
76 VOC_read /* read() method */ |
14 | 77 }; |
78 | |
79 | |
80 /* Private data for VOC file */ | |
81 typedef struct vocstuff { | |
82 Uint32 rest; /* bytes remaining in current block */ | |
83 Uint32 rate; /* rate code (byte) of this chunk */ | |
84 int silent; /* sound or silence? */ | |
85 Uint32 srate; /* rate code (byte) of silence */ | |
86 Uint32 blockseek; /* start of current output block */ | |
87 Uint32 samples; /* number of samples output */ | |
88 Uint32 size; /* word length of data */ | |
32
4a60ee42ca9a
Fixed a byte-ordering issue.
Ryan C. Gordon <icculus@icculus.org>
parents:
22
diff
changeset
|
89 Uint8 channels; /* number of sound channels */ |
14 | 90 int extended; /* Has an extended block been read? */ |
91 Uint32 bufpos; /* byte position in internal->buffer. */ | |
92 } vs_t; | |
93 | |
62
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
47
diff
changeset
|
94 /* Size field */ |
14 | 95 /* SJB: note that the 1st 3 are sometimes used as sizeof(type) */ |
96 #define ST_SIZE_BYTE 1 | |
97 #define ST_SIZE_8BIT 1 | |
98 #define ST_SIZE_WORD 2 | |
99 #define ST_SIZE_16BIT 2 | |
100 #define ST_SIZE_DWORD 4 | |
101 #define ST_SIZE_32BIT 4 | |
102 #define ST_SIZE_FLOAT 5 | |
103 #define ST_SIZE_DOUBLE 6 | |
104 #define ST_SIZE_IEEE 7 /* IEEE 80-bit floats. */ | |
105 | |
106 /* Style field */ | |
107 #define ST_ENCODING_UNSIGNED 1 /* unsigned linear: Sound Blaster */ | |
108 #define ST_ENCODING_SIGN2 2 /* signed linear 2's comp: Mac */ | |
109 #define ST_ENCODING_ULAW 3 /* U-law signed logs: US telephony, SPARC */ | |
110 #define ST_ENCODING_ALAW 4 /* A-law signed logs: non-US telephony */ | |
111 #define ST_ENCODING_ADPCM 5 /* Compressed PCM */ | |
112 #define ST_ENCODING_IMA_ADPCM 6 /* Compressed PCM */ | |
113 #define ST_ENCODING_GSM 7 /* GSM 6.10 33-byte frame lossy compression */ | |
114 | |
115 #define VOC_TERM 0 | |
116 #define VOC_DATA 1 | |
117 #define VOC_CONT 2 | |
118 #define VOC_SILENCE 3 | |
119 #define VOC_MARKER 4 | |
120 #define VOC_TEXT 5 | |
121 #define VOC_LOOP 6 | |
122 #define VOC_LOOPEND 7 | |
123 #define VOC_EXTENDED 8 | |
124 #define VOC_DATA_16 9 | |
125 | |
126 | |
47
ea58bc3b15d7
Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
32
diff
changeset
|
127 static int VOC_init(void) |
ea58bc3b15d7
Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
32
diff
changeset
|
128 { |
ea58bc3b15d7
Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
32
diff
changeset
|
129 return(1); /* always succeeds. */ |
ea58bc3b15d7
Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
32
diff
changeset
|
130 } /* VOC_init */ |
ea58bc3b15d7
Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
32
diff
changeset
|
131 |
ea58bc3b15d7
Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
32
diff
changeset
|
132 |
ea58bc3b15d7
Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
32
diff
changeset
|
133 static void VOC_quit(void) |
ea58bc3b15d7
Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
32
diff
changeset
|
134 { |
ea58bc3b15d7
Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
32
diff
changeset
|
135 /* it's a no-op. */ |
ea58bc3b15d7
Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
32
diff
changeset
|
136 } /* VOC_quit */ |
ea58bc3b15d7
Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
32
diff
changeset
|
137 |
ea58bc3b15d7
Added init() and quit() methods.
Ryan C. Gordon <icculus@icculus.org>
parents:
32
diff
changeset
|
138 |
14 | 139 static __inline__ int voc_check_header(SDL_RWops *src) |
140 { | |
141 /* VOC magic header */ | |
142 Uint8 signature[20]; /* "Creative Voice File\032" */ | |
143 Uint16 datablockofs; | |
144 | |
145 if (SDL_RWread(src, signature, sizeof (signature), 1) != 1) | |
146 return(0); | |
147 | |
148 if (memcmp(signature, "Creative Voice File\032", sizeof (signature)) != 0) { | |
149 Sound_SetError("Unrecognized file type (not VOC)"); | |
150 return(0); | |
151 } | |
152 | |
153 /* get the offset where the first datablock is located */ | |
154 if (SDL_RWread(src, &datablockofs, sizeof (Uint16), 1) != 1) | |
155 return(0); | |
156 | |
157 datablockofs = SDL_SwapLE16(datablockofs); | |
158 | |
159 if (SDL_RWseek(src, datablockofs, SEEK_SET) != datablockofs) | |
160 return(0); | |
161 | |
162 return(1); /* success! */ | |
163 } /* voc_check_header */ | |
164 | |
165 /* !!! FIXME : Add a flag to vs_t that distinguishes EOF and Error conditions. */ | |
166 | |
167 /* Read next block header, save info, leave position at start of data */ | |
168 static int voc_get_block(Sound_Sample *sample) | |
169 { | |
170 Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; | |
171 SDL_RWops *src = internal->rw; | |
172 vs_t *v = (vs_t *) internal->decoder_private; | |
173 Uint8 bits24[3]; | |
174 Uint8 uc, block; | |
175 Uint32 sblen; | |
176 Uint16 new_rate_short; | |
177 Uint32 new_rate_long; | |
178 Uint8 trash[6]; | |
179 Uint16 period; | |
180 int i; | |
181 | |
182 v->silent = 0; | |
183 while (v->rest == 0) | |
184 { | |
185 if (SDL_RWread(src, &block, sizeof (block), 1) != 1) | |
186 return 1; /* assume that's the end of the file. */ | |
187 | |
188 if (block == VOC_TERM) | |
189 return 1; | |
190 | |
191 if (SDL_RWread(src, bits24, sizeof (bits24), 1) != 1) | |
192 return 1; /* assume that's the end of the file. */ | |
62
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
47
diff
changeset
|
193 |
14 | 194 /* Size is an 24-bit value. Ugh. */ |
195 sblen = ( (bits24[0]) | (bits24[1] << 8) | (bits24[2] << 16) ); | |
196 | |
197 switch(block) | |
198 { | |
199 case VOC_DATA: | |
200 if (SDL_RWread(src, &uc, sizeof (uc), 1) != 1) | |
201 return 0; | |
202 | |
203 /* When DATA block preceeded by an EXTENDED */ | |
204 /* block, the DATA blocks rate value is invalid */ | |
205 if (!v->extended) | |
206 { | |
207 if (uc == 0) | |
208 { | |
209 Sound_SetError("VOC Sample rate is zero?"); | |
210 return 0; | |
211 } | |
212 | |
213 if ((v->rate != -1) && (uc != v->rate)) | |
214 { | |
215 Sound_SetError("VOC sample rate codes differ"); | |
216 return 0; | |
217 } | |
218 | |
219 v->rate = uc; | |
220 sample->actual.rate = 1000000.0/(256 - v->rate); | |
221 v->channels = 1; | |
222 } | |
223 | |
224 if (SDL_RWread(src, &uc, sizeof (uc), 1) != 1) | |
225 return 0; | |
226 | |
227 if (uc != 0) | |
228 { | |
229 Sound_SetError("VOC decoder only interprets 8-bit data"); | |
230 return 0; | |
231 } | |
232 | |
233 v->extended = 0; | |
234 v->rest = sblen - 2; | |
235 v->size = ST_SIZE_BYTE; | |
236 return 1; | |
237 | |
238 case VOC_DATA_16: | |
239 if (SDL_RWread(src, &new_rate_long, sizeof (new_rate_long), 1) != 1) | |
240 return 0; | |
241 new_rate_long = SDL_SwapLE32(new_rate_long); | |
242 if (new_rate_long == 0) | |
243 { | |
244 Sound_SetError("VOC Sample rate is zero?"); | |
245 return 0; | |
246 } | |
247 if ((v->rate != -1) && (new_rate_long != v->rate)) | |
248 { | |
249 Sound_SetError("VOC sample rate codes differ"); | |
250 return 0; | |
251 } | |
252 v->rate = new_rate_long; | |
253 sample->actual.rate = new_rate_long; | |
254 | |
255 if (SDL_RWread(src, &uc, sizeof (uc), 1) != 1) | |
256 return 0; | |
257 | |
258 switch (uc) | |
259 { | |
260 case 8: v->size = ST_SIZE_BYTE; break; | |
261 case 16: v->size = ST_SIZE_WORD; break; | |
262 default: | |
263 Sound_SetError("VOC with unknown data size"); | |
264 return 0; | |
265 } | |
266 | |
267 if (SDL_RWread(src, &v->channels, sizeof (Uint8), 1) != 1) | |
268 return 0; | |
269 | |
270 if (SDL_RWread(src, trash, sizeof (Uint8), 6) != 6) | |
271 return 0; | |
272 | |
273 v->rest = sblen - 12; | |
274 return 1; | |
275 | |
276 case VOC_CONT: | |
277 v->rest = sblen; | |
278 return 1; | |
279 | |
280 case VOC_SILENCE: | |
281 if (SDL_RWread(src, &period, sizeof (period), 1) != 1) | |
282 return 0; | |
283 period = SDL_SwapLE16(period); | |
284 | |
285 if (SDL_RWread(src, &uc, sizeof (uc), 1) != 1) | |
286 return 0; | |
287 if (uc == 0) | |
288 { | |
289 Sound_SetError("VOC silence sample rate is zero"); | |
290 return 0; | |
291 } | |
292 | |
293 /* | |
294 * Some silence-packed files have gratuitously | |
295 * different sample rate codes in silence. | |
296 * Adjust period. | |
297 */ | |
298 if ((v->rate != -1) && (uc != v->rate)) | |
299 period = (period * (256 - uc))/(256 - v->rate); | |
300 else | |
301 v->rate = uc; | |
302 v->rest = period; | |
303 v->silent = 1; | |
304 return 1; | |
305 | |
306 case VOC_LOOP: | |
307 case VOC_LOOPEND: | |
308 for(i = 0; i < sblen; i++) /* skip repeat loops. */ | |
309 { | |
310 if (SDL_RWread(src, trash, sizeof (Uint8), 1) != 1) | |
311 return 0; | |
312 } | |
313 break; | |
314 | |
315 case VOC_EXTENDED: | |
316 /* An Extended block is followed by a data block */ | |
317 /* Set this byte so we know to use the rate */ | |
318 /* value from the extended block and not the */ | |
319 /* data block. */ | |
320 v->extended = 1; | |
321 if (SDL_RWread(src, &new_rate_short, sizeof (new_rate_short), 1) != 1) | |
322 return 0; | |
323 new_rate_short = SDL_SwapLE16(new_rate_short); | |
324 if (new_rate_short == 0) | |
325 { | |
326 Sound_SetError("VOC sample rate is zero"); | |
327 return 0; | |
328 } | |
329 if ((v->rate != -1) && (new_rate_short != v->rate)) | |
330 { | |
331 Sound_SetError("VOC sample rate codes differ"); | |
332 return 0; | |
333 } | |
334 v->rate = new_rate_short; | |
335 | |
336 if (SDL_RWread(src, &uc, sizeof (uc), 1) != 1) | |
337 return 0; | |
338 | |
339 if (uc != 0) | |
340 { | |
341 Sound_SetError("VOC decoder only interprets 8-bit data"); | |
342 return 0; | |
343 } | |
344 | |
345 if (SDL_RWread(src, &uc, sizeof (uc), 1) != 1) | |
346 return 0; | |
347 | |
348 if (uc) | |
349 sample->actual.channels = 2; /* Stereo */ | |
350 /* Needed number of channels before finishing | |
351 compute for rate */ | |
352 sample->actual.rate = | |
353 (256000000L/(65536L - v->rate)) / sample->actual.channels; | |
354 /* An extended block must be followed by a data */ | |
355 /* block to be valid so loop back to top so it */ | |
356 /* can be grabed. */ | |
357 continue; | |
358 | |
359 case VOC_MARKER: | |
360 if (SDL_RWread(src, trash, sizeof (Uint8), 2) != 2) | |
361 return 0; | |
362 | |
363 /* Falling! Falling! */ | |
364 | |
365 default: /* text block or other krapola. */ | |
366 for(i = 0; i < sblen; i++) | |
367 { | |
368 if (SDL_RWread(src, &trash, sizeof (Uint8), 1) != 1) | |
369 return 0; | |
370 } | |
371 | |
372 if (block == VOC_TEXT) | |
373 continue; /* get next block */ | |
374 } | |
375 } | |
376 | |
377 return 1; | |
378 } | |
379 | |
380 | |
22
f6e679afe88b
Byte ordering fix, changed voc_read to voc_read_waveform, and cleaned up
Ryan C. Gordon <icculus@icculus.org>
parents:
14
diff
changeset
|
381 static int voc_read_waveform(Sound_Sample *sample) |
14 | 382 { |
383 Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; | |
384 SDL_RWops *src = internal->rw; | |
385 vs_t *v = (vs_t *) internal->decoder_private; | |
386 int done = 0; | |
387 Uint8 silence = 0x80; | |
388 Uint8 *buf = internal->buffer; | |
389 | |
390 if (v->rest == 0) | |
391 { | |
392 if (!voc_get_block(sample)) | |
393 return 0; | |
394 } | |
395 | |
396 if (v->rest == 0) | |
397 return 0; | |
398 | |
399 if (v->silent) | |
400 { | |
401 if (v->size == ST_SIZE_WORD) | |
402 silence = 0x00; | |
403 | |
404 /* Fill in silence */ | |
405 memset(buf, silence, v->rest); | |
406 done = v->rest; | |
407 v->rest = 0; | |
408 } | |
409 | |
410 else | |
411 { | |
412 Uint32 max = (v->rest < internal->buffer_size) ? | |
413 v->rest : internal->buffer_size; | |
414 done = SDL_RWread(src, buf + v->bufpos, 1, max); | |
415 v->rest -= done; | |
416 v->bufpos += done; | |
417 } | |
418 | |
419 return done; | |
22
f6e679afe88b
Byte ordering fix, changed voc_read to voc_read_waveform, and cleaned up
Ryan C. Gordon <icculus@icculus.org>
parents:
14
diff
changeset
|
420 } /* voc_read_waveform */ |
14 | 421 |
422 | |
423 static int VOC_open(Sound_Sample *sample, const char *ext) | |
424 { | |
425 Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; | |
426 vs_t *v = NULL; | |
427 | |
428 if (!voc_check_header(internal->rw)) | |
429 return(0); | |
430 | |
431 v = (vs_t *) malloc(sizeof (vs_t)); | |
432 BAIL_IF_MACRO(v == NULL, ERR_OUT_OF_MEMORY, 0); | |
433 memset(v, '\0', sizeof (vs_t)); | |
434 internal->decoder_private = v; | |
435 | |
436 v->rate = -1; | |
437 if (!voc_get_block(sample)) | |
438 { | |
439 free(v); | |
440 return(0); | |
441 } /* if */ | |
442 | |
443 if (v->rate == -1) | |
444 { | |
445 Sound_SetError("VOC data had no sound!"); | |
446 free(v); | |
447 return(0); | |
448 } /* if */ | |
449 | |
62
b13fafb976be
Changed _D macro to DBGSND.
Ryan C. Gordon <icculus@icculus.org>
parents:
47
diff
changeset
|
450 SNDDBG(("VOC: Accepting data stream.\n")); |
14 | 451 sample->actual.format = (v->size == ST_SIZE_WORD) ? AUDIO_S16LSB:AUDIO_U8; |
452 sample->actual.channels = v->channels; | |
453 sample->flags = SOUND_SAMPLEFLAG_NONE; | |
454 return(1); | |
455 } /* VOC_open */ | |
456 | |
457 | |
458 static void VOC_close(Sound_Sample *sample) | |
459 { | |
460 Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; | |
461 free(internal->decoder_private); | |
462 } /* VOC_close */ | |
463 | |
464 | |
465 static Uint32 VOC_read(Sound_Sample *sample) | |
466 { | |
467 Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; | |
468 vs_t *v = (vs_t *) internal->decoder_private; | |
469 | |
470 v->bufpos = 0; | |
471 while (v->bufpos < internal->buffer_size) | |
472 { | |
22
f6e679afe88b
Byte ordering fix, changed voc_read to voc_read_waveform, and cleaned up
Ryan C. Gordon <icculus@icculus.org>
parents:
14
diff
changeset
|
473 Uint32 rc = voc_read_waveform(sample); |
14 | 474 if (rc == 0) /* !!! FIXME: Could be an error... */ |
475 { | |
476 sample->flags |= SOUND_SAMPLEFLAG_EOF; | |
477 break; | |
478 } /* if */ | |
479 | |
480 if (!voc_get_block(sample)) | |
481 { | |
482 sample->flags |= SOUND_SAMPLEFLAG_ERROR; | |
483 break; | |
484 } /* if */ | |
485 } /* while */ | |
486 | |
487 return(v->bufpos); | |
488 } /* VOC_read */ | |
489 | |
64
40006625142a
Changes in preparation of autoconf support.
Ryan C. Gordon <icculus@icculus.org>
parents:
62
diff
changeset
|
490 #endif /* SOUND_SUPPORTS_VOC */ |
14 | 491 |
492 /* end of voc.c ... */ |