Beispiel #1
0
        public void Finish()
        {
            var nextNoteOnLine = new Util.Lazy <Note>(() => NextNoteOnSameLine(this));
            var prevNoteOnLine = new Util.Lazy <Note>(() => PreviousNoteOnSameLine(this));

            // connect ties
            if (IsTieDestination)
            {
                if (prevNoteOnLine.Value == null)
                {
                    IsTieDestination = false;
                }
                else
                {
                    TieOrigin                = prevNoteOnLine.Value;
                    TieOrigin.IsTieOrigin    = true;
                    TieOrigin.TieDestination = this;
                    Fret   = TieOrigin.Fret;
                    Octave = TieOrigin.Octave;
                    Tone   = TieOrigin.Tone;
                }
            }

            // set hammeron/pulloffs
            if (IsHammerPullOrigin)
            {
                if (nextNoteOnLine.Value == null)
                {
                    IsHammerPullOrigin = false;
                }
                else
                {
                    HammerPullDestination = nextNoteOnLine.Value;
                    HammerPullDestination.HammerPullOrigin = this;
                }
            }

            // set slides
            if (SlideType != SlideType.None)
            {
                SlideTarget = nextNoteOnLine.Value;
            }
        }
Beispiel #2
0
        internal void Finish(Settings settings)
        {
            var nextNoteOnLine = new Util.Lazy <Note>(() => NextNoteOnSameLine(this));
            var prevNoteOnLine = new Util.Lazy <Note>(() => PreviousNoteOnSameLine(this));

            var isSongBook = settings != null && settings.DisplayMode == DisplayMode.SongBook;

            // connect ties
            if (IsTieDestination)
            {
                if (prevNoteOnLine.Value == null)
                {
                    IsTieDestination = false;
                }
                else
                {
                    TieOrigin                = prevNoteOnLine.Value;
                    TieOrigin.IsTieOrigin    = true;
                    TieOrigin.TieDestination = this;
                    Fret   = TieOrigin.Fret;
                    Octave = TieOrigin.Octave;
                    Tone   = TieOrigin.Tone;

                    if (TieOrigin.HasBend)
                    {
                        BendOrigin = TieOrigin;
                    }
                }

                // implicit let ring
                if (isSongBook && TieOrigin.IsLetRing)
                {
                    IsLetRing = true;
                }
            }

            // connect letring
            if (IsLetRing)
            {
                if (nextNoteOnLine.Value == null || !nextNoteOnLine.Value.IsLetRing)
                {
                    LetRingDestination = this;
                }
                else
                {
                    LetRingDestination = nextNoteOnLine.Value;
                }

                if (isSongBook && IsTieDestination && !TieOrigin.HasBend)
                {
                    IsVisible = false;
                }
            }


            // connect palmmute
            if (IsPalmMute)
            {
                if (nextNoteOnLine.Value == null || !nextNoteOnLine.Value.IsPalmMute)
                {
                    PalmMuteDestination = this;
                }
                else
                {
                    PalmMuteDestination = nextNoteOnLine.Value;
                }
            }

            if (IsHammerPullOrigin || SlideType == SlideType.Legato)
            {
                IsSlurOrigin    = true;
                SlurDestination = nextNoteOnLine.Value;
                if (!IsSlurDestination)
                {
                    SlurOrigin = this;
                    if (SlurDestination != null)
                    {
                        SlurDestination.SlurOrigin = this;
                    }
                }
                else
                {
                    SlurOrigin.SlurDestination = SlurDestination;
                    if (SlurDestination != null)
                    {
                        SlurDestination.SlurOrigin = SlurOrigin;
                    }
                }
            }

            // set hammeron/pulloffs
            if (IsHammerPullOrigin)
            {
                if (nextNoteOnLine.Value == null)
                {
                    IsHammerPullOrigin = false;
                }
                else
                {
                    HammerPullDestination = nextNoteOnLine.Value;
                    HammerPullDestination.HammerPullOrigin = this;
                }
            }

            // set slides
            switch (SlideType)
            {
            case SlideType.Shift:
            case SlideType.Legato:
                SlideTarget = nextNoteOnLine.Value;
                if (SlideTarget == null)
                {
                    SlideType = SlideType.None;
                }
                break;
            }

            // try to detect what kind of bend was used and cleans unneeded points if required
            // Guitar Pro 6 and above (gpif.xml) uses exactly 4 points to define all bends
            if (BendPoints.Count > 0 && BendType == BendType.Custom)
            {
                var isContinuedBend = IsContinuedBend = TieOrigin != null && TieOrigin.HasBend;
                if (BendPoints.Count == 4)
                {
                    var origin      = BendPoints[0];
                    var middle1     = BendPoints[1];
                    var middle2     = BendPoints[2];
                    var destination = BendPoints[3];

                    // the middle points are used for holds, anything else is a new feature we do not support yet
                    if (middle1.Value == middle2.Value)
                    {
                        // bend higher?
                        if (destination.Value > origin.Value)
                        {
                            if (middle1.Value > destination.Value)
                            {
                                BendType = BendType.BendRelease;
                            }
                            else if (!isContinuedBend && origin.Value > 0)
                            {
                                BendType = BendType.PrebendBend;
                                BendPoints.RemoveAt(2);
                                BendPoints.RemoveAt(1);
                            }
                            else
                            {
                                BendType = BendType.Bend;
                                BendPoints.RemoveAt(2);
                                BendPoints.RemoveAt(1);
                            }
                        }
                        // release?
                        else if (destination.Value < origin.Value)
                        {
                            // origin must be > 0 otherwise it's no release, we cannot bend negative
                            if (isContinuedBend)
                            {
                                BendType = BendType.Release;
                                BendPoints.RemoveAt(2);
                                BendPoints.RemoveAt(1);
                            }
                            else
                            {
                                BendType = BendType.PrebendRelease;
                                BendPoints.RemoveAt(2);
                                BendPoints.RemoveAt(1);
                            }
                        }
                        // hold?
                        else
                        {
                            if (middle1.Value > origin.Value)
                            {
                                BendType = BendType.BendRelease;
                            }
                            else if (origin.Value > 0 && !isContinuedBend)
                            {
                                BendType = BendType.Prebend;
                                BendPoints.RemoveAt(2);
                                BendPoints.RemoveAt(1);
                            }
                            else
                            {
                                BendType = BendType.Hold;
                                BendPoints.RemoveAt(2);
                                BendPoints.RemoveAt(1);
                            }
                        }
                    }
                    else
                    {
                        Logger.Warning("Model", "Unsupported bend type detected, fallback to custom");
                    }
                }
                else if (BendPoints.Count == 2)
                {
                    var origin      = BendPoints[0];
                    var destination = BendPoints[1];

                    // bend higher?
                    if (destination.Value > origin.Value)
                    {
                        if (!isContinuedBend && origin.Value > 0)
                        {
                            BendType = BendType.PrebendBend;
                        }
                        else
                        {
                            BendType = BendType.Bend;
                        }
                    }
                    // release?
                    else if (destination.Value < origin.Value)
                    {
                        // origin must be > 0 otherwise it's no release, we cannot bend negative
                        if (isContinuedBend)
                        {
                            BendType = BendType.Release;
                        }
                        else
                        {
                            BendType = BendType.PrebendRelease;
                        }
                    }
                    // hold?
                    else
                    {
                        BendType = BendType.Hold;
                    }
                }
            }
            else if (BendPoints.Count == 0)
            {
                BendType = BendType.None;
            }
        }
