Lofelt / NiceVibrations

🎮 🚀 Nice Vibrations and Lofelt Studio SDK source code repository
MIT License
125 stars 17 forks source link

Loop Issue #27

Open owllyi opened 1 year ago

owllyi commented 1 year ago

The clip loop is not working, and I suspect it's because the playbackFinishedTimer.Interval setting causes HandleFinishedPlayback to be called. I modified the code so that when looping, Enabled = false, but this still didn't solve the problem. I'd like to ask if anyone has encountered a similar issue and how to make the clip loop play properly?

owllyi commented 1 year ago
        if (remainingPlayDuration > 0.0f)
        {
            if (isPlaybackLooping)
            {
                // Disable timer when looping
                playbackFinishedTimer.Enabled = false;
            }
            else
            {
                // Set Enabled last, Interval will update timer
                playbackFinishedTimer.Interval = remainingPlayDuration * 1000;
                playbackFinishedTimer.AutoReset = false;
                playbackFinishedTimer.Enabled = true;
            }
        }