From dd2b9274209be493529ef7e8f1d36c7190329678 Mon Sep 17 00:00:00 2001 From: cxgeorge <> Date: Tue, 8 Oct 2002 03:04:54 +0000 Subject: [PATCH] add exclusive mode --- panda/src/audio/audioManager.cxx | 7 +++++++ panda/src/audio/audioManager.h | 10 ++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/panda/src/audio/audioManager.cxx b/panda/src/audio/audioManager.cxx index 00e9c8d3b2..69f133d86b 100644 --- a/panda/src/audio/audioManager.cxx +++ b/panda/src/audio/audioManager.cxx @@ -41,6 +41,7 @@ register_AudioManager_creator(Create_AudioManager_proc* proc) { } + // Factory method for getting a platform specific AudioManager: PT(AudioManager) AudioManager:: create_AudioManager() { @@ -78,7 +79,13 @@ create_AudioManager() { if (!am->is_valid()) { am = create_NullAudioManger(); } + am->_bExclusive = false; return am; } +void AudioManager:: +set_mutually_exclusive(bool bExclusive) { + _bExclusive = bExclusive; +} + diff --git a/panda/src/audio/audioManager.h b/panda/src/audio/audioManager.h index 50059e7795..cd27d07c0d 100644 --- a/panda/src/audio/audioManager.h +++ b/panda/src/audio/audioManager.h @@ -36,11 +36,8 @@ PUBLISHED: // my_sound = MySoundEffects.get_sound("neatSfx.mp3"); // my_music = MyMusicManager.get_sound("introTheme.mid"); - // bOneAtATime: if true, turn off any currently-playing sounds before playing - // a new one (useful for midi songs) -static PT(AudioManager) create_AudioManager(/*bool bOneAtATime*/); + static PT(AudioManager) create_AudioManager(); virtual ~AudioManager() {} - virtual bool is_valid() = 0; // Get a sound: @@ -56,6 +53,10 @@ static PT(AudioManager) create_AudioManager(/*bool bOneAtATime*/); virtual void set_cache_limit(int count) = 0; virtual int get_cache_limit() = 0; + // if set, turn off any currently-playing sounds before playing + // a new one (useful for midi songs) + void set_mutually_exclusive(bool bExclusive); + // Control volume: // FYI: // If you start a sound with the volume off and turn the volume @@ -81,6 +82,7 @@ public: protected: static Create_AudioManager_proc* _create_AudioManager; + bool _bExclusive; AudioManager() { // intentionally blank.