示例#1
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            cbMidiDevices.Items.Clear();
            List <ComboboxItem> midiDevicesComboBoxItems = new List <ComboboxItem>();

            foreach (InputDevice inputDevice in InputDevice.GetAll())
            {
                midiDevicesComboBoxItems.Add(new ComboboxItem {
                    Name = inputDevice.Name, Value = inputDevice.Id
                });
            }

            cbMidiDevices.DataSource    = midiDevicesComboBoxItems;
            cbMidiDevices.DisplayMember = "Name";
            cbMidiDevices.ValueMember   = "Value";
            cbMidiDevices.DropDownStyle = ComboBoxStyle.DropDownList;


            cbSerialPorts.Items.Clear();
            List <ComboboxItem> serialPortsComboBoxItems = new List <ComboboxItem>();

            foreach (string serialPortName in SerialPort.GetPortNames())
            {
                serialPortsComboBoxItems.Add(new ComboboxItem {
                    Name = serialPortName, Value = -1
                });
            }

            cbSerialPorts.DataSource    = serialPortsComboBoxItems;
            cbSerialPorts.DisplayMember = "Name";
            cbSerialPorts.ValueMember   = "Value";
            cbSerialPorts.DropDownStyle = ComboBoxStyle.DropDownList;
        }
        /// <summary>
        /// Will look for any MIDI input devices connected to your computer.
        /// </summary>
        private void ScanDevices()
        {
            DeviceComboBox.Items.Clear();

            foreach (InputDevice device in InputDevice.GetAll())
            {
                DeviceComboBox.Items.Add($"{device.Name } ID:{device.Id}");
            }
        }
示例#3
0
        public static List <string> GetKeyboardList()
        {
            var ret = new List <string>();

            foreach (var device in InputDevice.GetAll())
            {
                ret.Add(device.Name + "|" + device.Id);
            }

            return(ret);
        }
示例#4
0
        private void RefreshDevices()
        {
            InputCombo.Items.Clear();
            foreach (InputDevice device in InputDevice.GetAll())
            {
                InputCombo.Items.Add(device.Name);
            }
            InputCombo.SelectedIndex = InputCombo.Items.Count - 1;

            OutputCombo.Items.Clear();
            foreach (OutputDevice device in OutputDevice.GetAll())
            {
                OutputCombo.Items.Add(device.Name);
            }
            OutputCombo.SelectedIndex = OutputCombo.Items.Count - 1;
        }
示例#5
0
        public MainWindowVM()
        {
            SynthData = new SynthData();
            Synth     = new Synth(SynthData);

            Pitch = 60;

            Synth.Play();

            MIDIDeviceNames = InputDevice
                              .GetAll()
                              .Select(inputDevice => inputDevice.Name)
                              .ToArray();

            Synth.InputDevice = InputDevice.GetByName("Axiom A.I.R. Mini32");
        }
示例#6
0
 private void Form1_Load(object sender, EventArgs e)
 {
     timer1.Start();
     foreach (var midid in InputDevice.GetAll())
     {
         comboBox1.Items.Add(midid.Name + "(" + midid.DriverManufacturer + ")");
     }
     foreach (var midid in InputDevice.GetAll())
     {
         comboBox2.Items.Add(midid.Name + "(" + midid.DriverManufacturer + ")");
     }
     foreach (var name in SerialPort.GetPortNames())
     {
         comboBox3.Items.Add(name);
     }
     comboBox1.SelectedIndex = 0;
     comboBox3.SelectedIndex = 0;
     comboBox4.SelectedIndex = 0;
 }
