Exemplo n.º 1
0
    void Start()
    {
        Application.targetFrameRate = 30;

        this.device = new StreamedMicrophone();

        //Set microphone to native device implementation.
        RecordingMachineBase.SetRecordingDevice(device);

                #if UNITY_IOS && !UNITY_EDITOR
        this.animationsDatabase = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/FacialAnimations/iOS/FacialAnimationsDatabase.facialanimation");
                #else
        this.animationsDatabase = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/FacialAnimations/Standalone/FacialAnimationsDatabase.facialanimation");
                #endif

        if (this.animationsDatabase != null)
        {
            GameObject mainGO = this.animationsDatabase.mainAsset as GameObject;
            GameObject.Instantiate(mainGO);
        }

        this.Actor = GameObject.Find("deadtrigger2.buck");

        this.animationTarget = this.Actor.GetComponent <FacialAnimation>();

        if (this.animationTarget != null)
        {
            Transform headTransform = TransformHelp.FindChildRecursive(this.Actor.transform, "BaseHead");

            this.animationTarget.SetTargetMesh(headTransform.GetComponent <SkinnedMeshRenderer>());
        }

                #if UNITY_IOS && !UNITY_EDITOR
        MicrophoneWrappers.RequestMicrophoneAccess((bool access) => {
            Debug.Log("Mic access: " + access);
        });
                #endif

        AudioConfiguration config = AudioSettings.GetConfiguration();

        config.sampleRate    = 44100;
        config.dspBufferSize = 512;
        config.speakerMode   = AudioSpeakerMode.Mono;

        AudioSettings.Reset(config);
    }
 public static void SetRecordingDevice(IMicrophoneDevice device)
 {
     Device = device;
 }