Exemple #1
0
    void Update()
    {
        if (audioProcessing)
        {
            if (!m_OVRLipSyncContext.enabled)
            {
                m_OVRLipSyncContext.enabled = true;
            }

            if (m_OVRLipSyncContext.Smoothing != smoothing)
            {
                m_OVRLipSyncContext.Smoothing = smoothing;
            }

            // Adding the required components depending on the lip synchronization mode (realtime/pre-computed).
            if (lipSyncMode == LipSyncMode.REALTIME && (!m_OVRLipSyncMicInput || !m_OVRLipSyncMicInput.enabled))
            {
                if (!m_OVRLipSyncMicInput)
                {
                    m_OVRLipSyncMicInput = gameObject.AddComponent <OVRLipSyncMicInput>();
                }

                m_OVRLipSyncMicInput.enabled = true;
            }

            else if (lipSyncMode == LipSyncMode.PRERECORDED && m_OVRLipSyncMicInput && m_OVRLipSyncMicInput.enabled)
            {
                m_OVRLipSyncMicInput.enabled = false;
            }

            // Calling the function to detect the visemes' variations.
            DetectVisemesVariations();
        }

        else
        {
            if (m_OVRLipSyncContext.enabled)
            {
                m_OVRLipSyncContext.enabled = false;
            }

            if (m_OVRLipSyncMicInput && m_OVRLipSyncMicInput.enabled)
            {
                m_OVRLipSyncMicInput.enabled = false;
            }
        }
    }
Exemple #2
0
    void InitPostLoad()
    {
        ExpressiveGlobalInit();

        ConfigureHelpers();

        if (GetComponent <OvrAvatarLocalDriver>() != null)
        {
            // Use mic.
            lipsyncContext.audioLoopback = false;
            if (CanOwnMicrophone && IsValidMic())
            {
                micInput = MouthAnchor.gameObject.AddComponent <OVRLipSyncMicInput>();
                micInput.enableMicSelectionGUI = false;
                micInput.MicFrequency          = 44100;
                micInput.micControl            = OVRLipSyncMicInput.micActivation.ConstantSpeak;
            }
        }
    }
    void InitPostLoad()
    {
        ExpressiveGlobalInit();

        ConfigureHelpers();

        if (GetComponent <OvrAvatarLocalDriver>() != null)
        {
            // Use mic.
            lipsyncContext.audioLoopback = false;
            if (CanOwnMicrophone && IsValidMic())
            {
                micInput = MouthAnchor.gameObject.AddComponent <OVRLipSyncMicInput>();
                micInput.enableMicSelectionGUI = false;
                micInput.MicFrequency          = 44100;
                micInput.micControl            = OVRLipSyncMicInput.micActivation.ConstantSpeak;
            }

            // Set lipsync animation parameters in SDK
            CAPI.ovrAvatar_SetActionUnitOnsetSpeed(sdkAvatar, ACTION_UNIT_ONSET_SPEED);
            CAPI.ovrAvatar_SetActionUnitFalloffSpeed(sdkAvatar, ACTION_UNIT_FALLOFF_SPEED);
            CAPI.ovrAvatar_SetVisemeMultiplier(sdkAvatar, VISEME_LEVEL_MULTIPLIER);
        }
    }