示例#1
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);
        }
示例#2
0
        public static GuitarChord CreateChord(GuitarMessageList owner, GuitarDifficulty difficulty, TickPair ticks,
                                              GuitarChordConfig config)
        {
            GuitarChord ret = null;

            ret = GetChord(owner, difficulty, ticks, config);

            if (ret != null)
            {
                ret.IsNew = true;
                ret.CreateEvents();
            }
            return(ret);
        }
示例#3
0
        public GuitarChord(MidiEventPair pair)
            : base(pair, GuitarMessageType.GuitarChord)
        {
            Notes           = new GuitarChordNoteList(this);
            Modifiers       = new List <ChordModifier>();
            ChordNameEvents = new GuitarChordNameList(this);

            chordConfig = new GuitarChordConfig()
            {
                Frets          = this.NoteFrets.ToArray(),
                Channels       = this.NoteChannels.ToArray(),
                IsHammeron     = this.HasHammeron,
                IsSlide        = this.HasSlide,
                IsSlideReverse = this.HasSlideReversed,
                StrumMode      = this.StrumMode,
            };
        }
示例#4
0
        public GuitarChord(GuitarMessageList owner, TickPair pair, GuitarDifficulty difficulty, IEnumerable <GuitarNote> notes)
            : base(owner, pair, GuitarMessageType.GuitarChord)
        {
            Notes           = new GuitarChordNoteList(this);
            Modifiers       = new List <ChordModifier>();
            ChordNameEvents = new GuitarChordNameList(this);

            Notes.SetNotes(notes);
            SetTicks(pair);

            chordConfig = new GuitarChordConfig()
            {
                Frets          = this.NoteFrets.ToArray(),
                Channels       = this.NoteChannels.ToArray(),
                IsHammeron     = this.HasHammeron,
                IsSlide        = this.HasSlide,
                IsSlideReverse = this.HasSlideReversed,
                StrumMode      = this.StrumMode,
            };
        }