summaryrefslogtreecommitdiff
path: root/VRCSDK3Worlds/Assets/VRCSDK/SDK3/Editor/Components3/VRCMidiEditor.cs
blob: 454d8dce306264c662cc26f9f107875f13d83a5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using UnityEditor;
using UnityEngine;
using VRC.SDK3.Midi;
using VRC.SDKBase.Midi;
#if (UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN) && !UNITY_ANDROID
namespace VRC.SDK3.Editor
{
    [CustomEditor(typeof(VRCMidiListener))]
    public class VRCMidiListenerEditor : UnityEditor.Editor
    {
#if UNITY_STANDALONE_WIN
        [RuntimeInitializeOnLoadMethod]
        public static void InitializeMidi()
        {
            VRCMidiHandler.OnLog = (message) => Debug.Log(message);
            VRCMidiHandler.Initialize = () =>
            {
                return VRCMidiHandler.OpenMidiInput<VRCPortMidiInput>(
                    EditorPrefs.GetString(VRCMidiWindow.DEVICE_NAME_STRING));
            };
        }
#endif
    }
}
#endif