Skip to content

Commit 6fce2c5

Browse files
author
Tim
committed
Merge branch 'update_toolkit' into develop
2 parents 2be9dd9 + a022a35 commit 6fce2c5

File tree

97 files changed

+10825
-9128
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+10825
-9128
lines changed

3dti_AudioToolkit

Submodule 3dti_AudioToolkit updated 31 files
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"version": "1.0",
3+
"components": [
4+
"Microsoft.VisualStudio.Workload.ManagedGame"
5+
]
6+
}

Binaural/BuildUnityWrapperPackage/Assets/3DTuneIn/APIScripts/API_3DTI_Common.cs

Lines changed: 81 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,92 @@
1-
using System.Collections.Generic; // List
1+
using System;
2+
using System.Collections.Generic; // List
23
using System.Collections.ObjectModel; // ReadOnlyCollection
4+
using UnityEngine;
35

46
namespace API_3DTI_Common
57
{
68
//////////////////////////////////////////////////////////////
79
// PUBLIC TYPE DEFINITIONS
810
//////////////////////////////////////////////////////////////
11+
912

13+
[System.AttributeUsage(System.AttributeTargets.Field)]
14+
public class ParameterAttribute : System.Attribute
15+
{
16+
// For parameters that are not ear-specific, pluginNameLeft == pluginNameRight and mixerNameLeft == mixerNameRight
17+
public string pluginNameLeft;
18+
public string pluginNameRight;
19+
public string mixerNameLeft;
20+
public string mixerNameRight;
21+
public Type type;
22+
// Label used in GUI
23+
public string label;
24+
// Tooltip used in GUI
25+
public string description;
26+
// For numeric values, the units label, e.g. "dB"
27+
public string units;
28+
// For int/float parameters: limit to these discrete values. Leave as null for no limits.
29+
public float[] validValues;
30+
31+
public bool isSharedBetweenEars()
32+
{
33+
Debug.Assert((pluginNameLeft == pluginNameRight) == (mixerNameLeft == mixerNameRight));
34+
return pluginNameLeft == pluginNameRight;
35+
}
36+
37+
public string pluginName(T_ear ear)
38+
{
39+
if (!(isSharedBetweenEars() == (ear == T_ear.BOTH)))
40+
{
41+
Debug.Assert(isSharedBetweenEars() == (ear == T_ear.BOTH), $"This parameter is shared between both ears so must be called with ear=={T_ear.BOTH}");
42+
}
43+
return ear.HasFlag(T_ear.LEFT) ? pluginNameLeft : pluginNameRight;
44+
}
45+
46+
public string mixerName(T_ear ear)
47+
{
48+
Debug.Assert(isSharedBetweenEars() == (ear == T_ear.BOTH), $"This parameter is shared between both ears so must be called with ear=={T_ear.BOTH}");
49+
return ear.HasFlag(T_ear.LEFT) ? mixerNameLeft : mixerNameRight;
50+
}
51+
52+
}
53+
54+
public static class EnumHelper
55+
{
56+
// https://stackoverflow.com/a/9276348
57+
/// <summary>
58+
/// Gets an attribute on an enum field value
59+
/// </summary>
60+
/// <typeparam name="T">The type of the attribute you want to retrieve</typeparam>
61+
/// <param name="enumVal">The enum value</param>
62+
/// <returns>The attribute of type T that exists on the enum value</returns>
63+
/// <example><![CDATA[string desc = myEnumVariable.GetAttributeOfType<DescriptionAttribute>().Description;]]></example>
64+
public static T GetAttribute<T>(this Enum enumVal) where T : System.Attribute
65+
{
66+
var type = enumVal.GetType();
67+
var memInfo = type.GetMember(enumVal.ToString());
68+
var attributes = memInfo[0].GetCustomAttributes(typeof(T), false);
69+
return (attributes.Length > 0) ? (T)attributes[0] : null;
70+
}
71+
}
72+
73+
74+
75+
//public class Parameter<T> where T : Enum
76+
//{
77+
// //public T id;
78+
// public string pluginName;
79+
// public string mixerName;
80+
// public Type type;
81+
// public object value;
82+
//}
83+
84+
[Flags]
1085
public enum T_ear
1186
{
12-
LEFT = 0, // Left ear
13-
RIGHT = 1, // Right ear
14-
BOTH = 2 // Both ears
15-
//NONE = 3 // No ear
87+
LEFT = 1, // Left ear
88+
RIGHT = 2, // Right ear
89+
BOTH = LEFT | RIGHT, // Both ears
1690
};
1791

1892
//public class T_LevelsList: List<float> { }
@@ -90,5 +164,7 @@ public static float Bool2Float(bool v)
90164
else
91165
return 0.0f;
92166
}
167+
168+
93169
}
94170
}

Binaural/BuildUnityWrapperPackage/Assets/3DTuneIn/APIScripts/API_3DTI_HA.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,7 @@ public bool GetNormalizationOffset(T_ear ear, out float offset)
251251
// GLOBAL METHODS
252252
//////////////////////////////////////////////////////////////
253253

254-
// Convenience method that avoids custom type allowing it to be connected to a UI element in the Editor.
255-
public void EnableHAInBothEars(bool isEnabled)
256-
{
257-
SwitchHAOnOff(T_ear.BOTH, isEnabled);
258-
}
254+
259255

260256
/// <summary>
261257
/// Switch on/off whole HA process

0 commit comments

Comments
 (0)