diff --git a/panda/src/audio/nullAudioManager.cxx b/panda/src/audio/nullAudioManager.cxx index 6697cd7c3f..a672879567 100644 --- a/panda/src/audio/nullAudioManager.cxx +++ b/panda/src/audio/nullAudioManager.cxx @@ -19,34 +19,83 @@ #include "nullAudioManager.h" -NullAudioManager::NullAudioManager() { + +//////////////////////////////////////////////////////////////////// +// Function: NullAudioManager::NullAudioManager +// Access: +// Description: +//////////////////////////////////////////////////////////////////// +NullAudioManager:: +NullAudioManager() { audio_info("NullAudioManager"); } -NullAudioManager::~NullAudioManager() { +//////////////////////////////////////////////////////////////////// +// Function: NullAudioManager::~NullAudioManager +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +NullAudioManager:: +~NullAudioManager() { // intentionally blank. } - -AudioSound* NullAudioManager::get_sound(const string&) { + +//////////////////////////////////////////////////////////////////// +// Function: NullAudioManager::get_sound +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +PT(AudioSound) NullAudioManager:: +get_sound(const string&) { return new NullAudioSound(); } -void NullAudioManager::drop_sound(const string&) { +//////////////////////////////////////////////////////////////////// +// Function: NullAudioManager::drop_sound +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +void NullAudioManager:: +drop_sound(const string&) { // intentionally blank. } -void NullAudioManager::set_volume(float) { +//////////////////////////////////////////////////////////////////// +// Function: NullAudioManager::set_volume +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +void NullAudioManager:: +set_volume(float) { // intentionally blank. } -float NullAudioManager::get_volume() { +//////////////////////////////////////////////////////////////////// +// Function: NullAudioManager::get_volume +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +float NullAudioManager:: +get_volume() { return 0; } - -void NullAudioManager::set_active(bool) { + +//////////////////////////////////////////////////////////////////// +// Function: NullAudioManager::set_active +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +void NullAudioManager:: +set_active(bool) { // intentionally blank. } -bool NullAudioManager::get_active() { +//////////////////////////////////////////////////////////////////// +// Function: NullAudioManager::get_active +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +bool NullAudioManager:: +get_active() { return 0; } diff --git a/panda/src/audio/nullAudioManager.h b/panda/src/audio/nullAudioManager.h index bfe36a1863..09ab995308 100644 --- a/panda/src/audio/nullAudioManager.h +++ b/panda/src/audio/nullAudioManager.h @@ -23,33 +23,21 @@ #include "audioManager.h" #include "nullAudioSound.h" -#define NAME_MACRO_FOR_AUDIO_MANAGER() NullAudioManager - class EXPCL_PANDA NullAudioManager : public AudioManager { + // All of these methods are stubbed out to some degree. + // If you're looking for a starting place for a new AudioManager, + // please consider looking at the milesAudioManager. + public: NullAudioManager(); virtual ~NullAudioManager(); - // Get a sound: - // You own this sound. Be sure to delete it when you're done. - virtual AudioSound* get_sound(const string&); - // Tell the AudioManager there is no need to keep this one cached. + virtual PT(AudioSound) get_sound(const string&); virtual void drop_sound(const string&); - // Control volume: - // FYI: - // If you start a sound with the volume off and turn the volume - // up later, you'll hear the sound playing at that late point. virtual void set_volume(float); virtual float get_volume(); - // Turn the manager on an off. - // If you play a sound while the manager is inactive, it won't start. - // If you deactivate the manager while sounds are playing, they'll - // stop. - // If you activate the manager while looping sounds are playing - // (those that have a loop_count of zero), - // they will start playing from the begining of their loop. virtual void set_active(bool); virtual bool get_active(); }; diff --git a/panda/src/audio/nullAudioSound.cxx b/panda/src/audio/nullAudioSound.cxx index d4eb7adf71..2263a4100e 100644 --- a/panda/src/audio/nullAudioSound.cxx +++ b/panda/src/audio/nullAudioSound.cxx @@ -85,7 +85,8 @@ bool NullAudioSound::get_active() const { } const string& NullAudioSound::get_name() const { - return ""; + static const string blank=""; + return blank; } float NullAudioSound::length() const { diff --git a/panda/src/audio/nullAudioSound.h b/panda/src/audio/nullAudioSound.h index d3c3f1fe9a..312b5aeccc 100644 --- a/panda/src/audio/nullAudioSound.h +++ b/panda/src/audio/nullAudioSound.h @@ -27,51 +27,36 @@ // It's used as a placeholder when you don't want a sound // system. class EXPCL_PANDA NullAudioSound : public AudioSound { + // All of these methods are stubbed out to some degree. + // If you're looking for a starting place for a new AudioManager, + // please consider looking at the milesAudioManager. + public: ~NullAudioSound(); - // For best compatability, set the loop_count, start_time, - // volume, and balance, prior to calling play(). You may - // set them while they're playing, but it's implementation - // specific whether you get the results. void play(); void stop(); - // loop: 0 = play once; 1 = play forever. - // inits to false. void set_loop(bool); bool get_loop() const; - // loop_count: 0 = forever; 1 = play once; n = play n times. - // inits to 1. void set_loop_count(unsigned long); unsigned long get_loop_count() const; - // start_time: 0 = begining; length() = end. - // inits to 0.0. void set_time(float); float get_time() const; - // 0 = minimum; 1.0 = maximum. - // inits to 1.0. void set_volume(float); float get_volume() const; - // -1.0 is hard left - // 0.0 is centered - // 1.0 is hard right - // inits to 0.0. void set_balance(float); float get_balance() const; - // inits to manager's state. void set_active(bool); bool get_active() const; - // There is no set_name(), this is intentional. const string& get_name() const; - // return: playing time in seconds. float length() const; AudioSound::SoundStatus status() const;