コード例 #1
0
ファイル: Clock.cs プロジェクト: 8ude/FrogRhythms
 public Args(TickValue beatVal, double beatTime, double nextBeatTime, TickMask <bool> beatTickMask)
 {
     BeatVal      = beatVal;
     BeatTime     = beatTime;
     NextBeatTime = nextBeatTime;
     TickMask     = beatTickMask;
 }
コード例 #2
0
ファイル: Clock.cs プロジェクト: 8ude/FrogRhythms
 /// <summary>
 /// Creates a beat mask array based on the number of ticks per measure
 /// </summary>
 void BuildBeatMaskArray()
 {
     _tickMaskArray = new TickMask <bool> [_ticksPerMeasure + 1];
     for (int i = 1; i <= _ticksPerMeasure; i++)
     {
         _tickMaskArray[i] = new TickMask <bool>();  //TODO: See if this impacts performance , used to use != & continue statements before triplets
         if (i % (int)TickValue.ThirtySecond == 0)
         {
             _tickMaskArray[i][TickValue.ThirtySecond] = true;
         }
         if (i % (int)TickValue.SixteenthTriplet == 0)
         {
             _tickMaskArray[i][TickValue.SixteenthTriplet] = true;
         }
         if (i % (int)TickValue.Sixteenth == 0)
         {
             _tickMaskArray[i][TickValue.Sixteenth] = true;
         }
         if (i % (int)TickValue.EighthTriplet == 0)
         {
             _tickMaskArray[i][TickValue.EighthTriplet] = true;
         }
         if (i % (int)TickValue.Eighth == 0)
         {
             _tickMaskArray[i][TickValue.Eighth] = true;
         }
         if (i % (int)TickValue.QuarterTriplet == 0)
         {
             _tickMaskArray[i][TickValue.QuarterTriplet] = true;
         }
         if (i % (int)TickValue.Quarter == 0)
         {
             _tickMaskArray[i][TickValue.Quarter] = true;
         }
         if (i % (int)TickValue.Half == 0)
         {
             _tickMaskArray[i][TickValue.Half] = true;
         }
         if (i % (int)TickValue.Measure == 0)
         {
             _tickMaskArray[i][TickValue.Measure] = true;
         }
     }
 }
コード例 #3
0
ファイル: Clock.cs プロジェクト: 8ude/FrogRhythms
 /// <summary>
 /// Function to update beat counts, called after every new tick
 /// </summary>
 void UpdateBeats()
 {
     if (AudioUpdate != null)
     {
         AudioUpdate();
     }
     TickMask = _tickMaskArray[_tickCounter];
     if (TickMask[TickValue.ThirtySecond])
     {
         if (ThirtySecond != null)
         {
             ThirtySecond(new Args(TickValue.ThirtySecond, _nextThirtySecond,
                                   _nextThirtySecond + _thirtySecondLength, TickMask));
         }
         _nextThirtySecond += _thirtySecondLength;
         _thirtySecondCount++;
     }
     if (TickMask[TickValue.SixteenthTriplet])
     {
         _nextSixteenthTriplet += _sixteenthTripletLength;
     }
     if (TickMask[TickValue.Sixteenth])
     {
         if (Sixteenth != null)
         {
             Sixteenth(new Args(TickValue.Sixteenth, _nextSixteenth,
                                _nextSixteenth + _sixteenthLength, TickMask));
         }
         _nextSixteenth += _sixteenthLength;
     }
     if (TickMask[TickValue.EighthTriplet])
     {
         _nextEighthTriplet += _eighthTripletLength;
     }
     if (TickMask[TickValue.Eighth])
     {
         if (Eighth != null)
         {
             Eighth(new Args(TickValue.Eighth, _nextEighth,
                             _nextEighth + _eighthLength, TickMask));
         }
         _nextEighth += _eighthLength;
     }
     if (TickMask[TickValue.QuarterTriplet])
     {
         _nextQuarterTriplet += _quarterTripletLength;
     }
     if (TickMask[TickValue.Quarter])
     {
         if (Beat != null)
         {
             Beat(new Args(TickValue.Quarter, _nextQuarter,
                           _nextQuarter + _quarterLength, TickMask));
         }
         _nextQuarter += _quarterLength;
     }
     if (TickMask[TickValue.Half])
     {
         _nextHalf += _halfLength;
     }
     if (TickMask[TickValue.Measure])
     {
         if (Measure != null)
         {
             Measure(new Args(TickValue.Measure, _nextMeasure,
                              _nextMeasure + _measureLength, TickMask));
         }
         _nextMeasure += _measureLength;
         //_thirtySecondCount = 0;
     }
 }