<commit_before>using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Drawing;
using System.Windows.Forms;
using PortMidiSharp;

namespace Commons.Music.Midi
{
	public class Mmk : Form
	{
		static readonly List<string> tone_list;

#if CHROMA_TONE
		public const bool ChromaTone = true;
#else
		public const bool ChromaTone = false;
#endif

		static Mmk ()
		{
			tone_list = new List<string> ();
			int n = 0;
			var chars = "\n".ToCharArray ();
			foreach (string s in new StreamReader (typeof (Mmk).Assembly.GetManifestResourceStream ("tonelist.txt")).ReadToEnd ().Split (chars, StringSplitOptions.RemoveEmptyEntries))
				tone_list.Add (n++ + ":" + s);
		}

		public static void Main ()
		{
			Application.Run (new Mmk ());
		}

		public Mmk ()
		{
			SetupMidiDevices ();

			this.Width = 420;
			this.Height = 300;
			this.Text = "MMK: MIDI Keyboard";

			SetupMenus ();

			var statusBar = new StatusBar ();
			Controls.Add (statusBar);

			SetupDeviceSelector ();
			SetupToneSelector ();
			SetupKeyboardLayout (KeyMap.JP106); // FIXME: make it customizible

			var rb = new RadioButton () { Text = "Normal" };
			rb.Location = new Point (30, 30);
			rb.EnabledChanged += delegate { if (rb.Enabled) channel = 0; };
			Controls.Add (rb);

			var rb2 = new RadioButton () { Text = "Drum" };
			rb2.Location = new Point (150, 30);
			rb2.EnabledChanged += delegate { if (rb2.Enabled) channel = 9; };
			Controls.Add (rb2);

			rb.Enabled = true;
		}

		void SetupMidiDevices ()
		{
			Application.ApplicationExit += delegate {
				if (output != null)
					output.Dispose ();
			};

			if (MidiDeviceManager.DefaultOutputDeviceID < 0) {
				MessageBox.Show ("No MIDI device was found.");
				Application.Exit ();
				return;
			}

			foreach (var dev in MidiDeviceManager.AllDevices)
				if (dev.IsOutput)
					output_devices.Add (dev);
			SwitchToDevice (0);
		}

		void SetupMenus ()
		{
			var menu = new MainMenu ();
			var file = new MenuItem ("&File");
			menu.MenuItems.Add (file);<commit_msg>oops, it should be checked, not enabled.<commit_after>using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Drawing;
using System.Windows.Forms;
using PortMidiSharp;

namespace Commons.Music.Midi
{
	public class Mmk : Form
	{
		static readonly List<string> tone_list;

#if CHROMA_TONE
		public const bool ChromaTone = true;
#else
		public const bool ChromaTone = false;
#endif

		static Mmk ()
		{
			tone_list = new List<string> ();
			int n = 0;
			var chars = "\n".ToCharArray ();
			foreach (string s in new StreamReader (typeof (Mmk).Assembly.GetManifestResourceStream ("tonelist.txt")).ReadToEnd ().Split (chars, StringSplitOptions.RemoveEmptyEntries))
				tone_list.Add (n++ + ":" + s);
		}

		public static void Main ()
		{
			Application.Run (new Mmk ());
		}

		public Mmk ()
		{
			SetupMidiDevices ();

			this.Width = 420;
			this.Height = 300;
			this.Text = "MMK: MIDI Keyboard";

			SetupMenus ();

			var statusBar = new StatusBar ();
			Controls.Add (statusBar);

			SetupDeviceSelector ();
			SetupToneSelector ();
			SetupKeyboardLayout (KeyMap.JP106); // FIXME: make it customizible

			var rb = new RadioButton () { Text = "Normal" };
			rb.Location = new Point (30, 30);
			rb.CheckedChanged += delegate { if (rb.Checked) channel = 0; };
			Controls.Add (rb);

			var rb2 = new RadioButton () { Text = "Drum" };
			rb2.Location = new Point (150, 30);
			rb2.CheckedChanged += delegate { if (rb2.Checked) channel = 9; };
			Controls.Add (rb2);

			rb.Enabled = true;
		}

		void SetupMidiDevices ()
		{
			Application.ApplicationExit += delegate {
				if (output != null)
					output.Dispose ();
			};

			if (MidiDeviceManager.DefaultOutputDeviceID < 0) {
				MessageBox.Show ("No MIDI device was found.");
				Application.Exit ();
				return;
			}

			foreach (var dev in MidiDeviceManager.AllDevices)
				if (dev.IsOutput)
					output_devices.Add (dev);
			SwitchToDevice (0);
		}

		void SetupMenus ()
		{
			var menu = new MainMenu ();
			var file = new MenuItem ("&File");
			menu.MenuItems.Add (file);
{'fraction_non_alphanumeric': 0.13085700412721535, 'fraction_numerical': 0.013595532896334061, 'mean_word_length': 3.247422680412371, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1412473', 'n_tokens_mistral': 1640, 'n_tokens_neox': 1341, 'n_words': 365}