OVRLipSyncTestAudio.cs 691 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using UnityEngine;
  3. [RequireComponent(typeof(AudioSource))]
  4. public class OVRLipSyncTestAudio : MonoBehaviour
  5. {
  6. private void Start()
  7. {
  8. if (!this.audioSource)
  9. {
  10. this.audioSource = base.GetComponent<AudioSource>();
  11. }
  12. if (!this.audioSource)
  13. {
  14. return;
  15. }
  16. string text = Application.dataPath;
  17. text += "/../";
  18. text += "TestViseme.wav";
  19. WWW www = new WWW("file:///" + text);
  20. while (!www.isDone)
  21. {
  22. Debug.Log(www.progress);
  23. }
  24. if (www.GetAudioClip() != null)
  25. {
  26. this.audioSource.clip = www.GetAudioClip();
  27. this.audioSource.loop = true;
  28. this.audioSource.mute = false;
  29. this.audioSource.Play();
  30. }
  31. }
  32. public AudioSource audioSource;
  33. }