예제 #1
0
    //public Transform prefab;

    void Start()
    {
        //levelManager = GetComponent<LevelManager>();
        // Déplacement au microphone

        /*
         * foreach (var device in Microphone.devices)
         * {
         *  Debug.Log("Name: " + device);
         *  //Debug.Log("Microphone.GetDeviceCaps : "+device.GetDeviceCaps);
         * }
         */

        //Debug.Log(Microphone.GetDeviceCaps);
        rb          = GetComponent <Rigidbody2D>();
        _audio      = GetComponent <AudioSource>();
        _audio.clip = Microphone.Start(null, true, 10, 44100);
        //_audio.clip = Microphone.Start("Microphone Array (Realtek High Definition Audio)", true, 10, 44100);
        _audio.loop = true;
        _audio.mute = false;
        while (!(Microphone.GetPosition(null) > 0))
        {
        }

        _audio.Play();
        Calibration calibration = GameObject.Find("Thresholds").GetComponent <Calibration>();

        runLoudnessThreshold  = calibration.moveThresh;
        jumpLoudnessThreshold = calibration.jumpThresh;
        LogWritter lw = gameObject.GetComponent <LogWritter>();

        lw.writeThreshOnFile(runLoudnessThreshold, jumpLoudnessThreshold);
    }