more debugging

This commit is contained in:
Cary Sandvig 2001-03-20 23:18:07 +00:00
parent fb6ab65c75
commit 51d9d1a928
2 changed files with 13 additions and 13 deletions

View File

@ -85,6 +85,9 @@ AudioManager* AudioManager::get_ptr(void) {
// Description: get the player off the sound, and start it playing
////////////////////////////////////////////////////////////////////
void AudioManager::ns_play(AudioSound* sound, float start_time) {
if (audio_cat->is_debug())
audio_cat->debug() << "AudioManager: playing sound 0x" << (void*)sound
<< endl;
if (sound->status() == AudioSound::PLAYING)
this->ns_stop(sound);
sound->get_player()->play_sound(sound->get_sound(), sound->get_state(),
@ -97,6 +100,9 @@ void AudioManager::ns_play(AudioSound* sound, float start_time) {
// Description: get the player off the sound, and stop it playing
////////////////////////////////////////////////////////////////////
void AudioManager::ns_stop(AudioSound* sound) {
if (audio_cat->is_debug())
audio_cat->debug() << "AudioManager: stopping sound 0x" << (void*)sound
<< endl;
this->ns_set_loop(sound, false);
if (sound->status() == AudioSound::PLAYING)
sound->get_player()->stop_sound(sound->get_sound(), sound->get_state());
@ -113,7 +119,7 @@ void AudioManager::ns_set_loop(AudioSound* sound, bool state) {
_loopset = new LoopSet;
if (state)
_loopset->insert(sound);
else
else if (_loopset->find(sound) != _loopset->end())
_loopset->erase(sound);
}

View File

@ -112,17 +112,15 @@ AudioSound* AudioPool::ns_load_sound(Filename filename) {
// Description: The nonstatic implementation of release_sound().
////////////////////////////////////////////////////////////////////
void AudioPool::ns_release_sound(AudioSound* sound) {
if (audio_cat->is_debug())
audio_cat->debug() << "AudioPool: releasing sound 0x" << (void*)sound
<< endl;
string filename = sound->get_name();
SoundMap::iterator si;
si = _sounds.find(filename);
if (si != _sounds.end() && (*si).second == sound->get_sound()) {
// REFCOUNT
// don't do this with refcounting
// AudioTraits::SoundClass* sc = (*si).second;
// (*(sc->get_destroy()))(sc);
if (si != _sounds.end() && (*si).second == sound->get_sound())
_sounds.erase(si);
}
}
////////////////////////////////////////////////////////////////////
// Function: AudioPool::ns_release_all_sounds
@ -130,12 +128,8 @@ void AudioPool::ns_release_sound(AudioSound* sound) {
// Description: The nonstatic implementation of release_all_sounds().
////////////////////////////////////////////////////////////////////
void AudioPool::ns_release_all_sounds(void) {
// REFCOUNT
// for (SoundMap::iterator i=_sounds.begin(); i!=_sounds.end(); ++i) {
// don't do this with refcounting
// AudioTraits::SoundClass* sc = (*i).second;
// (*(sc->get_destroy()))(sc);
// }
if (audio_cat->is_debug())
audio_cat->debug() << "AudioPool: releasing all sounds" << endl;
_sounds.clear();
}