BlueGit

blue-star ggj-2020

Files

ggj-2020 / Assets / Oculus / Spatializer / scripts / ONSPProfiler.cs

ONSPProfiler.cs

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