#Having too many loops is lagging the player.

3 messages · Page 1 of 1 (latest)

severe star
#

In my project, I have to loop through the audio too frequently(every ∼4 seconds). In player, whenever it hits that loop, shows the loop part for a split second and decreases my fps from 30 to 22-23.

Is there a way to hide the Loop part in the timeline, or the timeline altogether?(I tried to hide the timeline in the inspector, but got Timeline width is null. error.)

Here's the loop code in my project. Maybe I can approach the code some way else to eliminate the problem?

<Sequence from={0}>
  <Loop durationInFrames={oneLoopDuration}>
    <Audio
      volume={0.02}
      src={staticFile(`key-${i}.wav`)}
      endAt={oneLoopDuration - 10}
    />
  </Loop>
</Sequence>
hollow gorge
severe star
#

Thanks a ton Jonny, that gave me a pretty solid starting point and after many big brain math equation trials, i've made it work.

<Sequence
  from={Math.floor(frame / (oneLoopDuration - soundDelay)) * oneLoopDuration - soundDelay}
>
  <Audio
    volume={0.02}
    src={staticFile(`key-${i}.wav`)}/>
</Sequence>

Now it sticks to the value through duration allows the sequence to play nicely.

And I've came across Config.setMaxTimelineTracks(0);, that alone got rid of the lagging issue, but I wanted to get rid of Loop anyways.