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.

56 lines
1.9 KiB

  1. /************************************************************************************
  2. Filename : ONSPProfiler.cs
  3. Content : Use this to attach to the Oculus Audio Profiler tool
  4. Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
  5. Licensed under the Oculus SDK Version 3.5 (the "License");
  6. you may not use the Oculus SDK except in compliance with the License,
  7. which is provided at the time of installation or download, or which
  8. otherwise accompanies this software in either electronic or hard copy form.
  9. You may obtain a copy of the License at
  10. https://developer.oculus.com/licenses/sdk-3.5/
  11. Unless required by applicable law or agreed to in writing, the Oculus SDK
  12. distributed under the License is distributed on an "AS IS" BASIS,
  13. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. See the License for the specific language governing permissions and
  15. limitations under the License.
  16. ************************************************************************************/
  17. using System.Collections;
  18. using System.Collections.Generic;
  19. using System.Runtime.InteropServices;
  20. using UnityEngine;
  21. using UnityEngine.Networking;
  22. public class ONSPProfiler : MonoBehaviour
  23. {
  24. public bool profilerEnabled = false;
  25. const int DEFAULT_PORT = 2121;
  26. public int port = DEFAULT_PORT;
  27. void Start()
  28. {
  29. Application.runInBackground = true;
  30. }
  31. void Update()
  32. {
  33. if (port < 0 || port > 65535)
  34. {
  35. port = DEFAULT_PORT;
  36. }
  37. ONSP_SetProfilerPort(port);
  38. ONSP_SetProfilerEnabled(profilerEnabled);
  39. }
  40. // Import functions
  41. public const string strONSPS = "AudioPluginOculusSpatializer";
  42. [DllImport(strONSPS)]
  43. private static extern int ONSP_SetProfilerEnabled(bool enabled);
  44. [DllImport(strONSPS)]
  45. private static extern int ONSP_SetProfilerPort(int port);
  46. }