CalculateDuration() public method

Calculates the time spent in this bar. (unit: midi ticks)
public CalculateDuration ( ) : int
return int
Esempio n. 1
0
 private int GetBrushIncrement(Beat beat)
 {
     if (beat.BrushDuration == 0) return 0;
     var duration = beat.CalculateDuration();
     if (duration == 0) return 0;
     return (int)((duration / 8.0) * (4.0 / beat.BrushDuration));
 }
Esempio n. 2
0
 public Spring AddBeatSpring(Beat beat, float beatSize, float preBeatSize)
 {
     return AddSpring(beat.AbsoluteStart, beat.CalculateDuration(), beatSize, preBeatSize);
 }
Esempio n. 3
0
        private void GenerateBeat(Beat beat, int barStartTick)
        {
            // TODO: take care of tripletfeel 
            var beatStart = beat.Start;
            var duration = beat.CalculateDuration();

            var track = beat.Voice.Bar.Track;

            for (int i = 0, j = beat.Automations.Count; i < j; i++)
            {
                GenerateAutomation(beat, beat.Automations[i], barStartTick);
            }

            if (beat.IsRest)
            {
                _handler.AddRest(track.Index, barStartTick + beatStart, track.PlaybackInfo.PrimaryChannel);
            }
            else
            {
                var brushInfo = GetBrushInfo(beat);

                for (int i = 0, j = beat.Notes.Count; i < j; i++)
                {
                    var n = beat.Notes[i];
                    if (n.IsTieDestination) continue;

                    GenerateNote(n, barStartTick + beatStart, duration, brushInfo);
                }
            }
        }
Esempio n. 4
0
        private void GenerateBeat(Beat beat, int barStartTick)
        {
            // TODO: take care of tripletfeel
            var beatStart = beat.Start;
            var duration = beat.CalculateDuration();

            var beatLookup = new BeatTickLookup();
            beatLookup.Start = barStartTick + beatStart;
            beatLookup.End = barStartTick + beatStart + duration;
            beatLookup.Beat = beat;
            TickLookup.AddBeat(beatLookup);

            var track = beat.Voice.Bar.Staff.Track;

            for (int i = 0, j = beat.Automations.Count; i < j; i++)
            {
                GenerateAutomation(beat, beat.Automations[i], barStartTick);
            }

            if (beat.IsRest)
            {
                _handler.AddRest(track.Index, barStartTick + beatStart, track.PlaybackInfo.PrimaryChannel);
            }
            else
            {
                var brushInfo = GetBrushInfo(beat);

                for (int i = 0, j = beat.Notes.Count; i < j; i++)
                {
                    var n = beat.Notes[i];

                    GenerateNote(n, barStartTick + beatStart, duration, brushInfo);
                }
            }

            if (beat.Vibrato != VibratoType.None)
            {
                const int phaseLength = 240; // ticks
                const int bendAmplitude = 3;

                GenerateVibratorWithParams(beat.Voice.Bar.Staff.Track, barStartTick + beatStart, beat.CalculateDuration(), phaseLength, bendAmplitude);
            }
        }