public void AddCompressedData(byte[] compressedData) { if (decoder == null || bufferedAudioStream == null) { throw new System.Exception("VoipAudioSource failed to init"); } float[] decompressedData = decoder.Decode(compressedData); if (decompressedData != null && decompressedData.Length > 0) { bufferedAudioStream.AddData(decompressedData); if (debugOutputData != null) { debugOutputData.AddRange(decompressedData); } } }
void Update() { if (bufferedAudioStream == null) { throw new Exception("VoipAudioSource failed to init"); } if (senderID == 0) { throw new Exception("SenderID not set"); } int copied = (int)CAPI.ovr_Voip_GetPCMFloat(senderID, scratchBuffer, (UIntPtr)scratchBuffer.Length); if (copied > 0) { bufferedAudioStream.AddData(scratchBuffer, copied); } bufferedAudioStream.Update(); }