コード例 #1
0
 public void ProgressionTest_getChordNames()
 {
     _progression = new Progression();
     _progression.addChord(ChordFactory.getChordByName("C"));
     Assert.AreEqual("C", _progression.getChordNames());
     _progression.addChord(ChordFactory.getChordByName("Am7"));
     Assert.AreEqual("C, Am7", _progression.getChordNames());
     _progression.addChord(ChordFactory.getChordByName("G#(add9)"));
     Assert.AreEqual("C, Am7, G#(add9)", _progression.getChordNames());
 }
コード例 #2
0
        public static Progression menuTwo(Progression progression)
        {
            string inputError = "\nI'm sorry that was not a valid coice." +
                                "\nPlease try again.";
            bool   back = false;
            string answer;

            while (back == false)
            {
                if (progression.getSize() == 0)
                {
                    System.Console.WriteLine("\nThere are no chords in your progression");
                }
                else
                {
                    System.Console.WriteLine("\nThe current chords in your progression are: \n" + progression.getChordNames());
                }
                System.Console.WriteLine("\nWhat would you like to do?" +
                                         "\n1) Add a chord" +
                                         "\n2) Replace a chord" +
                                         "\n3) Swap two chords" +
                                         "\n4) Remove a chord" +
                                         "\n5) See more information about a chord" +
                                         "\n6) Add a chord by recomendation" +
                                         "\n7) Back to main menu");
                answer = System.Console.ReadLine();
                if (answer == "1")
                {
                    progression = addChord(progression);
                }
                else if (answer == "2")
                {
                    progression = replaceChord(progression);
                }
                else if (answer == "3")
                {
                    progression = swapChords(progression);
                }
                else if (answer == "4")
                {
                    progression = removeChord(progression);
                }
                else if (answer == "5")
                {
                    examineChords(progression);
                }
                else if (answer == "6")
                {
                    progression = addRecomendedChord(progression);
                }
                else if (answer == "7")
                {
                    back = true;
                }
                else
                {
                    System.Console.WriteLine(inputError);
                }
            }
            return(progression);
        }
コード例 #3
0
        public static Progression menuThree(Progression progression)
        {
            string inputError = "\nI'm sorry that was not a valid coice." +
                                "\nPlease try again.";
            bool   back = false;
            string answer;

            while (back == false)
            {
                if (progression.getSize() == 0)
                {
                    System.Console.WriteLine("\nThere are no chords in your progression");
                }
                else
                {
                    System.Console.WriteLine("\nThe current tablature is:");
                    System.Console.WriteLine("  " + progression.getChordNames());
                    string spacing;
                    int    spacingSize;
                    string stringOne = "";
                    string stringTwo = "";
                    string stringThree = "";
                    string stringFour = "";
                    string stringFive = "";
                    string stringSix = "";
                    int    i, j;
                    // i = chord, j = string
                    for (i = 1; i <= progression.getSize(); i++)
                    {
                        spacingSize = progression.getChord(i - 1).getName().ToCharArray().Count();
                        spacing     = "";
                        for (j = 0; j < spacingSize; j++)
                        {
                            spacing = spacing + " ";
                        }
                        stringOne   = stringOne + " " + progression.getTabNumber(i, 1) + spacing;
                        stringTwo   = stringTwo + " " + progression.getTabNumber(i, 2) + spacing;
                        stringThree = stringThree + " " + progression.getTabNumber(i, 3) + spacing;
                        stringFour  = stringFour + " " + progression.getTabNumber(i, 4) + spacing;
                        stringFive  = stringFive + " " + progression.getTabNumber(i, 5) + spacing;
                        stringSix   = stringSix + " " + progression.getTabNumber(i, 6) + spacing;
                    }
                    System.Console.WriteLine("T" + stringOne);
                    System.Console.WriteLine("T" + stringTwo);
                    System.Console.WriteLine("A" + stringThree);
                    System.Console.WriteLine("A" + stringFour);
                    System.Console.WriteLine("B" + stringFive);
                    System.Console.WriteLine("B" + stringSix);
                }
                System.Console.WriteLine("\nWhat would you like to do?" +
                                         "\n1) Swap two chords" +
                                         "\n2) Increase the pitch of a chord" +
                                         "\n3) Decrease the pitch of a chord" +
                                         "\n4) Back to main menu");

                answer = System.Console.ReadLine();
                if (answer == "1")
                {
                    progression = swapChords(progression);
                }
                else if (answer == "2")
                {
                    progression = increasePitch(progression);
                }
                else if (answer == "3")
                {
                    progression = decreasePitch(progression);
                }
                else if (answer == "4")
                {
                    back = true;
                }
                else
                {
                    System.Console.WriteLine(inputError);
                }
            }
            return(progression);
        }
コード例 #4
0
        static void Main(string[] args)
        {
            string      answer;
            bool        exit        = false;
            Progression progression = new Progression();
            string      inputError  = "\nI'm sorry that was not a valid coice." +
                                      "\nPlease try again.";

            System.Console.WriteLine("------------Chordnomicon-----------" +
                                     "\nThis is an application that helps" +
                                     "\ncomposers write chord progresssions ");
            while (exit == false)
            {
                System.Console.WriteLine("\nThe current key is: " + progression.getKey().getName() +
                                         "\n The current mode is: " + progression.getMode().getName() +
                                         "\n The current tuning is: " + progression.getTuning());
                if (progression.getSize() == 0)
                {
                    System.Console.WriteLine("There are no chords in your progression");
                }
                else
                {
                    System.Console.WriteLine("The current chords in your progression are: \n" + progression.getChordNames());
                }
                System.Console.WriteLine("\nWhat would you like to do?" +
                                         "\n1) Change the key, mode or tuning" +
                                         "\n2) Add or modify a chord" +
                                         "\n3) View tablature of current chords" +
                                         "\n4) Quit the program");
                answer = System.Console.ReadLine();
                if (answer == "1")
                {
                    progression = menuOne(progression);
                }
                else if (answer == "2")
                {
                    progression = menuTwo(progression);
                }
                else if (answer == "3")
                {
                    progression = menuThree(progression);
                }
                else if (answer == "4")
                {
                    exit = true;
                    System.Console.WriteLine("Goodbye");
                }
                else
                {
                    System.Console.WriteLine(inputError);
                }
            }
        }