Beispiel #3
0
        public void Finish()
        {
            var nextNoteOnLine = new Util.Lazy<Note>(() => NextNoteOnSameLine(this));
            var prevNoteOnLine = new Util.Lazy<Note>(() => PreviousNoteOnSameLine(this));

            // connect ties
            if (IsTieDestination)
            {
                if (prevNoteOnLine.Value == null)
                {
                    IsTieDestination = false;
                }
                else
                {
                    TieOrigin = prevNoteOnLine.Value;
                    TieOrigin.IsTieOrigin = true;
                    TieOrigin.TieDestination = this;
                    Fret = TieOrigin.Fret;
                }
            }

            // set hammeron/pulloffs
            if (IsHammerPullOrigin)
            {
                if (nextNoteOnLine.Value == null)
                {
                    IsHammerPullOrigin = false;
                }
                else
                {
                    HammerPullDestination = nextNoteOnLine.Value;
                    HammerPullDestination.HammerPullOrigin = this;
                }
            }

            // set slides
            if (SlideType != SlideType.None)
            {
                SlideTarget = nextNoteOnLine.Value;
            }
        }
Beispiel #4
0
 static FontEmbeddedSvgCanvas()
 {
     SvgFontString = new Util.Lazy <string>(LoadSvgFontString);
 }
 static FontEmbeddedSvgCanvas()
 {
     SvgFontString = new Util.Lazy<string>(LoadSvgFontString);
 }