예제 #1
0
        public static Progression decreasePitch(Progression progression)
        {
            string inputError = "\nI'm sorry that was not a valid coice." +
                                "\nPlease try again.";

            if (progression.getSize() == 0)
            {
                System.Console.WriteLine("\nThere are no chords in your progression.");
            }
            else
            {
                bool   validChoice = false;
                string choice;
                int    i;
                while (validChoice == false)
                {
                    System.Console.WriteLine("\nWhat chord would you like lower?");
                    for (i = 1; i <= progression.getSize(); i++)
                    {
                        System.Console.WriteLine(i + ") " + progression.getChord(i - 1).getName());
                    }
                    choice = System.Console.ReadLine();
                    for (i = 1; i <= progression.getSize(); i++)
                    {
                        if (choice == i.ToString())
                        {
                            validChoice = true;
                            if (TabController.checkPitchRange(progression.getTabPitch(i) - 1, progression.getChord(i - 1).getNoteAt(0), progression.getGuitar()))
                            {
                                progression.changeTabPitch(i, progression.getTabPitch(i) - 1);
                                System.Console.WriteLine("\n" + progression.getChord(i - 1).getName() + " has been lowered");
                            }
                            else
                            {
                                System.Console.WriteLine("\nThis chord cannot be lowered any further");
                            }
                        }
                    }
                    if (validChoice == false)
                    {
                        System.Console.WriteLine(inputError);
                    }
                }
            }
            return(progression);
        }