diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index 6c6c68d4a8..9e4f7a9296 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -296,7 +296,6 @@ class ShowBase(DirectObject.DirectObject): self.physicsMgrEnabled = 0 self.physicsMgrAngular = 0 - self.createBaseAudioManagers() self.createStats() self.AppHasAudioFocus = 1 @@ -384,6 +383,8 @@ class ShowBase(DirectObject.DirectObject): else: ShowBase.notify.info('__dev__ == %s' % __dev__) + self.createBaseAudioManagers() + # set up recording of Functor creation stacks in __dev__ PythonUtil.recordFunctorCreationStacks() diff --git a/panda/src/display/graphicsEngine.cxx b/panda/src/display/graphicsEngine.cxx index 22b2b876f8..5d3c109c46 100644 --- a/panda/src/display/graphicsEngine.cxx +++ b/panda/src/display/graphicsEngine.cxx @@ -630,8 +630,7 @@ remove_all_windows() { // a hack, since it's not really related to removing windows, this // would nevertheless be a fine time to ensure the model cache (if // any) has been flushed to disk. - BamCache *cache = BamCache::get_global_ptr(); - cache->flush_index(); + BamCache::flush_global_index(); // And, hey, let's stop the vertex paging threads, if any. VertexDataPage::stop_threads(); @@ -716,8 +715,7 @@ render_frame() { // Since this gets called every frame, we should take advantage of // the opportunity to flush the cache if necessary. - BamCache *cache = BamCache::get_global_ptr(); - cache->consider_flush_index(); + BamCache::consider_flush_global_index(); // Anything that happens outside of GraphicsEngine::render_frame() // is deemed to be App. diff --git a/panda/src/putil/bamCache.I b/panda/src/putil/bamCache.I index 3d2906e36c..9527bd0a83 100644 --- a/panda/src/putil/bamCache.I +++ b/panda/src/putil/bamCache.I @@ -257,6 +257,32 @@ get_global_ptr() { return _global_ptr; } +//////////////////////////////////////////////////////////////////// +// Function: BamCache::consider_flush_global_index +// Access: Published, Static +// Description: If there is a global BamCache object, calls +// consider_flush_index() on it. +//////////////////////////////////////////////////////////////////// +INLINE void BamCache:: +consider_flush_global_index() { + if (_global_ptr != (BamCache *)NULL) { + _global_ptr->consider_flush_index(); + } +} + +//////////////////////////////////////////////////////////////////// +// Function: BamCache::flush_global_index +// Access: Published, Static +// Description: If there is a global BamCache object, calls +// flush_index() on it. +//////////////////////////////////////////////////////////////////// +INLINE void BamCache:: +flush_global_index() { + if (_global_ptr != (BamCache *)NULL) { + _global_ptr->flush_index(); + } +} + //////////////////////////////////////////////////////////////////// // Function: BamCache::mark_index_stale // Access: Private diff --git a/panda/src/putil/bamCache.h b/panda/src/putil/bamCache.h index beab547935..f0615111a1 100644 --- a/panda/src/putil/bamCache.h +++ b/panda/src/putil/bamCache.h @@ -83,6 +83,8 @@ PUBLISHED: void list_index(ostream &out, int indent_level = 0) const; INLINE static BamCache *get_global_ptr(); + INLINE static void consider_flush_global_index(); + INLINE static void flush_global_index(); private: void read_index();