Inheritance: MonoBehaviour
Ejemplo n.º 1
0
    public override void Awake()
    {
        base.Awake();

        rawSpectrum = new float[spectrumSamples];
        bandLevels  = new float[numberOfBands];
        mic         = VJMicrophone.GetInstance();
        rawData     = null;
    }
Ejemplo n.º 2
0
    public override void Awake()
    {
        base.Awake();

        rawSpectrum = new float[spectrumSamples];
        bandLevels = new float[numberOfBands];
        mic = VJMicrophone.GetInstance();
        rawData = null;
    }
Ejemplo n.º 3
0
    public static VJMicrophone GetInstance()
    {
        if( !s_instance ) {
            GameObject go = new GameObject();
            go.name = "VJMicrophone";
            DontDestroyOnLoad(go);
            s_instance = go.AddComponent<VJMicrophone>();
            var asObj = go.AddComponent<AudioSource>() as AudioSource;
            asObj.volume = 1.0f;
            asObj.mute = true;
            asObj.loop = true;
            asObj.playOnAwake = false;
        }

        return s_instance;
    }
Ejemplo n.º 4
0
    public static VJMicrophone GetInstance()
    {
        if (!s_instance)
        {
            GameObject go = new GameObject();
            go.name = "VJMicrophone";
            DontDestroyOnLoad(go);
            s_instance = go.AddComponent <VJMicrophone>();
            var asObj = go.AddComponent <AudioSource>() as AudioSource;
            asObj.volume      = 1.0f;
            asObj.mute        = true;
            asObj.loop        = true;
            asObj.playOnAwake = false;
        }

        return(s_instance);
    }
Ejemplo n.º 5
0
    public override void OnInspectorGUI()
    {
        VJMicrophone mic = target as VJMicrophone;

        GUI.changed = false;

        base.OnInspectorGUI();

        string[] deviceNames = new string[Microphone.devices.Length];
        deviceNames[0] = "";
        int index = 0;

        for (int i = 0; i < Microphone.devices.Length; i++)
        {
            deviceNames[i] = Microphone.devices[i];
            if (Microphone.devices[i] == mic.deviceName)
            {
                index = i;
            }
        }

        if (mic.deviceName == null || mic.deviceName.Length == 0)
        {
            index = 0;
        }

        EditorGUILayout.BeginHorizontal();


        index          = EditorGUILayout.Popup("Mic Device", index, deviceNames);
        mic.deviceName = deviceNames[index];
        PlayerPrefs.SetString("VJMicrophone.deviceName", mic.deviceName);

        EditorGUILayout.EndHorizontal();

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }
    }