static int voc_read(SDL_RWops *src, vs_t *v, Uint8 *buf, SDL_AudioSpec *spec) { int done = 0; Uint8 silence = 0x80; if (v->rest == 0) { if (!voc_get_block(src, v, spec)) return 0; } if (v->rest == 0) return 0; if (v->silent) { if (v->size == ST_SIZE_WORD) silence = 0x00; /* Fill in silence */ memset(buf, silence, v->rest); done = v->rest; v->rest = 0; } else { done = SDL_RWread(src, buf, 1, v->rest); v->rest -= done; if (v->size == ST_SIZE_WORD) { #if (SDL_BYTEORDER == SDL_BIG_ENDIAN) Uint16 *samples = (Uint16 *)buf; for (; v->rest > 0; v->rest -= 2) { *samples = SDL_SwapLE16(*samples); samples++; } #endif done >>= 1; } }
static int voc_read(SDL_RWops *src, vs_t *v, unsigned char *buf, AudioSpec *spec) { int done = 0; unsigned char silence = 0x80; if (v->rest == 0) { if (!voc_get_block(src, v , spec )) return 0; } if (v->rest == 0) return 0; if (v->silent) { /* Fill in silence */ memset(buf, silence, v->rest); done = v->rest; v->rest = 0; } else { done = SDL_RWread(src, buf, 1, v->rest); v->rest -= done; if (v->size == ST_SIZE_WORD) { unsigned short *samples = (unsigned short *)buf; for (; v->rest > 0; v->rest -= 2) { *samples = SDL_Swap16(*samples); samples++; } done >>= 1; } }