cached oggs work

This commit is contained in:
Bill Currie 2003-04-11 02:58:24 +00:00
parent d8c0f50c11
commit 12724f5fa7

View file

@ -149,10 +149,23 @@ load_ogg (OggVorbis_File *vf, sfxblock_t *block, cache_allocator_t allocator)
sfxbuffer_t *sc = 0;
sfx_t *sfx = block->sfx;
int channels;
void (*paint) (channel_t *ch, sfxbuffer_t *buffer, int count);
get_info (vf, sfx);
switch (sfx->channels) {
case 1:
paint = SND_PaintChannelFrom16;
break;
case 2:
paint = SND_PaintChannelStereo16;
break;
default:
Sys_Printf ("%s: unsupported channel count: %d\n",
sfx->name, sfx->channels);
return 0;
}
channels = sfx->channels;
size = sfx->length * channels * 2;
@ -166,6 +179,8 @@ load_ogg (OggVorbis_File *vf, sfxblock_t *block, cache_allocator_t allocator)
if (read_ogg (vf, data, size) < 0)
goto bail;
SND_ResampleSfx (sfx, sc, data);
sc->paint = paint;
sc->length = sc->head = sfx->length;
bail:
if (data)
free (data);