Example #1
0
        public GuitarChord CloneToMemory(GuitarMessageList owner, GuitarDifficulty difficulty)
        {
            GuitarChord ret   = null;
            var         notes = Notes.Select(x => x.CloneToMemory(owner)).Where(x => x != null).ToList();

            if (notes.Any())
            {
                ret = GuitarChord.GetChord(owner, difficulty, notes, false);
                if (ret != null)
                {
                    if (HasSlide)
                    {
                        ret.AddSlide(HasSlideReversed, false);
                    }
                    if (HasStrum)
                    {
                        ret.AddStrum(StrumMode, false);
                    }
                    if (HasHammeron)
                    {
                        ret.AddHammeron(false);
                    }
                }
            }
            return(ret);
        }
Example #2
0
        public static GuitarChord GetChord(GuitarMessageList owner,
                                           GuitarDifficulty difficulty,
                                           TickPair ticks,
                                           GuitarChordConfig config)
        {
            GuitarChord ret = null;

            var lowE = Utility.GetStringLowE(difficulty);

            var notes = new List <GuitarNote>();

            for (int x = 0; x < config.Frets.Length; x++)
            {
                var fret    = config.Frets[x];
                var channel = config.Channels[x];

                if (!fret.IsNull() && fret >= 0 && fret <= 23)
                {
                    var note = GuitarNote.GetNote(owner,
                                                  difficulty, ticks, x, fret,
                                                  channel == Utility.ChannelTap,
                                                  channel == Utility.ChannelArpeggio,
                                                  channel == Utility.ChannelX);

                    if (note != null && note.NoteFretDown.IsNotNull() && note.NoteString.IsNotNull())
                    {
                        notes.Add(note);
                    }
                    else
                    {
                    }
                }
            }

            if (notes.Any())
            {
                ret             = new GuitarChord(owner, ticks, difficulty, notes);
                ret.chordConfig = config.Clone();

                if (ret != null)
                {
                    if (config.IsSlide || config.IsSlideReverse)
                    {
                        ret.AddSlide(config.IsSlideReverse, false);
                    }

                    if (config.IsHammeron)
                    {
                        ret.AddHammeron(false);
                    }

                    ret.AddStrum(config.StrumMode, false);
                }
            }

            return(ret);
        }