Ejemplo n.º 1
0
 public void PlayAudio(int _chatterId, byte[] _byteAudio, int _micChannels, int _sampleRate)
 {
     float[] floatAudio = ToFloatArray(_byteAudio);
     if (GridManager.instance.chatterWebcamHandles.ContainsKey(_chatterId))
     {
         ChatterWebcamHandle chatterWebcamHandle = GridManager.instance.chatterWebcamHandles[_chatterId];
         AudioSource         src = chatterWebcamHandle.GetComponent <AudioSource>();
         src.clip = AudioClip.Create("test", floatAudio.Length, _micChannels, _sampleRate, false);
         src.clip.SetData(floatAudio, 0);
         if (!src.isPlaying)
         {
             src.Play();
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Sets chatterWebcamHandle
 /// </summary>
 /// <param name="handle"></param>
 public void SetChatterWebcamHandle(ChatterWebcamHandle handle)
 {
     chatterWebcamHandle = handle;
     audioSource         = chatterWebcamHandle.GetComponent <AudioSource>();
 }