Example #1
0
 // Token: 0x06003A9C RID: 15004 RVA: 0x001279A1 File Offset: 0x00125DA1
 public int SendSignal(OVRLipSync.ovrLipSyncSignals signal, int arg1, int arg2)
 {
     if (OVRLipSync.IsInitialized() != 0)
     {
         return(-2200);
     }
     return(OVRLipSync.SendSignal(this.context, signal, arg1, arg2));
 }
    /// <summary>
    /// Sends the signal.
    /// </summary>
    /// <returns>error code</returns>
    /// <param name="signal">Signal.</param>
    /// <param name="arg1">Arg1.</param>
    /// <param name="arg2">Arg2.</param>
    public int SendSignal(OVRLipSync.ovrLipSyncSignals signal, int arg1, int arg2)
    {
        if (OVRLipSync.IsInitialized() != OVRLipSync.ovrLipSyncSuccess)
        {
            return((int)OVRLipSync.ovrLipSyncError.Unknown);
        }

        return(OVRLipSync.SendSignal(context, signal, arg1, arg2));
    }
    /// <summary>
    /// Sets a given viseme id blend weight to a given amount
    /// </summary>
    /// <param name="amount">Integer viseme amount</param>
    public void SetLaughterBlend(int amount)
    {
        OVRLipSync.Result result =
            OVRLipSync.SendSignal(context, OVRLipSync.Signals.LaughterAmount, amount, 0);

        if (result != OVRLipSync.Result.Success)
        {
            Debug.LogError("OVRLipSyncContextBase.SetLaughterBlend: An unexpected" +
                           " error occured.");
        }
    }
Example #4
0
 void Update()
 {
     if (inited && lastSmoothing != smoothAmount)
     {
         OVRLipSync.SendSignal(context, OVRLipSync.Signals.VisemeSmoothing, smoothAmount, 0);
         lastSmoothing = smoothAmount;
     }
     if (!openSeeIKTarget.fixedUpdate)
     {
         RunUpdates();
     }
 }
    public void SetVisemeBlend(int viseme, int amount)
    {
        OVRLipSync.Result result =
            OVRLipSync.SendSignal(context, OVRLipSync.Signals.VisemeAmount, viseme, amount);

        if (result != OVRLipSync.Result.Success)
        {
            if (result == OVRLipSync.Result.InvalidParam)
            {
                Debug.LogError("OVRLipSyncContextBase.SetVisemeBlend: Viseme ID is invalid.");
            }
            else
            {
                Debug.LogError("OVRLipSyncContextBase.SetVisemeBlend: An unexpected" +
                               " error occured.");
            }
        }
    }
Example #6
0
    public void InitializeLipSync()
    {
        active = false;
        if (catsData == null)
        {
            InitCatsData();
        }
        if (!isCanned && clip != null)
        {
            Microphone.End(lastMic);
        }

        partialAudio = null;
        partialPos   = 0;

        audioSource = GetComponent <AudioSource>();
        if (useCanned && audioSource != null && audioSource.clip != null)
        {
            isCanned     = true;
            clip         = audioSource.clip;
            channels     = clip.channels;
            partialAudio = new float[1024 * channels];
            freq         = audioSource.clip.frequency;
            if (!inited)
            {
                if (OVRLipSync.IsInitialized() == OVRLipSync.Result.Success)
                {
                    DestroyContext();
                    OVRLipSync.Shutdown();
                }
                OVRLipSync.Initialize(freq, 1024);
                CreateContext();
                OVRLipSync.SendSignal(context, OVRLipSync.Signals.VisemeSmoothing, smoothAmount, 0);
                inited = true;
            }
            active = true;
            return;
        }

        isCanned = false;

        int minFreq;
        int maxFreq = AudioSettings.outputSampleRate;

        freq = maxFreq;

        lastMic = mic;
        if (mic != null)
        {
            Microphone.GetDeviceCaps(lastMic, out minFreq, out maxFreq);
        }
        if (maxFreq > 0)
        {
            freq = maxFreq;
        }

        if (!inited)
        {
            if (OVRLipSync.IsInitialized() == OVRLipSync.Result.Success)
            {
                DestroyContext();
                OVRLipSync.Shutdown();
            }
            OVRLipSync.Initialize(freq, 1024);
            CreateContext();
            OVRLipSync.SendSignal(context, OVRLipSync.Signals.VisemeSmoothing, smoothAmount, 0);
            inited = true;
        }

        clip         = Microphone.Start(lastMic, true, 1, freq);
        channels     = clip.channels;
        partialAudio = new float[1024 * channels];
        lastPos      = 0;
        active       = true;
    }
    public void SetVisemeBlend(int viseme, int amount)

    {
        OVRLipSync.SendSignal(context, OVRLipSync.Signals.VisemeAmount, viseme, amount);
    }