Browse Source

more general handling of this

Cary Sandvig 25 years ago
parent
commit
98cf3c80b1
1 changed files with 47 additions and 0 deletions
  1. 47 0
      panda/src/audio/audio_sound.cxx

+ 47 - 0
panda/src/audio/audio_sound.cxx

@@ -0,0 +1,47 @@
+// Filename: audio_sound.cxx
+// Created by:  cary (17Oct00)
+// 
+////////////////////////////////////////////////////////////////////
+
+#include "audio_sound.h"
+#include "config_audio.h"
+
+TypeHandle AudioSound::_type_handle;
+
+////////////////////////////////////////////////////////////////////
+//     Function: AudioSound::destructor
+//       Access: Public
+//  Description: deletes the sound data and then lets the system
+//               destroy this structure
+////////////////////////////////////////////////////////////////////
+AudioSound::~AudioSound(void) {
+  (*_delstate)(_state);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: AudioSound::length
+//       Access: Public
+//  Description: return the length (in seconds) of the sound
+////////////////////////////////////////////////////////////////////
+float AudioSound::length(void) const {
+  return _sound->length();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: AudioSound::status
+//       Access: Public
+//  Description: return the current play status of this sound
+////////////////////////////////////////////////////////////////////
+AudioSound::SoundStatus AudioSound::status(void) {
+  AudioTraits::PlayingClass::PlayingStatus stat = _state->status();
+  switch (stat) {
+  case AudioTraits::PlayingClass::BAD:
+    return BAD;
+  case AudioTraits::PlayingClass::READY:
+    return READY;
+  case AudioTraits::PlayingClass::PLAYING:
+    return PLAYING;
+  }
+  audio_cat->error() << "unknown status for sound" << endl;
+  return BAD;
+}