Example #1
0
        void PartInfoLine()
        {
            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("Add Part"))
            {
                currentPart = music.NewPart();
            }

            if (music.GetPartsNum() > 1)
            {
                if (GUILayout.Button("Remove Part"))
                {
                    music.RemovePart(currentPart);
                    currentPart = music.GetPart(0);
                }
            }

            string[] Timbres = new string[] { "PULSE", "TRIANGLE", "SINE", "SQUARE", "SAWTOOTH", "NOISE" };
            int      newtype = EditorGUILayout.Popup((int)type, Timbres);

            if (newtype != (int)type)
            {
                type = (SoundGenType)newtype;
                currentPart.Timbre = type;
            }

            int n = 0;

            string[] names = new string[music.GetPartsNum()];
            for (int i = 0; i < music.GetPartsNum(); i++)
            {
                names[i] = "part " + (i + 1);
                if (music.GetPart(i) == currentPart)
                {
                    n = i;
                }
            }

            int sel = GUILayout.Toolbar(n, names);

            currentPart = music.GetPart(sel);
            type        = currentPart.Timbre;

            EditorGUILayout.EndHorizontal();
        }