示例#7
0
        private void InitOrRefreshDevicesList()
        {
            this.SuspendLayout();

            if (InputDevice.GetDevicesCount() != nbInputDevices)
            {
                nbInputDevices = InputDevice.GetDevicesCount();
                InputDevicesComboBox.Items.Clear();
                InputDevicesComboBox.Items.Add("Choose midi input source");
                InputDevicesComboBox.Items.Add("Midi events from network");
                InputDevice.GetAll().ToList().ForEach(inputDevice => InputDevicesComboBox.Items.Add(inputDevice.Name));
                if (inputDeviceName != null && InputDevicesComboBox.Items.Contains(inputDeviceName))
                {
                    InputDevicesComboBox.SelectedItem = inputDeviceName;
                }
                else
                {
                    InputDevicesComboBox.SelectedIndex = 0;
                }
            }

            if (OutputDevice.GetDevicesCount() != nbOutputDevices)
            {
                nbOutputDevices = OutputDevice.GetDevicesCount();
                OutputDevicesComboBox.Items.Clear();
                OutputDevicesComboBox.Items.Add("Choose midi output destination");
                OutputDevicesComboBox.Items.Add("Midi events to network");
                OutputDevice.GetAll().ToList().ForEach(outputDevice => OutputDevicesComboBox.Items.Add(outputDevice.Name));
                if (outputDeviceName != null && OutputDevicesComboBox.Items.Contains(outputDeviceName))
                {
                    OutputDevicesComboBox.SelectedItem = outputDeviceName;
                }
                else
                {
                    OutputDevicesComboBox.SelectedIndex = 0;
                }
            }
            this.ResumeLayout();
        }
示例#8
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <InputDevice> GetInputMidiDevices()
 {
     return(InputDevice.GetAll());
 }
示例#9
0
 public void FindInputDevice(string deviceName)
 {
     Assert.IsTrue(
         InputDevice.GetAll().Any(d => d.Name == deviceName),
         $"There is no device '{deviceName}' in the system.");
 }
 public IEnumerable <string> GetInputDevices()
 {
     return(InputDevice.GetAll().Select(d => d.Name).AsEnumerable());
 }
