Exemplo n.º 1
0
        private void GenerateBeat(Beat beat, int startMove)
        {
            // TODO: take care of tripletfeel
            var start    = 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], startMove);
            }

            if (beat.IsRest)
            {
                _handler.AddRest(track.Index, start + startMove, 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, start, duration, startMove, brushInfo);
                }
            }
        }
Exemplo n.º 2
0
        private void GenerateBeat(Beat beat, int barStartTick)
        {
            // TODO: take care of tripletfeel
            var beatStart     = beat.Start;
            var audioDuration = beat.Voice.Bar.IsEmpty
                ? beat.Voice.Bar.MasterBar.CalculateDuration()
                : beat.CalculateDuration();

            var beatLookup = new BeatTickLookup();

            beatLookup.Start = barStartTick + beatStart;
            var realTickOffset = beat.NextBeat == null ? audioDuration : beat.NextBeat.AbsoluteStart - beat.AbsoluteStart;

            beatLookup.End  = barStartTick + beatStart + (realTickOffset > audioDuration ? realTickOffset : audioDuration);
            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, audioDuration, 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);
            }
        }
Exemplo 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];

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

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

                GenerateVibratorWithParams(beat.Voice.Bar.Track, barStartTick + beatStart, beat.CalculateDuration(), phaseLength, bendAmplitude);
            }
        }
Exemplo n.º 4
0
        private void GenerateBeat(Beat beat, int barStartTick, Bar realBar)
        {
            // TODO: take care of tripletfeel
            var beatStart     = beat.PlaybackStart;
            var audioDuration = beat.Voice.Bar.IsEmpty
                ? beat.Voice.Bar.MasterBar.CalculateDuration()
                : beat.PlaybackDuration;

            var beatLookup = new BeatTickLookup();

            beatLookup.Start = barStartTick + beatStart;
            var realTickOffset = beat.NextBeat == null ? audioDuration : beat.NextBeat.AbsolutePlaybackStart - beat.AbsolutePlaybackStart;

            beatLookup.End = barStartTick + beatStart;

            beatLookup.End += (realTickOffset > audioDuration ? realTickOffset : audioDuration);

            // in case of normal playback register playback
            if (realBar == beat.Voice.Bar)
            {
                beatLookup.Beat = beat;
                TickLookup.AddBeat(beatLookup);
            }
            // in case of bar repeats register empty beat
            else
            {
                beatLookup.IsEmptyBar = true;
                beatLookup.Beat       = realBar.Voices[0].Beats[0];
                if (_currentBarRepeatLookup == null)
                {
                    _currentBarRepeatLookup = beatLookup;
                    TickLookup.AddBeat(_currentBarRepeatLookup);
                }
                else
                {
                    _currentBarRepeatLookup.End = beatLookup.End;
                }
            }

            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, audioDuration, brushInfo);
                }
            }

            if (beat.Vibrato != VibratoType.None)
            {
                int phaseLength   = 240;
                int bendAmplitude = 3;
                switch (beat.Vibrato)
                {
                case VibratoType.Slight:
                    phaseLength   = _settings.Vibrato.BeatSlightLength;
                    bendAmplitude = _settings.Vibrato.BeatSlightAmplitude;
                    break;

                case VibratoType.Wide:
                    phaseLength   = _settings.Vibrato.BeatWideLength;
                    bendAmplitude = _settings.Vibrato.BeatWideAmplitude;
                    break;
                }

                GenerateVibratorWithParams(beat.Voice.Bar.Staff.Track, barStartTick + beatStart, beat.PlaybackDuration, phaseLength, bendAmplitude, track.PlaybackInfo.SecondaryChannel);
            }
        }