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.

45 lines
1.0 KiB

  1. //This file is deprecated. Use the high level voip system instead:
  2. // https://developer3.oculus.com/documentation/platform/latest/concepts/dg-core-content/#dg-cc-voip
  3. #if false
  4. using UnityEngine;
  5. using System.Collections;
  6. using System;
  7. namespace Oculus.Platform {
  8. public class Decoder : IDisposable {
  9. IntPtr dec;
  10. float[] decodedScratchBuffer;
  11. public Decoder() {
  12. dec = CAPI.ovr_Voip_CreateDecoder();
  13. decodedScratchBuffer = new float[480 * 10];
  14. }
  15. public void Dispose()
  16. {
  17. if (dec != IntPtr.Zero)
  18. {
  19. CAPI.ovr_Voip_DestroyEncoder(dec);
  20. dec = IntPtr.Zero;
  21. }
  22. }
  23. public float[] Decode(byte[] data) {
  24. CAPI.ovr_VoipDecoder_Decode(dec, data, (uint)data.Length);
  25. ulong gotSize = (ulong)CAPI.ovr_VoipDecoder_GetDecodedPCM(dec, decodedScratchBuffer, (UIntPtr)decodedScratchBuffer.Length);
  26. if (gotSize > 0)
  27. {
  28. float[] pcm = new float[gotSize];
  29. Array.Copy(decodedScratchBuffer, pcm, (int)gotSize);
  30. return pcm;
  31. }
  32. return null;
  33. }
  34. }
  35. }
  36. #endif