Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     // Targets the player's position
     player = GameObject.FindWithTag("Player");
     // Gets an instance of the MicControlC script from the target variable
     mic = player.GetComponent<MicControlC> ();
 }
Exemplo n.º 2
0
        // Use this for initialization
        private void Start()
        {
            _micControl = GetComponent <MicControlC>();

            _analysisData = new float[SampleCount];
            GetComponent <AudioSource>().mute = true;
        }
Exemplo n.º 3
0
    public override void OnInspectorGUI()
    {
        MicControlC micCon = (MicControlC)target;

        float micInputValue = micCon.loudness;

        VolumeReader(micInputValue / 100, "Loudness " + micInputValue);

        EditorUtility.SetDirty(target);

        DrawDefaultInspector();
    }
Exemplo n.º 4
0
    public override void OnInspectorGUI()
    {
        if (!microphoneDeviceFound)
        {
            EditorGUILayout.HelpBox("No Microphone Device Was Found Connected To Your Computer.", MessageType.Warning);

            if (Microphone.devices.Length >= 1)
            {
                microphoneDeviceFound = true;
            }
        }

        MicControlC micCon = (MicControlC)target;

        if (microphoneDeviceFound)
        {
            float micInputValue = micCon.loudness;
            VolumeReader(micInputValue / 100, "Loudness " + micInputValue);

            micCon.virual3D        = EditorGUILayout.Toggle(new GUIContent("Enable Virtual 3D", "Uses a falloff system to simulate virtual 3D"), micCon.virual3D);
            micCon.volumeFallOff   = EditorGUILayout.FloatField(new GUIContent("Volume Falloff", "Set the rate at wich audio volume gets lowered. A lower value will have a slower falloff and thus hearable from a greater distance, while a higher value will make the audio degrate faster and dissapear from a shorter distance"), micCon.volumeFallOff);
            micCon.GuiSelectDevice = EditorGUILayout.Toggle(new GUIContent("Gui Selection", "Select the microphone ingame using a GUI menu"), micCon.GuiSelectDevice);
            EditorGUI.BeginChangeCheck();
            micCon.ableToHearMic = EditorGUILayout.Toggle(new GUIContent("Audio Mute", "Select whether you can hear yourself talking or not"), micCon.ableToHearMic);
            if (EditorGUI.EndChangeCheck())
            {
                micCon.GetComponent <AudioSource>().mute = micCon.ableToHearMic;
            }

            micCon.sensitivity = EditorGUILayout.FloatField(new GUIContent("Mic Sensitivity", "The sensitivity that the audio is recieved from the microphone"), micCon.sensitivity);
            //micCon.ramFlushSpeed = EditorGUILayout.FloatField(new GUIContent("Ram Flush Speed", "The interval time between when the microphone audioclip is reset"), micCon.ramFlushSpeed);
            micCon.sourceVolume = EditorGUILayout.FloatField(new GUIContent("Volume", "Volume of the audio that comes out of audiosouce, basically the volume of the microphone"), micCon.sourceVolume);
            micCon.micControl   = (MicControlC.micActivation)EditorGUILayout.EnumPopup(new GUIContent("Mic Control Type", "Changes the type of method for using the microphone"), micCon.micControl);

            EditorUtility.SetDirty(target);
        }
    }
Exemplo n.º 5
0
    /////////////////////////////////////////////////////////////////////////////////////////////////
    public override void OnInspectorGUI()
    {
        ListenToMic = (MicControlC)target;

        float micInputValue = MicControlC.loudness;

        ProgressBar(micInputValue, "Loudness");

        //show other variables

        //Redirect 3D toggle
        ListenToMic.ThreeD = GUILayout.Toggle(ListenToMic.ThreeD, new GUIContent("3D sound", "Should the streamed audio be a 3D sound? (Only enable this if you are using the controller to stream sound (VOIP) "));

        //when 3D audio is enabled show the fall off settings
        if (ListenToMic.ThreeD)
        {
            ListenToMic.VolumeFallOff = EditorGUILayout.FloatField(new GUIContent("Volume falloff", "Set the rate at wich audio volume gets lowered. A lower value will have a slower falloff and thus hearable from a greater distance, while a higher value will make the audio degrate faster and dissapear from a shorter distance"), ListenToMic.VolumeFallOff);
            ListenToMic.PanThreshold  = EditorGUILayout.FloatField(new GUIContent("PanThreshold", "Set the rate at wich audio PanThreshold gets switched between left or right ear. A lower value will have a faster transition and thus a faster switch, while a higher value will make the transition slower and smoothly switch between the ears. Don't go to smooth though as this will turn your audio to mono channel"), ListenToMic.PanThreshold);
        }

        //Redirect select ingame
        ListenToMic.SelectIngame = GUILayout.Toggle(ListenToMic.SelectIngame, new GUIContent("Select in game", "select the audio source through a GUI ingame"));

        //Redirect Mute ingame
        ListenToMic.Mute = GUILayout.Toggle(ListenToMic.Mute, new GUIContent("Mute", "when dissabled you can listen to a playback of the microphone"));

        //Redirect debug ingame
        ListenToMic.debug = GUILayout.Toggle(ListenToMic.debug, new GUIContent("Debug", "This will write the gathered Loudness value to the console during playmode. This is handy if you want if statements to listen at a specific value."));

        //Redirect ShozDeviceName ingame
        ListenToMic.ShowDeviceName = GUILayout.Toggle(ListenToMic.ShowDeviceName, new GUIContent("Show Device name(s)", "When selected all detected devices will be written to the console during play mode"));

        EditorUtility.SetDirty(target);

        // Show default inspector property editor
        DrawDefaultInspector();
    }