示例#11
0
		private static void DrawDebugWindow()
		{
			//ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, new Vector2(5, 0));
			if (ImGui.Begin("MIDIBARD DEBUG", ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.AlwaysAutoResize))
			{
				try
				{
					ImGui.TextUnformatted($"AgentModule: {AgentManager.AgentModule.ToInt64():X}");
					ImGui.SameLine();
					if (ImGui.SmallButton("C##AgentModule")) ImGui.SetClipboardText($"{AgentManager.AgentModule.ToInt64():X}");

					ImGui.TextUnformatted($"UiModule: {AgentManager.UiModule.ToInt64():X}");
					ImGui.SameLine();
					if (ImGui.SmallButton("C##4")) ImGui.SetClipboardText($"{AgentManager.UiModule.ToInt64():X}");
					ImGui.TextUnformatted($"AgentCount:{AgentManager.Agents.Count}");
				}
				catch (Exception e)
				{
					ImGui.TextUnformatted(e.ToString());
				}

				ImGui.Separator();
				try
				{
					ImGui.TextUnformatted($"AgentPerformance: {PerformanceAgent.Pointer.ToInt64():X}");
					ImGui.SameLine();
					if (ImGui.SmallButton("C##AgentPerformance")) ImGui.SetClipboardText($"{PerformanceAgent.Pointer.ToInt64():X}");

					ImGui.TextUnformatted($"AgentID: {PerformanceAgent.Id}");

					ImGui.TextUnformatted($"notePressed: {notePressed}");
					ImGui.TextUnformatted($"noteNumber: {noteNumber}");
					ImGui.TextUnformatted($"InPerformanceMode: {InPerformanceMode}");
					ImGui.TextUnformatted($"Timer1: {TimeSpan.FromMilliseconds(PerformanceTimer1)}");
					ImGui.TextUnformatted($"Timer2: {TimeSpan.FromTicks(PerformanceTimer2 * 10)}");
				}
				catch (Exception e)
				{
					ImGui.TextUnformatted(e.ToString());
				}

				ImGui.Separator();

				try
				{
					ImGui.TextUnformatted($"AgentMetronome: {MetronomeAgent.Pointer.ToInt64():X}");
					ImGui.SameLine();
					if (ImGui.SmallButton("C##AgentMetronome")) ImGui.SetClipboardText($"{MetronomeAgent.Pointer.ToInt64():X}");
					ImGui.TextUnformatted($"AgentID: {MetronomeAgent.Id}");


					ImGui.TextUnformatted($"Running: {MetronomeRunning}");
					ImGui.TextUnformatted($"Ensemble: {EnsembleModeRunning}");
					ImGui.TextUnformatted($"BeatsElapsed: {MetronomeBeatsElapsed}");
					ImGui.TextUnformatted($"PPQN: {MetronomePPQN} ({60_000_000 / (double)MetronomePPQN:F3}bpm)");
					ImGui.TextUnformatted($"BeatsPerBar: {MetronomeBeatsperBar}");
					ImGui.TextUnformatted($"Timer1: {TimeSpan.FromMilliseconds(MetronomeTimer1)}");
					ImGui.TextUnformatted($"Timer2: {TimeSpan.FromTicks(MetronomeTimer2 * 10)}");
				}
				catch (Exception e)
				{
					ImGui.TextUnformatted(e.ToString());
				}



				ImGui.Separator();
				try
				{
					ImGui.TextUnformatted($"PerformInfos: {PerformInfos.ToInt64() + 3:X}");
					ImGui.SameLine();
					if (ImGui.SmallButton("C##PerformInfos")) ImGui.SetClipboardText($"{PerformInfos.ToInt64() + 3:X}");
					ImGui.TextUnformatted($"CurrentInstrumentKey: {CurrentInstrument}");
					ImGui.TextUnformatted($"Instrument: {InstrumentSheet.GetRow(CurrentInstrument).Instrument}");
					ImGui.TextUnformatted($"Name: {InstrumentSheet.GetRow(CurrentInstrument).Name.RawString}");
					ImGui.TextUnformatted($"Tone: {CurrentGroupTone}");
					//ImGui.Text($"unkFloat: {UnkFloat}");
					////ImGui.Text($"unkByte: {UnkByte1}");
				}
				catch (Exception e)
				{
					ImGui.TextUnformatted(e.ToString());
				}

				ImGui.Separator();
				ImGui.TextUnformatted($"currentPlaying: {PlaylistManager.CurrentPlaying}");
				ImGui.TextUnformatted($"currentSelected: {PlaylistManager.CurrentSelected}");
				ImGui.TextUnformatted($"FilelistCount: {PlaylistManager.Filelist.Count}");
				ImGui.TextUnformatted($"currentUILanguage: {pluginInterface.UiLanguage}");

				ImGui.Separator();
				try
				{
					//var devicesList = DeviceManager.Devices.Select(i => i.ToDeviceString()).ToArray();


					//var inputDevices = DeviceManager.Devices;
					////ImGui.BeginListBox("##auofhiao", new Vector2(-1, ImGui.GetTextLineHeightWithSpacing()* (inputDevices.Length + 1)));
					//if (ImGui.BeginCombo("Input Device", DeviceManager.CurrentInputDevice.ToDeviceString()))
					//{
					//	if (ImGui.Selectable("None##device", DeviceManager.CurrentInputDevice is null))
					//	{
					//		DeviceManager.DisposeDevice();
					//	}
					//	for (int i = 0; i < inputDevices.Length; i++)
					//	{
					//		var device = inputDevices[i];
					//		if (ImGui.Selectable($"{device.Name}##{i}", device.Id == DeviceManager.CurrentInputDevice?.Id))
					//		{
					//			DeviceManager.SetDevice(device);
					//		}
					//	}
					//	ImGui.EndCombo();
					//}



					//ImGui.EndListBox();

					//if (ImGui.ListBox("##????", ref InputDeviceID, devicesList, devicesList.Length))
					//{
					//	if (InputDeviceID == 0)
					//	{
					//		DeviceManager.DisposeDevice();
					//	}
					//	else
					//	{
					//		DeviceManager.SetDevice(InputDevice.GetByName(devicesList[InputDeviceID]));
					//	}
					//}

					if (ImGui.SmallButton("Start Event Listening"))
					{
						DeviceManager.CurrentInputDevice?.StartEventsListening();
					}
					ImGui.SameLine();
					if (ImGui.SmallButton("Stop Event Listening"))
					{
						DeviceManager.CurrentInputDevice?.StopEventsListening();
					}

					ImGui.TextUnformatted($"InputDevices: {InputDevice.GetDevicesCount()}\n{string.Join("\n", InputDevice.GetAll().Select(i => $"[{i.Id}] {i.Name}"))}");
					ImGui.TextUnformatted($"OutputDevices: {OutputDevice.GetDevicesCount()}\n{string.Join("\n", OutputDevice.GetAll().Select(i => $"[{i.Id}] {i.Name}({i.DeviceType})"))}");

					ImGui.TextUnformatted($"CurrentInputDevice: \n{DeviceManager.CurrentInputDevice} Listening: {DeviceManager.CurrentInputDevice?.IsListeningForEvents}");
					ImGui.TextUnformatted($"CurrentOutputDevice: \n{CurrentOutputDevice}");
				}
				catch (Exception e)
				{
					PluginLog.Error(e.ToString());
				}

				#region Generator

				//ImGui.Separator();

				//if (ImGui.BeginChild("Generate", new Vector2(size - 5, 150), false, ImGuiWindowFlags.NoDecoration))
				//{
				//	ImGui.DragInt("length##keyboard", ref config.testLength, 0.05f);
				//	ImGui.DragInt("interval##keyboard", ref config.testInterval, 0.05f);
				//	ImGui.DragInt("repeat##keyboard", ref config.testRepeat, 0.05f);
				//	if (config.testLength < 0)
				//	{
				//		config.testLength = 0;
				//	}

				//	if (config.testInterval < 0)
				//	{
				//		config.testInterval = 0;
				//	}

				//	if (config.testRepeat < 0)
				//	{
				//		config.testRepeat = 0;
				//	}

				//	if (ImGui.Button("generate##keyboard"))
				//	{
				//		try
				//		{
				//			testplayback?.Dispose();

				//		}
				//		catch (Exception e)
				//		{
				//			//
				//		}

				//		static Pattern GetSequence(int octave)
				//		{
				//			return new PatternBuilder()
				//				.SetRootNote(Note.Get(NoteName.C, octave))
				//				.SetNoteLength(new MetricTimeSpan(0, 0, 0, config.testLength))
				//				.SetStep(new MetricTimeSpan(0, 0, 0, config.testInterval))
				//				.Note(Interval.Zero)
				//				.StepForward()
				//				.Note(Interval.One)
				//				.StepForward()
				//				.Note(Interval.Two)
				//				.StepForward()
				//				.Note(Interval.Three)
				//				.StepForward()
				//				.Note(Interval.Four)
				//				.StepForward()
				//				.Note(Interval.Five)
				//				.StepForward()
				//				.Note(Interval.Six)
				//				.StepForward()
				//				.Note(Interval.Seven)
				//				.StepForward()
				//				.Note(Interval.Eight)
				//				.StepForward()
				//				.Note(Interval.Nine)
				//				.StepForward()
				//				.Note(Interval.Ten)
				//				.StepForward()
				//				.Note(Interval.Eleven)
				//				.StepForward().Build();
				//		}

				//		static Pattern GetSequenceDown(int octave)
				//		{
				//			return new PatternBuilder()
				//				.SetRootNote(Note.Get(NoteName.C, octave))
				//				.SetNoteLength(new MetricTimeSpan(0, 0, 0, config.testLength))
				//				.SetStep(new MetricTimeSpan(0, 0, 0, config.testInterval))
				//				.Note(Interval.Eleven)
				//				.StepForward()
				//				.Note(Interval.Ten)
				//				.StepForward()
				//				.Note(Interval.Nine)
				//				.StepForward()
				//				.Note(Interval.Eight)
				//				.StepForward()
				//				.Note(Interval.Seven)
				//				.StepForward()
				//				.Note(Interval.Six)
				//				.StepForward()
				//				.Note(Interval.Five)
				//				.StepForward()
				//				.Note(Interval.Four)
				//				.StepForward()
				//				.Note(Interval.Three)
				//				.StepForward()
				//				.Note(Interval.Two)
				//				.StepForward()
				//				.Note(Interval.One)
				//				.StepForward()
				//				.Note(Interval.Zero)
				//				.StepForward()
				//				.Build();
				//		}

				//		Pattern pattern = new PatternBuilder()

				//			.SetNoteLength(new MetricTimeSpan(0, 0, 0, config.testLength))
				//			.SetStep(new MetricTimeSpan(0, 0, 0, config.testInterval))

				//			.Pattern(GetSequence(3))
				//			.Pattern(GetSequence(4))
				//			.Pattern(GetSequence(5))
				//			.SetRootNote(Note.Get(NoteName.C, 5))
				//			.StepForward()
				//			.Note(Interval.Twelve)
				//			.Pattern(GetSequenceDown(5))
				//			.Pattern(GetSequenceDown(4))
				//			.Pattern(GetSequenceDown(3))
				//			// Get pattern
				//			.Build();

				//		var repeat = new PatternBuilder().Pattern(pattern).Repeat(config.testRepeat).Build();

				//		testplayback = repeat.ToTrackChunk(TempoMap.Default).GetPlayback(TempoMap.Default, Plugin.CurrentOutputDevice,
				//			new MidiClockSettings() { CreateTickGeneratorCallback = () => new HighPrecisionTickGenerator() });
				//	}

				//	ImGui.SameLine();
				//	if (ImGui.Button("chord##keyboard"))
				//	{
				//		try
				//		{
				//			testplayback?.Dispose();

				//		}
				//		catch (Exception e)
				//		{
				//			//
				//		}

				//		var pattern = new PatternBuilder()
				//			//.SetRootNote(Note.Get(NoteName.C, 3))
				//			//C-G-Am-(G,Em,C/G)-F-(C,Em)-(F,Dm)-G
				//			.SetOctave(Octave.Get(3))
				//			.SetStep(new MetricTimeSpan(0, 0, 0, config.testInterval))
				//			.Chord(Chord.GetByTriad(NoteName.C, ChordQuality.Major)).Repeat(config.testRepeat)
				//			.Chord(Chord.GetByTriad(NoteName.G, ChordQuality.Major)).Repeat(config.testRepeat)
				//			.Chord(Chord.GetByTriad(NoteName.A, ChordQuality.Minor)).Repeat(config.testRepeat)
				//			.Chord(Chord.GetByTriad(NoteName.G, ChordQuality.Major)).Repeat(config.testRepeat)
				//			.Chord(Chord.GetByTriad(NoteName.F, ChordQuality.Major)).Repeat(config.testRepeat)
				//			.Chord(Chord.GetByTriad(NoteName.C, ChordQuality.Major)).Repeat(config.testRepeat)
				//			.Chord(Chord.GetByTriad(NoteName.F, ChordQuality.Major)).Repeat(config.testRepeat)
				//			.Chord(Chord.GetByTriad(NoteName.G, ChordQuality.Major)).Repeat(config.testRepeat)

				//			.Build();

				//		testplayback = pattern.ToTrackChunk(TempoMap.Default).GetPlayback(TempoMap.Default, Plugin.CurrentOutputDevice,
				//			new MidiClockSettings() { CreateTickGeneratorCallback = () => new HighPrecisionTickGenerator() });
				//	}

				//	ImGui.Spacing();
				//	if (ImGui.Button("play##keyboard"))
				//	{
				//		try
				//		{
				//			testplayback?.MoveToStart();
				//			testplayback?.Start();
				//		}
				//		catch (Exception e)
				//		{
				//			PluginLog.Error(e.ToString());
				//		}
				//	}

				//	ImGui.SameLine();
				//	if (ImGui.Button("dispose##keyboard"))
				//	{
				//		try
				//		{
				//			testplayback?.Dispose();
				//		}
				//		catch (Exception e)
				//		{
				//			PluginLog.Error(e.ToString());
				//		}
				//	}

				//	try
				//	{
				//		ImGui.TextUnformatted($"{testplayback.GetDuration(TimeSpanType.Metric)}");
				//	}
				//	catch (Exception e)
				//	{
				//		ImGui.TextUnformatted("null");
				//	}
				//	//ImGui.SetNextItemWidth(120);
				//	//UIcurrentInstrument = Plugin.CurrentInstrument;
				//	//if (ImGui.ListBox("##instrumentSwitch", ref UIcurrentInstrument, InstrumentSheet.Select(i => i.Instrument.ToString()).ToArray(), (int)InstrumentSheet.RowCount, (int)InstrumentSheet.RowCount))
				//	//{
				//	//	Task.Run(() => SwitchInstrument.SwitchTo((uint)UIcurrentInstrument));
				//	//}

				//	//if (ImGui.Button("Quit"))
				//	//{
				//	//	Task.Run(() => SwitchInstrument.SwitchTo(0));
				//	//}

				//	ImGui.EndChild();
				//}

				#endregion

				ImGui.End();
			}
			//ImGui.PopStyleVar();

		}
