Mercurial > SDL_sound_CoreAudio
diff decoders/oggtremor.c @ 591:8faf61a640f0 tip
Resynced fixes for unit conversion bugs in the Ogg Tremor decoder from SoundDecoder/ALmixer.
Ogg Vorbis uses seconds and we multiply by 1000 to convert to milliseconds. But Ogg Tremor already uses milliseconds but I was still multiplying by 1000.
author | Eric Wing <ewing . public |-at-| gmail . com> |
---|---|
date | Thu, 25 Oct 2012 16:34:18 -0700 |
parents | 1c8414cd5839 |
children |
line wrap: on
line diff
--- a/decoders/oggtremor.c Wed Apr 27 19:37:16 2011 -0700 +++ b/decoders/oggtremor.c Thu Oct 25 16:34:18 2012 -0700 @@ -215,7 +215,7 @@ if (OV_EINVAL == total_time) internal->total_time = -1; else - internal->total_time = (Sint32)(total_time * 1000.0 + 0.5); + internal->total_time = (Sint32)(total_time); /* @@ -365,8 +365,8 @@ { Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque; OggVorbis_File *vf = (OggVorbis_File *) internal->decoder_private; - double timepos = (((double) ms) / 1000.0); - BAIL_IF_MACRO(ov_time_seek(vf, timepos) < 0, ERR_IO_ERROR, 0); + /* Unlike Vorbis, Tremor uses integer milliseconds instead of double seconds. */ + BAIL_IF_MACRO(ov_time_seek(vf, (ogg_int64_t)ms) < 0, ERR_IO_ERROR, 0); return(1); } /* OGG_seek */