mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
more refcounting
This commit is contained in:
parent
397f403188
commit
b7d2a31c69
@ -32,7 +32,7 @@ private:
|
|||||||
|
|
||||||
typedef void UpdateFunc(void);
|
typedef void UpdateFunc(void);
|
||||||
typedef void ShutdownFunc(void);
|
typedef void ShutdownFunc(void);
|
||||||
typedef set<AudioSound*> LoopSet;
|
typedef set<PT(AudioSound)> LoopSet;
|
||||||
static AudioManager* _global_ptr;
|
static AudioManager* _global_ptr;
|
||||||
static UpdateFunc* _update_func;
|
static UpdateFunc* _update_func;
|
||||||
static ShutdownFunc* _shutdown_func;
|
static ShutdownFunc* _shutdown_func;
|
||||||
|
@ -24,11 +24,8 @@ INLINE bool AudioPool::has_sound(const string& filename) {
|
|||||||
// return a valid AudioSound pointer.
|
// return a valid AudioSound pointer.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE bool AudioPool::verify_sound(const string& filename) {
|
INLINE bool AudioPool::verify_sound(const string& filename) {
|
||||||
AudioSound* foo = load_sound(filename);
|
PT(AudioSound) foo = load_sound(filename);
|
||||||
bool ret = foo != (AudioSound*)0L;
|
return !(foo.is_null());
|
||||||
if (ret)
|
|
||||||
delete foo;
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -7,9 +7,7 @@
|
|||||||
#define __AUDIO_SOUND_H__
|
#define __AUDIO_SOUND_H__
|
||||||
|
|
||||||
#include "audio_trait.h"
|
#include "audio_trait.h"
|
||||||
/*
|
#include <typedReferenceCount.h>
|
||||||
#include "typedReferenceCount.h"
|
|
||||||
*/
|
|
||||||
#include <typeHandle.h>
|
#include <typeHandle.h>
|
||||||
#include <namable.h>
|
#include <namable.h>
|
||||||
#include <pointerTo.h>
|
#include <pointerTo.h>
|
||||||
@ -19,9 +17,9 @@ class AudioPool;
|
|||||||
class AudioManager;
|
class AudioManager;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
class EXPCL_PANDA AudioSound : public TypedReferenceCount, public Namable {
|
|
||||||
*/
|
|
||||||
class EXPCL_PANDA AudioSound : public TypedObject, public Namable {
|
class EXPCL_PANDA AudioSound : public TypedObject, public Namable {
|
||||||
|
*/
|
||||||
|
class EXPCL_PANDA AudioSound : public TypedReferenceCount, public Namable {
|
||||||
private:
|
private:
|
||||||
PT(AudioTraits::SoundClass) _sound;
|
PT(AudioTraits::SoundClass) _sound;
|
||||||
AudioTraits::PlayingClass *_state;
|
AudioTraits::PlayingClass *_state;
|
||||||
|
@ -18,10 +18,11 @@ main(int argc, char* argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
AudioSound* tester = AudioPool::load_sound(argv[1]);
|
{
|
||||||
AudioPool::release_all_sounds();
|
PT(AudioSound) tester = AudioPool::load_sound(argv[1]);
|
||||||
cerr << "all sounds but 1 released" << endl;
|
AudioPool::release_all_sounds();
|
||||||
delete tester;
|
cerr << "all sounds but 1 released" << endl;
|
||||||
|
}
|
||||||
cerr << "all sounds released" << endl;
|
cerr << "all sounds released" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user