more refcounting

This commit is contained in:
Cary Sandvig 2000-12-06 22:52:42 +00:00
parent 397f403188
commit b7d2a31c69
4 changed files with 11 additions and 15 deletions

View File

@ -32,7 +32,7 @@ private:
typedef void UpdateFunc(void);
typedef void ShutdownFunc(void);
typedef set<AudioSound*> LoopSet;
typedef set<PT(AudioSound)> LoopSet;
static AudioManager* _global_ptr;
static UpdateFunc* _update_func;
static ShutdownFunc* _shutdown_func;

View File

@ -24,11 +24,8 @@ INLINE bool AudioPool::has_sound(const string& filename) {
// return a valid AudioSound pointer.
////////////////////////////////////////////////////////////////////
INLINE bool AudioPool::verify_sound(const string& filename) {
AudioSound* foo = load_sound(filename);
bool ret = foo != (AudioSound*)0L;
if (ret)
delete foo;
return ret;
PT(AudioSound) foo = load_sound(filename);
return !(foo.is_null());
}
////////////////////////////////////////////////////////////////////

View File

@ -7,9 +7,7 @@
#define __AUDIO_SOUND_H__
#include "audio_trait.h"
/*
#include "typedReferenceCount.h"
*/
#include <typedReferenceCount.h>
#include <typeHandle.h>
#include <namable.h>
#include <pointerTo.h>
@ -19,9 +17,9 @@ class AudioPool;
class AudioManager;
/*
class EXPCL_PANDA AudioSound : public TypedReferenceCount, public Namable {
*/
class EXPCL_PANDA AudioSound : public TypedObject, public Namable {
*/
class EXPCL_PANDA AudioSound : public TypedReferenceCount, public Namable {
private:
PT(AudioTraits::SoundClass) _sound;
AudioTraits::PlayingClass *_state;

View File

@ -18,10 +18,11 @@ main(int argc, char* argv[]) {
}
{
AudioSound* tester = AudioPool::load_sound(argv[1]);
AudioPool::release_all_sounds();
cerr << "all sounds but 1 released" << endl;
delete tester;
{
PT(AudioSound) tester = AudioPool::load_sound(argv[1]);
AudioPool::release_all_sounds();
cerr << "all sounds but 1 released" << endl;
}
cerr << "all sounds released" << endl;
}