Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
2.0 KiB

  1. /************************************************************************************
  2. Filename : OVRLipSyncContextCanned.cs
  3. Content : Interface to Oculus Lip-Sync engine
  4. Created : August 6th, 2015
  5. Copyright : Copyright Facebook Technologies, LLC and its affiliates.
  6. All rights reserved.
  7. Licensed under the Oculus Audio SDK License Version 3.3 (the "License");
  8. you may not use the Oculus Audio SDK except in compliance with the License,
  9. which is provided at the time of installation or download, or which
  10. otherwise accompanies this software in either electronic or hard copy form.
  11. You may obtain a copy of the License at
  12. https://developer.oculus.com/licenses/audio-3.3/
  13. Unless required by applicable law or agreed to in writing, the Oculus Audio SDK
  14. distributed under the License is distributed on an "AS IS" BASIS,
  15. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. See the License for the specific language governing permissions and
  17. limitations under the License.
  18. ************************************************************************************/
  19. using UnityEngine;
  20. [RequireComponent(typeof(AudioSource))]
  21. //-------------------------------------------------------------------------------------
  22. // ***** OVRLipSyncContextCanned
  23. //
  24. /// <summary>
  25. /// OVRLipSyncContextCanned drives a canned phoneme sequence based on a pre-generated asset.
  26. ///
  27. /// </summary>
  28. public class OVRLipSyncContextCanned : OVRLipSyncContextBase
  29. {
  30. [Tooltip("Pre-computed viseme sequence asset. Compute from audio in Unity with Tools -> Oculus -> Generate Lip Sync Assets.")]
  31. public OVRLipSyncSequence currentSequence;
  32. /// <summary>
  33. /// Run processes that need to be updated in game thread
  34. /// </summary>
  35. void Update()
  36. {
  37. if (audioSource.isPlaying && currentSequence != null)
  38. {
  39. OVRLipSync.Frame currentFrame = currentSequence.GetFrameAtTime(audioSource.time);
  40. this.Frame.CopyInput(currentFrame);
  41. }
  42. }
  43. }