예제 #1
0
        public void CalculateScales(List <Scale> scales, List <Scale> chords, bool bDisplayAll)
        {
            for (int i = 0; i <= 5; i++)
            {
                var note = m_strings[i];
                for (int j = 0; j <= 22; j++)
                {
                    Fret f = new Fret();

                    f = this.Board[i][j];

                    f.Visible = false;
                    f.Color   = Color.Transparent;

                    if (bDisplayAll)
                    {
                        f.Visible = true;
                    }

                    foreach (Scale sc in scales)
                    {
                        ScaleNote scn = sc.GetScaleNote(f.Note);
                        if (scn != null)
                        {
                            if (sc.OverrideScaleColor)
                            {
                                f.Color = sc.ScaleColor;
                            }
                            else
                            {
                                f.Color = scn.Color;
                            }
                            f.IntervalLabel = "";
                            f.Visible       = true;
                            break;
                        }
                    }

                    foreach (Scale ch in chords)
                    {
                        ScaleNote scn = ch.GetScaleNote(f.Note);
                        if (scn != null)
                        {
                            if (scn.NoteType == NoteType.ROOT)
                            {
                                f.Color = ch.ChordRootColor;
                            }
                            else if (scn.NoteType == NoteType.THIRD)
                            {
                                f.Color = ch.Chord3rdColor;
                            }
                            else if (scn.NoteType == NoteType.FIFTH)
                            {
                                f.Color = ch.Chord5thColor;
                            }
                            else if (scn.NoteType == NoteType.SEVENTH)
                            {
                                f.Color = ch.Chord7thColor;
                            }
                            else if (scn.NoteType == NoteType.NINTH)
                            {
                                f.Color = ch.Chord9thColor;
                            }
                            else if (scn.NoteType == NoteType.THIRTEENTH)
                            {
                                f.Color = ch.Chord13thColor;
                            }
                            else
                            {
                                f.Color = scn.Color;
                            }

                            f.IntervalLabel = scn.IntervalName;

                            f.Visible = true;
                        }
                    }
                }
            }
        }
예제 #2
0
        public void CalculateNotes(Notes rootNote)
        {
            ScaleNotes.Clear();
            ScaleNotes.Add(new ScaleNote(rootNote, NoteType.ROOT, Intervals[0]));


            for (int i = 1; i <= Intervals.Count - 1; i++)
            {
                Notes note     = rootNote;
                int   interval = (int)m_intervals[Intervals[i]];


                if ((int)note + interval > 11)
                {
                    note = (Notes)((interval + (int)note) % 12);
                }
                else
                {
                    note += interval;
                }

                ScaleNote sNote = null /* TODO Change to default(_) if this is not a reference type */;

                switch (Intervals[i])
                {
                case "3":
                case "3b":
                {
                    sNote = new ScaleNote(note, NoteType.THIRD, Intervals[i]);
                    break;
                }

                case "5":
                {
                    sNote = new ScaleNote(note, NoteType.FIFTH, Intervals[i]);
                    break;
                }

                case "7":
                case "7b":
                {
                    sNote = new ScaleNote(note, NoteType.SEVENTH, Intervals[i]);
                    break;
                }

                case "13":
                {
                    sNote = new ScaleNote(note, NoteType.THIRTEENTH, Intervals[i]);
                    break;
                }

                case "9":
                {
                    sNote = new ScaleNote(note, NoteType.NINTH, Intervals[i]);
                    break;
                }

                default:
                {
                    if (this.BlueNotes.Contains(Intervals[i]))
                    {
                        sNote = new ScaleNote(note, NoteType.BLUE, Intervals[i]);
                    }
                    else
                    {
                        sNote = new ScaleNote(note, NoteType.SCALE, Intervals[i]);
                    }
                    break;
                }
                }

                ScaleNotes.Add(sNote);
            }
        }