This commit is contained in:
2025-03-11 16:42:49 +01:00
parent d2c9941a75
commit ea2d65ad14
29 changed files with 239 additions and 644 deletions

View File

@ -16,7 +16,6 @@
#if STEAMAUDIO_ENABLED
using System;
using System.Reflection;
using UnityEngine;
namespace SteamAudio
@ -43,6 +42,8 @@ namespace SteamAudio
return new UnityAudioEngineSource();
case AudioEngineType.FMODStudio:
return CreateFMODStudioAudioEngineSource();
case AudioEngineType.Wwise:
return CreateWwiseAudioEngineSource();
default:
return null;
}
@ -50,9 +51,18 @@ namespace SteamAudio
private static AudioEngineSource CreateFMODStudioAudioEngineSource()
{
var type = Type.GetType("SteamAudio.FMODStudioAudioEngineSource,SteamAudioUnity");
var type = Type.GetType("SteamAudio.FMODStudioAudioEngineSource,SteamAudioFMODStudio");
return (type != null) ? (AudioEngineSource) Activator.CreateInstance(type) : null;
}
private static AudioEngineSource CreateWwiseAudioEngineSource()
{
var type = Type.GetType("SteamAudio.WwiseAudioEngineSource,SteamAudioWwiseUnity");
if (type == null)
return null;
return (AudioEngineSource) Activator.CreateInstance(type);
}
}
}

View File

@ -16,9 +16,7 @@
#if STEAMAUDIO_ENABLED
using System;
using System.Reflection;
using UnityEngine;
using SteamAudio;
namespace SteamAudio
{
@ -47,6 +45,8 @@ namespace SteamAudio
return new UnityAudioEngineState();
case AudioEngineType.FMODStudio:
return CreateFMODStudioAudioEngineState();
case AudioEngineType.Wwise:
return CreateWwiseAudioEngineState();
default:
return null;
}
@ -54,9 +54,21 @@ namespace SteamAudio
private static AudioEngineState CreateFMODStudioAudioEngineState()
{
var type = Type.GetType("SteamAudio.FMODStudioAudioEngineState,SteamAudioUnity");
var type = Type.GetType("SteamAudio.FMODStudioAudioEngineState,SteamAudioFMODStudio");
return (type != null) ? (AudioEngineState) Activator.CreateInstance(type) : null;
}
private static AudioEngineState CreateWwiseAudioEngineState()
{
var type = Type.GetType("SteamAudio.WwiseAudioEngineState,SteamAudioWwiseUnity");
if (type == null)
return null;
return (AudioEngineState) Activator.CreateInstance(type);
}
public virtual void SetHRTFDisabled(bool disabled)
{ }
}
public abstract class AudioEngineStateHelpers
@ -73,6 +85,8 @@ namespace SteamAudio
return new UnityAudioEngineStateHelpers();
case AudioEngineType.FMODStudio:
return CreateFMODStudioAudioEngineStateHelpers();
case AudioEngineType.Wwise:
return CreateWwiseAudioEngineStateHelpers();
default:
return null;
}
@ -80,9 +94,18 @@ namespace SteamAudio
private static AudioEngineStateHelpers CreateFMODStudioAudioEngineStateHelpers()
{
var type = Type.GetType("SteamAudio.FMODStudioAudioEngineStateHelpers,SteamAudioUnity");
var type = Type.GetType("SteamAudio.FMODStudioAudioEngineStateHelpers,SteamAudioFMODStudio");
return (type != null) ? (AudioEngineStateHelpers) Activator.CreateInstance(type) : null;
}
private static AudioEngineStateHelpers CreateWwiseAudioEngineStateHelpers()
{
var type = Type.GetType("SteamAudio.WwiseAudioEngineStateHelpers,SteamAudioWwiseUnity");
if (type == null)
return null;
return (AudioEngineStateHelpers) Activator.CreateInstance(type);
}
}
}

View File

