mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
more debugging
This commit is contained in:
parent
fb6ab65c75
commit
51d9d1a928
@ -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);
|
||||
}
|
||||
|
||||
|
@ -112,16 +112,14 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user