示例#1
0
 // Token: 0x06003A99 RID: 15001 RVA: 0x001277FC File Offset: 0x00125BFC
 private void OnAudioFilterRead(float[] data, int channels)
 {
     if (OVRLipSync.IsInitialized() != 0 || this.audioSource == null)
     {
         return;
     }
     float[] array = this.floatArrayPool.Get(data.Length);
     data.CopyTo(array, 0);
     for (int i = 0; i < array.Length; i++)
     {
         array[i] *= this.gain;
     }
     lock (this)
     {
         if (this.context != 0u)
         {
             OVRLipSync.ovrLipSyncFlag ovrLipSyncFlag = OVRLipSync.ovrLipSyncFlag.None;
             if (this.delayCompensate)
             {
                 ovrLipSyncFlag |= OVRLipSync.ovrLipSyncFlag.DelayCompensateAudio;
             }
             OVRLipSync.ProcessFrameInterleaved(this.context, array, ovrLipSyncFlag, ref this.frame);
         }
     }
     this.floatArrayPool.Return(array);
     if (this.audioMute)
     {
         for (int j = 0; j < data.Length; j++)
         {
             data[j] *= 0f;
         }
     }
 }
示例#2
0
 // Token: 0x06003A90 RID: 14992 RVA: 0x0012765A File Offset: 0x00125A5A
 public static int ProcessFrameInterleaved(uint context, float[] audioBuffer, OVRLipSync.ovrLipSyncFlag flags, ref OVRLipSync.ovrLipSyncFrame frame)
 {
     if (OVRLipSync.IsInitialized() != 0)
     {
         return(-2200);
     }
     return(OVRLipSync.ovrLipSyncDll_ProcessFrameInterleaved(context, audioBuffer, flags, ref frame.frameNumber, ref frame.frameDelay, frame.Visemes, frame.Visemes.Length));
 }
    /// <summary>
    /// Raises the audio filter read event.
    /// </summary>
    /// <param name="data">Data.</param>
    /// <param name="channels">Channels.</param>
    void OnAudioFilterRead(float[] data, int channels)
    {
        // Do not spatialize if we are not initialized, or if there is no
        // audio source attached to game object
        if ((OVRLipSync.IsInitialized() != OVRLipSync.ovrLipSyncSuccess) || audioSource == null)
        {
            return;
        }
        // increase the gain of the input to get a better signal input
        for (int i = 0; i < data.Length; ++i)
        {
            data[i] = data[i] * gain;
        }



        // Send data into Phoneme context for processing (if context is not 0)
        lock (this)
        {
            if (context != 0)
            {
                OVRLipSync.ovrLipSyncFlag flags = 0;

                // Set flags to feed into process
                if (delayCompensate == true)
                {
                    flags |= OVRLipSync.ovrLipSyncFlag.DelayCompensateAudio;
                }

                OVRLipSync.ProcessFrameInterleaved(context, data, flags, ref frame);
            }
        }

        // Turn off output (so that we don't get feedback from mics too close to speakers)
        if (audioMute == true)
        {
            for (int i = 0; i < data.Length; ++i)
            {
                data[i] = data[i] * 0.0f;
            }
        }
    }
示例#4
0
 private static extern int ovrLipSyncDll_ProcessFrameInterleaved(uint context, float[] audioBuffer, OVRLipSync.ovrLipSyncFlag flags, ref int frameNumber, ref int frameDelay, float[] visemes, int visemeCount);