@ -25,8 +25,8 @@ namespace SteamAudio
public static class Constants
{
public const uint kVersionMajor = 4;
public const uint kVersionMinor = 5;
public const uint kVersionPatch = 1;
public const uint kVersionMinor = 6;
public const uint kVersionPatch = 0;
public const uint kVersion = (kVersionMajor << 16) | (kVersionMinor << 8) | kVersionPatch;
}
@ -666,21 +666,21 @@ namespace SteamAudio
{
// Context
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern Error iplContextCreate(ref ContextSettings settings, out IntPtr context);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern IntPtr iplContextRetain(IntPtr context);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
@ -689,7 +689,7 @@ namespace SteamAudio
// Geometry
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
@ -698,35 +698,35 @@ namespace SteamAudio
// Serialization
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern Error iplSerializedObjectCreate(IntPtr context, ref SerializedObjectSettings settings, out IntPtr serializedObject);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern IntPtr iplSerializedObjectRetain(IntPtr serializedObject);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplSerializedObjectRelease(ref IntPtr serializedObject);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern UIntPtr iplSerializedObjectGetSize(IntPtr serializedObject);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
@ -735,21 +735,21 @@ namespace SteamAudio
// Embree
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern Error iplEmbreeDeviceCreate(IntPtr context, ref EmbreeDeviceSettings settings, out IntPtr device);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern IntPtr iplEmbreeDeviceRetain(IntPtr device);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
@ -758,56 +758,56 @@ namespace SteamAudio
// OpenCL
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern Error iplOpenCLDeviceListCreate(IntPtr context, ref OpenCLDeviceSettings settings, out IntPtr deviceList);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern IntPtr iplOpenCLDeviceListRetain(IntPtr deviceList);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplOpenCLDeviceListRelease(ref IntPtr deviceList);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern int iplOpenCLDeviceListGetNumDevices(IntPtr deviceList);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplOpenCLDeviceListGetDeviceDesc(IntPtr deviceList, int index, out OpenCLDeviceDesc deviceDesc);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern Error iplOpenCLDeviceCreate(IntPtr context, IntPtr deviceList, int index, out IntPtr device);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern IntPtr iplOpenCLDeviceRetain(IntPtr device);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
@ -816,21 +816,21 @@ namespace SteamAudio
// Radeon Rays
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern Error iplRadeonRaysDeviceCreate(IntPtr openCLDevice, ref RadeonRaysDeviceSettings settings, out IntPtr rrDevice);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern IntPtr iplRadeonRaysDeviceRetain(IntPtr device);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
@ -839,21 +839,21 @@ namespace SteamAudio
// TrueAudio Next
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern Error iplTrueAudioNextDeviceCreate(IntPtr openCLDevice, ref TrueAudioNextDeviceSettings settings, out IntPtr tanDevice);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern IntPtr iplTrueAudioNextDeviceRetain(IntPtr device);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
@ -862,140 +862,140 @@ namespace SteamAudio
// Scene
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern Error iplSceneCreate(IntPtr context, ref SceneSettings settings, out IntPtr scene);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern IntPtr iplSceneRetain(IntPtr scene);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplSceneRelease(ref IntPtr scene);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern Error iplSceneLoad(IntPtr context, ref SceneSettings settings, IntPtr serializedObject, ProgressCallback progressCallback, IntPtr progressCallbackUserData, out IntPtr scene);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplSceneSave(IntPtr scene, IntPtr serializedObject);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplSceneSaveOBJ(IntPtr scene, string fileBaseName);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplSceneCommit(IntPtr scene);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern Error iplStaticMeshCreate(IntPtr scene, ref StaticMeshSettings settings, out IntPtr staticMesh);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern IntPtr iplStaticMeshRetain(IntPtr staticMesh);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplStaticMeshRelease(ref IntPtr staticMesh);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern Error iplStaticMeshLoad(IntPtr scene, IntPtr serializedObject, ProgressCallback progressCallback, IntPtr progressCallbackUserData, out IntPtr staticMesh);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplStaticMeshSave(IntPtr staticMesh, IntPtr serializedObject);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplStaticMeshAdd(IntPtr staticMesh, IntPtr scene);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplStaticMeshRemove(IntPtr staticMesh, IntPtr scene);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern Error iplInstancedMeshCreate(IntPtr scene, ref InstancedMeshSettings settings, out IntPtr instancedMesh);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern IntPtr iplInstancedMeshRetain(IntPtr instancedMesh);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplInstancedMeshRelease(ref IntPtr instancedMesh);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplInstancedMeshAdd(IntPtr instancedMesh, IntPtr scene);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplInstancedMeshRemove(IntPtr instancedMesh, IntPtr scene);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
@ -1004,21 +1004,21 @@ namespace SteamAudio
// HRTF
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern Error iplHRTFCreate(IntPtr context, ref AudioSettings audioSettings, ref HRTFSettings hrtfSettings, out IntPtr hrtf);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern IntPtr iplHRTFRetain(IntPtr hrtf);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
@ -1027,126 +1027,126 @@ namespace SteamAudio
// Probes
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern Error iplProbeArrayCreate(IntPtr context, out IntPtr probeArray);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern IntPtr iplProbeArrayRetain(IntPtr probeArray);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplProbeArrayRelease(ref IntPtr probeArray);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplProbeArrayGenerateProbes(IntPtr probeArray, IntPtr scene, ref ProbeGenerationParams generationParams);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern int iplProbeArrayGetNumProbes(IntPtr probeArray);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern Sphere iplProbeArrayGetProbe(IntPtr probeArray, int index);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern Error iplProbeBatchCreate(IntPtr context, out IntPtr probeBatch);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern IntPtr iplProbeBatchRetain(IntPtr probeBatch);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplProbeBatchRelease(ref IntPtr probeBatch);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern Error iplProbeBatchLoad(IntPtr context, IntPtr serializedObject, out IntPtr probeBatch);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplProbeBatchSave(IntPtr probeBatch, IntPtr serializedObject);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern int iplProbeBatchGetNumProbes(IntPtr probeBatch);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplProbeBatchAddProbe(IntPtr probeBatch, Sphere probe);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplProbeBatchAddProbeArray(IntPtr probeBatch, IntPtr probeArray);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplProbeBatchRemoveProbe(IntPtr probeBatch, int index);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplProbeBatchCommit(IntPtr probeBatch);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplProbeBatchRemoveData(IntPtr probeBatch, ref BakedDataIdentifier identifier);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
@ -1155,28 +1155,28 @@ namespace SteamAudio
// Baking
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplReflectionsBakerBake(IntPtr context, ref ReflectionsBakeParams bakeParams, ProgressCallback progressCallback, IntPtr userData);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplReflectionsBakerCancelBake(IntPtr context);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplPathBakerBake(IntPtr context, ref PathBakeParams bakeParams, ProgressCallback progressCallback, IntPtr userData);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
@ -1185,126 +1185,126 @@ namespace SteamAudio
// Run-Time Simulation
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern Error iplSimulatorCreate(IntPtr context, ref SimulationSettings settings, out IntPtr simulator);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern IntPtr iplSimulatorRetain(IntPtr simulator);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplSimulatorRelease(ref IntPtr simulator);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplSimulatorSetScene(IntPtr simulator, IntPtr scene);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplSimulatorAddProbeBatch(IntPtr simulator, IntPtr probeBatch);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplSimulatorRemoveProbeBatch(IntPtr simulator, IntPtr probeBatch);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplSimulatorSetSharedInputs(IntPtr simulator, SimulationFlags flags, ref SimulationSharedInputs sharedInputs);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplSimulatorCommit(IntPtr simulator);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplSimulatorRunDirect(IntPtr simulator);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplSimulatorRunReflections(IntPtr simulator);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplSimulatorRunPathing(IntPtr simulator);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern Error iplSourceCreate(IntPtr simulator, ref SourceSettings settings, out IntPtr source);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern IntPtr iplSourceRetain(IntPtr source);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplSourceRelease(ref IntPtr source);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplSourceAdd(IntPtr source, IntPtr simulator);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplSourceRemove(IntPtr source, IntPtr simulator);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
#endif
public static extern void iplSourceSetInputs(IntPtr source, SimulationFlags flags, ref SimulationInputs inputs);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("phonon")]
@ -1313,60 +1313,67 @@ namespace SteamAudio
// UNITY PLUGIN
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("audioplugin_phonon")]
#endif
public static extern void iplUnityInitialize(IntPtr context);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("audioplugin_phonon")]
#endif
public static extern void iplUnitySetPerspectiveCorrection(PerspectiveCorrection correction);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("audioplugin_phonon")]
#endif
public static extern void iplUnitySetHRTF(IntPtr hrtf);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("audioplugin_phonon")]
#endif
public static extern void iplUnitySetSimulationSettings(SimulationSettings simulationSettings);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("audioplugin_phonon")]
#endif
public static extern void iplUnitySetReverbSource(IntPtr reverbSource);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("audioplugin_phonon")]
#endif
public static extern int iplUnityAddSource(IntPtr source);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("audioplugin_phonon")]
#endif
public static extern void iplUnityRemoveSource(int handle);
#if UNITY_IOS && !UNITY_EDITOR
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("audioplugin_phonon")]
#endif
public static extern void iplUnityTerminate();
#if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
[DllImport("__Internal")]
#else
[DllImport("audioplugin_phonon")]
#endif
public static extern void iplUnitySetHRTFDisabled(bool disabled);
}
}

