File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -679,6 +679,30 @@ bool AudioManager::anyPlayingSounds(const std::string &filename) const
679679 return false ;
680680}
681681
682+ int AudioManager::getTotalPlayingSoundCount () const
683+ {
684+ int count = 0 ;
685+
686+ for (const SoundInstance &soundInst : this ->soundInstancesPool .values )
687+ {
688+ if (alIsSource (soundInst.source ) != AL_TRUE)
689+ {
690+ continue ;
691+ }
692+
693+ ALint sourceState;
694+ alGetSourcei (soundInst.source , AL_SOURCE_STATE, &sourceState);
695+ if (sourceState != AL_PLAYING)
696+ {
697+ continue ;
698+ }
699+
700+ count++;
701+ }
702+
703+ return count;
704+ }
705+
682706bool AudioManager::hasNextMusic () const
683707{
684708 return !mNextSong .empty ();
Original file line number Diff line number Diff line change @@ -124,6 +124,8 @@ class AudioManager
124124 // Returns whether the given filename is playing in any sound instance.
125125 bool anyPlayingSounds (const std::string &filename) const ;
126126
127+ int getTotalPlayingSoundCount () const ;
128+
127129 // Sets the music to the given music definition, with an optional music to play first as a
128130 // lead-in to the actual music. If no music definition is given, the current music is stopped.
129131 void setMusic (const MusicDefinition *musicDef, const MusicDefinition *optMusicDef = nullptr );
You can’t perform that action at this time.
0 commit comments