Exemple #1
0
        static public void ResetChordRootStepsModeAndInversion(SevenChord chordo)
        {
            for (int n = 0; n < 4; n++)
            {
                for (int m = 0; m < 6; m++)
                {
                    for (int i = 0; i < 4; i++)
                    {
                        var neuChord = new SevenChord(chordo.ChordNotes[n], GetChordFormula(chordo.ChordType), (SevenChordMode)m, (SevenChordInversion)i);

                        var notesNeu  = neuChord.ChordNotes.OrderBy(n2 => n2.getNoteNumber()).ToArray().Select(nn => nn.nameOfTheNote).ToList();
                        var notesOrig = chordo.ChordNotes.OrderBy(n2 => n2.getNoteNumber()).ToArray().Select(nn => nn.nameOfTheNote).ToList();

                        if (
                            notesNeu[0] == notesOrig[0] &&
                            notesNeu[1] == notesOrig[1] &&
                            notesNeu[2] == notesOrig[2] &&
                            notesNeu[3] == notesOrig[3]
                            )
                        {
                            JustNote[] notes = new JustNote[4];
                            notes[0] = chordo.ChordNotes[0];
                            notes[1] = chordo.ChordNotes[1];
                            notes[2] = chordo.ChordNotes[2];
                            notes[3] = chordo.ChordNotes[3];

                            chordo.ChordNotes[0] = notes.Where(no => no.nameOfTheNote == neuChord.ChordNotes[0].nameOfTheNote).First();
                            chordo.ChordNotes[1] = notes.Where(no => no.nameOfTheNote == neuChord.ChordNotes[1].nameOfTheNote).First();
                            chordo.ChordNotes[2] = notes.Where(no => no.nameOfTheNote == neuChord.ChordNotes[2].nameOfTheNote).First();
                            chordo.ChordNotes[3] = notes.Where(no => no.nameOfTheNote == neuChord.ChordNotes[3].nameOfTheNote).First();


                            chordo.Mode      = neuChord.Mode;
                            chordo.Inversion = neuChord.Inversion;
                            return;
                        }
                    }
                }
            }
        }
        static public void ResetTriadRootStepsModeAndInversion(Triad triad)
        {
            for (int n = 0; n < 3; n++)
            {
                for (int m = 0; m < 2; m++)
                {
                    for (int i = 0; i < 3; i++)
                    {
                        var neuTriad = new Triad(triad.ChordNotes[n], GetChordFormula(triad.TriadType), (TriadMode)m, (TriadInversion)i);

                        var notesNeu  = neuTriad.ChordNotes.OrderBy(n2 => n2.getNoteNumber()).ToArray().Select(nn => nn.nameOfTheNote).ToList();
                        var notesOrig = triad.ChordNotes.OrderBy(n2 => n2.getNoteNumber()).ToArray().Select(nn => nn.nameOfTheNote).ToList();

                        if (
                            notesNeu[0] == notesOrig[0] &&
                            notesNeu[1] == notesOrig[1] &&
                            notesNeu[2] == notesOrig[2]
                            )
                        {
                            JustNote[] notes = new JustNote[4];
                            notes[0] = triad.ChordNotes[0];
                            notes[1] = triad.ChordNotes[1];
                            notes[2] = triad.ChordNotes[2];

                            triad.ChordNotes[0] = notes.Where(no => no.nameOfTheNote == neuTriad.ChordNotes[0].nameOfTheNote).First();
                            triad.ChordNotes[1] = notes.Where(no => no.nameOfTheNote == neuTriad.ChordNotes[1].nameOfTheNote).First();
                            triad.ChordNotes[2] = notes.Where(no => no.nameOfTheNote == neuTriad.ChordNotes[2].nameOfTheNote).First();

                            triad.Mode      = neuTriad.Mode;
                            triad.Inversion = neuTriad.Inversion;
                            return;
                        }
                    }
                }
            }
        }