BlueGit

blue-star ggj-2020

Files

ggj-2020 / Assets / Oculus / Spatializer / editor / ONSPReflectionCustomGUI.cs

ONSPReflectionCustomGUI.cs

Project Import
timfa Tim Falken · pushed by timfa · 6 years ago
b77834a1 History
ONSPReflectionCustomGUI.cs 5.0 KiB Download Raw
1/************************************************************************************
2Filename : ONSPReflectionCustomGUI.cs
3Content : GUI for Oculus Spatializer mixer effect
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 UnityEditor;
22using UnityEngine;
23using System.Runtime.InteropServices;
24
25public class OculusSpatializerReflectionCustomGUI : IAudioEffectPluginGUI
26{
27 public override string Name
28 {
29 get { return "OculusSpatializerReflection"; }
30 }
31
32 public override string Description
33 {
34 get { return "Reflection parameters for Oculus Spatializer"; }
35 }
36
37 public override string Vendor
38 {
39 get { return "Oculus"; }
40 }
41
42 public override bool OnGUI(IAudioEffectPlugin plugin)
43 {
44 float fval = 0.0f;
45 bool bval = false;
46
47 Separator();
48 Label ("GLOBAL SCALE (0.00001 - 10000.0)");
49 plugin.GetFloatParameter("GScale", out fval);
50 plugin.SetFloatParameter("GScale", EditorGUILayout.FloatField(" ", Mathf.Clamp (fval, 0.00001f, 10000.0f)));
51
52 Separator();
53
54 Label ("REFLECTION ENGINE");
55 Label("");
56 // Treat these floats as bools in the inspector
57 plugin.GetFloatParameter("E.Rflt On", out fval);
58 bval = (fval == 0.0f) ? false : true;
59 bval = EditorGUILayout.Toggle("Enable Early Reflections", bval);
60 plugin.SetFloatParameter("E.Rflt On", (bval == false) ? 0.0f : 1.0f);
61
62 plugin.GetFloatParameter("E.Rflt Rev On", out fval);
63 bval = (fval == 0.0f) ? false : true;
64 bval = EditorGUILayout.Toggle("Enable Reverberation", bval);
65 plugin.SetFloatParameter("E.Rflt Rev On", (bval == false) ? 0.0f : 1.0f);
66
67 Separator();
68 Label("ROOM DIMENSIONS (meters)");
69 Label("");
70 plugin.GetFloatParameter("Room X", out fval);
71 plugin.SetFloatParameter("Room X", EditorGUILayout.Slider("Width", fval, 1.0f, 200.0f));
72 plugin.GetFloatParameter("Room Y", out fval);
73 plugin.SetFloatParameter("Room Y", EditorGUILayout.Slider("Height", fval, 1.0f, 200.0f));
74 plugin.GetFloatParameter("Room Z", out fval);
75 plugin.SetFloatParameter("Room Z", EditorGUILayout.Slider("Length", fval, 1.0f, 200.0f));
76
77 Separator();
78 Label("WALL REFLECTION COEFFICIENTS (0.0 - 0.97)");
79 Label("");
80
81 plugin.GetFloatParameter("Left", out fval);
82 plugin.SetFloatParameter("Left", EditorGUILayout.Slider("Left", fval, 0.0f, 0.97f));
83 plugin.GetFloatParameter("Right", out fval);
84 plugin.SetFloatParameter("Right", EditorGUILayout.Slider("Right", fval, 0.0f, 0.97f));
85 plugin.GetFloatParameter("Up", out fval);
86 plugin.SetFloatParameter("Up", EditorGUILayout.Slider("Up", fval, 0.0f, 0.97f));
87 plugin.GetFloatParameter("Down", out fval);
88 plugin.SetFloatParameter("Down", EditorGUILayout.Slider("Down", fval, 0.0f, 0.97f));
89 plugin.GetFloatParameter("Behind", out fval);
90 plugin.SetFloatParameter("Behind", EditorGUILayout.Slider("Back", fval, 0.0f, 0.97f));
91 plugin.GetFloatParameter("Front", out fval);
92 plugin.SetFloatParameter("Front", EditorGUILayout.Slider("Front", fval, 0.0f, 0.97f));
93
94 Separator();
95 Label("SHARED REVERB ATTENUATION RANGE (1.0 - 10000.0 meters)");
96 Label("");
97 plugin.GetFloatParameter("Shared Rev Min", out fval);
98 plugin.SetFloatParameter("Shared Rev Min", EditorGUILayout.Slider("Minimum", fval, 1.0f, 10000.0f));
99 plugin.GetFloatParameter("Shared Rev Max", out fval);
100 plugin.SetFloatParameter("Shared Rev Max", EditorGUILayout.Slider("Maximum", fval, 1.0f, 10000.0f));
101
102 Separator();
103 Label("SHARED REVERB WET MIX (-60.0 - 20.0 dB)");
104 Label("");
105 plugin.GetFloatParameter("Shared Rev Wet", out fval);
106 plugin.SetFloatParameter("Shared Rev Wet", EditorGUILayout.Slider(" ", fval, -60.0f, 20.0f));
107
108 Separator();
109 Label("PROPAGATION QUALITY LEVEL (0.0 - 200.0%)");
110 Label("");
111 plugin.GetFloatParameter("Prop Quality", out fval);
112 plugin.SetFloatParameter("Prop Quality", EditorGUILayout.Slider(" ", fval, 0.0f, 200.0f));
113
114 Separator();
115
116 // We will override the controls with our own, so return false
117 return false;
118 }
119
120 // Separator
121 void Separator()
122 {
123 GUI.color = new Color(1, 1, 1, 0.25f);
124 GUILayout.Box("", "HorizontalSlider", GUILayout.Height(16));
125 GUI.color = Color.white;
126 }
127
128 // Label
129 void Label(string label)
130 {
131 EditorGUILayout.LabelField (label);
132 }
133
134
135}