View File

@ -506,6 +506,7 @@ namespace SteamAudio
if (mAudioEngineState == null)
return;
mAudioEngineState.SetHRTFDisabled(SteamAudioSettings.Singleton.hrtfDisabled);
var perspectiveCorrection = GetPerspectiveCorrection();
mAudioEngineState.SetPerspectiveCorrection(perspectiveCorrection);
@ -1260,6 +1261,12 @@ namespace SteamAudio
var dataAsset = (!exportOBJ) ? GetDataAsset(dynamicObject) : null;
var objFileName = (exportOBJ) ? GetOBJFileName(dynamicObject) : "";
if (!exportOBJ && dataAsset == null)
return;
if (exportOBJ && (objFileName == null || objFileName.Length == 0))
return;
Export(objects, dynamicObject.name, dataAsset, objFileName, true, exportOBJ);
}

View File

@ -24,7 +24,8 @@ namespace SteamAudio
public enum AudioEngineType
{
Unity,
FMODStudio
FMODStudio,
Wwise
}
[CreateAssetMenu(menuName = "Steam Audio/Steam Audio Settings")]
@ -34,6 +35,7 @@ namespace SteamAudio
public AudioEngineType audioEngine = AudioEngineType.Unity;
[Header("HRTF Settings")]
public bool hrtfDisabled = false;
public bool perspectiveCorrection = false;
[Range(.25f, 4.0f)]
public float perspectiveCorrectionFactor = 1.0f;

View File

@ -227,7 +227,10 @@ namespace SteamAudio
~SteamAudioSource()
{
mThis.Free();
if (mThis.IsAllocated)
{
mThis.Free();
}
}
private void OnEnable()
@ -510,7 +513,7 @@ namespace SteamAudio
case AudioRolloffMode.Logarithmic:
if (distance < rMin)
return 1.0f;
else if (distance < rMax)
else if (distance > rMax)
return 0.0f;
else
return rMin / distance;

View File

@ -49,6 +49,13 @@ namespace SteamAudio
{
API.iplUnitySetReverbSource(reverbSource.Get());
}
public override void SetHRTFDisabled(bool disabled)
{
base.SetHRTFDisabled(disabled);
API.iplUnitySetHRTFDisabled(disabled);
}
}
public sealed class UnityAudioEngineStateHelpers : AudioEngineStateHelpers