From b7ea87d1b54d437a8ee52ee810c592681c89e885 Mon Sep 17 00:00:00 2001 From: Dave Schuyler Date: Sat, 8 Dec 2001 00:54:24 +0000 Subject: [PATCH] rolled back Miles sound length hack --- panda/src/audiotraits/milesAudioSound.cxx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/panda/src/audiotraits/milesAudioSound.cxx b/panda/src/audiotraits/milesAudioSound.cxx index 5f18b5be27..72642fb297 100644 --- a/panda/src/audiotraits/milesAudioSound.cxx +++ b/panda/src/audiotraits/milesAudioSound.cxx @@ -229,10 +229,21 @@ get_balance() const { float MilesAudioSound:: length() const { + // hack: + // For now, the sound needs to be playing, in order to + // get the right length. I'm in contact with RAD about the problem. I've + // sent them example code. They've told me they're looking into it. + // Until then, we'll play the sound to get the length. if (!_length) { - _length=((float)AIL_quick_ms_length(_audio))*0.001f; + if (AIL_quick_status(_audio)==QSTAT_PLAYING) { + _length=((float)AIL_quick_ms_length(_audio))*0.001f; + } else { + AIL_quick_play(_audio, 1); + _length=((float)AIL_quick_ms_length(_audio))*0.001f; + AIL_quick_halt(_audio); + } } - miles_audio_debug("length() returning "<<_length); + audio_debug("MilesAudioSound::length() returning "<<_length); return _length; }