Samples clipping after playing back a few seconds

I’m playing back sounds with a simple pitch-shifted sample playback, however after a few seconds of adding more samples, the audio starts to “clip.” Any advice on how to avoid this? These are 2 second WAV samples. The code worked in much earlier versions of FMOD. I’m on iOS.

    ERRCHECK(fmodsys_->playSound(sound, 0, true, &channel)); 
    fmodresult_ = channel->setVolume(kVolume);
    ERRCHECK(channel->getFrequency(&channelFrequency));
    ERRCHECK(channel->setFrequency(powf(2.0f,pitchShift/12.0f) * channelFrequency));
    ERRCHECK(channel->setPaused(false));        // This is where the sound really starts

Here’s a video example:

https://streamable.com/q3w4pz

And here’s how I load the sounds:

    FMOD::System_Create(&fmodsys_);
    fmodresult_ = fmodsys_->init(32, FMOD_INIT_NORMAL, NULL);
    ERRCHECK(fmodresult_);
    SetFMODSystem(fmodsys_);
    fmodsys_ = GetFMODSystem();
    fmodresult_ = fmodsys_->createSound(buffer, FMOD_CREATESAMPLE, NULL, &sound);
    ERRCHECK(fmodresult_);

Thanks!

It sound as if there was some stealing applied: the last sound steals the previous ones. This could be in line with the 32 max channel. Is there a release at some point?

I did try upping the max channels, but either get the same problem, or going completely silent.

Do you get the same problem after the same amount of note played, or does it have an impact on that point?

You can see in the video - basically the notes play fine for a few seconds and then start clipping out. Very likely we’re exhausting available channels. The old FMOD used to somehow prioritize newer samples, but somehow the way it works now, we’re getting these sound artifacts. Open to any solution!

I have solved this. It looks like the update() call wasn’t getting called in our code on a per-frame basis. Once that was restored, everything works fine!

fmodsys_->update();