FMOD CORE API | Channel mamangment

,

Hi

I’m a FMOD newbie (working on iOS). I’m want to enforce that no more than 24 sounds will be played in my app, so I init FMOD system with 24 channels.
I’m checking current playing channels (getChannelsPlaying) before I try to play a sound, if it’s exceeded 24 I just don’t play that sound.
The problem comes after a while when I reach to that limit (not once), I can’t play new sounds because all channels are occupied.
I would expect that on the next update() you will cleared the non playing channels, but it doesn’t happen every time.
Some times I need to go to bg and come back, keep playing a lot of channel simultaneously so I will exceed 24 limit, in order to reproduce it. But when I get to the problematic state, one channel or no channel at all is freed on each update, even if I let it rest for a while (keep calling to update()).

If you initialize FMOD with 24 channels , then when you play new sounds, old ones will be stolen.
If you don’t call System::update() , voice management won’t work properly.
If you say they are still occupied, have you tried checking if they’re actually still playing or not? Use isPlaying on your voices. If you have them looping then they will continue to play until you call stop().

Going back to the first point, the new playSound always succeeds, and it will kick out one of the other voices, unless you are taking things a step further and setting the sound default priority settings? (a low priority sound will not steal a higher priority sound playing on a channel). I will assume not because you probably would have mentioned it.

You might need to check all your result codes, im sure there would be errors happening if a sound didn’t play. Are you checking the result from playSound?

Thanks Brett
My problem was that I just set my looped channels as pause(true) instead of calling to stop method when I actually want it to be stopped, hence the channels were not cleaned up :slight_smile: