void OnGUI()
    {
        if (window == null)
        {
            window        = EditorWindow.GetWindow(typeof(MIDIEditor)) as MIDIEditor;
            oneFrameDelay = false;
            return;
        }

        if (!midiINInitialized || !midiOUTInitialized)
        {
            EditorGUILayout.HelpBox("Initializing MIDI. Please wait....", MessageType.Info);
            oneFrameDelay = false;
            return;
        }

        if (!oneFrameDelay)
        {
            oneFrameDelay = true;
            return;
        }

        if (!oneFrameDelay)
        {
            oneFrameDelay = true;
            EditorGUILayout.HelpBox("Waiting one frame...", MessageType.Info);
            return;
        }

        DrawINOUT();

        if (GUILayout.Button("Clear"))
        {
            messages = "";
        }

        scrollMessages = GUILayout.BeginScrollView(scrollMessages);
        messages       = GUILayout.TextArea(messages, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
        GUILayout.EndScrollView();

        if (debug)
        {
            GUILayout.Label("Connected IN Devices : " + MidiINPlugin.GetConnectedDeviceCount().ToString());
            GUILayout.Label("Connected OUT Devices : " + MidiOUTPlugin.GetConnectedDeviceCount().ToString());
        }

        debug = GUILayout.Toggle(debug, "Debug");
    }
 static void Init()
 {
     window = EditorWindow.GetWindow(typeof(MIDIEditor)) as MIDIEditor;
     window.titleContent = new GUIContent("MIDI");
 }