This commit is contained in:
2024-05-14 04:06:02 +02:00
commit d2c9941a75
191 changed files with 12353 additions and 0 deletions

105
Scripts/Editor/Build.cs Executable file
View File

@ -0,0 +1,105 @@
//
// Copyright 2017-2023 Valve Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using System;
using UnityEngine; // deleteme?
using UnityEditor;
#if UNITY_2021_2_OR_NEWER
using UnityEditor.Build;
#endif
using UnityEditor.Callbacks;
#if UNITY_IOS
using UnityEditor.iOS.Xcode;
#endif
namespace SteamAudio
{
public static class Build
{
public static void BuildSteamAudio()
{
var args = Environment.GetCommandLineArgs();
var lastArg = args[args.Length - 1];
var fileName = "SteamAudio.unitypackage";
if (lastArg != "SteamAudio.Build.BuildSteamAudio")
{
fileName = lastArg + "/" + fileName;
}
var assets = new string[] { "Assets/Plugins" };
AssetDatabase.ExportPackage(assets, fileName, ExportPackageOptions.Recurse);
}
}
[InitializeOnLoad]
public static class Defines
{
// Define the constant STEAMAUDIO_ENABLED for all platforms that are supported by
// Steam Audio. User scripts should check if this constant is defined
// (using #if STEAMAUDIO_ENABLED) before using any of the Steam Audio C# classes.
static Defines()
{
#if UNITY_2021_2_OR_NEWER
NamedBuildTarget[] supportedPlatforms = {
NamedBuildTarget.Standalone,
NamedBuildTarget.Android,
NamedBuildTarget.iOS,
};
foreach (var supportedPlatform in supportedPlatforms)
{
var defines = PlayerSettings.GetScriptingDefineSymbols(supportedPlatform);
if (!defines.Contains("STEAMAUDIO_ENABLED"))
{
if (defines.Length > 0)
{
defines += ";";
}
defines += "STEAMAUDIO_ENABLED";
PlayerSettings.SetScriptingDefineSymbols(supportedPlatform, defines);
}
}
#endif
}
}
public static class BuildProcessor
{
[PostProcessBuild]
public static void OnPostProcessBuild(BuildTarget buildTarget, string buildPath)
{
if (buildTarget == BuildTarget.iOS)
{
#if UNITY_IOS
var projectPath = PBXProject.GetPBXProjectPath(buildPath);
var project = new PBXProject();
project.ReadFromFile(projectPath);
var file = project.AddFile("usr/lib/libz.tbd", "Frameworks/libz.tbd", PBXSourceTree.Sdk);
var target = project.TargetGuidByName("UnityFramework");
project.AddFileToBuild(target, file);
project.WriteToFile(projectPath);
#endif
}
}
}
}

