Mercurial > SDL_sound_CoreAudio
comparison decoders/voc.c @ 224:1bafef18dabf
Implemented rewind method.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Fri, 18 Jan 2002 02:12:03 +0000 |
parents | c9772a9f5271 |
children | ca43129df299 |
comparison
equal
deleted
inserted
replaced
223:249186e31431 | 224:1bafef18dabf |
---|---|
89 Uint32 samples; /* number of samples output */ | 89 Uint32 samples; /* number of samples output */ |
90 Uint32 size; /* word length of data */ | 90 Uint32 size; /* word length of data */ |
91 Uint8 channels; /* number of sound channels */ | 91 Uint8 channels; /* number of sound channels */ |
92 int extended; /* Has an extended block been read? */ | 92 int extended; /* Has an extended block been read? */ |
93 Uint32 bufpos; /* byte position in internal->buffer. */ | 93 Uint32 bufpos; /* byte position in internal->buffer. */ |
94 Uint32 start_pos; /* offset to seek to in stream when rewinding. */ | |
94 } vs_t; | 95 } vs_t; |
95 | 96 |
96 /* Size field */ | 97 /* Size field */ |
97 /* SJB: note that the 1st 3 are sometimes used as sizeof(type) */ | 98 /* SJB: note that the 1st 3 are sometimes used as sizeof(type) */ |
98 #define ST_SIZE_BYTE 1 | 99 #define ST_SIZE_BYTE 1 |
433 v = (vs_t *) malloc(sizeof (vs_t)); | 434 v = (vs_t *) malloc(sizeof (vs_t)); |
434 BAIL_IF_MACRO(v == NULL, ERR_OUT_OF_MEMORY, 0); | 435 BAIL_IF_MACRO(v == NULL, ERR_OUT_OF_MEMORY, 0); |
435 memset(v, '\0', sizeof (vs_t)); | 436 memset(v, '\0', sizeof (vs_t)); |
436 internal->decoder_private = v; | 437 internal->decoder_private = v; |
437 | 438 |
439 v->start_pos = SDL_RWtell(internal->rw); | |
438 v->rate = -1; | 440 v->rate = -1; |
439 if (!voc_get_block(sample)) | 441 if (!voc_get_block(sample)) |
440 { | 442 { |
441 free(v); | 443 free(v); |
442 return(0); | 444 return(0); |
490 } /* VOC_read */ | 492 } /* VOC_read */ |
491 | 493 |
492 | 494 |
493 static int VOC_rewind(Sound_Sample *sample) | 495 static int VOC_rewind(Sound_Sample *sample) |
494 { | 496 { |
495 /* !!! FIXME. */ | 497 Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; |
496 SNDDBG(("VOC_rewind(): Write me!\n")); | 498 vs_t *v = (vs_t *) internal->decoder_private; |
497 assert(0); | 499 int rc = SDL_RWseek(internal->rw, v->start_pos, SEEK_SET); |
498 return(0); | 500 BAIL_IF_MACRO(rc != v->start_pos, ERR_IO_ERROR, 0); |
501 v->rest = 0; | |
502 return(1); | |
499 } /* VOC_rewind */ | 503 } /* VOC_rewind */ |
500 | 504 |
501 #endif /* SOUND_SUPPORTS_VOC */ | 505 #endif /* SOUND_SUPPORTS_VOC */ |
502 | 506 |
503 /* end of voc.c ... */ | 507 /* end of voc.c ... */ |