Exemple #1
0
        static void Main(string[] args)
        {
            int choice;

            bool[]   setting = new bool[(int)Settings.Exit - (int)Settings.DisplayNotes];
            Slider[] t       = { new Slider(0, 127, 100) };
            setting[0] = true;
            do
            {
                choice = UIGeneric.UI("Select an option", typeof(Menu), ConsoleColor.DarkRed, ConsoleColor.White,
                                      ConsoleColor.Cyan);
                switch (choice)
                {
                case (int)Menu.PlaySongs:
                    PlaySongs(setting);
                    break;

                case (int)Menu.Settings:
                    Setting(ref setting, ref t);
                    break;

                default:
                    break;
                }
            } while (choice != (int)Menu.Exit);
        }
Exemple #2
0
        private static void PlaySongs(bool[] settings)
        {
            MidiOutCaps myCaps       = new MidiOutCaps();
            int         handle       = 0;
            int         deviceNumber = 0;

            midiOutGetDevCaps(0, ref myCaps,
                              (uint)Marshal.SizeOf(myCaps));
            midiOutOpen(ref handle, deviceNumber,
                        null, 0, 0);
            int choice;

            do
            {
                choice = UIGeneric.UI("Select a song", typeof(Songs), ConsoleColor.DarkRed, ConsoleColor.White,
                                      ConsoleColor.Cyan);
                if (choice != (int)Songs.Exit)
                {
                    Note[,] note;
                    string[] arr = PlayTheNotes(choice, out note);
                    if (choice == 5)
                    {
                        NoteIntepereter(handle, PianoString(arr, true, 3), settings[(int)Settings.DisplayNotes - (int)Settings.DisplayNotes]);
                    }
                    else
                    {
                        PlayNote(note, handle, settings[(int)Settings.DisplayNotes - (int)Settings.DisplayNotes]);
                    }

                    Console.WriteLine("Press a button to continue... ");
                    Console.ReadKey(true);
                }
            } while (choice != (int)Songs.Exit);

            midiOutClose(handle);
        }