Browse Source

some more tools

Cary Sandvig 25 years ago
parent
commit
25a987f9c8
3 changed files with 34 additions and 0 deletions
  1. 19 0
      panda/src/audio/audio_pool.I
  2. 12 0
      panda/src/audio/audio_pool.cxx
  3. 3 0
      panda/src/audio/audio_pool.h

+ 19 - 0
panda/src/audio/audio_pool.I

@@ -78,3 +78,22 @@ INLINE void AudioPool::release_all_sounds(void) {
 //               in the universe and it constructs itself.
 ////////////////////////////////////////////////////////////////////
 INLINE AudioPool::AudioPool(void) {}
+
+////////////////////////////////////////////////////////////////////
+//     Function: AudioPool::get_num_loaded_sounds
+//       Access: Public, static
+//  Description: return the number of sounds the audiopool thinks
+//               are loaded at the moment
+////////////////////////////////////////////////////////////////////
+INLINE int AudioPool::get_num_loaded_sounds(void) {
+  return get_ptr()->_sounds.size();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: AudioPool::get_nth_sound_name
+//       Access: Public, static
+//  Description: return the name of the nth loaded  sound
+////////////////////////////////////////////////////////////////////
+INLINE string AudioPool::get_nth_sound_name(int n) {
+  return get_ptr()->ns_get_nth_sound_name(n);
+}

+ 12 - 0
panda/src/audio/audio_pool.cxx

@@ -151,3 +151,15 @@ void AudioPool::register_sound_loader(const string& ext,
   }
   (*_sound_loaders)[ext] = func;
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: AudioPool::ns_get_nth_sound_name
+//       Access: Public
+//  Description: return the name of the nth loaded  sound
+////////////////////////////////////////////////////////////////////
+string AudioPool::ns_get_nth_sound_name(int n) const {
+  SoundMap::const_iterator i;
+  int j;
+  for (i=_sounds.begin(), j=0; j<n; ++i, ++j);
+  return (*i).first;
+}

+ 3 - 0
panda/src/audio/audio_pool.h

@@ -22,6 +22,7 @@ private:
   AudioSound* ns_load_sound(Filename filename);
   void ns_release_sound(AudioSound* sound);
   void ns_release_all_sounds(void);
+  string ns_get_nth_sound_name(int) const;
 
   static AudioPool* get_ptr(void);
 
@@ -37,6 +38,8 @@ PUBLISHED:
   INLINE static AudioSound* load_sound(const string& filename);
   INLINE static void release_sound(AudioSound* sound);
   INLINE static void release_all_sounds(void);
+  INLINE static int get_num_loaded_sounds(void);
+  INLINE static string get_nth_sound_name(int);
   static void register_sound_loader(const string&, SoundLoadFunc*);
 };