11
Scripts/Editor/Build.cs.meta Executable file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4cf552bb6c6d7894c8e64136a5d4a41c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,33 @@
//
// Copyright 2017-2023 Valve Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using UnityEditor;
namespace SteamAudio
{
/*
* Custom editor GUI for SOFAFile assets.
*/
[CustomEditor(typeof(SOFAFile))]
public class SOFAFileEditor : Editor
{
public override void OnInspectorGUI()
{
EditorGUILayout.PropertyField(serializedObject.FindProperty("sofaName"));
EditorGUILayout.LabelField("Size", Common.HumanReadableDataSize(serializedObject.FindProperty("data").arraySize));
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ad7854f3d94e96f4795542d446b68921
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,50 @@
//
// Copyright 2017-2023 Valve Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using System.IO;
using UnityEngine;
#if UNITY_2020_2_OR_NEWER
using UnityEditor.AssetImporters;
#else
using UnityEditor.Experimental.AssetImporters;
#endif
namespace SteamAudio
{
/*
* Imports .sofa files as SOFAFile asset objects.
*/
[ScriptedImporter(2, "sofa")]
public class SOFAFileImporter : ScriptedImporter
{
[Range(-12.0f, 12.0f)]
public float hrtfVolumeGainDB = 0.0f;
public HRTFNormType hrtfNormalizationType = HRTFNormType.None;
public override void OnImportAsset(AssetImportContext ctx)
{
var sofaFile = ScriptableObject.CreateInstance<SOFAFile>();
sofaFile.sofaName = Path.GetFileName(ctx.assetPath);
sofaFile.data = File.ReadAllBytes(ctx.assetPath);
sofaFile.volume = hrtfVolumeGainDB;
sofaFile.normType = hrtfNormalizationType;
ctx.AddObjectToAsset("sofa file", sofaFile);
ctx.SetMainObject(sofaFile);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1731f5ddf70efee4c8320ac591373b56
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,41 @@
//
// Copyright 2017-2023 Valve Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using UnityEditor;
#if UNITY_2020_2_OR_NEWER
using UnityEditor.AssetImporters;
#else
using UnityEditor.Experimental.AssetImporters;
#endif
namespace SteamAudio
{
/*
* Custom editor GUI for SOFAFile import settings.
*/
[CustomEditor(typeof(SOFAFileImporter))]
public class SOFAFileImporterEditor : ScriptedImporterEditor
{
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(serializedObject.FindProperty("hrtfVolumeGainDB"), new UnityEngine.GUIContent("HRTF Volume Gain (dB)"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("hrtfNormalizationType"), new UnityEngine.GUIContent("HRTF Normalization Type"));
serializedObject.ApplyModifiedProperties();
ApplyRevertGUI();
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d3653cc84febdd64e8064c9e17883043
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,41 @@
//
// Copyright 2017-2023 Valve Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using UnityEditor;
namespace SteamAudio
{
[CustomEditor(typeof(SerializedData))]
public class SerializedDataInspector : Editor
{
SerializedProperty mData;
private void OnEnable()
{
mData = serializedObject.FindProperty("data");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
var size = mData.arraySize;
EditorGUILayout.LabelField("Serialized Data", Common.HumanReadableDataSize(size));
serializedObject.ApplyModifiedProperties();
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9184af0375b7f6140be4f789b5fc7083
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,50 @@
//
// Copyright 2017-2023 Valve Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using UnityEditor;
namespace SteamAudio
{
[CustomEditor(typeof(SteamAudioAmbisonicSource))]
[CanEditMultipleObjects]
public class SteamAudioAmbisonicSourceInspector : Editor
{
SerializedProperty mApplyHRTF;
private void OnEnable()
{
mApplyHRTF = serializedObject.FindProperty("applyHRTF");
}
public override void OnInspectorGUI()
{
if (SteamAudioSettings.Singleton.audioEngine != AudioEngineType.Unity)
{
EditorGUILayout.HelpBox(
"This component requires the audio engine to be set to Unity. Click" +
"Steam Audio > Settings to change this.", MessageType.Warning);
return;
}
serializedObject.Update();
EditorGUILayout.PropertyField(mApplyHRTF);
serializedObject.ApplyModifiedProperties();
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 93bd07e672dff904ea2291dd4ac45a45
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,97 @@
//
// Copyright 2017-2023 Valve Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using UnityEngine;
using UnityEditor;
namespace SteamAudio
{
[CustomEditor(typeof(SteamAudioBakedListener))]
public class SteamAudioBakedListenerInspector : Editor
{
#if STEAMAUDIO_ENABLED
SerializedProperty mInfluenceRadius;
SerializedProperty mUseAllProbeBatches;
SerializedProperty mProbeBatches;
bool mStatsFoldout = false;
bool mShouldShowProgressBar = false;
private void OnEnable()
{
mInfluenceRadius = serializedObject.FindProperty("influenceRadius");
mUseAllProbeBatches = serializedObject.FindProperty("useAllProbeBatches");
mProbeBatches = serializedObject.FindProperty("probeBatches");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
var oldGUIEnabled = GUI.enabled;
GUI.enabled = !Baker.IsBakeActive() && !EditorApplication.isPlayingOrWillChangePlaymode;
var tgt = target as SteamAudioBakedListener;
EditorGUILayout.PropertyField(mInfluenceRadius);
EditorGUILayout.PropertyField(mUseAllProbeBatches);
if (!mUseAllProbeBatches.boolValue)
{
EditorGUILayout.PropertyField(mProbeBatches);
}
EditorGUILayout.Space();
if (GUILayout.Button("Bake"))
{
tgt.BeginBake();
mShouldShowProgressBar = true;
}
GUI.enabled = oldGUIEnabled;
if (mShouldShowProgressBar && !Baker.IsBakeActive())
{
mShouldShowProgressBar = false;
}
if (mShouldShowProgressBar)
{
Baker.DrawProgressBar();
}
Repaint();
EditorGUILayout.Space();
mStatsFoldout = EditorGUILayout.Foldout(mStatsFoldout, "Baked Data Statistics");
if (mStatsFoldout && !Baker.IsBakeActive())
{
for (var i = 0; i < tgt.GetProbeBatchesUsed().Length; ++i)
{
EditorGUILayout.LabelField(tgt.GetProbeBatchesUsed()[i].gameObject.name, Common.HumanReadableDataSize(tgt.GetProbeDataSizes()[i]));
}
EditorGUILayout.LabelField("Total Size", Common.HumanReadableDataSize(tgt.GetTotalDataSize()));
}
serializedObject.ApplyModifiedProperties();
}
#else
public override void OnInspectorGUI()
{
EditorGUILayout.HelpBox("Steam Audio is not supported for the target platform or STEAMAUDIO_ENABLED define symbol is missing.", MessageType.Warning);
}
#endif
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5e99d6d8163e0e24cadf1add0983102e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,97 @@
//
// Copyright 2017-2023 Valve Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using UnityEngine;
using UnityEditor;
namespace SteamAudio
{
[CustomEditor(typeof(SteamAudioBakedSource))]
public class SteamAudioBakedSourceInspector : Editor
{
#if STEAMAUDIO_ENABLED
SerializedProperty mInfluenceRadius;
SerializedProperty mUseAllProbeBatches;
SerializedProperty mProbeBatches;
bool mStatsFoldout = false;
bool mShouldShowProgressBar = false;
private void OnEnable()
{
mInfluenceRadius = serializedObject.FindProperty("influenceRadius");
mUseAllProbeBatches = serializedObject.FindProperty("useAllProbeBatches");
mProbeBatches = serializedObject.FindProperty("probeBatches");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
var oldGUIEnabled = GUI.enabled;
GUI.enabled = !Baker.IsBakeActive() && !EditorApplication.isPlayingOrWillChangePlaymode;
var tgt = target as SteamAudioBakedSource;
EditorGUILayout.PropertyField(mInfluenceRadius);
EditorGUILayout.PropertyField(mUseAllProbeBatches);
if (!mUseAllProbeBatches.boolValue)
{
EditorGUILayout.PropertyField(mProbeBatches);
}
EditorGUILayout.Space();
if (GUILayout.Button("Bake"))
{
tgt.BeginBake();
mShouldShowProgressBar = true;
}
GUI.enabled = oldGUIEnabled;
if (mShouldShowProgressBar && !Baker.IsBakeActive())
{
mShouldShowProgressBar = false;
}
if (mShouldShowProgressBar)
{
Baker.DrawProgressBar();
}
Repaint();
EditorGUILayout.Space();
mStatsFoldout = EditorGUILayout.Foldout(mStatsFoldout, "Baked Data Statistics");
if (mStatsFoldout && !Baker.IsBakeActive())
{
for (var i = 0; i < tgt.GetProbeBatchesUsed().Length; ++i)
{
EditorGUILayout.LabelField(tgt.GetProbeBatchesUsed()[i].gameObject.name, Common.HumanReadableDataSize(tgt.GetProbeDataSizes()[i]));
}
EditorGUILayout.LabelField("Total Size", Common.HumanReadableDataSize(tgt.GetTotalDataSize()));
}
serializedObject.ApplyModifiedProperties();
}
#else
public override void OnInspectorGUI()
{
EditorGUILayout.HelpBox("Steam Audio is not supported for the target platform or STEAMAUDIO_ENABLED define symbol is missing.", MessageType.Warning);
}
#endif
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3333927edc4e4ec4e880a1ff9e9a7a2e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,75 @@
//
// Copyright 2017-2023 Valve Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
namespace SteamAudio
{
[CustomEditor(typeof(SteamAudioDynamicObject))]
public class SteamAudioDynamicObjectInspector : Editor
{
#if STEAMAUDIO_ENABLED
SerializedProperty mAsset;
private void OnEnable()
{
mAsset = serializedObject.FindProperty("asset");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(mAsset);
if (mAsset.objectReferenceValue == null)
{
EditorGUILayout.HelpBox(
"This Dynamic Object has not been exported to an asset yet. Please click Export Dynamic Object " +
"to do so.", MessageType.Warning);
}
EditorGUILayout.Space();
if (GUILayout.Button("Export Dynamic Object"))
{
if (mAsset.objectReferenceValue == null)
{
var name = (target as SteamAudioDynamicObject).gameObject.scene.name + "_" + target.name;
mAsset.objectReferenceValue = SerializedData.PromptForNewAsset(name);
serializedObject.ApplyModifiedProperties();
}
SteamAudioManager.ExportDynamicObject(target as SteamAudioDynamicObject, false);
}
if (GUILayout.Button("Export Dynamic Object as OBJ"))
{
SteamAudioManager.ExportDynamicObject(target as SteamAudioDynamicObject, true);
}
serializedObject.ApplyModifiedProperties();
}
#else
public override void OnInspectorGUI()
{
EditorGUILayout.HelpBox("Steam Audio is not supported for the target platform or STEAMAUDIO_ENABLED define symbol is missing.", MessageType.Warning);
}
#endif
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 980be31a5041c924094140b19f4276cd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,70 @@
//
// Copyright 2017-2023 Valve Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using UnityEngine;
using UnityEditor;
namespace SteamAudio
{
[CustomEditor(typeof(SteamAudioGeometry))]
[CanEditMultipleObjects]
public class SteamAudioGeometryInspector : Editor
{
#if STEAMAUDIO_ENABLED
SerializedProperty mMaterial;
SerializedProperty mExportAllChildren;
SerializedProperty mTerrainSimplificationLevel;
private void OnEnable()
{
mMaterial = serializedObject.FindProperty("material");
mExportAllChildren = serializedObject.FindProperty("exportAllChildren");
mTerrainSimplificationLevel = serializedObject.FindProperty("terrainSimplificationLevel");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
var tgt = target as SteamAudioGeometry;
EditorGUILayout.PropertyField(mMaterial);
if (tgt.transform.childCount != 0)
{
EditorGUILayout.PropertyField(mExportAllChildren);
}
if (tgt.gameObject.GetComponent<Terrain>() != null)
{
EditorGUILayout.PropertyField(mTerrainSimplificationLevel);
}
EditorGUILayout.Space();
EditorGUILayout.LabelField("Geometry Statistics", EditorStyles.boldLabel);
EditorGUILayout.LabelField("Vertices", tgt.GetNumVertices().ToString());
EditorGUILayout.LabelField("Triangles", tgt.GetNumTriangles().ToString());
serializedObject.ApplyModifiedProperties();
}
#else
public override void OnInspectorGUI()
{
EditorGUILayout.HelpBox("Steam Audio is not supported for the target platform or STEAMAUDIO_ENABLED define symbol is missing.", MessageType.Warning);
}
#endif
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 58fcd8cc93a64734490ae21a46fb412d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,108 @@
//
// Copyright 2017-2023 Valve Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using UnityEngine;
using UnityEditor;
namespace SteamAudio
{
[CustomEditor(typeof(SteamAudioListener))]
public class SteamAudioListenerInspector : Editor
{
#if STEAMAUDIO_ENABLED
SerializedProperty mCurrentBakedListener;
SerializedProperty mApplyReverb;
SerializedProperty mReverbType;
SerializedProperty mUseAllProbeBatches;
SerializedProperty mProbeBatches;
bool mStatsFoldout = false;
bool mShouldShowProgressBar = false;
private void OnEnable()
{
mCurrentBakedListener = serializedObject.FindProperty("currentBakedListener");
mApplyReverb = serializedObject.FindProperty("applyReverb");
mReverbType = serializedObject.FindProperty("reverbType");
mUseAllProbeBatches = serializedObject.FindProperty("useAllProbeBatches");
mProbeBatches = serializedObject.FindProperty("probeBatches");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(mCurrentBakedListener);
EditorGUILayout.PropertyField(mApplyReverb);
if (mApplyReverb.boolValue)
{
EditorGUILayout.PropertyField(mReverbType);
}
var oldGUIEnabled = GUI.enabled;
GUI.enabled = !Baker.IsBakeActive() && !EditorApplication.isPlayingOrWillChangePlaymode;
var tgt = target as SteamAudioListener;
EditorGUILayout.PropertyField(mUseAllProbeBatches);
if (!mUseAllProbeBatches.boolValue)
{
EditorGUILayout.PropertyField(mProbeBatches);
}
EditorGUILayout.Space();
if (GUILayout.Button("Bake"))
{
tgt.BeginBake();
mShouldShowProgressBar = true;
}
GUI.enabled = oldGUIEnabled;
if (mShouldShowProgressBar && !Baker.IsBakeActive())
{
mShouldShowProgressBar = false;
}
if (mShouldShowProgressBar)
{
Baker.DrawProgressBar();
}
Repaint();
EditorGUILayout.Space();
mStatsFoldout = EditorGUILayout.Foldout(mStatsFoldout, "Baked Data Statistics");
if (mStatsFoldout && !Baker.IsBakeActive())
{
for (var i = 0; i < tgt.GetProbeBatchesUsed().Length; ++i)
{
EditorGUILayout.LabelField(tgt.GetProbeBatchesUsed()[i].gameObject.name, Common.HumanReadableDataSize(tgt.GetProbeDataSizes()[i]));
}
EditorGUILayout.LabelField("Total Size", Common.HumanReadableDataSize(tgt.GetTotalDataSize()));
}
serializedObject.ApplyModifiedProperties();
}
#else
public override void OnInspectorGUI()
{
EditorGUILayout.HelpBox("Steam Audio is not supported for the target platform or STEAMAUDIO_ENABLED define symbol is missing.", MessageType.Warning);
}
#endif
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 68c66682e05a3a744896f1452c21c860
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,57 @@
//
// Copyright 2017-2023 Valve Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using UnityEditor;
namespace SteamAudio
{
[CustomEditor(typeof(SteamAudioManager))]
[CanEditMultipleObjects]
public class SteamAudioManagerInspector : Editor
{
#if STEAMAUDIO_ENABLED
SerializedProperty mCurrentHRTF;
private void OnEnable()
{
mCurrentHRTF = serializedObject.FindProperty("currentHRTF");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
var tgt = target as SteamAudioManager;
EditorGUILayout.Space();
EditorGUILayout.LabelField("HRTF Settings", EditorStyles.boldLabel);
mCurrentHRTF.intValue = EditorGUILayout.Popup("Current HRTF", mCurrentHRTF.intValue, tgt.hrtfNames);
EditorGUILayout.Space();
EditorGUILayout.HelpBox(
"This component should not be added manually to any GameObject. It is automatically created and" +
"destroyed by Steam Audio.", MessageType.Warning);
serializedObject.ApplyModifiedProperties();
}
#else
public override void OnInspectorGUI()
{
EditorGUILayout.HelpBox("Steam Audio is not supported for the target platform or STEAMAUDIO_ENABLED define symbol is missing.", MessageType.Warning);
}
#endif
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e5adb5adac336b84fa2308b30315459d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,59 @@
//
// Copyright 2017-2023 Valve Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using UnityEditor;
namespace SteamAudio
{
[CustomEditor(typeof(SteamAudioMaterial))]
[CanEditMultipleObjects]
public class SteamAudioMaterialInspector : Editor
{
SerializedProperty lowFreqAbsorption;
SerializedProperty midFreqAbsorption;
SerializedProperty highFreqAbsorption;
SerializedProperty scattering;
SerializedProperty lowFreqTransmission;
SerializedProperty midFreqTransmission;
SerializedProperty highFreqTransmission;
private void OnEnable()
{
lowFreqAbsorption = serializedObject.FindProperty("lowFreqAbsorption");
midFreqAbsorption = serializedObject.FindProperty("midFreqAbsorption");
highFreqAbsorption = serializedObject.FindProperty("highFreqAbsorption");
scattering = serializedObject.FindProperty("scattering");
lowFreqTransmission = serializedObject.FindProperty("lowFreqTransmission");
midFreqTransmission = serializedObject.FindProperty("midFreqTransmission");
highFreqTransmission = serializedObject.FindProperty("highFreqTransmission");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(lowFreqAbsorption);
EditorGUILayout.PropertyField(midFreqAbsorption);
EditorGUILayout.PropertyField(highFreqAbsorption);
EditorGUILayout.PropertyField(scattering);
EditorGUILayout.PropertyField(lowFreqTransmission);
EditorGUILayout.PropertyField(midFreqTransmission);
EditorGUILayout.PropertyField(highFreqTransmission);
serializedObject.ApplyModifiedProperties();
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d390cf1bb6f67ca47b6b5d3c43ec5956
timeCreated: 1499375927
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,74 @@
//
// Copyright 2017-2023 Valve Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using UnityEngine;
using UnityEditor;
namespace SteamAudio
{
public class SteamAudioMixerReturnGUI : IAudioEffectPluginGUI
{
public override string Name
{
get
{
return "Steam Audio Mixer Return";
}
}
public override string Vendor
{
get
{
return "Valve Corporation";
}
}
public override string Description
{
get
{
return "Enables accelerated mixing of reflections for sources spatialized using Steam Audio.";
}
}
public override bool OnGUI(IAudioEffectPlugin plugin)
{
if (SteamAudioSettings.Singleton.audioEngine != AudioEngineType.Unity)
{
EditorGUILayout.HelpBox(
"This Audio Mixer effect requires the audio engine to be set to Unity. Click" +
"Steam Audio > Settings to change this.", MessageType.Warning);
return false;
}
var binauralValue = 0.0f;
plugin.GetFloatParameter("Binaural", out binauralValue);
var binaural = (binauralValue == 1.0f);
binaural = EditorGUILayout.Toggle("Apply HRTF", binaural);
binauralValue = (binaural) ? 1.0f : 0.0f;
plugin.SetFloatParameter("Binaural", binauralValue);
return false;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 03cab73d8173c364bb30b17574e2f240
timeCreated: 1499881264
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,143 @@
//
// Copyright 2017-2023 Valve Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEditor;
using UnityEditor.SceneManagement;
namespace SteamAudio
{
[CustomEditor(typeof(SteamAudioProbeBatch))]
public class SteamAudioProbeBatchInspector : Editor
{
#if STEAMAUDIO_ENABLED
SerializedProperty mPlacementStrategy;
SerializedProperty mHorizontalSpacing;
SerializedProperty mHeightAboveFloor;
SerializedProperty mAsset;
bool mShouldShowProgressBar = false;
private void OnEnable()
{
mPlacementStrategy = serializedObject.FindProperty("placementStrategy");
mHorizontalSpacing = serializedObject.FindProperty("horizontalSpacing");
mHeightAboveFloor = serializedObject.FindProperty("heightAboveFloor");
mAsset = serializedObject.FindProperty("asset");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
var oldGUIEnabled = GUI.enabled;
GUI.enabled = !Baker.IsBakeActive() && !EditorApplication.isPlayingOrWillChangePlaymode;
var tgt = target as SteamAudioProbeBatch;
EditorGUILayout.PropertyField(mAsset);
EditorGUILayout.PropertyField(mPlacementStrategy);
if ((ProbeGenerationType) mPlacementStrategy.enumValueIndex == ProbeGenerationType.UniformFloor)
{
EditorGUILayout.PropertyField(mHorizontalSpacing);
EditorGUILayout.PropertyField(mHeightAboveFloor);
}
EditorGUILayout.Space();
if (GUILayout.Button("Generate Probes"))
{
tgt.GenerateProbes();
EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
}
if (tgt.GetNumProbes() > 0)
{
EditorGUILayout.Space();
EditorGUILayout.LabelField("Baked Pathing Settings", EditorStyles.boldLabel);
if (GUILayout.Button("Bake"))
{
tgt.BeginBake();
mShouldShowProgressBar = true;
}
}
GUI.enabled = oldGUIEnabled;
if (mShouldShowProgressBar && !Baker.IsBakeActive())
{
mShouldShowProgressBar = false;
}
if (mShouldShowProgressBar)
{
Baker.DrawProgressBar();
}
Repaint();
if (tgt.GetNumProbes() > 0)
{
EditorGUILayout.Space();
EditorGUILayout.LabelField("Probe Statistics", EditorStyles.boldLabel);
EditorGUILayout.LabelField("Probes", tgt.GetNumProbes().ToString());
EditorGUILayout.LabelField("Data Size", Common.HumanReadableDataSize(tgt.probeDataSize));
if (tgt.GetNumLayers() > 0)
{
EditorGUILayout.Space();
EditorGUILayout.LabelField("Detailed Statistics", EditorStyles.boldLabel);
for (var i = 0; i < tgt.GetNumLayers(); ++i)
{
var layerInfo = tgt.GetInfoForLayer(i);
var name = "";
if (layerInfo.identifier.type == BakedDataType.Pathing)
{
name = "Pathing";
}
else if (layerInfo.identifier.variation == BakedDataVariation.Reverb)
{
name = "Reverb";
}
else
{
name = layerInfo.gameObject.name;
}
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(name, Common.HumanReadableDataSize(layerInfo.dataSize));
if (GUILayout.Button("Clear"))
{
tgt.DeleteBakedDataForIdentifier(layerInfo.identifier);
EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
}
EditorGUILayout.EndHorizontal();
}
}
}
serializedObject.ApplyModifiedProperties();
}
#else
public override void OnInspectorGUI()
{
EditorGUILayout.HelpBox("Steam Audio is not supported for the target platform or STEAMAUDIO_ENABLED define symbol is missing.", MessageType.Warning);
}
#endif
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: db54b1d0b8cefcf4486eccd5e7c185f7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,74 @@
//
// Copyright 2017-2023 Valve Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using UnityEngine;
using UnityEditor;
namespace SteamAudio
{
public class SteamAudioReverbGUI : IAudioEffectPluginGUI
{
public override string Name
{
get
{
return "Steam Audio Reverb";
}
}
public override string Vendor
{
get
{
return "Valve Corporation";
}
}
public override string Description
{
get
{
return "Listener-centric reverb using Steam Audio.";
}
}
public override bool OnGUI(IAudioEffectPlugin plugin)
{
if (SteamAudioSettings.Singleton.audioEngine != AudioEngineType.Unity)
{
EditorGUILayout.HelpBox(
"This Audio Mixer effect requires the audio engine to be set to Unity. Click" +
"Steam Audio > Settings to change this.", MessageType.Warning);
return false;
}
var binauralValue = 0.0f;
plugin.GetFloatParameter("Binaural", out binauralValue);
var binaural = (binauralValue == 1.0f);
binaural = EditorGUILayout.Toggle("Apply HRTF", binaural);
binauralValue = (binaural) ? 1.0f : 0.0f;
plugin.SetFloatParameter("Binaural", binauralValue);
return false;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 6f194df3638411045b8624f4e62e44fd
timeCreated: 1499886452
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,233 @@
//
// Copyright 2017-2023 Valve Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using UnityEditor;
namespace SteamAudio
{
[CustomEditor(typeof(SteamAudioSettings))]
[CanEditMultipleObjects]
public class SteamAudioSettingsInspector : Editor
{
SerializedProperty mAudioEngine;
SerializedProperty mPerspectiveCorrection;
SerializedProperty mPerspectiveCorrectionFactor;
SerializedProperty mHRTFVolumeNormalizationType;
SerializedProperty mHRTFVolumeGainDB;
SerializedProperty mSOFAFiles;
SerializedProperty mDefaultMaterial;
SerializedProperty mSceneType;
SerializedProperty mLayerMask;
SerializedProperty mMaxOcclusionSamples;
SerializedProperty mRealTimeRays;
SerializedProperty mRealTimeBounces;
SerializedProperty mRealTimeDuration;
SerializedProperty mRealTimeAmbisonicOrder;
SerializedProperty mRealTimeMaxSources;
SerializedProperty mRealTimeCPUCoresPercentage;
SerializedProperty mRealTimeIrradianceMinDistance;
SerializedProperty mBakeConvolution;
SerializedProperty mBakeParametric;
SerializedProperty mBakingRays;
SerializedProperty mBakingBounces;
SerializedProperty mBakingDuration;
SerializedProperty mBakingAmbisonicOrder;
SerializedProperty mBakingCPUCoresPercentage;
SerializedProperty mBakingIrradianceMinDistance;
SerializedProperty mBakingVisibilitySamples;
SerializedProperty mBakingVisibilityRadius;
SerializedProperty mBakingVisibilityThreshold;
SerializedProperty mBakingVisibilityRange;
SerializedProperty mBakingPathRange;
SerializedProperty mBakedPathingCPUCoresPercentage;
SerializedProperty mSimulationUpdateInterval;
SerializedProperty mReflectionEffectType;
SerializedProperty mHybridReverbTransitionTime;
SerializedProperty mHybridReverbOverlapPercent;
SerializedProperty mDeviceType;
SerializedProperty mMaxReservedCUs;
SerializedProperty mFractionCUsForIRUpdate;
SerializedProperty mBakingBatchSize;
SerializedProperty mTANDuration;
SerializedProperty mTANAmbisonicOrder;
SerializedProperty mTANMaxSources;
SerializedProperty mEnableValidation;
#if !UNITY_2019_2_OR_NEWER
static string[] sSceneTypes = new string[] { "Phonon", "Embree", "Radeon Rays", "Unity" };
#endif
#if !UNITY_2019_2_OR_NEWER
static string[] sReflectionEffectTypes = new string[] { "Convolution", "Parametric", "Hybrid", "TrueAudio Next" };
#endif
private void OnEnable()
{
mAudioEngine = serializedObject.FindProperty("audioEngine");
mPerspectiveCorrection = serializedObject.FindProperty("perspectiveCorrection");
mPerspectiveCorrectionFactor = serializedObject.FindProperty("perspectiveCorrectionFactor");
mHRTFVolumeGainDB = serializedObject.FindProperty("hrtfVolumeGainDB");
mHRTFVolumeNormalizationType = serializedObject.FindProperty("hrtfNormalizationType");
mSOFAFiles = serializedObject.FindProperty("SOFAFiles");
mDefaultMaterial = serializedObject.FindProperty("defaultMaterial");
mSceneType = serializedObject.FindProperty("sceneType");
mLayerMask = serializedObject.FindProperty("layerMask");
mMaxOcclusionSamples = serializedObject.FindProperty("maxOcclusionSamples");
mRealTimeRays = serializedObject.FindProperty("realTimeRays");
mRealTimeBounces = serializedObject.FindProperty("realTimeBounces");
mRealTimeDuration = serializedObject.FindProperty("realTimeDuration");
mRealTimeAmbisonicOrder = serializedObject.FindProperty("realTimeAmbisonicOrder");
mRealTimeMaxSources = serializedObject.FindProperty("realTimeMaxSources");
mRealTimeCPUCoresPercentage = serializedObject.FindProperty("realTimeCPUCoresPercentage");
mRealTimeIrradianceMinDistance = serializedObject.FindProperty("realTimeIrradianceMinDistance");
mBakeConvolution = serializedObject.FindProperty("bakeConvolution");
mBakeParametric = serializedObject.FindProperty("bakeParametric");
mBakingRays = serializedObject.FindProperty("bakingRays");
mBakingBounces = serializedObject.FindProperty("bakingBounces");
mBakingDuration = serializedObject.FindProperty("bakingDuration");
mBakingAmbisonicOrder = serializedObject.FindProperty("bakingAmbisonicOrder");
mBakingCPUCoresPercentage = serializedObject.FindProperty("bakingCPUCoresPercentage");
mBakingIrradianceMinDistance = serializedObject.FindProperty("bakingIrradianceMinDistance");
mBakingVisibilitySamples = serializedObject.FindProperty("bakingVisibilitySamples");
mBakingVisibilityRadius = serializedObject.FindProperty("bakingVisibilityRadius");
mBakingVisibilityThreshold = serializedObject.FindProperty("bakingVisibilityThreshold");
mBakingVisibilityRange = serializedObject.FindProperty("bakingVisibilityRange");
mBakingPathRange = serializedObject.FindProperty("bakingPathRange");
mBakedPathingCPUCoresPercentage = serializedObject.FindProperty("bakedPathingCPUCoresPercentage");
mSimulationUpdateInterval = serializedObject.FindProperty("simulationUpdateInterval");
mReflectionEffectType = serializedObject.FindProperty("reflectionEffectType");
mHybridReverbTransitionTime = serializedObject.FindProperty("hybridReverbTransitionTime");
mHybridReverbOverlapPercent = serializedObject.FindProperty("hybridReverbOverlapPercent");
mDeviceType = serializedObject.FindProperty("deviceType");
mMaxReservedCUs = serializedObject.FindProperty("maxReservedComputeUnits");
mFractionCUsForIRUpdate = serializedObject.FindProperty("fractionComputeUnitsForIRUpdate");
mBakingBatchSize = serializedObject.FindProperty("bakingBatchSize");
mTANDuration = serializedObject.FindProperty("TANDuration");
mTANAmbisonicOrder = serializedObject.FindProperty("TANAmbisonicOrder");
mTANMaxSources = serializedObject.FindProperty("TANMaxSources");
mEnableValidation = serializedObject.FindProperty("EnableValidation");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(mAudioEngine);
EditorGUILayout.PropertyField(mPerspectiveCorrection, new UnityEngine.GUIContent("Enable Perspective Correction"));
if (mPerspectiveCorrection.boolValue)
EditorGUILayout.PropertyField(mPerspectiveCorrectionFactor);
EditorGUILayout.PropertyField(mHRTFVolumeGainDB, new UnityEngine.GUIContent("HRTF Volume Gain (dB)"));
EditorGUILayout.PropertyField(mHRTFVolumeNormalizationType, new UnityEngine.GUIContent("HRTF Normalization Type"));
EditorGUILayout.PropertyField(mSOFAFiles, true);
EditorGUILayout.PropertyField(mDefaultMaterial);
#if UNITY_2019_2_OR_NEWER
EditorGUILayout.PropertyField(mSceneType);
#else
SceneTypeField();
#endif
if (((SceneType) mSceneType.enumValueIndex) == SceneType.Custom)
{
EditorGUILayout.PropertyField(mLayerMask);
}
EditorGUILayout.PropertyField(mMaxOcclusionSamples);
EditorGUILayout.PropertyField(mRealTimeRays);
EditorGUILayout.PropertyField(mRealTimeBounces);
EditorGUILayout.PropertyField(mRealTimeDuration);
EditorGUILayout.PropertyField(mRealTimeAmbisonicOrder);
EditorGUILayout.PropertyField(mRealTimeMaxSources);
EditorGUILayout.PropertyField(mRealTimeCPUCoresPercentage);
EditorGUILayout.PropertyField(mRealTimeIrradianceMinDistance);
EditorGUILayout.PropertyField(mBakeConvolution);
EditorGUILayout.PropertyField(mBakeParametric);
EditorGUILayout.PropertyField(mBakingRays);
EditorGUILayout.PropertyField(mBakingBounces);
EditorGUILayout.PropertyField(mBakingDuration);
EditorGUILayout.PropertyField(mBakingAmbisonicOrder);
EditorGUILayout.PropertyField(mBakingCPUCoresPercentage);
EditorGUILayout.PropertyField(mBakingIrradianceMinDistance);
EditorGUILayout.PropertyField(mBakingVisibilitySamples);
EditorGUILayout.PropertyField(mBakingVisibilityRadius);
EditorGUILayout.PropertyField(mBakingVisibilityThreshold);
EditorGUILayout.PropertyField(mBakingVisibilityRange);
EditorGUILayout.PropertyField(mBakingPathRange);
EditorGUILayout.PropertyField(mBakedPathingCPUCoresPercentage);
EditorGUILayout.PropertyField(mSimulationUpdateInterval);
#if UNITY_2019_2_OR_NEWER
EditorGUILayout.PropertyField(mReflectionEffectType);
#else
ReflectionEffectTypeField();
#endif
if (((ReflectionEffectType) mReflectionEffectType.enumValueIndex) == ReflectionEffectType.Hybrid)
{
EditorGUILayout.PropertyField(mHybridReverbTransitionTime);
EditorGUILayout.PropertyField(mHybridReverbOverlapPercent);
}
if (((SceneType) mSceneType.enumValueIndex) == SceneType.RadeonRays ||
((ReflectionEffectType) mReflectionEffectType.enumValueIndex) == ReflectionEffectType.TrueAudioNext)
{
EditorGUILayout.PropertyField(mDeviceType);
EditorGUILayout.PropertyField(mMaxReservedCUs);
EditorGUILayout.PropertyField(mFractionCUsForIRUpdate);
if (((SceneType) mSceneType.enumValueIndex) == SceneType.RadeonRays)
{
EditorGUILayout.PropertyField(mBakingBatchSize);
}
if (((ReflectionEffectType) mReflectionEffectType.enumValueIndex) == ReflectionEffectType.TrueAudioNext)
{
EditorGUILayout.PropertyField(mTANDuration);
EditorGUILayout.PropertyField(mTANAmbisonicOrder);
EditorGUILayout.PropertyField(mTANMaxSources);
}
}
EditorGUILayout.PropertyField(mEnableValidation);
serializedObject.ApplyModifiedProperties();
}
#if !UNITY_2019_2_OR_NEWER
void SceneTypeField()
{
EditorGUILayout.Space();
EditorGUILayout.LabelField("Ray Tracer Settings", EditorStyles.boldLabel);
mSceneType.enumValueIndex = EditorGUILayout.Popup(mSceneType.displayName, mSceneType.enumValueIndex, sSceneTypes);
}
#endif
#if !UNITY_2019_2_OR_NEWER
void ReflectionEffectTypeField()
{
EditorGUILayout.Space();
EditorGUILayout.LabelField("Reflection Effect Settings", EditorStyles.boldLabel);
mReflectionEffectType.enumValueIndex = EditorGUILayout.Popup(mReflectionEffectType.displayName, mReflectionEffectType.enumValueIndex, sReflectionEffectTypes);
}
#endif
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4874c09ead1502c4b966e1bb4e7ad3da
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,346 @@
//
// Copyright 2017-2023 Valve Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using UnityEngine;
using UnityEditor;
namespace SteamAudio
{
[CustomEditor(typeof(SteamAudioSource))]
public class SteamAudioSourceInspector : Editor
{
SerializedProperty mDirectBinaural;
SerializedProperty mInterpolation;
SerializedProperty mPerspectiveCorrection;
SerializedProperty mDistanceAttenuation;
SerializedProperty mDistanceAttenuationInput;
SerializedProperty mAirAbsorption;
SerializedProperty mAirAbsorptionInput;
SerializedProperty mAirAbsorptionLow;
SerializedProperty mAirAbsorptionMid;
SerializedProperty mAirAbsorptionHigh;
SerializedProperty mDirectivity;
SerializedProperty mDirectivityInput;
SerializedProperty mDipoleWeight;
SerializedProperty mDipolePower;
SerializedProperty mDirectivityValue;
SerializedProperty mOcclusion;
SerializedProperty mOcclusionInput;
SerializedProperty mOcclusionType;
SerializedProperty mOcclusionRadius;
SerializedProperty mOcclusionSamples;
SerializedProperty mOcclusionValue;
SerializedProperty mTransmission;
SerializedProperty mTransmissionType;
SerializedProperty mTransmissionInput;
SerializedProperty mTransmissionLow;
SerializedProperty mTransmissionMid;
SerializedProperty mTransmissionHigh;
SerializedProperty mTransmissionRays;
SerializedProperty mDirectMixLevel;
SerializedProperty mReflections;
SerializedProperty mReflectionsType;
SerializedProperty mUseDistanceCurveForReflections;
SerializedProperty mCurrentBakedSource;
SerializedProperty mApplyHRTFToReflections;
SerializedProperty mReflectionsMixLevel;
SerializedProperty mPathing;
SerializedProperty mPathingProbeBatch;
SerializedProperty mPathValidation;
SerializedProperty mFindAlternatePaths;
SerializedProperty mApplyHRTFToPathing;
SerializedProperty mPathingMixLevel;
Texture2D mDirectivityPreview = null;
float[] mDirectivitySamples = null;
Vector2[] mDirectivityPositions = null;
private void OnEnable()
{
mDirectBinaural = serializedObject.FindProperty("directBinaural");
mInterpolation = serializedObject.FindProperty("interpolation");
mPerspectiveCorrection = serializedObject.FindProperty("perspectiveCorrection");
mDistanceAttenuation = serializedObject.FindProperty("distanceAttenuation");
mDistanceAttenuationInput = serializedObject.FindProperty("distanceAttenuationInput");
mAirAbsorption = serializedObject.FindProperty("airAbsorption");
mAirAbsorptionInput = serializedObject.FindProperty("airAbsorptionInput");
mAirAbsorptionLow = serializedObject.FindProperty("airAbsorptionLow");
mAirAbsorptionMid = serializedObject.FindProperty("airAbsorptionMid");
mAirAbsorptionHigh = serializedObject.FindProperty("airAbsorptionHigh");
mDirectivity = serializedObject.FindProperty("directivity");
mDirectivityInput = serializedObject.FindProperty("directivityInput");
mDipoleWeight = serializedObject.FindProperty("dipoleWeight");
mDipolePower = serializedObject.FindProperty("dipolePower");
mDirectivityValue = serializedObject.FindProperty("directivityValue");
mOcclusion = serializedObject.FindProperty("occlusion");
mOcclusionInput = serializedObject.FindProperty("occlusionInput");
mOcclusionType = serializedObject.FindProperty("occlusionType");
mOcclusionRadius = serializedObject.FindProperty("occlusionRadius");
mOcclusionSamples = serializedObject.FindProperty("occlusionSamples");
mOcclusionValue = serializedObject.FindProperty("occlusionValue");
mTransmission = serializedObject.FindProperty("transmission");
mTransmissionType = serializedObject.FindProperty("transmissionType");
mTransmissionInput = serializedObject.FindProperty("transmissionInput");
mTransmissionLow = serializedObject.FindProperty("transmissionLow");
mTransmissionMid = serializedObject.FindProperty("transmissionMid");
mTransmissionHigh = serializedObject.FindProperty("transmissionHigh");
mTransmissionRays = serializedObject.FindProperty("maxTransmissionSurfaces");
mDirectMixLevel = serializedObject.FindProperty("directMixLevel");
mReflections = serializedObject.FindProperty("reflections");
mReflectionsType = serializedObject.FindProperty("reflectionsType");
mUseDistanceCurveForReflections = serializedObject.FindProperty("useDistanceCurveForReflections");
mCurrentBakedSource = serializedObject.FindProperty("currentBakedSource");
mApplyHRTFToReflections = serializedObject.FindProperty("applyHRTFToReflections");
mReflectionsMixLevel = serializedObject.FindProperty("reflectionsMixLevel");
mPathing = serializedObject.FindProperty("pathing");
mPathingProbeBatch = serializedObject.FindProperty("pathingProbeBatch");
mPathValidation = serializedObject.FindProperty("pathValidation");
mFindAlternatePaths = serializedObject.FindProperty("findAlternatePaths");
mApplyHRTFToPathing = serializedObject.FindProperty("applyHRTFToPathing");
mPathingMixLevel = serializedObject.FindProperty("pathingMixLevel");
}
public override void OnInspectorGUI()
{
var audioEngineIsUnity = (SteamAudioSettings.Singleton.audioEngine == AudioEngineType.Unity);
serializedObject.Update();
if (audioEngineIsUnity)
{
EditorGUILayout.PropertyField(mDirectBinaural);
EditorGUILayout.PropertyField(mInterpolation);
}
if (audioEngineIsUnity && SteamAudioSettings.Singleton.perspectiveCorrection)
{
EditorGUILayout.PropertyField(mPerspectiveCorrection);
}
if (audioEngineIsUnity)
{
EditorGUILayout.PropertyField(mDistanceAttenuation);
if (mDistanceAttenuation.boolValue)
{
EditorGUILayout.PropertyField(mDistanceAttenuationInput);
}
}
if (audioEngineIsUnity)
{
EditorGUILayout.PropertyField(mAirAbsorption);
if (mAirAbsorption.boolValue)
{
EditorGUILayout.PropertyField(mAirAbsorptionInput);
if ((AirAbsorptionInput)mAirAbsorptionInput.enumValueIndex == AirAbsorptionInput.UserDefined)
{
EditorGUILayout.PropertyField(mAirAbsorptionLow);
EditorGUILayout.PropertyField(mAirAbsorptionMid);
EditorGUILayout.PropertyField(mAirAbsorptionHigh);
}
}
}
if (audioEngineIsUnity)
{
EditorGUILayout.PropertyField(mDirectivity);
if (mDirectivity.boolValue)
{
EditorGUILayout.PropertyField(mDirectivityInput);
if ((DirectivityInput) mDirectivityInput.enumValueIndex == DirectivityInput.SimulationDefined)
{
EditorGUILayout.PropertyField(mDipoleWeight);
EditorGUILayout.PropertyField(mDipolePower);
DrawDirectivity(mDipoleWeight.floatValue, mDipolePower.floatValue);
}
else if ((DirectivityInput) mDirectivityInput.enumValueIndex == DirectivityInput.UserDefined)
{
EditorGUILayout.PropertyField(mDirectivityValue);
}
}
}
EditorGUILayout.PropertyField(mOcclusion);
if (mOcclusion.boolValue)
{
if (audioEngineIsUnity)
{
EditorGUILayout.PropertyField(mOcclusionInput);
}
if (!audioEngineIsUnity ||
(OcclusionInput) mOcclusionInput.enumValueIndex == OcclusionInput.SimulationDefined)
{
EditorGUILayout.PropertyField(mOcclusionType);
if ((OcclusionType) mOcclusionType.enumValueIndex == OcclusionType.Volumetric)
{
EditorGUILayout.PropertyField(mOcclusionRadius);
EditorGUILayout.PropertyField(mOcclusionSamples);
}
}
else if ((OcclusionInput) mOcclusionInput.enumValueIndex == OcclusionInput.UserDefined)
{
EditorGUILayout.PropertyField(mOcclusionValue);
}
EditorGUILayout.PropertyField(mTransmission);
if (audioEngineIsUnity)
{
if (mTransmission.boolValue)
{
EditorGUILayout.PropertyField(mTransmissionType);
EditorGUILayout.PropertyField(mTransmissionInput);
if ((TransmissionInput)mTransmissionInput.enumValueIndex == TransmissionInput.UserDefined)
{
if (mTransmissionType.enumValueIndex == (int)TransmissionType.FrequencyDependent)
{
EditorGUILayout.PropertyField(mTransmissionLow);
EditorGUILayout.PropertyField(mTransmissionMid);
EditorGUILayout.PropertyField(mTransmissionHigh);
}
else
{
EditorGUILayout.PropertyField(mTransmissionMid);
}
}
else if ((TransmissionInput) mTransmissionInput.enumValueIndex == TransmissionInput.SimulationDefined)
{
EditorGUILayout.PropertyField(mTransmissionRays);
}
}
}
}
if (audioEngineIsUnity)
{
EditorGUILayout.PropertyField(mDirectMixLevel);
}
EditorGUILayout.PropertyField(mReflections);
if (mReflections.boolValue)
{
EditorGUILayout.PropertyField(mReflectionsType);
if (audioEngineIsUnity &&
mDistanceAttenuation.boolValue &&
(DistanceAttenuationInput) mDistanceAttenuationInput.enumValueIndex == DistanceAttenuationInput.CurveDriven)
{
EditorGUILayout.PropertyField(mUseDistanceCurveForReflections);
}
if ((ReflectionsType) mReflectionsType.enumValueIndex == ReflectionsType.BakedStaticSource)
{
EditorGUILayout.PropertyField(mCurrentBakedSource);
}
if (audioEngineIsUnity)
{
EditorGUILayout.PropertyField(mApplyHRTFToReflections);
EditorGUILayout.PropertyField(mReflectionsMixLevel);
}
}
EditorGUILayout.PropertyField(mPathing);
if (mPathing.boolValue)
{
EditorGUILayout.PropertyField(mPathingProbeBatch);
EditorGUILayout.PropertyField(mPathValidation);
EditorGUILayout.PropertyField(mFindAlternatePaths);
if (audioEngineIsUnity)
{
EditorGUILayout.PropertyField(mApplyHRTFToPathing);
EditorGUILayout.PropertyField(mPathingMixLevel);
}
}
serializedObject.ApplyModifiedProperties();
}
void DrawDirectivity(float dipoleWeight, float dipolePower)
{
if (mDirectivityPreview == null)
{
mDirectivityPreview = new Texture2D(65, 65);
}
if (mDirectivitySamples == null)
{
mDirectivitySamples = new float[360];
mDirectivityPositions = new Vector2[360];
}
for (var i = 0; i < mDirectivitySamples.Length; ++i)
{
var theta = (i / 360.0f) * (2.0f * Mathf.PI);
mDirectivitySamples[i] = Mathf.Pow(Mathf.Abs((1.0f - dipoleWeight) + dipoleWeight * Mathf.Cos(theta)), dipolePower);
var r = 31 * Mathf.Abs(mDirectivitySamples[i]);
var x = r * Mathf.Cos(theta) + 32;
var y = r * Mathf.Sin(theta) + 32;
mDirectivityPositions[i] = new Vector2(-y, x);
}
for (var v = 0; v < mDirectivityPreview.height; ++v)
{
for (var u = 0; u < mDirectivityPreview.width; ++u)
{
mDirectivityPreview.SetPixel(u, v, Color.gray);
}
}
for (var u = 0; u < mDirectivityPreview.width; ++u)
{
mDirectivityPreview.SetPixel(u, 32, Color.black);
}
for (var v = 0; v < mDirectivityPreview.height; ++v)
{
mDirectivityPreview.SetPixel(32, v, Color.black);
}
for (var i = 0; i < mDirectivitySamples.Length; ++i)
{
var color = (mDirectivitySamples[i] > 0.0f) ? Color.red : Color.blue;
mDirectivityPreview.SetPixel((int) mDirectivityPositions[i].x, (int) mDirectivityPositions[i].y, color);
}
mDirectivityPreview.Apply();
EditorGUILayout.PrefixLabel("Preview");
EditorGUILayout.Space();
var rect = EditorGUI.IndentedRect(EditorGUILayout.GetControlRect());
var center = rect.center;
center.x += 4;
rect.center = center;
rect.width = 65;
rect.height = 65;
EditorGUILayout.Space();
EditorGUILayout.Space();
EditorGUILayout.Space();
EditorGUILayout.Space();
EditorGUILayout.Space();
EditorGUILayout.Space();
EditorGUILayout.Space();
EditorGUILayout.Space();
EditorGUILayout.Space();
EditorGUI.DrawPreviewTexture(rect, mDirectivityPreview);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0a0b6df87f513414b805186eba677e7e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,75 @@
//
// Copyright 2017-2023 Valve Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using UnityEngine;
using UnityEditor;
namespace SteamAudio
{
[CustomEditor(typeof(SteamAudioStaticMesh))]
public class SteamAudioStaticMeshInspector : Editor
{
#if STEAMAUDIO_ENABLED
SerializedProperty mAsset;
SerializedProperty mSceneNameWhenExported;
void OnEnable()
{
mAsset = serializedObject.FindProperty("asset");
mSceneNameWhenExported = serializedObject.FindProperty("sceneNameWhenExported");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(mAsset);
var scene = (target as SteamAudioStaticMesh).gameObject.scene;
if (mAsset.objectReferenceValue == null)
{
EditorGUILayout.HelpBox(
"This scene has not been exported. Click Steam Audio > Export Active Scene to export.",
MessageType.Warning);
}
else if (mSceneNameWhenExported.stringValue != scene.name)
{
EditorGUILayout.HelpBox(
string.Format("This geometry was last exported for the scene {0}. If this is not what you " +
"intended, click Export As New Asset below.", mSceneNameWhenExported.stringValue),
MessageType.Warning);
if (GUILayout.Button("Export As New Asset"))
{
mAsset.objectReferenceValue = SerializedData.PromptForNewAsset(scene.name);
mSceneNameWhenExported.stringValue = scene.name;
serializedObject.ApplyModifiedProperties();
SteamAudioManager.ExportScene(scene, false);
}
}
serializedObject.ApplyModifiedProperties();
}
#else
public override void OnInspectorGUI()
{
EditorGUILayout.HelpBox("Steam Audio is not supported for the target platform or STEAMAUDIO_ENABLED define symbol is missing.", MessageType.Warning);
}
#endif
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d6929999ad3f3e54196cfa59c3181b95
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,17 @@
{
"name": "SteamAudioUnityEditor",
"references": [
"SteamAudioUnity"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 32059f5c68d213f49892e59f10b1a065
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: