Steam Audio tryout
This commit is contained in:
151
Assets/Plugins/SteamAudio/Scripts/Editor/Build.cs
Normal file
151
Assets/Plugins/SteamAudio/Scripts/Editor/Build.cs
Normal file
@@ -0,0 +1,151 @@
|
||||
//
|
||||
// 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 baseAssets = new string[]
|
||||
{
|
||||
"Assets/Plugins/SteamAudio/SteamAudioUnity.asmdef",
|
||||
"Assets/Plugins/SteamAudio/Binaries",
|
||||
"Assets/Plugins/SteamAudio/Resources",
|
||||
"Assets/Plugins/SteamAudio/Scripts/Runtime",
|
||||
"Assets/Plugins/SteamAudio/Scripts/Editor",
|
||||
};
|
||||
|
||||
|
||||
var fmodAssets = new string[]
|
||||
{
|
||||
"Assets/Plugins/SteamAudio/Scripts/FMODStudio",
|
||||
"Assets/Plugins/FMOD/platforms/win/lib/x86/phonon_fmod.dll",
|
||||
"Assets/Plugins/FMOD/platforms/win/lib/x86_64/phonon_fmod.dll",
|
||||
"Assets/Plugins/FMOD/platforms/linux/lib/x86/libphonon_fmod.so",
|
||||
"Assets/Plugins/FMOD/platforms/linux/lib/x86_64/libphonon_fmod.so",
|
||||
"Assets/Plugins/FMOD/platforms/mac/lib/phonon_fmod.bundle",
|
||||
"Assets/Plugins/FMOD/platforms/android/lib/armeabi-v7a/libphonon_fmod.so",
|
||||
"Assets/Plugins/FMOD/platforms/android/lib/arm64-v8a/libphonon_fmod.so",
|
||||
"Assets/Plugins/FMOD/platforms/android/lib/x86/libphonon_fmod.so",
|
||||
"Assets/Plugins/FMOD/platforms/ios/lib/libphonon_fmod.a",
|
||||
};
|
||||
|
||||
var wwiseAssets = new string[]
|
||||
{
|
||||
"Assets/Plugins/SteamAudio/Scripts/Wwise",
|
||||
"Assets/Wwise/API/Runtime/Plugins/Windows/x86/DSP/SteamAudioWwise.dll",
|
||||
"Assets/Wwise/API/Runtime/Plugins/Windows/x86_64/DSP/SteamAudioWwise.dll",
|
||||
"Assets/Wwise/API/Runtime/Plugins/Linux/x86_64/DSP/libSteamAudioWwise.so",
|
||||
"Assets/Wwise/API/Runtime/Plugins/Mac/DSP/libSteamAudioWwise.bundle",
|
||||
"Assets/Wwise/API/Runtime/Plugins/Android/armeabi-v7a/DSP/libSteamAudioWwise.so",
|
||||
"Assets/Wwise/API/Runtime/Plugins/Android/arm64-v8a/DSP/libSteamAudioWwise.so",
|
||||
"Assets/Wwise/API/Runtime/Plugins/Android/x86/DSP/libSteamAudioWwise.so",
|
||||
"Assets/Wwise/API/Runtime/Plugins/iOS/iphoneos/DSP/SteamAudioWwiseFXFactory.h",
|
||||
"Assets/Wwise/API/Runtime/Plugins/iOS/iphoneos/DSP/libSteamAudioWwiseFX.a",
|
||||
"Assets/Wwise/API/Runtime/Plugins/iOS/iphonesimulator/DSP/SteamAudioWwiseFXFactory.h",
|
||||
"Assets/Wwise/API/Runtime/Plugins/iOS/iphonesimulator/DSP/libSteamAudioWwiseFX.a",
|
||||
};
|
||||
|
||||
BuildPackage("SteamAudio", baseAssets);
|
||||
BuildPackage("SteamAudioFMODStudio", fmodAssets);
|
||||
BuildPackage("SteamAudioWwise", wwiseAssets);
|
||||
}
|
||||
|
||||
private static void BuildPackage(string name, string[] assets)
|
||||
{
|
||||
var args = Environment.GetCommandLineArgs();
|
||||
var lastArg = args[args.Length - 1];
|
||||
|
||||
var fileName = name + ".unitypackage";
|
||||
if (lastArg != "SteamAudio.Build.BuildSteamAudio")
|
||||
{
|
||||
fileName = lastArg + "/" + fileName;
|
||||
}
|
||||
|
||||
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,
|
||||
NamedBuildTarget.WebGL,
|
||||
};
|
||||
|
||||
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
Assets/Plugins/SteamAudio/Scripts/Editor/Build.cs.meta
Normal file
11
Assets/Plugins/SteamAudio/Scripts/Editor/Build.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4cf552bb6c6d7894c8e64136a5d4a41c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
33
Assets/Plugins/SteamAudio/Scripts/Editor/SOFAFileEditor.cs
Normal file
33
Assets/Plugins/SteamAudio/Scripts/Editor/SOFAFileEditor.cs
Normal 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad7854f3d94e96f4795542d446b68921
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
50
Assets/Plugins/SteamAudio/Scripts/Editor/SOFAFileImporter.cs
Normal file
50
Assets/Plugins/SteamAudio/Scripts/Editor/SOFAFileImporter.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1731f5ddf70efee4c8320ac591373b56
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d3653cc84febdd64e8064c9e17883043
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9184af0375b7f6140be4f789b5fc7083
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93bd07e672dff904ea2291dd4ac45a45
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e99d6d8163e0e24cadf1add0983102e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3333927edc4e4ec4e880a1ff9e9a7a2e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 980be31a5041c924094140b19f4276cd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 58fcd8cc93a64734490ae21a46fb412d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68c66682e05a3a744896f1452c21c860
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5adb5adac336b84fa2308b30315459d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d390cf1bb6f67ca47b6b5d3c43ec5956
|
||||
timeCreated: 1499375927
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 03cab73d8173c364bb30b17574e2f240
|
||||
timeCreated: 1499881264
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: db54b1d0b8cefcf4486eccd5e7c185f7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,147 @@
|
||||
//
|
||||
// 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.Data;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SteamAudio
|
||||
{
|
||||
|
||||
[CustomEditor(typeof(SteamAudioReverbData)), CanEditMultipleObjects]
|
||||
public class ReverbDataEditor : Editor
|
||||
{
|
||||
private string mReverbTimeFoldoutKey = "SteamAudioProbeInspector_ReverbTimeFoldoutState";
|
||||
private string mEnergyFieldFoldoutKey = "SteamAudioProbeInspector_EnergyFieldFoldoutState";
|
||||
private string mImpulseResponseFoldoutKey = "SteamAudioProbeInspector_ImpulseResponseFoldoutState";
|
||||
public bool mOwnerIsMultiEditing = false; // Typically set by parent.
|
||||
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
var tgt = target as SteamAudioReverbData;
|
||||
bool bReverbTimesFoldoutExpanded = SessionState.GetBool(mReverbTimeFoldoutKey, false);
|
||||
bReverbTimesFoldoutExpanded = EditorGUILayout.BeginFoldoutHeaderGroup(bReverbTimesFoldoutExpanded, "Reverb Times");
|
||||
if (bReverbTimesFoldoutExpanded)
|
||||
{
|
||||
if (serializedObject.isEditingMultipleObjects | mOwnerIsMultiEditing)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Multiple objects selected.", MessageType.Info);
|
||||
}
|
||||
else if (tgt.reverbTimes == null || tgt.reverbTimes.Length == 0)
|
||||
{
|
||||
EditorGUILayout.HelpBox("No reverb time data to display.", MessageType.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < tgt.reverbTimes.Length; ++i)
|
||||
{
|
||||
EditorGUILayout.LabelField("Band " + i + " (seconds)", tgt.reverbTimes[i].ToString("0.000"));
|
||||
}
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
SessionState.SetBool(mReverbTimeFoldoutKey, bReverbTimesFoldoutExpanded);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
bool bEnergyFieldFoldoutExpanded = SessionState.GetBool(mEnergyFieldFoldoutKey, false);
|
||||
bEnergyFieldFoldoutExpanded = EditorGUILayout.BeginFoldoutHeaderGroup(bEnergyFieldFoldoutExpanded, "Reverb Energy Field Stats");
|
||||
if (bEnergyFieldFoldoutExpanded)
|
||||
{
|
||||
if (serializedObject.isEditingMultipleObjects || mOwnerIsMultiEditing)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Multiple objects selected.", MessageType.Info);
|
||||
}
|
||||
else if (tgt.reverbEnergyField == null || tgt.reverbEnergyField.Length == 0)
|
||||
{
|
||||
EditorGUILayout.HelpBox("No energy field data to display.", MessageType.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
string sampleCountString = tgt.reverbEnergyField.Length.ToString();
|
||||
sampleCountString += " (" + tgt.reverbEnergyFieldNumChannels + (tgt.reverbEnergyFieldNumChannels > 1 ? " channels" : " channel");
|
||||
sampleCountString += " x " + tgt.reverbEnergyFieldNumBands + " bands";
|
||||
sampleCountString += " x " + tgt.reverbEnergyFieldNumBins + " bins)";
|
||||
EditorGUILayout.LabelField("Sample Count", sampleCountString);
|
||||
EditorGUILayout.LabelField("Total Size", Common.HumanReadableDataSize(tgt.GetEnergyFieldSize()));
|
||||
|
||||
int numChannels = tgt.reverbEnergyFieldNumChannels;
|
||||
int numBands = tgt.reverbEnergyFieldNumBands;
|
||||
int numSamples = tgt.reverbEnergyFieldNumBins;
|
||||
float[] channelEnergy = new float[numChannels];
|
||||
for (int i = 0; i < numChannels; ++i)
|
||||
{
|
||||
channelEnergy[i] = .0f;
|
||||
for (int j = 0; j < numBands; ++j)
|
||||
{
|
||||
for (int k = 0; k < numSamples; ++k)
|
||||
{
|
||||
channelEnergy[i] += tgt.GetEnergyFieldData(i, j, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
EditorGUILayout.LabelField("Per Channel Energy", string.Join(", ", channelEnergy.Select(value => value.ToString("e2"))));
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
SessionState.SetBool(mEnergyFieldFoldoutKey, bEnergyFieldFoldoutExpanded);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
bool bImpulseResponseFoldoutExpanded = SessionState.GetBool(mImpulseResponseFoldoutKey, false);
|
||||
bImpulseResponseFoldoutExpanded = EditorGUILayout.BeginFoldoutHeaderGroup(bImpulseResponseFoldoutExpanded, "Reverb Impulse Response Stats");
|
||||
if (bImpulseResponseFoldoutExpanded)
|
||||
{
|
||||
if (serializedObject.isEditingMultipleObjects || mOwnerIsMultiEditing)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Multiple objects selected.", MessageType.Info);
|
||||
}
|
||||
else if (tgt.reverbIR == null || tgt.reverbIR.Length == 0)
|
||||
{
|
||||
EditorGUILayout.HelpBox("No impulse response data to display.", MessageType.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
string sampleCountString = tgt.reverbIR.Length.ToString();
|
||||
sampleCountString += " (" + tgt.reverbIRNumChannels + (tgt.reverbIRNumChannels > 1 ? " channels" : " channel");
|
||||
sampleCountString += " x " + tgt.reverbIRNumSamples + " samples)";
|
||||
EditorGUILayout.LabelField("Sample Count", sampleCountString);
|
||||
EditorGUILayout.LabelField("Total Size", Common.HumanReadableDataSize(tgt.GetImpulseResponseSize()));
|
||||
|
||||
int numChannels = tgt.reverbIRNumChannels;
|
||||
int numSamples = tgt.reverbIRNumSamples;
|
||||
float[] channelMax = new float[numChannels];
|
||||
float[] channelMin = new float[numChannels];
|
||||
for (int i = 0; i < numChannels; ++i)
|
||||
{
|
||||
channelMax[i] = float.MinValue;
|
||||
channelMin[i] = float.MaxValue;
|
||||
for (int k = 0; k < numSamples; ++k)
|
||||
{
|
||||
channelMax[i] = Mathf.Max(tgt.GetImpulseResponseData(i, k), channelMax[i]);
|
||||
channelMin[i] = Mathf.Min(tgt.GetImpulseResponseData(i, k), channelMin[i]);
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.LabelField("Per Channel Min", string.Join(", ", channelMin.Select(value => value.ToString("e2"))));
|
||||
EditorGUILayout.LabelField("Per Channel Max", string.Join(", ", channelMax.Select(value => value.ToString("e2"))));
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
SessionState.SetBool(mImpulseResponseFoldoutKey, bImpulseResponseFoldoutExpanded);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ded1a41ba66630a418b44e6d9411e3db
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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 UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using System.Linq;
|
||||
using System.Data;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SteamAudio
|
||||
{
|
||||
[CustomEditor(typeof(SteamAudioReverbDataPoint)), CanEditMultipleObjects]
|
||||
public class SteamAudioReverbDataPointInspector : Editor
|
||||
{
|
||||
#if STEAMAUDIO_ENABLED
|
||||
private int[] alllowedSampleRates = new int[] { 24000, 44100, 48000, 96000 };
|
||||
private string[] displaySampleRates = new string[] { "24000 Hz", "44100 Hz", "48000 Hz", "96000 Hz" };
|
||||
public SerializedProperty mSamplingRate;
|
||||
|
||||
public SerializedProperty mAmbisonicOrder;
|
||||
public SerializedProperty mReverbDuration;
|
||||
public SerializedProperty mReverbDataAsset;
|
||||
public SerializedProperty mStoreEnergyField;
|
||||
public SerializedProperty mStoreImpulseResponse;
|
||||
private Editor mReverbDataEditor;
|
||||
|
||||
static bool mShouldShowProgressBar = false;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
mSamplingRate = serializedObject.FindProperty("sampleRate");
|
||||
mAmbisonicOrder = serializedObject.FindProperty("ambisonicOrder");
|
||||
mReverbDuration = serializedObject.FindProperty("reverbDuration");
|
||||
mReverbDataAsset = serializedObject.FindProperty("reverbData");
|
||||
mStoreEnergyField = serializedObject.FindProperty("storeEnergyField");
|
||||
mStoreImpulseResponse = serializedObject.FindProperty("storeImpulseResponse");
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/Steam Audio/Steam Audio Reverb Data Point", false, 10)]
|
||||
static void CreateGameObjectWithProbe(MenuCommand menuCommand)
|
||||
{
|
||||
var gameObject = new GameObject("Steam Audio Reverb Data Point");
|
||||
gameObject.AddComponent<SteamAudioReverbDataPoint>();
|
||||
|
||||
GameObjectUtility.SetParentAndAlign(gameObject, menuCommand.context as GameObject);
|
||||
|
||||
Undo.RegisterCreatedObjectUndo(gameObject, "Create " + gameObject.name);
|
||||
}
|
||||
|
||||
[MenuItem("Steam Audio/Steam Audio Reverb Data Point/Bake All", false, 61)]
|
||||
public static void BakeAllProbes()
|
||||
{
|
||||
var allProbes = FindObjectsByType<SteamAudioReverbDataPoint>(FindObjectsSortMode.None);
|
||||
|
||||
if (allProbes.Length == 0)
|
||||
{
|
||||
EditorUtility.DisplayDialog("No Steam Audio Reverb Data Points Found", "No Steam Audio Reverb Data Point components were found in the currently-open scene.", "OK");
|
||||
return;
|
||||
}
|
||||
|
||||
SteamAudioReverbDataPoint.BeginBake(allProbes);
|
||||
mShouldShowProgressBar = true;
|
||||
EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
|
||||
}
|
||||
|
||||
[MenuItem("Steam Audio/Steam Audio Reverb Data Point/Clear Unreferenced Data", false, 62)]
|
||||
public static void DeleteUnreferencedAssets()
|
||||
{
|
||||
AssetDatabase.StartAssetEditing();
|
||||
|
||||
// Find all assets in SteamAudioProbe.GetAssetFolderPath() path.
|
||||
string[] reverbDataFolder = new string[] { SteamAudioReverbDataPoint.GetAssetFolderPath() };
|
||||
string assetType = typeof(SteamAudioReverbData).Name;
|
||||
|
||||
// Createa a list of all SteamAudioReverbData Assets which are inside reverbDataFolder folder.
|
||||
string[] reverbDataAssets = AssetDatabase.FindAssets("t:" + assetType, reverbDataFolder);
|
||||
|
||||
if (reverbDataAssets.Length == 0)
|
||||
{
|
||||
Debug.Log("No cleanup needed. No Steam Audio Reverb Data assets found in " + reverbDataFolder[0] );
|
||||
AssetDatabase.StopAssetEditing();
|
||||
return;
|
||||
}
|
||||
|
||||
// Go through all the assets and make a list of referenced SteamAudioProbe Assets.
|
||||
List<string> referencedReverbDataAssetPaths = new List<string>();
|
||||
var assetPaths = AssetDatabase.GetAllAssetPaths();
|
||||
foreach (var assetPath in assetPaths)
|
||||
{
|
||||
if (!(assetPath.EndsWith(".unity") || assetPath.EndsWith(".prefab")))
|
||||
continue;
|
||||
|
||||
var assetDependencies = AssetDatabase.GetDependencies(assetPath, false);
|
||||
foreach (var assetDependency in assetDependencies)
|
||||
{
|
||||
if (assetDependency.Contains(reverbDataFolder[0]))
|
||||
referencedReverbDataAssetPaths.Add(assetDependency);
|
||||
}
|
||||
}
|
||||
|
||||
// Go through all the assets of type SteamAudioReverbData inside reverbDataFolder.
|
||||
// Delete the once which are not found in referenced SteamAudioProbe Assets found above.
|
||||
int numReverbDataAssetsDeleted = 0;
|
||||
foreach (var reverbDataAsset in reverbDataAssets)
|
||||
{
|
||||
var reverbDataAssetPath = AssetDatabase.GUIDToAssetPath(reverbDataAsset);
|
||||
if (string.IsNullOrEmpty(reverbDataAssetPath))
|
||||
continue;
|
||||
|
||||
bool deleteReverbDataAsset = !referencedReverbDataAssetPaths.Contains(reverbDataAssetPath);
|
||||
if (deleteReverbDataAsset)
|
||||
{
|
||||
bool deleteSuccessful = AssetDatabase.DeleteAsset(reverbDataAssetPath);
|
||||
var deleteSuccessfulString = "Delete Failed:";
|
||||
if (deleteSuccessful)
|
||||
{
|
||||
++numReverbDataAssetsDeleted;
|
||||
deleteSuccessfulString = "Deleted:";
|
||||
}
|
||||
|
||||
Debug.Log(deleteSuccessfulString + " " + reverbDataAssetPath);
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log("Number of SteamAudioReverbData Assets deleted: " + numReverbDataAssetsDeleted);
|
||||
AssetDatabase.StopAssetEditing();
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
var oldGUIEnabled = GUI.enabled;
|
||||
GUI.enabled = !Baker.IsBakeActive() && !EditorApplication.isPlayingOrWillChangePlaymode;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Reverb Settings", EditorStyles.boldLabel);
|
||||
|
||||
var tgt = target as SteamAudioReverbDataPoint;
|
||||
int sampleRateIndex = System.Array.IndexOf(alllowedSampleRates, tgt.sampleRate);
|
||||
if (sampleRateIndex < 0)
|
||||
{
|
||||
sampleRateIndex = 0;
|
||||
tgt.sampleRate = alllowedSampleRates[sampleRateIndex];
|
||||
}
|
||||
|
||||
EditorGUI.showMixedValue = mSamplingRate.hasMultipleDifferentValues;
|
||||
EditorGUI.BeginChangeCheck();
|
||||
int newSampleRate = EditorGUILayout.IntPopup("Sampling Rate", tgt.sampleRate, displaySampleRates, alllowedSampleRates);
|
||||
var selectedProbes = targets.Cast<SteamAudioReverbDataPoint>().ToArray();
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
foreach (SteamAudioReverbDataPoint probe in selectedProbes)
|
||||
{
|
||||
if (newSampleRate != probe.sampleRate)
|
||||
{
|
||||
probe.sampleRate = newSampleRate;
|
||||
EditorUtility.SetDirty(probe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.PropertyField(mAmbisonicOrder);
|
||||
EditorGUILayout.PropertyField(mReverbDuration, new UnityEngine.GUIContent("Reverb Duration (seconds)"));
|
||||
EditorGUILayout.PropertyField(mStoreEnergyField);
|
||||
EditorGUILayout.PropertyField(mStoreImpulseResponse);
|
||||
|
||||
GUI.enabled = !Baker.IsBakeActive() && !EditorApplication.isPlayingOrWillChangePlaymode;
|
||||
EditorGUILayout.Space();
|
||||
string bakeButtonString = serializedObject.isEditingMultipleObjects ? "Bake Selected Probes" : "Bake";
|
||||
if (GUILayout.Button(bakeButtonString))
|
||||
{
|
||||
SteamAudioReverbDataPoint.BeginBake(selectedProbes);
|
||||
mShouldShowProgressBar = true;
|
||||
EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
|
||||
}
|
||||
|
||||
GUI.enabled = oldGUIEnabled;
|
||||
|
||||
if (mShouldShowProgressBar && !Baker.IsBakeActive())
|
||||
{
|
||||
mShouldShowProgressBar = false;
|
||||
}
|
||||
|
||||
if (mShouldShowProgressBar)
|
||||
{
|
||||
Baker.DrawProgressBar();
|
||||
Repaint();
|
||||
}
|
||||
|
||||
// Display Stats
|
||||
EditorGUILayout.PropertyField(mReverbDataAsset);
|
||||
EditorGUILayout.Space();
|
||||
if (mReverbDataAsset.objectReferenceValue != null)
|
||||
{
|
||||
Editor.CreateCachedEditor(mReverbDataAsset.objectReferenceValue, null, ref mReverbDataEditor);
|
||||
|
||||
// Pass the flag down for multi editing.
|
||||
if (mReverbDataEditor is ReverbDataEditor reverbDataEditor)
|
||||
reverbDataEditor.mOwnerIsMultiEditing = serializedObject.isEditingMultipleObjects;
|
||||
|
||||
mReverbDataEditor.OnInspectorGUI();
|
||||
}
|
||||
|
||||
GUI.enabled = oldGUIEnabled;
|
||||
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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: db31fe9f01131d244895b5e6b9623f3f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f194df3638411045b8624f4e62e44fd
|
||||
timeCreated: 1499886452
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,236 @@
|
||||
//
|
||||
// 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 mHRTFDisabled;
|
||||
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");
|
||||
mHRTFDisabled = serializedObject.FindProperty("hrtfDisabled");
|
||||
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(mHRTFDisabled, new UnityEngine.GUIContent("Disable HRTF Globally", "Disable HRTF rendering for all events/sources. Useful when the end user is using speakers instead of headphones."));
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4874c09ead1502c4b966e1bb4e7ad3da
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,351 @@
|
||||
//
|
||||
// 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;
|
||||
SerializedProperty mNormalizePathingEQ;
|
||||
|
||||
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");
|
||||
mNormalizePathingEQ = serializedObject.FindProperty("normalizePathingEQ");
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!audioEngineIsUnity ||
|
||||
(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);
|
||||
EditorGUILayout.PropertyField(mNormalizePathingEQ);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a0b6df87f513414b805186eba677e7e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6929999ad3f3e54196cfa59c3181b95
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "SteamAudioUnityEditor",
|
||||
"references": [
|
||||
"SteamAudioUnity"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32059f5c68d213f49892e59f10b1a065
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user