コード例 #1
0
    void DrawFrequencyBands()
    {
        DrawHeader("Beat Frequency Bands");

        int indexToDelete = -1;

        for (int i = 0; i < detector.subBands.Count; i++)
        {
            FrequencyBand band = detector.subBands[i];
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(i.ToString());

            float frequency;
            EditorGUI.BeginChangeCheck();
            frequency = EditorGUILayout.FloatField(band.lowerFrequency);
            EndChangeCheck(() =>
            {
                band.lowerFrequency = frequency;
            });

            EditorGUI.BeginChangeCheck();
            frequency = EditorGUILayout.FloatField(band.higherFrequency);
            EndChangeCheck(() =>
            {
                band.higherFrequency = frequency;
            });

            if (GUILayout.Button("X", EditorStyles.miniButton))
            {
                indexToDelete = i;
            }

            EditorGUILayout.EndHorizontal();
        }

        if (indexToDelete >= 0)
        {
            Undo.RecordObject(detector, "Deleted a band in the beat dector");
            detector.subBands.RemoveAt(indexToDelete);
        }

        EditorGUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Add BeatBand"))
        {
            detector.subBands.Add(new FrequencyBand());
        }
        if (GUILayout.Button("Beat Band Editor"))
        {
            SpectogramWindow.OpenWindow(detector);
        }

        GUILayout.FlexibleSpace();
        EditorGUILayout.EndHorizontal();
    }
コード例 #2
0
 public static void OpenWindow(BeatDetector detector)
 {
     window          = GetWindow <SpectogramWindow>();
     window.detector = detector;
 }
コード例 #3
0
 public static void OpenWindow(BeatDetector detector)
 {
     window = GetWindow<SpectogramWindow>();
     window.detector = detector;
 }