bool UpdateClapForTracker <T>(uint currentTick, SongObjectTracker <T> tracker, bool clapSettingEnabled) where T : SongObject
    {
        if (tracker.currentIndex < tracker.objects.Count)
        {
            SongObject so         = tracker.objects[tracker.currentIndex];
            bool       shouldClap = false;

            // Advance tracker to the next object that is ahead of the current tick
            while (tracker.currentIndex < tracker.objects.Count && tracker.objects[tracker.currentIndex].tick <= currentTick)
            {
                ++tracker.currentIndex;
                shouldClap = true;
            }

            if (clapSettingEnabled && ObjectCanClap(so) && shouldClap)
            {
                sampleStream.volume = GameSettings.sfxVolume * GameSettings.vol_master;
                sampleStream.pan    = GameSettings.audio_pan;
                sampleStream.Play();

                return(true);
            }
        }

        return(false);
    }
    public override void SystemEnter()
    {
        sampleStream = ChartEditor.Instance.sfxAudioStreams.GetSample(SkinKeys.clap);
        Debug.Assert(sampleStream != null && sampleStream.isValid);

        float currentAudioTime = playFromTime;

        ChartEditor editor      = ChartEditor.Instance;
        Song        currentSong = editor.currentSong;

        uint currentTick = currentSong.TimeToTick(currentAudioTime, currentSong.resolution);

        noteTracker       = new SongObjectTracker <Note>(ChartEditor.Instance.currentChart.notes, currentTick);
        spTracker         = new SongObjectTracker <Starpower>(ChartEditor.Instance.currentChart.starPower, currentTick);
        chartEventTracker = new SongObjectTracker <ChartEvent>(ChartEditor.Instance.currentChart.events, currentTick);
        bpmTracker        = new SongObjectTracker <BPM>(ChartEditor.Instance.currentSong.bpms, currentTick);
        tsTracker         = new SongObjectTracker <TimeSignature>(ChartEditor.Instance.currentSong.timeSignatures, currentTick);
        sectionTracker    = new SongObjectTracker <Section>(ChartEditor.Instance.currentSong.sections, currentTick);
        eventsTracker     = new SongObjectTracker <Event>(ChartEditor.Instance.currentSong.events, currentTick);
    }