示例#12
0
        static void Main(string[] args)
        {
            state = new KeyboardState();
            Console.WriteLine("Keyboard state initialized");
            //Load configs
            try
            {
                cursor = new CursorState(Settings.Default.cursorSettingFile);
                cursor.Move(0, 0);
                Console.WriteLine("Cursor state initialized");
            }
            catch (Exception e)
            {
                Console.WriteLine("Error reading cursor config");
                Console.ReadLine();
                return;
            }
            try
            {
                bindings = new KeyBindings(Settings.Default.keyBindingFile);
                Console.WriteLine("Keybindings loaded");
            }
            catch (Exception e)
            {
                Console.WriteLine("Error reading keybindings");
                Console.ReadLine();
                return;
            }
            var deviceList = InputDevice.GetAll().ToList();

            //If there are no midi devices fall back into a demo mode
            if (deviceList.Count == 0)
            {
                Console.WriteLine("No midi input device found");
                Console.ReadLine();
                Console.WriteLine("Doing cursor move demo");
                cursor.Move(1, 0);
                Console.ReadLine();
                cursor.Move(0, 1);
                Console.ReadLine();
                cursor.Move(-1, 0);
                Console.ReadLine();
                cursor.Move(0, -1);
                Console.ReadLine();
                Console.WriteLine("Doing binding test");
                Console.WriteLine("Pressing key 62");
                Console.ReadLine();
                state.PressKey(64);
                bindings.ProcessState(state, cursor);
                Console.ReadLine();
                return;
            }
            Console.WriteLine("Using midi device:");
            //Get first available midi device and start event loop, wait for keypress to avoid quitting the program without busy loop
            for (int i = 0; i < deviceList.Count; i++)
            {
                try
                {
                    Console.WriteLine(deviceList[i].ProductIdentifier);
                    Console.WriteLine(deviceList[i].Name);
                    using (var inputDevice = deviceList[i])
                    {
                        inputDevice.EventReceived += OnEventReceived;
                        inputDevice.StartEventsListening();

                        Console.ReadLine();
                    }
                }
                catch (Exception e)
                {
                }
            }
        }