Exemplo n.º 6
0
	void Awake ()
	{
		micControl = wind.GetComponent<MicControlC>();
		windRenderer = wind.GetComponent<SpriteRenderer>();
	}
Exemplo n.º 7
0
 void Start()
 {
     //micC.micControl = Co
     //micC = gameObject.GetComponent("MicControl") as GameObject;
     micC = MicController.GetComponent<MicControlC>() as MicControlC;
 }
Exemplo n.º 8
0
    // Use this for initialization
    void Start()
    {
        if (transform.localScale.x > bigSpiderRange){
            bigSpider = true;
        }
        else{
            bigSpider = false;
        }

        // Targets the player's position
        player = GameObject.FindWithTag("Player");
        // Gets an instance of the MicControlC script from the target variable
        mic = player.GetComponent<MicControlC> ();
        control = player.GetComponent<PlayerControl> ();
    }
Exemplo n.º 9
0
	private float loudness; // holds loudness value from mic input

	// Use this for initialization
	void Start () {

		// Gets an instance of the MicControlC script from the target variable
		mic = GetComponent<MicControlC> ();
	
	}
Exemplo n.º 10
0
 void Start()
 {
     control = Camera.main.GetComponent<MicControlC>();
 }
Exemplo n.º 11
0
    // Use this for initialization
    void Start()
    {
        uiManagerScript = uiManager.GetComponent <UIManager> ();

        // Initialize the current emotion
        // currentFacialEmotion = new EmotionStruct();
        // currentWordSentimentEmotion = new EmotionStruct();
        // currentVocalEmotion = new ToneAnalysis();

        // Enable and disable emotion modality game objects based on the flags
        // if (useFacialEmotion)
        // {
        //  facialEmotionAnalyzerObject.SetActive(false);
        // }

        // if (useWordSentimentEmotion)
        // {
        //  wordSentimentEmotionAnalyzerObject.SetActive(false);
        // }

        // if (useVocalToneEmotion)
        // {
        //  vocalEmotionAnalyzerObject.SetActive(false);
        // }

        // // Find the script for facial emotion analysis
        // try
        // {
        //  facialAnalyzer = (FacialEmotionAnalyzer) facialEmotionAnalyzerObject.GetComponent(typeof(FacialEmotionAnalyzer)); // this seems to fail silently...
        // }
        // catch (System.Exception)
        // {
        //  Debug.Log("Unable to find facial emotion analyzer. This functionality will be disabled.");
        //  useFacialEmotion = false;
        // }

        // // Find the script for sentiment analysis of speech to text results
        // try
        // {
        //  wordAnalyzer = (SentimentAnalyzer) wordSentimentEmotionAnalyzerObject.GetComponent(typeof(SentimentAnalyzer));
        // }
        // catch (System.Exception)
        // {
        //  Debug.Log("Unable to find the sentiment analyzer. This functionality will be disabled.");
        //  useWordSentimentEmotion = false;
        // }
        // // Find the script for vocal analysis results
        // try
        // {
        //  vocalAnalyzer = (MicControlC) vocalEmotionAnalyzerObject.GetComponent(typeof(MicControlC));
        // }
        // catch (System.Exception)
        // {
        //  Debug.Log("Unable to find the vocal analyzer. This functionality will be disabled.");
        //  useVocalToneEmotion = false;
        // }


        if (!useFacialEmotion)
        {
            facialEmotionAnalyzerObject.SetActive(false);
        }
        else
        {
            facialAnalyzer  = (FacialEmotionAnalyzer)facialEmotionAnalyzerObject.GetComponent(typeof(FacialEmotionAnalyzer));
            facialAnalyzer2 = (FacialEmotionAnalyzer2)facialEmotionAnalyzer2Object.GetComponent(typeof(FacialEmotionAnalyzer2));
            Debug.Log(facialAnalyzer2);
        }

        if (!useWordSentimentEmotion)
        {
            wordSentimentEmotionAnalyzerObject.SetActive(false);
        }
        else
        {
            wordAnalyzer = (SentimentAnalyzer)wordSentimentEmotionAnalyzerObject.GetComponent(typeof(SentimentAnalyzer));
        }

        if (!useVocalToneEmotion)
        {
            vocalEmotionAnalyzerObject.SetActive(false);
        }
        else
        {
            vocalAnalyzer = (MicControlC)vocalEmotionAnalyzerObject.GetComponent(typeof(MicControlC));
            StartCoroutine(passAudio());
        }
    }