public void GetProperties(out int[] frets, out int[] channels,
                                  out ChordStrum chordStrum,
                                  out bool isSlide,
                                  out bool isSlideReverse,
                                  out bool isHammeron,
                                  out GuitarChordRootNoteConfig rootNoteConfig)
        {
            rootNoteConfig = this.RootNoteConfig.Clone();

            frets    = Utility.Null6.ToArray();
            channels = Utility.Null6.ToArray();
            foreach (var n in Notes)
            {
                frets[n.String]    = n.Fret;
                channels[n.String] = n.Channel;
            }
            var ct = Modifiers.Select(x => (ChordModifierType)x.Type).ToArray();

            chordStrum = ChordStrum.Normal;
            if (ct.Any(x => x == ChordModifierType.ChordStrumHigh))
            {
                chordStrum |= ChordStrum.High;
            }
            if (ct.Any(x => x == ChordModifierType.ChordStrumMed))
            {
                chordStrum |= ChordStrum.Mid;
            }
            if (ct.Any(x => x == ChordModifierType.ChordStrumLow))
            {
                chordStrum |= ChordStrum.Low;
            }
            isSlide        = ct.Any(x => x == ChordModifierType.SlideReverse || x == ChordModifierType.Slide);
            isSlideReverse = ct.Any(x => x == ChordModifierType.SlideReverse);
            isHammeron     = ct.Any(x => x == ChordModifierType.Hammeron);
        }
        public static GuitarChordStrum CreateStrum(GuitarChord chord, ChordStrum strum)
        {
            GuitarChordStrum ret = null;

            if (!chord.HasStrumMode(strum) && Utility.GetStrumData1(chord.Difficulty).IsNotNull())
            {
                ret       = new GuitarChordStrum(chord, strum.GetModifierType());
                ret.IsNew = true;
                ret.CreateEvents();
            }
            return(ret);
        }
        public GuitarChordConfig(int[] frets, int[] channels,
                                 bool isSlide, bool isSlideReverse,
                                 bool isHammeron,
                                 ChordStrum strumMode,
                                 GuitarChordRootNoteConfig rootNoteConfig)
            : this()
        {
            this.RootNoteConfig = rootNoteConfig;
            if (frets != null)
            {
                Frets = frets.ToArray();
            }

            if (channels != null)
            {
                Channels = channels.ToArray();

                if (Frets != null)
                {
                    for (int x = 0; x < Frets.Count(); x++)
                    {
                        if (Frets[x].IsNotNull() && Channels[x].IsNull())
                        {
                            Channels[x] = Utility.ChannelDefault;
                        }
                        else if (Frets[x].IsNull() && Channels[x].IsNotNull())
                        {
                            Channels[x] = Int32.MinValue;
                        }
                    }
                }

                if (Channels.Any(x => x == Utility.ChannelX))
                {
                    for (int x = 0; x < Channels.Count(); x++)
                    {
                        if (Channels[x].IsNotNull())
                        {
                            Channels[x] = Utility.ChannelX;
                        }
                    }
                }
            }
            IsSlide        = isSlide | isSlideReverse;
            IsSlideReverse = isSlideReverse;
            IsHammeron     = isHammeron;
            StrumMode      = strumMode;
        }
        public GuitarChordConfig(int[] frets, int[] channels,
            bool isSlide, bool isSlideReverse,
            bool isHammeron,
            ChordStrum strumMode,
            GuitarChordRootNoteConfig rootNoteConfig)
            : this()
        {
            this.RootNoteConfig = rootNoteConfig;
            if (frets != null)
            {
                Frets = frets.ToArray();
            }

            if (channels != null)
            {
                Channels = channels.ToArray();

                if (Frets != null)
                {
                    for (int x = 0; x < Frets.Count(); x++)
                    {
                        if (Frets[x].IsNotNull() && Channels[x].IsNull())
                        {
                            Channels[x] = Utility.ChannelDefault;
                        }
                        else if (Frets[x].IsNull() && Channels[x].IsNotNull())
                        {
                            Channels[x] = Int32.MinValue;
                        }
                    }
                }

                if (Channels.Any(x => x == Utility.ChannelX))
                {
                    for (int x = 0; x < Channels.Count(); x++)
                    {
                        if (Channels[x].IsNotNull())
                        {
                            Channels[x] = Utility.ChannelX;
                        }
                    }
                }
            }
            IsSlide = isSlide | isSlideReverse;
            IsSlideReverse = isSlideReverse;
            IsHammeron = isHammeron;
            StrumMode = strumMode;
        }
