예제 #1
0
        // Token: 0x060000D2 RID: 210 RVA: 0x000049D4 File Offset: 0x00002BD4
        public int NearestSnapPointBeat(int snapResolution, int offset)
        {
            SyncTrackSection syncTrack = this.chart.SyncTrack;
            int num = 0;

            if (offset > this.lastTSOffset)
            {
                num = this.lastTSOffset;
            }
            else
            {
                foreach (int index in this.tSInd)
                {
                    if (syncTrack[index].Offset < offset)
                    {
                        num = syncTrack[index].Offset;
                    }
                }
            }
            num += (offset - num) / snapResolution * snapResolution;
            int num2 = 0;

            while (Math.Abs(offset - (num + num2)) <= Math.Abs(offset - (num + num2 - snapResolution)))
            {
                num2 += snapResolution;
            }
            return(num + num2 - snapResolution);
        }
예제 #2
0
 // Token: 0x060000D1 RID: 209 RVA: 0x00004774 File Offset: 0x00002974
 public void DetectTimeSignatures(SyncTrackSection sT)
 {
     this.beat.Clear();
     this.tSInd = new List <int>();
     for (int i = 0; i < sT.Count; i++)
     {
         if (sT[i].Type == SyncType.TimeSignature)
         {
             this.tSInd.Add(i);
         }
     }
     for (int i = 0; i < this.tSInd.Count; i++)
     {
         int timeSignature = sT[this.tSInd[i]].TimeSignature;
         int offset        = sT[this.tSInd[i]].Offset;
         if (this.tSInd.Count == i + 1)
         {
             this.beat.Add(beatType.Measure);
             this.lastTSOffset = offset;
             this.lastTS       = timeSignature;
             break;
         }
         int offset2 = sT[this.tSInd[i + 1]].Offset;
         for (int j = offset; j < offset2; j += this.chart.HalfResolution)
         {
             int num = j - offset;
             if (num % (this.chart.Resolution * timeSignature) == 0)
             {
                 this.beat.Add(beatType.Measure);
             }
             else if (num % this.chart.Resolution == 0)
             {
                 this.beat.Add(beatType.Beat);
             }
             else if (num % this.chart.HalfResolution == 0)
             {
                 this.beat.Add(beatType.HalfBeat);
             }
             else if (num % this.chart.QuarterResolution == 0)
             {
                 this.beat.Add(beatType.QuarterBeat);
             }
             else if (num % this.chart.EighthResolution == 0)
             {
                 this.beat.Add(beatType.EighthBeat);
             }
             else if (num % this.chart.SixteenthResolution == 0)
             {
                 this.beat.Add(beatType.SixteenthBeat);
             }
             else
             {
                 this.beat.Add(beatType.NotABeat);
             }
         }
     }
 }