Browse Source

hack fix for sound length

Dave Schuyler 24 years ago
parent
commit
cbb60ab16e
1 changed files with 8 additions and 1 deletions
  1. 8 1
      panda/src/audio/audio_rad_mss_traits.cxx

+ 8 - 1
panda/src/audio/audio_rad_mss_traits.cxx

@@ -104,7 +104,14 @@ MilesSound::~MilesSound() {
 }
 }
 
 
 float MilesSound::length() const {
 float MilesSound::length() const {
-  float length=float(AIL_quick_ms_length(_audio))/1000.0;
+  float length=0;
+  if (AIL_quick_status(_audio)!=QSTAT_PLAYING) {
+    AIL_quick_play(_audio, 1);
+    length=float(AIL_quick_ms_length(_audio))/1000.0;
+    AIL_quick_halt(_audio);
+  } else {
+    length=float(AIL_quick_ms_length(_audio))/1000.0;
+  }
   audio_debug("MilesSound::length returning "<<length);
   audio_debug("MilesSound::length returning "<<length);
   return length;
   return length;
 }
 }