Reset audio states

Hey!

I am interested in which functions you would reset your ringbuffers if you always store a bit of past audio for your processing and you don’t want this old audio if the user stopped the playback or moved around in the timeline (so when the old audio in the ringbuffers is not connected to the new incoming data).
Should I reset the ringbuffers in reset(), releaseResources() and prepareToPlay() or is it enough to do it in prepareToPlay()?

From my search I guess when the user skips around in the timeline, none of those functions are called and I need to find this out myself in the process function?

Thank you for your help, I am so sure that this topic must have been discussed somewhere but I could not find an answer to this question searching for ringbuffer or fifo reset.

You are right, those functions are not called and you need to do that kind of reset in the process, tracking the playing state.

It is something like:

  info = *getPlayHead()->getPosition();
  if (info.getIsPlaying() && !playingState) resetRing();
  playingState = info.getIsPlaying();

info is a AudioPlayHead and playingState a bool.

1 Like