示例#13
0
        private static void Main()
        {
            Console.WriteLine("WELCOME TO MIDI PRACTICE\n");
            Console.WriteLine("Select gametype by typing number (1 to 4) and hitting ENTER.\n\n");
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("1: Score Attack");
            Console.WriteLine("2: Score Attack - Text To Speech DISABLED");
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("3: Endless Mode");
            Console.WriteLine("4: Endless Mode - Text To Speech DISABLED");
            Console.ResetColor();
            bool endlessMode = EndlessOrScore();

            Console.ForegroundColor = endlessMode ? ConsoleColor.Cyan : ConsoleColor.Yellow;
            Console.WriteLine(endlessMode ? EndlessModeASCII : ScoreAttackASCII);
            Console.WriteLine("Select difficulty by typing number (1 to 5) and hitting ENTER.\n\n");
            Console.ResetColor();
            Console.WriteLine("1: Numpad\n    Numbers 0 to 9, no MIDI keyboard required!\n");
            Console.WriteLine("2: Basic\n    White keys only, notes are always natural.\n");
            Console.WriteLine("3: Regular\n    White keys are always natural, and black keys are always sharp.\n");
            Console.WriteLine("4: Semi-Advanced\n    White keys are always natural, and black keys can be either sharp or flat.\n");
            Console.WriteLine("5: Advanced\n    White keys are NOT always natural, and black keys can be either sharp or flat.\n");
            Console.WriteLine("x: Exit\n");
            bool   game       = int.TryParse(Console.ReadLine(), out int gameDifficulty); // get the game difficulty the user selected
            string modeString = endlessMode ? "Endless Mode." : "Score Attack - 20 rounds.";

            switch (gameDifficulty)
            {
            case 1:
                Console.WriteLine("Numpad selected. \n" + (endlessMode ? modeString : "Score Attack - 30 rounds."));
                break;

            case 2:
                Console.WriteLine("Basic selected. \n" + modeString);
                break;

            case 3:
                Console.WriteLine("Regular selected. \n" + modeString);
                break;

            case 4:
                Console.WriteLine("Semi-Advanced selected. \n" + modeString);
                break;

            case 5:
                Console.WriteLine("Advanced selected. \n" + modeString);
                break;

            default:
                Console.WriteLine("Press ENTER to exit.");
                break;
            }
            OutputDevice outputDevice = null;
            InputDevice  inputDevice  = null;

            if (game)
            {
                outputDevice            = SelectMidiDevice(OutputDevice.GetAll().ToList()); // get output device
                outputDevice.EventSent += EmptyEvent;
                if (gameDifficulty > 1)
                {
                    inputDevice = SelectMidiDevice(InputDevice.GetAll().ToList()); // get input device for MIDI mode
                    if (inputDevice == default)                                    // if no input devices, default to Numpad
                    {
                        gameDifficulty          = 1;
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("A MIDI keyboard is required for this difficulty! Starting Numpad instead.\nPress ENTER to continue.");
                        Console.ResetColor();
                        Console.ReadLine();
                    }
                }
            }
            while (game)                                                          // we're playing
            {
                GameCode(endlessMode, gameDifficulty, outputDevice, inputDevice); // the game is in here
                Console.WriteLine("Want to play again? Type Y to replay the game.");
                if (Console.ReadLine().ToLower() != "y")                          // if the user doesn't want to play
                {
                    game = false;                                                 // change the game bool to false
                    Console.WriteLine("\nPress ENTER to exit.");
                }
            }
            if (inputDevice != null)
            {
                inputDevice.Dispose(); // always dispose your IDisposables when you're done with them
            }
            if (outputDevice != null)
            {
                outputDevice.Dispose(); // always dispose your IDisposables when you're done with them
            }
            Console.ReadLine();
        }