From 98cf3c80b1505b2237b8fcde4b36ee7d97bc1633 Mon Sep 17 00:00:00 2001 From: Cary Sandvig Date: Tue, 17 Oct 2000 21:50:22 +0000 Subject: [PATCH] more general handling of this --- panda/src/audio/audio_sound.cxx | 47 +++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 panda/src/audio/audio_sound.cxx diff --git a/panda/src/audio/audio_sound.cxx b/panda/src/audio/audio_sound.cxx new file mode 100644 index 0000000000..5b212e7032 --- /dev/null +++ b/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; +}