Ejemplo n.º 5
0
        public void AddStrum(ChordStrum strum, bool createEvents)
        {
            if (strum != ChordStrum.Normal && !HasStrum)
            {
                if (strum.HasFlag(ChordStrum.High))
                {
                    var gs = new GuitarChordStrum(this, ChordModifierType.ChordStrumHigh);

                    gs.IsNew = true;

                    Modifiers.Add(gs);

                    if (createEvents)
                    {
                        gs.CreateEvents();
                    }
                }
                if (strum.HasFlag(ChordStrum.Mid))
                {
                    var gs = new GuitarChordStrum(this, ChordModifierType.ChordStrumMed);

                    gs.IsNew = true;

                    Modifiers.Add(gs);

                    if (createEvents)
                    {
                        gs.CreateEvents();
                    }
                }
                if (strum.HasFlag(ChordStrum.Low))
                {
                    var gs = new GuitarChordStrum(this, ChordModifierType.ChordStrumLow);

                    gs.IsNew = true;

                    Modifiers.Add(gs);

                    if (createEvents)
                    {
                        gs.CreateEvents();
                    }
                }
            }
        }
Ejemplo n.º 6
0
        public bool HasStrumMode(ChordStrum strum)
        {
            var ret = false;

            if (strum.HasFlag(ChordStrum.High))
            {
                ret = Modifiers.Any(x => x.ModifierType == ChordModifierType.ChordStrumHigh);
            }
            else if (strum.HasFlag(ChordStrum.Mid))
            {
                ret = Modifiers.Any(x => x.ModifierType == ChordModifierType.ChordStrumMed);
            }
            else if (strum.HasFlag(ChordStrum.Low))
            {
                ret = Modifiers.Any(x => x.ModifierType == ChordModifierType.ChordStrumLow);
            }
            return(ret);
        }
        public static int GetChannelFromStrum(ChordStrum cs)
        {
            int ret = 0;

            switch (cs)
            {
            case ChordStrum.High:
                ret = ChannelStrumHigh;
                break;

            case ChordStrum.Mid:
                ret = ChannelStrumMid;
                break;

            case ChordStrum.Low:
                ret = ChannelStrumLow;
                break;
            }
            return(ret);
        }
Ejemplo n.º 8
0
        public static int GetChannelFromStrum(ChordStrum cs)
        {
            int ret = 0;

            switch (cs)
            {
                case ChordStrum.High:
                    ret = ChannelStrumHigh;
                    break;
                case ChordStrum.Mid:
                    ret = ChannelStrumMid;
                    break;
                case ChordStrum.Low:
                    ret = ChannelStrumLow;
                    break;
            }
            return ret;
        }
        public void GetProperties(out int[] frets, out int[] channels, 
            out ChordStrum chordStrum,
            out bool isSlide,
            out bool isSlideReverse,
            out bool isHammeron,
            out GuitarChordRootNoteConfig rootNoteConfig)
        {
            rootNoteConfig = this.RootNoteConfig.Clone();

            frets = Utility.Null6.ToArray();
            channels = Utility.Null6.ToArray();
            foreach (var n in Notes)
            {
                frets[n.String] = n.Fret;
                channels[n.String] = n.Channel;
            }
            var ct = Modifiers.Select(x => (ChordModifierType)x.Type).ToArray();

            chordStrum = ChordStrum.Normal;
            if (ct.Any(x => x == ChordModifierType.ChordStrumHigh))
            {
                chordStrum |= ChordStrum.High;
            }
            if (ct.Any(x => x == ChordModifierType.ChordStrumMed))
            {
                chordStrum |= ChordStrum.Mid;
            }
            if (ct.Any(x => x == ChordModifierType.ChordStrumLow))
            {
                chordStrum |= ChordStrum.Low;
            }
            isSlide = ct.Any(x => x == ChordModifierType.SlideReverse || x == ChordModifierType.Slide);
            isSlideReverse = ct.Any(x => x == ChordModifierType.SlideReverse);
            isHammeron = ct.Any(x => x == ChordModifierType.Hammeron);
        }