mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
more refcounting
This commit is contained in:
parent
397f403188
commit
b7d2a31c69
@ -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;
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user