diff --git a/Assets/Editor/ReplaceGvr.cs b/Assets/Editor/ReplaceGvr.cs new file mode 100644 index 0000000000..668ee133ea --- /dev/null +++ b/Assets/Editor/ReplaceGvr.cs @@ -0,0 +1,159 @@ +using UnityEngine; +using UnityEditor; +using UnityEditor.SceneManagement; +using UnityEngine.SceneManagement; + +public class ReplaceGvr : Editor +{ + + // Only used for console logging + private static string currentSceneOrPrefabName; + + [MenuItem("Open Brush/Replace GoogleVR Audio")] + public static void Run() + { + // Iterate through all scenes + for (int i = 0; i < SceneManager.sceneCount; i++) + { + var scene = SceneManager.GetSceneAt(i); + EditorSceneManager.OpenScene(scene.path); + + currentSceneOrPrefabName = scene.name; + foreach (GameObject obj in FindObjectsOfType(includeInactive: true)) + { + FixAllGvr(obj); + } + } + + // Iterate through all prefabs + string[] prefabGUIDs = AssetDatabase.FindAssets("t:Prefab"); + foreach (string prefabGuid in prefabGUIDs) + { + string prefabPath = AssetDatabase.GUIDToAssetPath(prefabGuid); + GameObject prefab = AssetDatabase.LoadAssetAtPath(prefabPath); + IteratePrefab(prefab.transform); + } + } + + private static void IteratePrefab(Transform transform) + { + currentSceneOrPrefabName = transform.name; + FixAllGvr(transform.gameObject); + + foreach (Transform child in transform) + { + IteratePrefab(child); + } + } + + public static void FixAllGvr(GameObject go) + { + FixGvrSource(go); + FixGvrSoundfield(go); + FixGvrRoom(go); + FixGvrListener(go); + } + + public static void FixGvrSoundfield(GameObject go) + { + var gvr = go.GetComponent(); + if (gvr == null) return; + + // Disable Resonance for now + // if (go.GetComponent() == null) + // { + // go.AddComponent(); + // Debug.Log($"Added ResonanceAudioSource to {currentSceneOrPrefabName}.{go.name}"); + // } + } + + public static void FixGvrRoom(GameObject go) + { + var gvr = go.GetComponent(); + if (gvr == null) return; + + // Disable Resonance for now + // ResonanceAudioRoom resAudioRoom = null; + // if (go.GetComponent() == null) + // { + // resAudioRoom = go.AddComponent(); + // Debug.Log($"Added ResonanceAudioRoom to {currentSceneOrPrefabName}.{go.name}"); + // } + + // resAudioRoom.leftWall = (ResonanceAudioRoomManager.SurfaceMaterial)gvr.leftWall; + // resAudioRoom.rightWall = (ResonanceAudioRoomManager.SurfaceMaterial)gvr.rightWall; + // resAudioRoom.floor = (ResonanceAudioRoomManager.SurfaceMaterial)gvr.floor; + // resAudioRoom.ceiling = (ResonanceAudioRoomManager.SurfaceMaterial)gvr.ceiling; + // resAudioRoom.backWall = (ResonanceAudioRoomManager.SurfaceMaterial)gvr.backWall; + // resAudioRoom.frontWall = (ResonanceAudioRoomManager.SurfaceMaterial)gvr.frontWall; + // resAudioRoom.reflectivity = gvr.reflectivity; + // resAudioRoom.reverbGainDb = gvr.reverbGainDb; + // resAudioRoom.reverbBrightness = gvr.reverbBrightness; + // resAudioRoom.reverbTime = gvr.reverbTime; + // resAudioRoom.size = gvr.size; + } + + public static void FixGvrListener(GameObject go) + { + var gvr = go.GetComponent(); + if (gvr == null) return; + + // Disable Resonance for now + // ResonanceAudioListener resAudioListener = null; + // if (go.GetComponent() == null) + // { + // resAudioListener = go.AddComponent(); + // Debug.Log($"Added ResonanceAudioListener to {currentSceneOrPrefabName}.{go.name}"); + // } + + // resAudioListener.occlusionMask = gvr.occlusionMask; + // resAudioListener.globalGainDb = gvr.globalGainDb; + // // resAudioListener.??? = gvr.quality; + } + + public static void FixGvrSource(GameObject go) + { + var gvr = go.GetComponent(); + if (gvr == null) return; + + var audioSource = go.GetComponent(); + if (audioSource == null) + { + audioSource = go.AddComponent(); + Debug.Log($"Added AudioSource to {currentSceneOrPrefabName}.{go.name}"); + } + + audioSource.bypassEffects = gvr.bypassRoomEffects; + audioSource.bypassListenerEffects = gvr.bypassRoomEffects; + audioSource.clip = gvr.sourceClip; + audioSource.loop = gvr.sourceLoop; + audioSource.mute = gvr.sourceMute; + audioSource.pitch = gvr.sourcePitch; + audioSource.priority = gvr.sourcePriority; + audioSource.spatialBlend = gvr.sourceSpatialBlend; + audioSource.dopplerLevel = gvr.sourceDopplerLevel; + audioSource.spread = gvr.sourceSpread; + audioSource.volume = gvr.sourceVolume; + audioSource.rolloffMode = gvr.sourceRolloffMode; + audioSource.maxDistance = gvr.sourceMaxDistance; + audioSource.minDistance = gvr.sourceMinDistance; + + // Disable Resonance for now + // ResonanceAudioSource resAudioSource = null; + // if (go.GetComponent() == null) + // { + // resAudioSource = go.AddComponent(); + // Debug.Log($"Added ResonanceAudioSource to {currentSceneOrPrefabName}.{go.name}"); + // } + + // resAudioSource.directivityAlpha = gvr.directivityAlpha; + // resAudioSource.directivitySharpness = gvr.directivitySharpness; + // resAudioSource.listenerDirectivityAlpha = gvr.listenerDirectivityAlpha; + // resAudioSource.listenerDirectivitySharpness = gvr.listenerDirectivitySharpness; + // resAudioSource.gainDb = gvr.gainDb; + // resAudioSource.occlusionEnabled = gvr.occlusionEnabled; + // audioSource.playOnAwake = gvr.playOnAwake; + // // resAudioSource.disableOnStop = gvr.disableOnStop; + // // resAudioSource.hrtfEnabled = gvr.hrtfEnabled; + } +} diff --git a/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioSoundfieldEditor.cs.meta b/Assets/Editor/ReplaceGvr.cs.meta similarity index 83% rename from Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioSoundfieldEditor.cs.meta rename to Assets/Editor/ReplaceGvr.cs.meta index 5f4fede1be..6b806a9fb9 100644 --- a/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioSoundfieldEditor.cs.meta +++ b/Assets/Editor/ReplaceGvr.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 95b832a777470485b891baa8026133ce +guid: 0c54654c465090d4ab9689226748f69f MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Prefabs/AudioLoop.prefab b/Assets/Prefabs/AudioLoop.prefab index e3f0b84e0e..ff10520700 100644 --- a/Assets/Prefabs/AudioLoop.prefab +++ b/Assets/Prefabs/AudioLoop.prefab @@ -10,6 +10,7 @@ GameObject: m_Component: - component: {fileID: 446936} - component: {fileID: 114000012757747538} + - component: {fileID: -8006449586877461498} m_Layer: 0 m_Name: AudioLoop m_TagString: Untagged @@ -27,6 +28,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 @@ -66,3 +68,99 @@ MonoBehaviour: sourceMinDistance: 1 hrtfEnabled: 1 audioSource: {fileID: 0} +--- !u!82 &-8006449586877461498 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 166670} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 0} + m_PlayOnAwake: 1 + m_Volume: 1 + m_Pitch: 1 + Loop: 0 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 1 + MaxDistance: 10 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 diff --git a/Assets/Prefabs/AudioOneShot.prefab b/Assets/Prefabs/AudioOneShot.prefab index 3e4aa9a0e4..8068438791 100644 --- a/Assets/Prefabs/AudioOneShot.prefab +++ b/Assets/Prefabs/AudioOneShot.prefab @@ -10,6 +10,7 @@ GameObject: m_Component: - component: {fileID: 446936} - component: {fileID: 114000012757747538} + - component: {fileID: 343108808504654218} m_Layer: 0 m_Name: AudioOneShot m_TagString: Untagged @@ -27,6 +28,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 @@ -66,3 +68,99 @@ MonoBehaviour: sourceMinDistance: 1 hrtfEnabled: 1 audioSource: {fileID: 0} +--- !u!82 &343108808504654218 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 166670} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 0} + m_PlayOnAwake: 1 + m_Volume: 1 + m_Pitch: 1 + Loop: 0 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 1 + MaxDistance: 10 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 diff --git a/Assets/Prefabs/Pointer_Main.prefab b/Assets/Prefabs/Pointer_Main.prefab index 3b0c2e9507..8fd6f54340 100644 --- a/Assets/Prefabs/Pointer_Main.prefab +++ b/Assets/Prefabs/Pointer_Main.prefab @@ -28,6 +28,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0.094486505} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 487766} m_RootOrder: 0 @@ -91,6 +92,7 @@ Light: m_UseColorTemperature: 0 m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 m_ShadowRadius: 0 m_ShadowAngle: 0 --- !u!114 &11449678 @@ -198,6 +200,7 @@ Transform: m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0.5, y: 0.5, z: 0.5} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 487766} m_RootOrder: 3 @@ -221,10 +224,12 @@ MeshRenderer: m_CastShadows: 0 m_ReceiveShadows: 0 m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 m_RayTracingMode: 2 + m_RayTraceProcedural: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -249,6 +254,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} --- !u!1 &133060 GameObject: m_ObjectHideFlags: 0 @@ -276,6 +282,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 467624} - {fileID: 469164} @@ -310,9 +317,9 @@ MonoBehaviour: m_PreviewLineControlPointLife: 0.2 m_PreviewLineIdealLength: 1 m_AudioSources: - - {fileID: 114453837716747884} - - {fileID: 114054523002933400} - - {fileID: 114160529511473284} + - {fileID: -3960940074271305933} + - {fileID: -8312023248257998569} + - {fileID: -6042884290199676049} m_BrushAudioPitchVelocityRange: {x: 10, y: 30} m_BrushPlaybackAudioClip: {fileID: 8300000, guid: d52d5fa13bdd38749b0cd828ae9a9193, type: 3} @@ -344,6 +351,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 487766} m_RootOrder: 1 @@ -367,10 +375,12 @@ MeshRenderer: m_CastShadows: 0 m_ReceiveShadows: 0 m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 m_MotionVectors: 1 m_LightProbeUsage: 0 m_ReflectionProbeUsage: 1 m_RayTracingMode: 2 + m_RayTraceProcedural: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -395,6 +405,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} --- !u!1 &1006578575455840 GameObject: m_ObjectHideFlags: 0 @@ -405,6 +416,7 @@ GameObject: m_Component: - component: {fileID: 4008230342632392} - component: {fileID: 114453837716747884} + - component: {fileID: -3960940074271305933} m_Layer: 14 m_Name: AudioSource1 m_TagString: Untagged @@ -422,6 +434,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4720948884069568} m_RootOrder: 0 @@ -461,6 +474,102 @@ MonoBehaviour: sourceMinDistance: 0.75 hrtfEnabled: 1 audioSource: {fileID: 0} +--- !u!82 &-3960940074271305933 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1006578575455840} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 0} + m_PlayOnAwake: 1 + m_Volume: 0 + m_Pitch: 1 + Loop: 1 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 0 + MinDistance: 0.75 + MaxDistance: 15 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 --- !u!1 &1240372603388100 GameObject: m_ObjectHideFlags: 0 @@ -471,6 +580,7 @@ GameObject: m_Component: - component: {fileID: 4093886704260266} - component: {fileID: 114160529511473284} + - component: {fileID: -6042884290199676049} m_Layer: 14 m_Name: AudioSource3 m_TagString: Untagged @@ -488,6 +598,7 @@ Transform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4720948884069568} m_RootOrder: 2 @@ -527,6 +638,102 @@ MonoBehaviour: sourceMinDistance: 0.75 hrtfEnabled: 1 audioSource: {fileID: 0} +--- !u!82 &-6042884290199676049 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1240372603388100} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 0} + m_PlayOnAwake: 1 + m_Volume: 0 + m_Pitch: 1 + Loop: 1 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 0 + MinDistance: 0.75 + MaxDistance: 15 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 --- !u!1 &1544320839044516 GameObject: m_ObjectHideFlags: 0 @@ -553,6 +760,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 4008230342632392} - {fileID: 4083097702606122} @@ -570,6 +778,7 @@ GameObject: m_Component: - component: {fileID: 4083097702606122} - component: {fileID: 114054523002933400} + - component: {fileID: -8312023248257998569} m_Layer: 14 m_Name: AudioSource2 m_TagString: Untagged @@ -587,6 +796,7 @@ Transform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4720948884069568} m_RootOrder: 1 @@ -626,6 +836,102 @@ MonoBehaviour: sourceMinDistance: 0.75 hrtfEnabled: 1 audioSource: {fileID: 0} +--- !u!82 &-8312023248257998569 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1901529591950498} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 0} + m_PlayOnAwake: 1 + m_Volume: 0 + m_Pitch: 1 + Loop: 1 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 0 + MinDistance: 0.75 + MaxDistance: 15 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 --- !u!1 &2258206953472289196 GameObject: m_ObjectHideFlags: 0 @@ -654,6 +960,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 487766} m_RootOrder: 2 @@ -677,10 +984,12 @@ MeshRenderer: m_CastShadows: 0 m_ReceiveShadows: 0 m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 m_MotionVectors: 1 m_LightProbeUsage: 0 m_ReflectionProbeUsage: 1 m_RayTracingMode: 2 + m_RayTraceProcedural: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -705,3 +1014,4 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 754b57228a..e62024eb5b 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -3438,6 +3438,102 @@ MonoBehaviour: sourceMinDistance: 0.75 hrtfEnabled: 1 audioSource: {fileID: 0} +--- !u!82 &151850540 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 151850538} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 8300000, guid: a54573c219ca2e949ab798815c9078c8, type: 3} + m_PlayOnAwake: 1 + m_Volume: 1 + m_Pitch: 1 + Loop: 1 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 0.75 + MaxDistance: 15 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 --- !u!1 &152983283 GameObject: m_ObjectHideFlags: 0 @@ -3640,6 +3736,7 @@ GameObject: m_Component: - component: {fileID: 160917794} - component: {fileID: 160917795} + - component: {fileID: 160917796} m_Layer: 14 m_Name: MeshParent m_TagString: Untagged @@ -3701,6 +3798,102 @@ MonoBehaviour: sourceMinDistance: 0.75 hrtfEnabled: 1 audioSource: {fileID: 0} +--- !u!82 &160917796 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 160917793} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 8300000, guid: 670ce17e9f3fb614cae2e3433eb40097, type: 3} + m_PlayOnAwake: 1 + m_Volume: 1 + m_Pitch: 1 + Loop: 1 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 0 + MinDistance: 0.75 + MaxDistance: 15 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 --- !u!1 &161836534 GameObject: m_ObjectHideFlags: 0 @@ -15276,6 +15469,102 @@ Transform: type: 3} m_PrefabInstance: {fileID: 1093897234} m_PrefabAsset: {fileID: 0} +--- !u!82 &1093897236 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 90463641} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 8300000, guid: bf8585fc12bb2974c8562060b13192c4, type: 3} + m_PlayOnAwake: 1 + m_Volume: 0.15 + m_Pitch: 1 + Loop: 1 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 0.75 + MaxDistance: 15 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 --- !u!1001 &1095157233 PrefabInstance: m_ObjectHideFlags: 0 @@ -18649,60 +18938,156 @@ PrefabInstance: - target: {fileID: 2300006, guid: 535a5aa7349085e42b210f7d2bdbe548, type: 3} propertyPath: m_LightProbeUsage value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2300006, guid: 535a5aa7349085e42b210f7d2bdbe548, type: 3} - propertyPath: m_Materials.Array.data[0] - value: - objectReference: {fileID: 2100000, guid: 7a8548efbc741469d932a1fca2487ca7, type: 2} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 535a5aa7349085e42b210f7d2bdbe548, type: 3} ---- !u!4 &1399244134 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 400000, guid: 535a5aa7349085e42b210f7d2bdbe548, - type: 3} - m_PrefabInstance: {fileID: 1399244133} - m_PrefabAsset: {fileID: 0} ---- !u!1 &1399244135 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 100000, guid: 535a5aa7349085e42b210f7d2bdbe548, - type: 3} - m_PrefabInstance: {fileID: 1399244133} - m_PrefabAsset: {fileID: 0} ---- !u!114 &1399244136 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1399244135} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 6dbca64e524ea44f9b26142ec59aca8a, type: 3} - m_Name: - m_EditorClassIdentifier: - bypassRoomEffects: 0 - directivityAlpha: 0 - directivitySharpness: 1 - listenerDirectivityAlpha: 0.125 - listenerDirectivitySharpness: 1 - gainDb: 3 - occlusionEnabled: 0 - playOnAwake: 0 - disableOnStop: 0 - sourceClip: {fileID: 8300000, guid: a54573c219ca2e949ab798815c9078c8, type: 3} - sourceLoop: 1 - sourceMute: 0 - sourcePitch: 1 - sourcePriority: 128 - sourceSpatialBlend: 1 - sourceDopplerLevel: 1 - sourceSpread: 0 - sourceVolume: 1 - sourceRolloffMode: 0 - sourceMaxDistance: 15 - sourceMinDistance: 0.75 - hrtfEnabled: 1 - audioSource: {fileID: 0} + objectReference: {fileID: 0} + - target: {fileID: 2300006, guid: 535a5aa7349085e42b210f7d2bdbe548, type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: 7a8548efbc741469d932a1fca2487ca7, type: 2} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 535a5aa7349085e42b210f7d2bdbe548, type: 3} +--- !u!4 &1399244134 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 400000, guid: 535a5aa7349085e42b210f7d2bdbe548, + type: 3} + m_PrefabInstance: {fileID: 1399244133} + m_PrefabAsset: {fileID: 0} +--- !u!1 &1399244135 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 100000, guid: 535a5aa7349085e42b210f7d2bdbe548, + type: 3} + m_PrefabInstance: {fileID: 1399244133} + m_PrefabAsset: {fileID: 0} +--- !u!114 &1399244136 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1399244135} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6dbca64e524ea44f9b26142ec59aca8a, type: 3} + m_Name: + m_EditorClassIdentifier: + bypassRoomEffects: 0 + directivityAlpha: 0 + directivitySharpness: 1 + listenerDirectivityAlpha: 0.125 + listenerDirectivitySharpness: 1 + gainDb: 3 + occlusionEnabled: 0 + playOnAwake: 0 + disableOnStop: 0 + sourceClip: {fileID: 8300000, guid: a54573c219ca2e949ab798815c9078c8, type: 3} + sourceLoop: 1 + sourceMute: 0 + sourcePitch: 1 + sourcePriority: 128 + sourceSpatialBlend: 1 + sourceDopplerLevel: 1 + sourceSpread: 0 + sourceVolume: 1 + sourceRolloffMode: 0 + sourceMaxDistance: 15 + sourceMinDistance: 0.75 + hrtfEnabled: 1 + audioSource: {fileID: 0} +--- !u!82 &1399244137 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1399244135} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 8300000, guid: a54573c219ca2e949ab798815c9078c8, type: 3} + m_PlayOnAwake: 1 + m_Volume: 1 + m_Pitch: 1 + Loop: 1 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 0.75 + MaxDistance: 15 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 --- !u!1 &1412532061 GameObject: m_ObjectHideFlags: 0 @@ -20487,6 +20872,7 @@ GameObject: m_Component: - component: {fileID: 1541150095} - component: {fileID: 1541150096} + - component: {fileID: 1541150097} m_Layer: 14 m_Name: Selection m_TagString: Untagged @@ -20548,6 +20934,102 @@ MonoBehaviour: sourceMinDistance: 0.75 hrtfEnabled: 1 audioSource: {fileID: 0} +--- !u!82 &1541150097 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1541150094} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 8300000, guid: 26960500efb643c46892c59bc57ed348, type: 3} + m_PlayOnAwake: 1 + m_Volume: 0.15 + m_Pitch: 1 + Loop: 1 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 0.75 + MaxDistance: 15 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 --- !u!1001 &1553199669 PrefabInstance: m_ObjectHideFlags: 0 @@ -33829,6 +34311,102 @@ MonoBehaviour: sourceMinDistance: 0.75 hrtfEnabled: 1 audioSource: {fileID: 0} +--- !u!82 &2103185555 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2103185553} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 8300000, guid: be949bc723bdf6447802b4e1b067e993, type: 3} + m_PlayOnAwake: 1 + m_Volume: 0.15 + m_Pitch: 0.9 + Loop: 1 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 0 + MinDistance: 0.75 + MaxDistance: 15 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 --- !u!1 &2104863928 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/AudioManager.cs b/Assets/Scripts/AudioManager.cs index 9e6f4f3264..fafede38ea 100644 --- a/Assets/Scripts/AudioManager.cs +++ b/Assets/Scripts/AudioManager.cs @@ -32,7 +32,7 @@ public class AudioManager : MonoBehaviour { class AudioLoop { - public GvrAudioSource m_GvrAudioSource; + public AudioSource m_AudioSource; // This is null if and only if the source is not being used. public string m_LoopName; } @@ -58,7 +58,7 @@ static public bool Enabled [SerializeField] private GameObject m_AudioOneShotPrefab; [SerializeField] private int m_NumAudioOneShots; - private GvrAudioSource[] m_AudioOneShots; + private AudioSource[] m_AudioOneShots; private int m_NextAvailableAudioOneShot; [SerializeField] private GameObject m_AudioLoopPrefab; @@ -208,12 +208,12 @@ void Awake() Transform audioParent = new GameObject("AudioManager Things").transform; audioParent.parent = transform; - m_AudioOneShots = new GvrAudioSource[m_NumAudioOneShots]; + m_AudioOneShots = new AudioSource[m_NumAudioOneShots]; for (int i = 0; i < m_AudioOneShots.Length; ++i) { GameObject audioObj = Instantiate(m_AudioOneShotPrefab, audioParent, true); - GvrAudioSource audioSource = audioObj.GetComponent(); - audioSource.disableOnStop = true; + AudioSource audioSource = audioObj.GetComponent(); + // audioSource.disableOnStop = true; m_AudioOneShots[i] = audioSource; } @@ -223,13 +223,13 @@ void Awake() for (int i = 0; i < m_AudioLoops.Length; ++i) { GameObject audioObj = Instantiate(m_AudioLoopPrefab, audioParent, true); - GvrAudioSource audioSource = audioObj.GetComponent(); - audioSource.disableOnStop = true; + AudioSource audioSource = audioObj.GetComponent(); + // audioSource.disableOnStop = true; audioSource.loop = true; m_AudioLoops[i] = new AudioLoop { - m_GvrAudioSource = audioSource, + m_AudioSource = audioSource, m_LoopName = null }; } @@ -278,15 +278,15 @@ public bool StartLoop(AudioClip rClip, string sLoopName, Transform targetTransfo m_RecentlyUsedAudioLoop = available.Value; - m_AudioLoops[m_RecentlyUsedAudioLoop].m_GvrAudioSource.gameObject.SetActive(true); - m_AudioLoops[m_RecentlyUsedAudioLoop].m_GvrAudioSource.volume = fVolume; - m_AudioLoops[m_RecentlyUsedAudioLoop].m_GvrAudioSource.gainDb = fGain; - m_AudioLoops[m_RecentlyUsedAudioLoop].m_GvrAudioSource.spatialBlend = fSpatialBlend; - m_AudioLoops[m_RecentlyUsedAudioLoop].m_GvrAudioSource.clip = rClip; - m_AudioLoops[m_RecentlyUsedAudioLoop].m_GvrAudioSource.transform.SetParent(targetTransform); - m_AudioLoops[m_RecentlyUsedAudioLoop].m_GvrAudioSource.transform.localPosition = Vector3.zero; + m_AudioLoops[m_RecentlyUsedAudioLoop].m_AudioSource.gameObject.SetActive(true); + m_AudioLoops[m_RecentlyUsedAudioLoop].m_AudioSource.volume = fVolume; + // m_AudioLoops[m_RecentlyUsedAudioLoop].m_AudioSource.gainDb = fGain; + m_AudioLoops[m_RecentlyUsedAudioLoop].m_AudioSource.spatialBlend = fSpatialBlend; + m_AudioLoops[m_RecentlyUsedAudioLoop].m_AudioSource.clip = rClip; + m_AudioLoops[m_RecentlyUsedAudioLoop].m_AudioSource.transform.SetParent(targetTransform); + m_AudioLoops[m_RecentlyUsedAudioLoop].m_AudioSource.transform.localPosition = Vector3.zero; m_AudioLoops[m_RecentlyUsedAudioLoop].m_LoopName = sLoopName; - m_AudioLoops[m_RecentlyUsedAudioLoop].m_GvrAudioSource.Play(); + m_AudioLoops[m_RecentlyUsedAudioLoop].m_AudioSource.Play(); return true; } @@ -300,7 +300,7 @@ public void ChangeLoopVolume(string sLoopName, float fVolume) { if (m_AudioLoops[i].m_LoopName == sLoopName) { - m_AudioLoops[i].m_GvrAudioSource.volume = fVolume; + m_AudioLoops[i].m_AudioSource.volume = fVolume; return; } } @@ -312,9 +312,9 @@ public void StopLoop(string sLoopName) { if (m_AudioLoops[i].m_LoopName == sLoopName) { - m_AudioLoops[i].m_GvrAudioSource.Stop(); + m_AudioLoops[i].m_AudioSource.Stop(); m_AudioLoops[i].m_LoopName = null; - m_AudioLoops[i].m_GvrAudioSource.transform.SetParent(transform); + m_AudioLoops[i].m_AudioSource.transform.SetParent(transform); } } } @@ -325,9 +325,9 @@ public void StopAllLoops() { if (m_AudioLoops[i].m_LoopName != null) { - m_AudioLoops[i].m_GvrAudioSource.Stop(); + m_AudioLoops[i].m_AudioSource.Stop(); m_AudioLoops[i].m_LoopName = null; - m_AudioLoops[i].m_GvrAudioSource.transform.SetParent(transform); + m_AudioLoops[i].m_AudioSource.transform.SetParent(transform); } } } @@ -735,7 +735,7 @@ public void TriggerOneShot(AudioClip rClip, Vector3 vPos, float fVolume, { m_AudioOneShots[m_NextAvailableAudioOneShot].gameObject.SetActive(true); m_AudioOneShots[m_NextAvailableAudioOneShot].volume = fVolume; - m_AudioOneShots[m_NextAvailableAudioOneShot].gainDb = fGain; + // m_AudioOneShots[m_NextAvailableAudioOneShot].gainDb = fGain; m_AudioOneShots[m_NextAvailableAudioOneShot].spatialBlend = fSpatialBlend; m_AudioOneShots[m_NextAvailableAudioOneShot].clip = rClip; m_AudioOneShots[m_NextAvailableAudioOneShot].transform.position = vPos; @@ -748,7 +748,7 @@ public void TriggerOneShot(AudioClip rClip, Vector3 vPos, float fVolume, public void StopAudio() { - foreach (GvrAudioSource s in m_AudioOneShots) + foreach (AudioSource s in m_AudioOneShots) { s.Stop(); } diff --git a/Assets/ThirdParty/GoogleVR/Editor.meta b/Assets/Scripts/GvrStubs.meta similarity index 77% rename from Assets/ThirdParty/GoogleVR/Editor.meta rename to Assets/Scripts/GvrStubs.meta index c5f160861d..619b2fe427 100644 --- a/Assets/ThirdParty/GoogleVR/Editor.meta +++ b/Assets/Scripts/GvrStubs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 099bb01229bb0cf4ba06368f3d4bcbe0 +guid: 0b245d8a2e0a89b46b19d00c6653b6bf folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Scripts/GvrStubs/GvrAudio.cs b/Assets/Scripts/GvrStubs/GvrAudio.cs new file mode 100644 index 0000000000..07a7845bee --- /dev/null +++ b/Assets/Scripts/GvrStubs/GvrAudio.cs @@ -0,0 +1,7 @@ +public class GvrAudio +{ + public enum Quality + { + High + } +} diff --git a/Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudio.cs.meta b/Assets/Scripts/GvrStubs/GvrAudio.cs.meta similarity index 100% rename from Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudio.cs.meta rename to Assets/Scripts/GvrStubs/GvrAudio.cs.meta diff --git a/Assets/Scripts/GvrStubs/GvrAudioListener.cs b/Assets/Scripts/GvrStubs/GvrAudioListener.cs new file mode 100644 index 0000000000..d8d668cfae --- /dev/null +++ b/Assets/Scripts/GvrStubs/GvrAudioListener.cs @@ -0,0 +1,13 @@ +using UnityEngine; + +public class GvrAudioListener : MonoBehaviour +{ + /// Global gain in decibels to be applied to the processed output. + public float globalGainDb = 0.0f; + + /// Global layer mask to be used in occlusion detection. + public LayerMask occlusionMask = -1; + + /// Audio rendering quality of the system. + public GvrAudio.Quality quality = GvrAudio.Quality.High; +} diff --git a/Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudioListener.cs.meta b/Assets/Scripts/GvrStubs/GvrAudioListener.cs.meta similarity index 100% rename from Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudioListener.cs.meta rename to Assets/Scripts/GvrStubs/GvrAudioListener.cs.meta diff --git a/Assets/Scripts/GvrStubs/GvrAudioRoom.cs b/Assets/Scripts/GvrStubs/GvrAudioRoom.cs new file mode 100644 index 0000000000..eea793f542 --- /dev/null +++ b/Assets/Scripts/GvrStubs/GvrAudioRoom.cs @@ -0,0 +1,87 @@ +using UnityEngine; + +public class GvrAudioRoom : MonoBehaviour +{ + /// Material type that determines the acoustic properties of a room surface. + public enum SurfaceMaterial + { + Transparent = 0, + ///< Transparent + AcousticCeilingTiles = 1, + ///< Acoustic ceiling tiles + BrickBare = 2, + ///< Brick, bare + BrickPainted = 3, + ///< Brick, painted + ConcreteBlockCoarse = 4, + ///< Concrete block, coarse + ConcreteBlockPainted = 5, + ///< Concrete block, painted + CurtainHeavy = 6, + ///< Curtain, heavy + FiberglassInsulation = 7, + ///< Fiberglass insulation + GlassThin = 8, + ///< Glass, thin + GlassThick = 9, + ///< Glass, thick + Grass = 10, + ///< Grass + LinoleumOnConcrete = 11, + ///< Linoleum on concrete + Marble = 12, + ///< Marble + Metal = 13, + ///< Galvanized sheet metal + ParquetOnConcrete = 14, + ///< Parquet on concrete + PlasterRough = 15, + ///< Plaster, rough + PlasterSmooth = 16, + ///< Plaster, smooth + PlywoodPanel = 17, + ///< Plywood panel + PolishedConcreteOrTile = 18, + ///< Polished concrete or tile + Sheetrock = 19, + ///< Sheetrock + WaterOrIceSurface = 20, + ///< Water or ice surface + WoodCeiling = 21, + ///< Wood ceiling + WoodPanel = 22 ///< Wood panel + } + + /// Room surface material in negative x direction. + public SurfaceMaterial leftWall = SurfaceMaterial.ConcreteBlockCoarse; + + /// Room surface material in positive x direction. + public SurfaceMaterial rightWall = SurfaceMaterial.ConcreteBlockCoarse; + + /// Room surface material in negative y direction. + public SurfaceMaterial floor = SurfaceMaterial.ParquetOnConcrete; + + /// Room surface material in positive y direction. + public SurfaceMaterial ceiling = SurfaceMaterial.PlasterRough; + + /// Room surface material in negative z direction. + public SurfaceMaterial backWall = SurfaceMaterial.ConcreteBlockCoarse; + + /// Room surface material in positive z direction. + public SurfaceMaterial frontWall = SurfaceMaterial.ConcreteBlockCoarse; + + /// Reflectivity scalar for each surface of the room. + public float reflectivity = 1.0f; + + /// Reverb gain modifier in decibels. + public float reverbGainDb = 0.0f; + + /// Reverb brightness modifier. + public float reverbBrightness = 0.0f; + + /// Reverb time modifier. + public float reverbTime = 1.0f; + + /// Size of the room (normalized with respect to scale of the game object). + public Vector3 size = Vector3.one; +} diff --git a/Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudioRoom.cs.meta b/Assets/Scripts/GvrStubs/GvrAudioRoom.cs.meta similarity index 100% rename from Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudioRoom.cs.meta rename to Assets/Scripts/GvrStubs/GvrAudioRoom.cs.meta diff --git a/Assets/Scripts/GvrStubs/GvrAudioSoundfield.cs b/Assets/Scripts/GvrStubs/GvrAudioSoundfield.cs new file mode 100644 index 0000000000..5351aff89e --- /dev/null +++ b/Assets/Scripts/GvrStubs/GvrAudioSoundfield.cs @@ -0,0 +1,53 @@ +using UnityEngine; + +public class GvrAudioSoundfield : MonoBehaviour +{ + /// Denotes whether the room effects should be bypassed. + public bool bypassRoomEffects = true; + + /// Input gain in decibels. + public float gainDb = 0.0f; + + /// Play source on awake. + public bool playOnAwake = true; + + public AudioClip soundfieldClip0102 = null; + + public AudioClip soundfieldClip0304 = null; + + /// Is the audio clip looping? + public bool soundfieldLoop = false; + + /// Un- / Mutes the soundfield. Mute sets the volume=0, Un-Mute restore the original volume. + public bool soundfieldMute = false; + + /// The pitch of the audio source. + [Range(-3.0f, 3.0f)] + public float soundfieldPitch = 1.0f; + + /// Sets the priority of the soundfield. + [Range(0, 256)] + public int soundfieldPriority = 32; + + /// Sets how much this soundfield is affected by 3D spatialization calculations + /// (attenuation, doppler). + [Range(0.0f, 1.0f)] + public float soundfieldSpatialBlend = 0.0f; + + /// Sets the Doppler scale for this soundfield. + [Range(0.0f, 5.0f)] + public float soundfieldDopplerLevel = 0.0f; + + + /// The volume of the audio source (0.0 to 1.0). + [Range(0.0f, 1.0f)] + public float soundfieldVolume = 1.0f; + + /// Volume rolloff model with respect to the distance. + public AudioRolloffMode soundfieldRolloffMode = AudioRolloffMode.Logarithmic; + + public float soundfieldMaxDistance = 500.0f; + + public float soundfieldMinDistance = 1.0f; + +} diff --git a/Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudioSoundfield.cs.meta b/Assets/Scripts/GvrStubs/GvrAudioSoundfield.cs.meta similarity index 100% rename from Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudioSoundfield.cs.meta rename to Assets/Scripts/GvrStubs/GvrAudioSoundfield.cs.meta diff --git a/Assets/Scripts/GvrStubs/GvrAudioSource.cs b/Assets/Scripts/GvrStubs/GvrAudioSource.cs new file mode 100644 index 0000000000..83110375be --- /dev/null +++ b/Assets/Scripts/GvrStubs/GvrAudioSource.cs @@ -0,0 +1,76 @@ +using System; +using UnityEngine; +using UnityEngine.Audio; + +public class GvrAudioSource : MonoBehaviour +{ + + /// Denotes whether the room effects should be bypassed. + public bool bypassRoomEffects = false; + + /// Directivity pattern shaping factor. + public float directivityAlpha = 0.0f; + + /// Directivity pattern order. + public float directivitySharpness = 1.0f; + + /// Listener directivity pattern shaping factor. + public float listenerDirectivityAlpha = 0.0f; + + /// Listener directivity pattern order. + public float listenerDirectivitySharpness = 1.0f; + + /// Input gain in decibels. + public float gainDb = 0.0f; + + /// Occlusion effect toggle. + public bool occlusionEnabled = false; + + /// Play source on awake. + public bool playOnAwake = true; + + /// Disable the gameobject when sound isn't playing. + public bool disableOnStop = false; + + /// The default AudioClip to play. + public AudioClip sourceClip = null; + + /// Is the audio clip looping? + public bool sourceLoop = false; + + /// Un- / Mutes the source. Mute sets the volume=0, Un-Mute restore the original volume. + public bool sourceMute = false; + + /// The pitch of the audio source. + [Range(-3.0f, 3.0f)] + public float sourcePitch = 1.0f; + + /// Sets the priority of the audio source. + public int sourcePriority = 128; + + /// Sets how much this source is affected by 3D spatialization calculations (attenuation, doppler). + public float sourceSpatialBlend = 1.0f; + + /// Sets the Doppler scale for this audio source. + public float sourceDopplerLevel = 1.0f; + + /// Sets the spread angle (in degrees) in 3D space. + public float sourceSpread = 0.0f; + + /// The volume of the audio source (0.0 to 1.0). + public float sourceVolume = 1.0f; + + /// Volume rolloff model with respect to the distance. + public AudioRolloffMode sourceRolloffMode = AudioRolloffMode.Logarithmic; + + public float sourceMaxDistance = 500.0f; + + public float sourceMinDistance = 1.0f; + + /// Binaural (HRTF) rendering toggle. + public bool hrtfEnabled = true; + + // Unity audio source attached to the game object. + public AudioSource audioSource = null; + +} diff --git a/Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudioSource.cs.meta b/Assets/Scripts/GvrStubs/GvrAudioSource.cs.meta similarity index 100% rename from Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudioSource.cs.meta rename to Assets/Scripts/GvrStubs/GvrAudioSource.cs.meta diff --git a/Assets/Scripts/PointerScript.cs b/Assets/Scripts/PointerScript.cs index 73a4c6ee76..a2d0a713df 100644 --- a/Assets/Scripts/PointerScript.cs +++ b/Assets/Scripts/PointerScript.cs @@ -58,7 +58,7 @@ public enum BrushLerp [SerializeField] private bool m_PreviewLineEnabled; [SerializeField] private float m_PreviewLineControlPointLife = 1.0f; [SerializeField] private float m_PreviewLineIdealLength = 1.0f; - [SerializeField] private GvrAudioSource[] m_AudioSources; + [SerializeField] private AudioSource[] m_AudioSources; [SerializeField] private Vector2 m_BrushAudioPitchVelocityRange; [SerializeField] private AudioClip m_BrushPlaybackAudioClip; diff --git a/Assets/Scripts/Tools/StrokeModificationTool.cs b/Assets/Scripts/Tools/StrokeModificationTool.cs index 2060e03ecf..eccb5b7525 100644 --- a/Assets/Scripts/Tools/StrokeModificationTool.cs +++ b/Assets/Scripts/Tools/StrokeModificationTool.cs @@ -41,7 +41,7 @@ private enum AudioState On, FadingOut } - private GvrAudioSource m_ToolAudio; + private AudioSource m_ToolAudio; private AudioState m_CurrentAudioState; private float m_AudioFadeRatio; public float m_AudioVolumeMax; @@ -66,7 +66,7 @@ override public void Init() m_CurrentSize = Mathf.Lerp(m_SizeRange.x, m_SizeRange.y, 0.5f); m_ToolTransform.localScale = Vector3.one * m_CurrentSize; - m_ToolAudio = m_ToolTransform.GetComponent(); + m_ToolAudio = m_ToolTransform.GetComponent(); m_LockToController = m_SketchSurface.IsInFreePaintMode(); diff --git a/Assets/ThirdParty/GoogleVR/Editor/Audio.meta b/Assets/ThirdParty/GoogleVR/Editor/Audio.meta deleted file mode 100644 index 1b9ffe66a4..0000000000 --- a/Assets/ThirdParty/GoogleVR/Editor/Audio.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8d3214d00e8a9ba499c6e5d47140f709 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioListenerEditor.cs b/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioListenerEditor.cs deleted file mode 100644 index ce1c16b13e..0000000000 --- a/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioListenerEditor.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// -// 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; -using System.Collections; - -/// A custom editor for properties on the GvrAudioListener script. This appears in the Inspector -/// window of a GvrAudioListener object. -[CustomEditor(typeof(GvrAudioListener))] -public class GvrAudioListenerEditor : Editor { - private SerializedProperty globalGainDb = null; - private SerializedProperty occlusionMask = null; - private SerializedProperty quality = null; - - private GUIContent globalGainLabel = new GUIContent("Global Gain (dB)", - "Sets the global gain of the system. Can be used to adjust the overall output volume."); - private GUIContent occlusionMaskLabel = new GUIContent("Occlusion Mask", - "Sets the global layer mask for occlusion detection."); - private GUIContent qualityLabel = new GUIContent("Quality", - "Sets the quality mode in which the spatial audio will be rendered. " + - "Higher quality modes allow for increased fidelity at the cost of greater CPU usage."); - - void OnEnable () { - globalGainDb = serializedObject.FindProperty("globalGainDb"); - occlusionMask = serializedObject.FindProperty("occlusionMask"); - quality = serializedObject.FindProperty("quality"); - } - - /// @cond - public override void OnInspectorGUI () { - serializedObject.Update(); - - // Add clickable script field, as would have been provided by DrawDefaultInspector() - MonoScript script = MonoScript.FromMonoBehaviour (target as MonoBehaviour); - EditorGUI.BeginDisabledGroup (true); - EditorGUILayout.ObjectField ("Script", script, typeof(MonoScript), false); - EditorGUI.EndDisabledGroup (); - - // Rendering quality can only be modified through the Inspector in Edit mode. - EditorGUI.BeginDisabledGroup (EditorApplication.isPlaying); - EditorGUILayout.PropertyField(quality, qualityLabel); - EditorGUI.EndDisabledGroup (); - - EditorGUILayout.Separator(); - - EditorGUILayout.Slider(globalGainDb, GvrAudio.minGainDb, GvrAudio.maxGainDb, globalGainLabel); - - EditorGUILayout.Separator(); - - EditorGUILayout.PropertyField(occlusionMask, occlusionMaskLabel); - - serializedObject.ApplyModifiedProperties(); - } - /// @endcond -} diff --git a/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioListenerEditor.cs.meta b/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioListenerEditor.cs.meta deleted file mode 100644 index 0699adea14..0000000000 --- a/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioListenerEditor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 846f7b1b78d8e4eb2a0db361797b6e76 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioRoomEditor.cs b/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioRoomEditor.cs deleted file mode 100644 index b1840f2426..0000000000 --- a/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioRoomEditor.cs +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// -// 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; -using System.Collections; - -/// A custom editor for properties on the GvrAudioRoom script. This appears in the Inspector window -/// of a GvrAudioRoom object. -[CustomEditor(typeof(GvrAudioRoom))] -[CanEditMultipleObjects] -public class GvrAudioRoomEditor : Editor { - private SerializedProperty leftWall = null; - private SerializedProperty rightWall = null; - private SerializedProperty floor = null; - private SerializedProperty ceiling = null; - private SerializedProperty backWall = null; - private SerializedProperty frontWall = null; - private SerializedProperty reflectivity = null; - private SerializedProperty reverbGainDb = null; - private SerializedProperty reverbBrightness = null; - private SerializedProperty reverbTime = null; - private SerializedProperty size = null; - - private GUIContent surfaceMaterialsLabel = new GUIContent("Surface Materials", - "Room surface materials to calculate the acoustic properties of the room."); - private GUIContent surfaceMaterialLabel = new GUIContent("Surface Material", - "Surface material used to calculate the acoustic properties of the room."); - private GUIContent reflectivityLabel = new GUIContent("Reflectivity", - "Adjusts what proportion of the direct sound is reflected back by each surface, after an " + - "appropriate delay. Reverberation is unaffected by this setting."); - private GUIContent reverbGainLabel = new GUIContent("Gain (dB)", - "Applies a gain adjustment to the reverberation in the room. The default value will leave " + - "reverb unaffected."); - private GUIContent reverbPropertiesLabel = new GUIContent("Reverb Properties", - "Parameters to adjust the reverb properties of the room."); - private GUIContent reverbBrightnessLabel = new GUIContent("Brightness", - "Adjusts the balance between high and low frequencies in the reverb."); - private GUIContent reverbTimeLabel = new GUIContent("Time", - "Adjusts the overall duration of the reverb by a positive scaling factor."); - private GUIContent sizeLabel = new GUIContent("Size", "Sets the room dimensions."); - - void OnEnable () { - leftWall = serializedObject.FindProperty("leftWall"); - rightWall = serializedObject.FindProperty("rightWall"); - floor = serializedObject.FindProperty("floor"); - ceiling = serializedObject.FindProperty("ceiling"); - backWall = serializedObject.FindProperty("backWall"); - frontWall = serializedObject.FindProperty("frontWall"); - reflectivity = serializedObject.FindProperty("reflectivity"); - reverbGainDb = serializedObject.FindProperty("reverbGainDb"); - reverbBrightness = serializedObject.FindProperty("reverbBrightness"); - reverbTime = serializedObject.FindProperty("reverbTime"); - size = serializedObject.FindProperty("size"); - } - - /// @cond - public override void OnInspectorGUI () { - serializedObject.Update(); - - // Add clickable script field, as would have been provided by DrawDefaultInspector() - MonoScript script = MonoScript.FromMonoBehaviour (target as MonoBehaviour); - EditorGUI.BeginDisabledGroup (true); - EditorGUILayout.ObjectField ("Script", script, typeof(MonoScript), false); - EditorGUI.EndDisabledGroup (); - - EditorGUILayout.LabelField(surfaceMaterialsLabel); - ++EditorGUI.indentLevel; - DrawSurfaceMaterial(leftWall); - DrawSurfaceMaterial(rightWall); - DrawSurfaceMaterial(floor); - DrawSurfaceMaterial(ceiling); - DrawSurfaceMaterial(backWall); - DrawSurfaceMaterial(frontWall); - --EditorGUI.indentLevel; - - EditorGUILayout.Separator(); - - EditorGUILayout.Slider(reflectivity, 0.0f, GvrAudio.maxReflectivity, reflectivityLabel); - - EditorGUILayout.Separator(); - - EditorGUILayout.LabelField(reverbPropertiesLabel); - ++EditorGUI.indentLevel; - EditorGUILayout.Slider(reverbGainDb, GvrAudio.minGainDb, GvrAudio.maxGainDb, reverbGainLabel); - EditorGUILayout.Slider(reverbBrightness, GvrAudio.minReverbBrightness, - GvrAudio.maxReverbBrightness, reverbBrightnessLabel); - EditorGUILayout.Slider(reverbTime, 0.0f, GvrAudio.maxReverbTime, reverbTimeLabel); - --EditorGUI.indentLevel; - - EditorGUILayout.Separator(); - - EditorGUILayout.PropertyField(size, sizeLabel); - - serializedObject.ApplyModifiedProperties(); - } - /// @endcond - - private void DrawSurfaceMaterial (SerializedProperty surfaceMaterial) { - surfaceMaterialLabel.text = surfaceMaterial.displayName; - EditorGUILayout.PropertyField(surfaceMaterial, surfaceMaterialLabel); - } -} diff --git a/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioRoomEditor.cs.meta b/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioRoomEditor.cs.meta deleted file mode 100644 index c89c34889d..0000000000 --- a/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioRoomEditor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2e20199949e8e4ecd992d68cf09fc902 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioSoundfieldEditor.cs b/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioSoundfieldEditor.cs deleted file mode 100644 index 84ca375ae3..0000000000 --- a/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioSoundfieldEditor.cs +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// -// 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; -using System.Collections; - -/// A custom editor for properties on the GvrAudioSoundfield script. This appears in the Inspector -/// window of a GvrAudioSoundfield object. -[CustomEditor(typeof(GvrAudioSoundfield))] -[CanEditMultipleObjects] -public class GvrAudioSoundfieldEditor : Editor { - private SerializedProperty clip0102 = null; - private SerializedProperty clip0304 = null; - private SerializedProperty loop = null; - private SerializedProperty mute = null; - private SerializedProperty pitch = null; - private SerializedProperty playOnAwake = null; - private SerializedProperty priority = null; - private SerializedProperty spatialBlend = null; - private SerializedProperty volume = null; - private SerializedProperty dopplerLevel = null; - private SerializedProperty rolloffMode = null; - private SerializedProperty maxDistance = null; - private SerializedProperty minDistance = null; - private SerializedProperty bypassRoomEffects = null; - private SerializedProperty gainDb = null; - - private GUIContent clip0102Label = new GUIContent("Channels 1 & 2 (WY)", - "The AudioClip asset for the 1 & 2 channels (W & Y components) of the first-order " + - "ambisonic soundfield. Channels must be in Ambix (ACN/SN3D) format."); - private GUIContent clip0304Label = new GUIContent("Channels 3 & 4 (ZX)", - "The AudioClip asset for the 3 & 4 channels (Z & X components) of the first-order " + - "ambisonic soundfield. Channels must be in Ambix (ACN/SN3D) format."); - private GUIContent loopLabel = new GUIContent("Loop", - "Sets the soundfield to loop."); - private GUIContent muteLabel = new GUIContent("Mute", - "Mutes the sound."); - private GUIContent pitchLabel = new GUIContent("Pitch", - "Sets the frequency of the sound. Use this to slow down or speed up the sound."); - private GUIContent priorityLabel = new GUIContent("Priority", - "Sets the priority of the soundfield. Note that a sound with a larger priority value will " + - "more likely be stolen by sounds with smaller priority values."); - private GUIContent spatialBlendLabel = new GUIContent("Spatial Blend", - "Sets how much this soundfield is treated as a 3D source. Setting this value to 0 will " + - "ignore distance attenuation and doppler effects. However, it does not affect panning the " + - "sound around the listener."); - private GUIContent volumeLabel = new GUIContent("Volume", - "Sets the overall volume of the soundfield."); - private GUIContent dopplerLevelLabel = new GUIContent("Doppler Level", - "Specifies how much the pitch is changed based on the relative velocity between the " + - "soundfield and the listener."); - private GUIContent rolloffModeLabel = new GUIContent("Volume Rolloff", - "Which type of rolloff curve to use."); - private GUIContent maxDistanceLabel = new GUIContent("Max Distance", - "Max distance is the distance a sound stops attenuating at."); - private GUIContent minDistanceLabel = new GUIContent("Min Distance", - "Within the min distance, the volume will stay at the loudest possible. " + - "Outside this min distance it will begin to attenuate."); - private GUIContent playOnAwakeLabel = new GUIContent("Play On Awake", - "Play the sound when the scene loads."); - private GUIContent bypassRoomEffectsLabel = new GUIContent("Bypass Room Effects", - "Sets whether the room effects for the soundfield should be bypassed."); - private GUIContent gainLabel = new GUIContent("Gain (dB)", - "Applies a gain to the soundfield for adjustment of relative loudness."); - - void OnEnable () { - clip0102 = serializedObject.FindProperty("soundfieldClip0102"); - clip0304 = serializedObject.FindProperty("soundfieldClip0304"); - loop = serializedObject.FindProperty("soundfieldLoop"); - mute = serializedObject.FindProperty("soundfieldMute"); - pitch = serializedObject.FindProperty("soundfieldPitch"); - playOnAwake = serializedObject.FindProperty("playOnAwake"); - priority = serializedObject.FindProperty("soundfieldPriority"); - spatialBlend = serializedObject.FindProperty("soundfieldSpatialBlend"); - volume = serializedObject.FindProperty("soundfieldVolume"); - dopplerLevel = serializedObject.FindProperty("soundfieldDopplerLevel"); - rolloffMode = serializedObject.FindProperty("soundfieldRolloffMode"); - maxDistance = serializedObject.FindProperty("soundfieldMaxDistance"); - minDistance = serializedObject.FindProperty("soundfieldMinDistance"); - bypassRoomEffects = serializedObject.FindProperty("bypassRoomEffects"); - gainDb = serializedObject.FindProperty("gainDb"); - } - - /// @cond - public override void OnInspectorGUI () { - serializedObject.Update(); - - // Add clickable script field, as would have been provided by DrawDefaultInspector() - MonoScript script = MonoScript.FromMonoBehaviour (target as MonoBehaviour); - EditorGUI.BeginDisabledGroup (true); - EditorGUILayout.ObjectField ("Script", script, typeof(MonoScript), false); - EditorGUI.EndDisabledGroup (); - - EditorGUILayout.LabelField("AudioClip"); - EditorGUI.indentLevel++; - EditorGUILayout.PropertyField(clip0102, clip0102Label); - EditorGUILayout.PropertyField(clip0304, clip0304Label); - EditorGUI.indentLevel--; - - EditorGUILayout.Separator(); - - EditorGUILayout.PropertyField(mute, muteLabel); - EditorGUILayout.PropertyField(bypassRoomEffects, bypassRoomEffectsLabel); - EditorGUILayout.PropertyField(playOnAwake, playOnAwakeLabel); - EditorGUILayout.PropertyField(loop, loopLabel); - - EditorGUILayout.Separator(); - - EditorGUILayout.PropertyField(priority, priorityLabel); - - EditorGUILayout.Separator(); - - EditorGUILayout.PropertyField(volume, volumeLabel); - - EditorGUILayout.Separator(); - - EditorGUILayout.PropertyField(pitch, pitchLabel); - - EditorGUILayout.Separator(); - - EditorGUILayout.PropertyField(spatialBlend, spatialBlendLabel); - - EditorGUILayout.Separator(); - - EditorGUILayout.Slider(gainDb, GvrAudio.minGainDb, GvrAudio.maxGainDb, gainLabel); - - EditorGUILayout.Separator(); - - EditorGUILayout.PropertyField(dopplerLevel, dopplerLevelLabel); - EditorGUILayout.PropertyField(rolloffMode, rolloffModeLabel); - ++EditorGUI.indentLevel; - EditorGUILayout.PropertyField(minDistance, minDistanceLabel); - EditorGUILayout.PropertyField(maxDistance, maxDistanceLabel); - --EditorGUI.indentLevel; - if (rolloffMode.enumValueIndex == (int)AudioRolloffMode.Custom) { - EditorGUILayout.HelpBox("Custom rolloff mode is not supported, no distance attenuation " + - "will be applied.", MessageType.Warning); - } - - EditorGUILayout.Separator(); - - serializedObject.ApplyModifiedProperties(); - } - /// @endcond -} diff --git a/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioSourceEditor.cs b/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioSourceEditor.cs deleted file mode 100644 index 61e458502b..0000000000 --- a/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioSourceEditor.cs +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// -// 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; -using System.Collections; - -/// A custom editor for properties on the GvrAudioSource script. This appears in the Inspector -/// window of a GvrAudioSource object. -[CustomEditor(typeof(GvrAudioSource))] -[CanEditMultipleObjects] -public class GvrAudioSourceEditor : Editor { - private SerializedProperty clip = null; - private SerializedProperty loop = null; - private SerializedProperty mute = null; - private SerializedProperty pitch = null; - private SerializedProperty playOnAwake = null; - private SerializedProperty priority = null; - private SerializedProperty spatialBlend = null; - private SerializedProperty volume = null; - private SerializedProperty dopplerLevel = null; - private SerializedProperty spread = null; - private SerializedProperty rolloffMode = null; - private SerializedProperty maxDistance = null; - private SerializedProperty minDistance = null; - private SerializedProperty bypassRoomEffects = null; - private SerializedProperty directivityAlpha = null; - private SerializedProperty directivitySharpness = null; - private SerializedProperty listenerDirectivityAlpha = null; - private SerializedProperty listenerDirectivitySharpness = null; - private Texture2D directivityTexture = null; - private SerializedProperty gainDb = null; - private SerializedProperty hrtfEnabled = null; - private SerializedProperty occlusionEnabled = null; - - private GUIContent clipLabel = new GUIContent("AudioClip", - "The AudioClip asset played by the GvrAudioSource."); - private GUIContent loopLabel = new GUIContent("Loop", - "Sets the source to loop."); - private GUIContent muteLabel = new GUIContent("Mute", - "Mutes the sound."); - private GUIContent pitchLabel = new GUIContent("Pitch", - "Sets the frequency of the sound. Use this to slow down or speed up the sound."); - private GUIContent priorityLabel = new GUIContent("Priority", - "Sets the priority of the source. Note that a sound with a larger priority value will more " + - "likely be stolen by sounds with smaller priority values."); - private GUIContent spatialBlendLabel = new GUIContent("Spatial Blend", - "Sets how much this source is treated as a 3D source. Setting this value to 0 will ignore " + - "distance attenuation and doppler effects. However, it does not affect panning the sound " + - "around the listener."); - private GUIContent volumeLabel = new GUIContent("Volume", - "Sets the overall volume of the sound."); - private GUIContent dopplerLevelLabel = new GUIContent("Doppler Level", - "Specifies how much the pitch is changed based on the relative velocity between the source " + - "and the listener."); - private GUIContent spreadLabel = new GUIContent("Spread", - "Source spread in degrees."); - private GUIContent rolloffModeLabel = new GUIContent("Volume Rolloff", - "Which type of rolloff curve to use."); - private GUIContent maxDistanceLabel = new GUIContent("Max Distance", - "Max distance is the distance a sound stops attenuating at."); - private GUIContent minDistanceLabel = new GUIContent("Min Distance", - "Within the min distance, the volume will stay at the loudest possible. " + - "Outside this min distance it will begin to attenuate."); - private GUIContent playOnAwakeLabel = new GUIContent("Play On Awake", - "Play the sound when the scene loads."); - private GUIContent bypassRoomEffectsLabel = new GUIContent("Bypass Room Effects", - "Sets whether the room effects for the source should be bypassed."); - private GUIContent directivityLabel = new GUIContent("Directivity", - "Controls the pattern of sound emission of the source. This can change the perceived " + - "loudness of the source depending on which way it is facing relative to the listener. " + - "Patterns are aligned to the 'forward' direction of the parent object."); - private GUIContent directivityAlphaLabel = new GUIContent("Alpha", - "Controls the balance between dipole pattern and omnidirectional pattern for source " + - "emission. By varying this value, differing directivity patterns can be formed."); - private GUIContent directivitySharpnessLabel = new GUIContent("Sharpness", - "Sets the sharpness of the directivity pattern. Higher values will result in increased " + - "directivity."); - private GUIContent listenerDirectivityLabel = new GUIContent("Listener Directivity", - "Controls the pattern of sound sensitivity of the listener for the source. This can " + - "change the perceived loudness of the source depending on which way the listener is facing " + - "relative to the source. Patterns are aligned to the 'forward' direction of the listener."); - private GUIContent listenerDirectivityAlphaLabel = new GUIContent("Alpha", - "Controls the balance between dipole pattern and omnidirectional pattern for listener " + - "sensitivity. By varying this value, differing directivity patterns can be formed."); - private GUIContent listenerDirectivitySharpnessLabel = new GUIContent("Sharpness", - "Sets the sharpness of the listener directivity pattern. Higher values will result in " + - "increased directivity."); - private GUIContent gainLabel = new GUIContent("Gain (dB)", - "Applies a gain to the source for adjustment of relative loudness."); - private GUIContent hrtfEnabledLabel = new GUIContent("Enable HRTF", - "Sets HRTF binaural rendering for the source. Note that this setting has no effect when " + - "stereo quality mode is selected globally."); - private GUIContent occlusionLabel = new GUIContent("Enable Occlusion", - "Sets whether the sound of the source should be occluded when there are other objects " + - "between the source and the listener."); - - void OnEnable () { - clip = serializedObject.FindProperty("sourceClip"); - loop = serializedObject.FindProperty("sourceLoop"); - mute = serializedObject.FindProperty("sourceMute"); - pitch = serializedObject.FindProperty("sourcePitch"); - playOnAwake = serializedObject.FindProperty("playOnAwake"); - priority = serializedObject.FindProperty("sourcePriority"); - spatialBlend = serializedObject.FindProperty("sourceSpatialBlend"); - volume = serializedObject.FindProperty("sourceVolume"); - dopplerLevel = serializedObject.FindProperty("sourceDopplerLevel"); - spread = serializedObject.FindProperty("sourceSpread"); - rolloffMode = serializedObject.FindProperty("sourceRolloffMode"); - maxDistance = serializedObject.FindProperty("sourceMaxDistance"); - minDistance = serializedObject.FindProperty("sourceMinDistance"); - bypassRoomEffects = serializedObject.FindProperty("bypassRoomEffects"); - directivityAlpha = serializedObject.FindProperty("directivityAlpha"); - directivitySharpness = serializedObject.FindProperty("directivitySharpness"); - listenerDirectivityAlpha = serializedObject.FindProperty("listenerDirectivityAlpha"); - listenerDirectivitySharpness = serializedObject.FindProperty("listenerDirectivitySharpness"); - directivityTexture = Texture2D.blackTexture; - gainDb = serializedObject.FindProperty("gainDb"); - hrtfEnabled = serializedObject.FindProperty("hrtfEnabled"); - occlusionEnabled = serializedObject.FindProperty("occlusionEnabled"); - } - - /// @cond - public override void OnInspectorGUI () { - serializedObject.Update(); - - // Add clickable script field, as would have been provided by DrawDefaultInspector() - MonoScript script = MonoScript.FromMonoBehaviour (target as MonoBehaviour); - EditorGUI.BeginDisabledGroup (true); - EditorGUILayout.ObjectField ("Script", script, typeof(MonoScript), false); - EditorGUI.EndDisabledGroup (); - - EditorGUILayout.PropertyField(clip, clipLabel); - - EditorGUILayout.Separator(); - - EditorGUILayout.PropertyField(mute, muteLabel); - EditorGUILayout.PropertyField(bypassRoomEffects, bypassRoomEffectsLabel); - EditorGUILayout.PropertyField(playOnAwake, playOnAwakeLabel); - EditorGUILayout.PropertyField(loop, loopLabel); - - EditorGUILayout.Separator(); - - EditorGUILayout.PropertyField(priority, priorityLabel); - - EditorGUILayout.Separator(); - - EditorGUILayout.PropertyField(volume, volumeLabel); - - EditorGUILayout.Separator(); - - EditorGUILayout.PropertyField(pitch, pitchLabel); - - EditorGUILayout.Separator(); - - EditorGUILayout.PropertyField(spatialBlend, spatialBlendLabel); - - EditorGUILayout.Separator(); - - EditorGUILayout.Slider(gainDb, GvrAudio.minGainDb, GvrAudio.maxGainDb, gainLabel); - - EditorGUILayout.Separator(); - - EditorGUILayout.PropertyField(dopplerLevel, dopplerLevelLabel); - EditorGUILayout.PropertyField(spread, spreadLabel); - EditorGUILayout.PropertyField(rolloffMode, rolloffModeLabel); - ++EditorGUI.indentLevel; - EditorGUILayout.PropertyField(minDistance, minDistanceLabel); - EditorGUILayout.PropertyField(maxDistance, maxDistanceLabel); - --EditorGUI.indentLevel; - if (rolloffMode.enumValueIndex == (int)AudioRolloffMode.Custom) { - EditorGUILayout.HelpBox("Custom rolloff mode is not supported, no distance attenuation " + - "will be applied.", MessageType.Warning); - } - - EditorGUILayout.Separator(); - - // Draw the listener directivity properties. - EditorGUILayout.BeginHorizontal(); - EditorGUILayout.BeginVertical(); - GUILayout.Label(listenerDirectivityLabel); - ++EditorGUI.indentLevel; - EditorGUILayout.Slider(listenerDirectivityAlpha, 0.0f, 1.0f, listenerDirectivityAlphaLabel); - EditorGUILayout.Slider(listenerDirectivitySharpness, 1.0f, 10.0f, - listenerDirectivitySharpnessLabel); - --EditorGUI.indentLevel; - EditorGUILayout.EndVertical(); - DrawDirectivityPattern(listenerDirectivityAlpha.floatValue, - listenerDirectivitySharpness.floatValue, - GvrAudio.listenerDirectivityColor, - (int)(3.0f * EditorGUIUtility.singleLineHeight)); - EditorGUILayout.EndHorizontal(); - - EditorGUILayout.Separator(); - - // Draw the source directivity properties. - EditorGUILayout.BeginHorizontal(); - EditorGUILayout.BeginVertical(); - GUILayout.Label(directivityLabel); - ++EditorGUI.indentLevel; - EditorGUILayout.Slider(directivityAlpha, 0.0f, 1.0f, directivityAlphaLabel); - EditorGUILayout.Slider(directivitySharpness, 1.0f, 10.0f, directivitySharpnessLabel); - --EditorGUI.indentLevel; - EditorGUILayout.EndVertical(); - DrawDirectivityPattern(directivityAlpha.floatValue, directivitySharpness.floatValue, - GvrAudio.sourceDirectivityColor, - (int)(3.0f * EditorGUIUtility.singleLineHeight)); - EditorGUILayout.EndHorizontal(); - EditorGUILayout.PropertyField(occlusionEnabled, occlusionLabel); - - EditorGUILayout.Separator(); - - // HRTF toggle can only be modified through the Inspector in Edit mode. - EditorGUI.BeginDisabledGroup (EditorApplication.isPlaying); - EditorGUILayout.PropertyField(hrtfEnabled, hrtfEnabledLabel); - EditorGUI.EndDisabledGroup (); - - serializedObject.ApplyModifiedProperties(); - } - /// @endcond - - private void DrawDirectivityPattern (float alpha, float sharpness, Color color, int size) { - directivityTexture.Resize(size, size); - // Draw the axes. - Color axisColor = color.a * Color.black; - for (int i = 0; i < size; ++i) { - directivityTexture.SetPixel(i, size / 2, axisColor); - directivityTexture.SetPixel(size / 2, i, axisColor); - } - // Draw the 2D polar directivity pattern. - float offset = 0.5f * size; - float cardioidSize = 0.45f * size; - Vector2[] vertices = GvrAudio.Generate2dPolarPattern(alpha, sharpness, 180); - for (int i = 0; i < vertices.Length; ++i) { - directivityTexture.SetPixel((int)(offset + cardioidSize * vertices[i].x), - (int)(offset + cardioidSize * vertices[i].y), color); - } - directivityTexture.Apply(); - // Show the texture. - GUILayout.Box(directivityTexture); - } -} diff --git a/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioSourceEditor.cs.meta b/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioSourceEditor.cs.meta deleted file mode 100644 index 0a4349ca92..0000000000 --- a/Assets/ThirdParty/GoogleVR/Editor/Audio/GvrAudioSourceEditor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 39eb02921e5624cf18f5b235bcc1e1cb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/ThirdParty/GoogleVR/Scripts.meta b/Assets/ThirdParty/GoogleVR/Scripts.meta deleted file mode 100644 index 5f7dd6f0f3..0000000000 --- a/Assets/ThirdParty/GoogleVR/Scripts.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: df24e89c62a80724d823bde53bbd8a41 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/ThirdParty/GoogleVR/Scripts/Audio.meta b/Assets/ThirdParty/GoogleVR/Scripts/Audio.meta deleted file mode 100644 index 4421f01598..0000000000 --- a/Assets/ThirdParty/GoogleVR/Scripts/Audio.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 3a9b072127e2fb844b78428c5e658695 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudio.cs b/Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudio.cs deleted file mode 100644 index 0fc45ca10b..0000000000 --- a/Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudio.cs +++ /dev/null @@ -1,440 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// -// 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 System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Runtime.InteropServices; - -/// This is the main GVR audio class that communicates with the native code implementation of -/// the audio system. Native functions of the system can only be called through this class to -/// preserve the internal system functionality. Public function calls are *not* thread-safe. -public static class GvrAudio { - /// Audio system rendering quality. - public enum Quality { - Stereo = 0, ///< Stereo-only rendering - Low = 1, ///< Low quality binaural rendering (first-order HRTF) - High = 2 ///< High quality binaural rendering (third-order HRTF) - } - - /// Native audio spatializer effect data. - public enum SpatializerData { - Id = 0, /// ID. - Type = 1, /// Spatializer type. - NumChannels = 2, /// Number of input channels. - ChannelSet = 3, /// Soundfield channel set. - Gain = 4, /// Gain. - DistanceAttenuation = 5, /// Computed distance attenuation. - MinDistance = 6, /// Minimum distance for distance-based attenuation. - ZeroOutput = 7, /// Should zero out the output buffer? - } - - /// Native audio spatializer type. - public enum SpatializerType { - Source = 0, /// 3D sound object. - Soundfield = 1 /// First-order ambisonic soundfield. - } - - /// System sampling rate. - public static int SampleRate { - get { return sampleRate; } - } - private static int sampleRate = -1; - - /// System number of output channels. - public static int NumChannels { - get { return numChannels; } - } - private static int numChannels = -1; - - /// System number of frames per buffer. - public static int FramesPerBuffer { - get { return framesPerBuffer; } - } - private static int framesPerBuffer = -1; - - /// Initializes the audio system with the current audio configuration. - /// @note This should only be called from the main Unity thread. - public static void Initialize (GvrAudioListener listener, Quality quality) { - if (!initialized) { - // Initialize the audio system. - AudioConfiguration config = AudioSettings.GetConfiguration(); - sampleRate = config.sampleRate; - numChannels = (int)config.speakerMode; - framesPerBuffer = config.dspBufferSize; - if (numChannels != (int)AudioSpeakerMode.Stereo) { - Debug.LogError("Only 'Stereo' speaker mode is supported by GVR Audio."); - return; - } - if (Application.platform != RuntimePlatform.Android) { - // TODO: GvrAudio bug on Android with Unity 2017 - Initialize((int) quality, sampleRate, numChannels, framesPerBuffer); - } - listenerTransform = listener.transform; - if (Application.platform == RuntimePlatform.Android) { - // TODO: GvrAudio bug on Android with Unity 2017 - return; - } - initialized = true; - } else if (listener.transform != listenerTransform) { - Debug.LogError("Only one GvrAudioListener component is allowed in the scene."); - GvrAudioListener.Destroy(listener); - } - } - - /// Shuts down the audio system. - /// @note This should only be called from the main Unity thread. - public static void Shutdown (GvrAudioListener listener) { - if (initialized && listener.transform == listenerTransform) { - initialized = false; - if (Application.platform == RuntimePlatform.Android) { - // TODO: GvrAudio bug on Android with Unity 2017 - return; - } - Shutdown(); - sampleRate = -1; - numChannels = -1; - framesPerBuffer = -1; - listenerTransform = null; - } - } - - /// Updates the audio listener. - /// @note This should only be called from the main Unity thread. - public static void UpdateAudioListener (float globalGainDb, LayerMask occlusionMask) { - if (initialized) { - occlusionMaskValue = occlusionMask.value; - SetListenerGain(ConvertAmplitudeFromDb(globalGainDb)); - } - } - - /// Creates a new first-order ambisonic soundfield with a unique id. - /// @note This should only be called from the main Unity thread. - public static int CreateAudioSoundfield () { - int soundfieldId = -1; - if (initialized) { - soundfieldId = CreateSoundfield(numFoaChannels); - } - return soundfieldId; - } - - /// Updates the |soundfield| with given |id| and its properties. - /// @note This should only be called from the main Unity thread. - public static void UpdateAudioSoundfield (int id, GvrAudioSoundfield soundfield) { - if (initialized) { - SetSourceBypassRoomEffects(id, soundfield.bypassRoomEffects); - } - } - - /// Creates a new audio source with a unique id. - /// @note This should only be called from the main Unity thread. - public static int CreateAudioSource (bool hrtfEnabled) { - int sourceId = -1; - if (initialized) { - sourceId = CreateSoundObject(hrtfEnabled); - } - return sourceId; - } - - /// Destroys the audio source with given |id|. - /// @note This should only be called from the main Unity thread. - public static void DestroyAudioSource (int id) { - if (initialized) { - DestroySource(id); - } - } - - /// Updates the audio |source| with given |id| and its properties. - /// @note This should only be called from the main Unity thread. - public static void UpdateAudioSource (int id, GvrAudioSource source, float currentOcclusion) { - if (initialized) { - SetSourceBypassRoomEffects(id, source.bypassRoomEffects); - SetSourceDirectivity(id, source.directivityAlpha, source.directivitySharpness); - SetSourceListenerDirectivity(id, source.listenerDirectivityAlpha, - source.listenerDirectivitySharpness); - SetSourceOcclusionIntensity(id, currentOcclusion); - } - } - - /// Updates the room effects of the environment with given |room| properties. - /// @note This should only be called from the main Unity thread. - public static void UpdateAudioRoom(GvrAudioRoom room, bool roomEnabled) { - // Update the enabled rooms list. - if (roomEnabled) { - if (!enabledRooms.Contains(room)) { - enabledRooms.Add(room); - } - } else { - enabledRooms.Remove(room); - } - // Update the current room effects to be applied. - if(initialized) { - if (enabledRooms.Count > 0) { - GvrAudioRoom currentRoom = enabledRooms[enabledRooms.Count - 1]; - RoomProperties roomProperties = GetRoomProperties(currentRoom); - // Pass the room properties into a pointer. - IntPtr roomPropertiesPtr = Marshal.AllocHGlobal(Marshal.SizeOf(roomProperties)); - Marshal.StructureToPtr(roomProperties, roomPropertiesPtr, false); - SetRoomProperties(roomPropertiesPtr); - Marshal.FreeHGlobal(roomPropertiesPtr); - } else { - // Set the room properties to null, which will effectively disable the room effects. - SetRoomProperties(IntPtr.Zero); - } - } - } - - /// Computes the occlusion intensity of a given |source| using point source detection. - /// @note This should only be called from the main Unity thread. - public static float ComputeOcclusion (Transform sourceTransform) { - float occlusion = 0.0f; - if (initialized) { - Vector3 listenerPosition = listenerTransform.position; - Vector3 sourceFromListener = sourceTransform.position - listenerPosition; - int numHits = Physics.RaycastNonAlloc(listenerPosition, sourceFromListener, occlusionHits, - sourceFromListener.magnitude, occlusionMaskValue); - for (int i = 0; i < numHits; ++i) { - if (occlusionHits[i].transform != listenerTransform && - occlusionHits[i].transform != sourceTransform) { - occlusion += 1.0f; - } - } - } - return occlusion; - } - - /// Converts given |db| value to its amplitude equivalent where 'dB = 20 * log10(amplitude)'. - public static float ConvertAmplitudeFromDb (float db) { - return Mathf.Pow(10.0f, 0.05f * db); - } - - /// Generates a set of points to draw a 2D polar pattern. - public static Vector2[] Generate2dPolarPattern (float alpha, float order, int resolution) { - Vector2[] points = new Vector2[resolution]; - float interval = 2.0f * Mathf.PI / resolution; - for (int i = 0; i < resolution; ++i) { - float theta = i * interval; - // Magnitude |r| for |theta| in radians. - float r = Mathf.Pow(Mathf.Abs((1 - alpha) + alpha * Mathf.Cos(theta)), order); - points[i] = new Vector2(r * Mathf.Sin(theta), r * Mathf.Cos(theta)); - } - return points; - } - - /// Returns whether the listener is currently inside the given |room| boundaries. - public static bool IsListenerInsideRoom(GvrAudioRoom room) { - bool isInside = false; - if(initialized) { - Vector3 relativePosition = listenerTransform.position - room.transform.position; - Quaternion rotationInverse = Quaternion.Inverse(room.transform.rotation); - - bounds.size = Vector3.Scale(room.transform.lossyScale, room.size); - isInside = bounds.Contains(rotationInverse * relativePosition); - } - return isInside; - } - - /// Listener directivity GUI color. - public static readonly Color listenerDirectivityColor = 0.65f * Color.magenta; - - /// Source directivity GUI color. - public static readonly Color sourceDirectivityColor = 0.65f * Color.blue; - - /// Minimum distance threshold between |minDistance| and |maxDistance|. - public const float distanceEpsilon = 0.01f; - - /// Max distance limit that can be set for volume rolloff. - public const float maxDistanceLimit = 1000000.0f; - - /// Min distance limit that can be set for volume rolloff. - public const float minDistanceLimit = 990099.0f; - - /// Maximum allowed gain value in decibels. - public const float maxGainDb = 24.0f; - - /// Minimum allowed gain value in decibels. - public const float minGainDb = -24.0f; - - /// Maximum allowed reverb brightness modifier value. - public const float maxReverbBrightness = 1.0f; - - /// Minimum allowed reverb brightness modifier value. - public const float minReverbBrightness = -1.0f; - - /// Maximum allowed reverb time modifier value. - public const float maxReverbTime = 3.0f; - - /// Maximum allowed reflectivity multiplier of a room surface material. - public const float maxReflectivity = 2.0f; - - /// Maximum allowed number of raycast hits for occlusion computation per source. - public const int maxNumOcclusionHits = 12; - - /// Source occlusion detection rate in seconds. - public const float occlusionDetectionInterval = 0.2f; - - /// Number of first-order ambisonic input channels. - public const int numFoaChannels = 4; - - [StructLayout(LayoutKind.Sequential)] - private struct RoomProperties { - // Center position of the room in world space. - public float positionX; - public float positionY; - public float positionZ; - - // Rotation (quaternion) of the room in world space. - public float rotationX; - public float rotationY; - public float rotationZ; - public float rotationW; - - // Size of the shoebox room in world space. - public float dimensionsX; - public float dimensionsY; - public float dimensionsZ; - - // Material name of each surface of the shoebox room. - public GvrAudioRoom.SurfaceMaterial materialLeft; - public GvrAudioRoom.SurfaceMaterial materialRight; - public GvrAudioRoom.SurfaceMaterial materialBottom; - public GvrAudioRoom.SurfaceMaterial materialTop; - public GvrAudioRoom.SurfaceMaterial materialFront; - public GvrAudioRoom.SurfaceMaterial materialBack; - - // User defined uniform scaling factor for reflectivity. This parameter has no effect when set - // to 1.0f. - public float reflectionScalar; - - // User defined reverb tail gain multiplier. This parameter has no effect when set to 0.0f. - public float reverbGain; - - // Parameter which allows the reverberation time across all frequency bands to be increased or - // decreased. This parameter has no effect when set to 1.0f. - public float reverbTime; - - // Parameter which allows the ratio of high frequncy reverb components to low frequency reverb - // components to be adjusted. This parameter has no effect when set to 0.0f. - public float reverbBrightness; - }; - - // Converts given |position| and |rotation| from Unity space to audio space. - private static void ConvertAudioTransformFromUnity (ref Vector3 position, - ref Quaternion rotation) { - transformMatrix = flipZ * Matrix4x4.TRS(position, rotation, Vector3.one) * flipZ; - position = transformMatrix.GetColumn(3); - rotation = Quaternion.LookRotation(transformMatrix.GetColumn(2), transformMatrix.GetColumn(1)); - } - - // Returns room properties of the given |room|. - private static RoomProperties GetRoomProperties(GvrAudioRoom room) { - RoomProperties roomProperties; - Vector3 position = room.transform.position; - Quaternion rotation = room.transform.rotation; - Vector3 scale = Vector3.Scale(room.transform.lossyScale, room.size); - ConvertAudioTransformFromUnity(ref position, ref rotation); - roomProperties.positionX = position.x; - roomProperties.positionY = position.y; - roomProperties.positionZ = position.z; - roomProperties.rotationX = rotation.x; - roomProperties.rotationY = rotation.y; - roomProperties.rotationZ = rotation.z; - roomProperties.rotationW = rotation.w; - roomProperties.dimensionsX = scale.x; - roomProperties.dimensionsY = scale.y; - roomProperties.dimensionsZ = scale.z; - roomProperties.materialLeft = room.leftWall; - roomProperties.materialRight = room.rightWall; - roomProperties.materialBottom = room.floor; - roomProperties.materialTop = room.ceiling; - roomProperties.materialFront = room.frontWall; - roomProperties.materialBack = room.backWall; - roomProperties.reverbGain = ConvertAmplitudeFromDb(room.reverbGainDb); - roomProperties.reverbTime = room.reverbTime; - roomProperties.reverbBrightness = room.reverbBrightness; - roomProperties.reflectionScalar = room.reflectivity; - return roomProperties; - } - - // Right-handed to left-handed matrix converter (and vice versa). - private static readonly Matrix4x4 flipZ = Matrix4x4.Scale(new Vector3(1.0f, 1.0f, -1.0f)); - - // Boundaries instance to be used in room detection logic. - private static Bounds bounds = new Bounds(Vector3.zero, Vector3.zero); - - // Container to store the currently active rooms in the scene. - private static List enabledRooms = new List(); - - // Denotes whether the system is initialized properly. - private static bool initialized = false; - - // Listener transform. - private static Transform listenerTransform = null; - - // Pre-allocated raycast hit list for occlusion computation. - private static RaycastHit[] occlusionHits = new RaycastHit[maxNumOcclusionHits]; - - // Occlusion layer mask. - private static int occlusionMaskValue = -1; - - // 4x4 transformation matrix to be used in transform space conversion. - private static Matrix4x4 transformMatrix = Matrix4x4.identity; - -#if UNITY_IOS - private const string pluginName = "__Internal"; -#else - private const string pluginName = "audioplugingvrunity"; -#endif - - // Listener handlers. - [DllImport(pluginName)] - private static extern void SetListenerGain (float gain); - - // Soundfield handlers. - [DllImport(pluginName)] - private static extern int CreateSoundfield (int numChannels); - - // Source handlers. - [DllImport(pluginName)] - private static extern int CreateSoundObject (bool enableHrtf); - - [DllImport(pluginName)] - private static extern void DestroySource (int sourceId); - - [DllImport(pluginName)] - private static extern void SetSourceBypassRoomEffects (int sourceId, bool bypassRoomEffects); - - [DllImport(pluginName)] - private static extern void SetSourceDirectivity (int sourceId, float alpha, float order); - - [DllImport(pluginName)] - private static extern void SetSourceListenerDirectivity (int sourceId, float alpha, float order); - - [DllImport(pluginName)] - private static extern void SetSourceOcclusionIntensity (int sourceId, float intensity); - - // Room handlers. - [DllImport(pluginName)] - private static extern void SetRoomProperties (IntPtr roomProperties); - - // System handlers. - [DllImport(pluginName)] - private static extern void Initialize (int quality, int sampleRate, int numChannels, - int framesPerBuffer); - - [DllImport(pluginName)] - private static extern void Shutdown (); -} diff --git a/Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudioListener.cs b/Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudioListener.cs deleted file mode 100644 index 1f36b6e883..0000000000 --- a/Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudioListener.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// -// 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 System.Collections; - -/// GVR audio listener component that enhances AudioListener to provide advanced spatial audio -/// features. -/// -/// There should be only one instance of this which is attached to the AudioListener's game object. -[AddComponentMenu("GoogleVR/Audio/GvrAudioListener")] -public class GvrAudioListener : MonoBehaviour { - /// Global gain in decibels to be applied to the processed output. - public float globalGainDb = 0.0f; - - /// Global layer mask to be used in occlusion detection. - public LayerMask occlusionMask = -1; - - /// Audio rendering quality of the system. - [SerializeField] - private GvrAudio.Quality quality = GvrAudio.Quality.High; - - void Awake () { - GvrAudio.Initialize(this, quality); - } - - void OnEnable () { - GvrAudio.UpdateAudioListener(globalGainDb, occlusionMask); - } - - void OnDestroy () { - GvrAudio.Shutdown(this); - } - - void Update () { - GvrAudio.UpdateAudioListener(globalGainDb, occlusionMask); - } -} diff --git a/Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudioRoom.cs b/Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudioRoom.cs deleted file mode 100644 index e6ce63db83..0000000000 --- a/Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudioRoom.cs +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// -// 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 System.Collections; - -/// GVR audio room component that simulates environmental effects of a room with respect to the -/// properties of the attached game object. -[AddComponentMenu("GoogleVR/Audio/GvrAudioRoom")] -public class GvrAudioRoom : MonoBehaviour { - /// Material type that determines the acoustic properties of a room surface. - public enum SurfaceMaterial { - Transparent = 0, ///< Transparent - AcousticCeilingTiles = 1, ///< Acoustic ceiling tiles - BrickBare = 2, ///< Brick, bare - BrickPainted = 3, ///< Brick, painted - ConcreteBlockCoarse = 4, ///< Concrete block, coarse - ConcreteBlockPainted = 5, ///< Concrete block, painted - CurtainHeavy = 6, ///< Curtain, heavy - FiberglassInsulation = 7, ///< Fiberglass insulation - GlassThin = 8, ///< Glass, thin - GlassThick = 9, ///< Glass, thick - Grass = 10, ///< Grass - LinoleumOnConcrete = 11, ///< Linoleum on concrete - Marble = 12, ///< Marble - Metal = 13, ///< Galvanized sheet metal - ParquetOnConcrete = 14, ///< Parquet on concrete - PlasterRough = 15, ///< Plaster, rough - PlasterSmooth = 16, ///< Plaster, smooth - PlywoodPanel = 17, ///< Plywood panel - PolishedConcreteOrTile = 18, ///< Polished concrete or tile - Sheetrock = 19, ///< Sheetrock - WaterOrIceSurface = 20, ///< Water or ice surface - WoodCeiling = 21, ///< Wood ceiling - WoodPanel = 22 ///< Wood panel - } - - /// Room surface material in negative x direction. - public SurfaceMaterial leftWall = SurfaceMaterial.ConcreteBlockCoarse; - - /// Room surface material in positive x direction. - public SurfaceMaterial rightWall = SurfaceMaterial.ConcreteBlockCoarse; - - /// Room surface material in negative y direction. - public SurfaceMaterial floor = SurfaceMaterial.ParquetOnConcrete; - - /// Room surface material in positive y direction. - public SurfaceMaterial ceiling = SurfaceMaterial.PlasterRough; - - /// Room surface material in negative z direction. - public SurfaceMaterial backWall = SurfaceMaterial.ConcreteBlockCoarse; - - /// Room surface material in positive z direction. - public SurfaceMaterial frontWall = SurfaceMaterial.ConcreteBlockCoarse; - - /// Reflectivity scalar for each surface of the room. - public float reflectivity = 1.0f; - - /// Reverb gain modifier in decibels. - public float reverbGainDb = 0.0f; - - /// Reverb brightness modifier. - public float reverbBrightness = 0.0f; - - /// Reverb time modifier. - public float reverbTime = 1.0f; - - /// Size of the room (normalized with respect to scale of the game object). - public Vector3 size = Vector3.one; - - void OnEnable () { - GvrAudio.UpdateAudioRoom(this, GvrAudio.IsListenerInsideRoom(this)); - } - - void OnDisable () { - GvrAudio.UpdateAudioRoom(this, false); - } - - void Update () { - GvrAudio.UpdateAudioRoom(this, GvrAudio.IsListenerInsideRoom(this)); - } - - void OnDrawGizmosSelected () { - // Draw shoebox model wireframe of the room. - Gizmos.color = Color.yellow; - Gizmos.matrix = transform.localToWorldMatrix; - Gizmos.DrawWireCube(Vector3.zero, size); - } -} diff --git a/Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudioSoundfield.cs b/Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudioSoundfield.cs deleted file mode 100644 index 623277bac8..0000000000 --- a/Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudioSoundfield.cs +++ /dev/null @@ -1,494 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// -// 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.Audio; -using System.Collections; - -/// GVR soundfield component that allows playback of first-order ambisonic recordings. The audio -/// sample should be in Ambix (ACN-SN3D) format. -[AddComponentMenu("GoogleVR/Audio/GvrAudioSoundfield")] -public class GvrAudioSoundfield : MonoBehaviour { - /// Denotes whether the room effects should be bypassed. - public bool bypassRoomEffects = true; - - /// Input gain in decibels. - public float gainDb = 0.0f; - - /// Play source on awake. - public bool playOnAwake = true; - - /// The default AudioClip to play. - public AudioClip clip0102 { - get { return soundfieldClip0102; } - set { - soundfieldClip0102 = value; - if (audioSources != null && audioSources.Length > 0) { - audioSources[0].clip = soundfieldClip0102; - } - } - } - [SerializeField] - private AudioClip soundfieldClip0102 = null; - - public AudioClip clip0304 { - get { return soundfieldClip0304; } - set { - soundfieldClip0304 = value; - if (audioSources != null && audioSources.Length > 0) { - audioSources[1].clip = soundfieldClip0304; - } - } - } - [SerializeField] - private AudioClip soundfieldClip0304 = null; - - /// Is the clip playing right now (Read Only)? - public bool isPlaying { - get { - if(audioSources != null && audioSources.Length > 0) { - return audioSources[0].isPlaying; - } - return false; - } - } - - /// Is the audio clip looping? - public bool loop { - get { return soundfieldLoop; } - set { - soundfieldLoop = value; - if(audioSources != null) { - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - audioSources[channelSet].loop = soundfieldLoop; - } - } - } - } - [SerializeField] - private bool soundfieldLoop = false; - - /// Un- / Mutes the soundfield. Mute sets the volume=0, Un-Mute restore the original volume. - public bool mute { - get { return soundfieldMute; } - set { - soundfieldMute = value; - if(audioSources != null) { - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - audioSources[channelSet].mute = soundfieldMute; - } - } - } - } - [SerializeField] - private bool soundfieldMute = false; - - /// The pitch of the audio source. - public float pitch { - get { return soundfieldPitch; } - set { - soundfieldPitch = value; - if(audioSources != null) { - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - audioSources[channelSet].pitch = soundfieldPitch; - } - } - } - } - [SerializeField] - [Range(-3.0f, 3.0f)] - private float soundfieldPitch = 1.0f; - - /// Sets the priority of the soundfield. - public int priority { - get { return soundfieldPriority; } - set { - soundfieldPriority = value; - if(audioSources != null) { - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - audioSources[channelSet].priority = soundfieldPriority; - } - } - } - } - [SerializeField] - [Range(0, 256)] - private int soundfieldPriority = 32; - - /// Sets how much this soundfield is affected by 3D spatialization calculations - /// (attenuation, doppler). - public float spatialBlend { - get { return soundfieldSpatialBlend; } - set { - soundfieldSpatialBlend = value; - if (audioSources != null) { - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - audioSources[channelSet].spatialBlend = soundfieldSpatialBlend; - } - } - } - } - [SerializeField] - [Range(0.0f, 1.0f)] - private float soundfieldSpatialBlend = 0.0f; - - /// Sets the Doppler scale for this soundfield. - public float dopplerLevel { - get { return soundfieldDopplerLevel; } - set { - soundfieldDopplerLevel = value; - if(audioSources != null) { - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - audioSources[channelSet].dopplerLevel = soundfieldDopplerLevel; - } - } - } - } - [SerializeField] - [Range(0.0f, 5.0f)] - private float soundfieldDopplerLevel = 0.0f; - - /// Playback position in seconds. - public float time { - get { - if(audioSources != null && audioSources.Length > 0) { - return audioSources[0].time; - } - return 0.0f; - } - set { - if(audioSources != null) { - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - audioSources[channelSet].time = value; - } - } - } - } - - /// Playback position in PCM samples. - public int timeSamples { - get { - if(audioSources != null && audioSources.Length > 0) { - return audioSources[0].timeSamples; - } - return 0; - } - set { - if(audioSources != null) { - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - audioSources[channelSet].timeSamples = value; - } - } - } - } - - /// The volume of the audio source (0.0 to 1.0). - public float volume { - get { return soundfieldVolume; } - set { - soundfieldVolume = value; - if(audioSources != null) { - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - audioSources[channelSet].volume = soundfieldVolume; - } - } - } - } - [SerializeField] - [Range(0.0f, 1.0f)] - private float soundfieldVolume = 1.0f; - - /// Volume rolloff model with respect to the distance. - public AudioRolloffMode rolloffMode { - get { return soundfieldRolloffMode; } - set { - soundfieldRolloffMode = value; - if (audioSources != null) { - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - audioSources[channelSet].rolloffMode = soundfieldRolloffMode; - if (rolloffMode == AudioRolloffMode.Custom) { - // Custom rolloff is not supported, set the curve for no distance attenuation. - audioSources[channelSet].SetCustomCurve( - AudioSourceCurveType.CustomRolloff, - AnimationCurve.Linear(soundfieldMinDistance, 1.0f, soundfieldMaxDistance, 1.0f)); - } - } - } - } - } - [SerializeField] - private AudioRolloffMode soundfieldRolloffMode = AudioRolloffMode.Logarithmic; - - /// MaxDistance is the distance a sound stops attenuating at. - public float maxDistance { - get { return soundfieldMaxDistance; } - set { - soundfieldMaxDistance = Mathf.Clamp(value, soundfieldMinDistance + GvrAudio.distanceEpsilon, - GvrAudio.maxDistanceLimit); - if (audioSources != null) { - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - audioSources[channelSet].maxDistance = soundfieldMaxDistance; - } - } - } - } - [SerializeField] - private float soundfieldMaxDistance = 500.0f; - - /// Within the Min distance the GvrAudioSource will cease to grow louder in volume. - public float minDistance { - get { return soundfieldMinDistance; } - set { - soundfieldMinDistance = Mathf.Clamp(value, 0.0f, GvrAudio.minDistanceLimit); - if (audioSources != null) { - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - audioSources[channelSet].minDistance = soundfieldMinDistance; - } - } - } - } - [SerializeField] - private float soundfieldMinDistance = 1.0f; - - // Unique source id. - private int id = -1; - - // Unity audio sources per each soundfield channel set. - private AudioSource[] audioSources = null; - - // Denotes whether the source is currently paused or not. - private bool isPaused = false; - - void Awake () { - // Route the source output to |GvrAudioMixer|. - AudioMixer mixer = (Resources.Load("GvrAudioMixer") as AudioMixer); - if(mixer == null) { - Debug.LogError("GVRAudioMixer could not be found in Resources. Make sure that the GVR SDK" + - "Unity package is imported properly."); - return; - } - audioSources = new AudioSource[GvrAudio.numFoaChannels / 2]; - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - GameObject channelSetObject = new GameObject("Channel Set " + channelSet); - channelSetObject.transform.parent = gameObject.transform; - channelSetObject.transform.localPosition = Vector3.zero; - channelSetObject.transform.localRotation = Quaternion.identity; - channelSetObject.hideFlags = HideFlags.HideAndDontSave; - audioSources[channelSet] = channelSetObject.AddComponent(); - audioSources[channelSet].enabled = false; - audioSources[channelSet].playOnAwake = false; - audioSources[channelSet].bypassReverbZones = true; -#if UNITY_5_5_OR_NEWER - audioSources[channelSet].spatializePostEffects = true; -#endif // UNITY_5_5_OR_NEWER - audioSources[channelSet].outputAudioMixerGroup = mixer.FindMatchingGroups("Master")[0]; - } - OnValidate(); - } - - void OnEnable () { - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - audioSources[channelSet].enabled = true; - } - if (playOnAwake && !isPlaying && InitializeSoundfield()) { - Play(); - } - } - - void Start () { - if (playOnAwake && !isPlaying) { - Play(); - } - } - - void OnDisable () { - Stop(); - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - audioSources[channelSet].enabled = false; - } - } - - void OnDestroy () { - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - Destroy(audioSources[channelSet].gameObject); - } - } - - void OnApplicationPause (bool pauseStatus) { - if (pauseStatus) { - Pause(); - } else { - UnPause(); - } - } - - void Update () { - // Update soundfield. - if (!isPlaying && !isPaused) { - Stop(); - } else { - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - audioSources[channelSet].SetSpatializerFloat((int) GvrAudio.SpatializerData.Gain, - GvrAudio.ConvertAmplitudeFromDb(gainDb)); - audioSources[channelSet].SetSpatializerFloat((int) GvrAudio.SpatializerData.MinDistance, - soundfieldMinDistance); - } - GvrAudio.UpdateAudioSoundfield(id, this); - } - } - - /// Pauses playing the clip. - public void Pause () { - if (audioSources != null) { - isPaused = true; - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - audioSources[channelSet].Pause(); - } - } - } - - /// Plays the clip. - public void Play () { - double dspTime = AudioSettings.dspTime; - PlayScheduled(dspTime); - } - - /// Plays the clip with a delay specified in seconds. - public void PlayDelayed (float delay) { - double delayedDspTime = AudioSettings.dspTime + (double)delay; - PlayScheduled(delayedDspTime); - } - - /// Plays the clip at a specific time on the absolute time-line that AudioSettings.dspTime reads - /// from. - public void PlayScheduled (double time) { - if (audioSources != null && InitializeSoundfield()) { - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - audioSources[channelSet].PlayScheduled(time); - } - isPaused = false; - } else { - Debug.LogWarning ("GVR Audio soundfield not initialized. Audio playback not supported " + - "until after Awake() and OnEnable(). Try calling from Start() instead."); - } - } - - /// Changes the time at which a sound that has already been scheduled to play will end. - public void SetScheduledEndTime(double time) { - if (audioSources != null) { - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - audioSources[channelSet].SetScheduledEndTime(time); - } - } - } - - /// Changes the time at which a sound that has already been scheduled to play will start. - public void SetScheduledStartTime(double time) { - if (audioSources != null) { - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - audioSources[channelSet].SetScheduledStartTime(time); - } - } - } - - /// Stops playing the clip. - public void Stop () { - if(audioSources != null) { - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - audioSources[channelSet].Stop(); - } - ShutdownSoundfield(); - isPaused = false; - } - } - - /// Unpauses the paused playback. - public void UnPause () { - if (audioSources != null) { - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - audioSources[channelSet].UnPause(); - } - isPaused = false; - } - } - - // Initializes the source. - private bool InitializeSoundfield () { - if (id < 0) { - id = GvrAudio.CreateAudioSoundfield(); - if (id >= 0) { - GvrAudio.UpdateAudioSoundfield(id, this); - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - InitializeChannelSet(audioSources[channelSet], channelSet); - } - } - } - return id >= 0; - } - - // Shuts down the source. - private void ShutdownSoundfield () { - if (id >= 0) { - for (int channelSet = 0; channelSet < audioSources.Length; ++channelSet) { - ShutdownChannelSet(audioSources[channelSet], channelSet); - } - GvrAudio.DestroyAudioSource(id); - id = -1; - } - } - - // Initializes given channel set of the soundfield. - private void InitializeChannelSet(AudioSource source, int channelSet) { - source.spatialize = true; - source.SetSpatializerFloat((int) GvrAudio.SpatializerData.Type, - (float) GvrAudio.SpatializerType.Soundfield); - source.SetSpatializerFloat((int) GvrAudio.SpatializerData.NumChannels, - (float) GvrAudio.numFoaChannels); - source.SetSpatializerFloat((int) GvrAudio.SpatializerData.ChannelSet, (float) channelSet); - source.SetSpatializerFloat((int) GvrAudio.SpatializerData.Gain, - GvrAudio.ConvertAmplitudeFromDb(gainDb)); - source.SetSpatializerFloat((int) GvrAudio.SpatializerData.MinDistance, soundfieldMinDistance); - source.SetSpatializerFloat((int) GvrAudio.SpatializerData.ZeroOutput, 0.0f); - // Soundfield id must be set after all the spatializer parameters, to ensure that the soundfield - // is properly initialized before processing. - source.SetSpatializerFloat((int) GvrAudio.SpatializerData.Id, (float) id); - } - - // Shuts down given channel set of the soundfield. - private void ShutdownChannelSet(AudioSource source, int channelSet) { - source.SetSpatializerFloat((int) GvrAudio.SpatializerData.Id, -1.0f); - // Ensure that the output is zeroed after shutdown. - source.SetSpatializerFloat((int) GvrAudio.SpatializerData.ZeroOutput, 1.0f); - source.spatialize = false; - } - - void OnDidApplyAnimationProperties () { - OnValidate(); - } - - void OnValidate () { - clip0102 = soundfieldClip0102; - clip0304 = soundfieldClip0304; - loop = soundfieldLoop; - mute = soundfieldMute; - pitch = soundfieldPitch; - priority = soundfieldPriority; - spatialBlend = soundfieldSpatialBlend; - volume = soundfieldVolume; - dopplerLevel = soundfieldDopplerLevel; - minDistance = soundfieldMinDistance; - maxDistance = soundfieldMaxDistance; - rolloffMode = soundfieldRolloffMode; - } -} diff --git a/Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudioSource.cs b/Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudioSource.cs deleted file mode 100644 index bae049df80..0000000000 --- a/Assets/ThirdParty/GoogleVR/Scripts/Audio/GvrAudioSource.cs +++ /dev/null @@ -1,579 +0,0 @@ -// Copyright 2016 Google Inc. All rights reserved. -// -// 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.Audio; -using System.Collections; - -/// GVR audio source component that enhances AudioSource to provide advanced spatial audio features. -[AddComponentMenu("GoogleVR/Audio/GvrAudioSource")] -public class GvrAudioSource : MonoBehaviour { - /// Denotes whether the room effects should be bypassed. - public bool bypassRoomEffects = false; - - /// Directivity pattern shaping factor. - public float directivityAlpha = 0.0f; - - /// Directivity pattern order. - public float directivitySharpness = 1.0f; - - /// Listener directivity pattern shaping factor. - public float listenerDirectivityAlpha = 0.0f; - - /// Listener directivity pattern order. - public float listenerDirectivitySharpness = 1.0f; - - /// Input gain in decibels. - public float gainDb = 0.0f; - - /// Occlusion effect toggle. - public bool occlusionEnabled = false; - - /// Play source on awake. - public bool playOnAwake = true; - - /// Disable the gameobject when sound isn't playing. - public bool disableOnStop = false; - - /// The default AudioClip to play. - public AudioClip clip { - get { return sourceClip; } - set { - sourceClip = value; - if (audioSource != null) { - audioSource.clip = sourceClip; - } - } - } - [SerializeField] - private AudioClip sourceClip = null; - - /// Is the clip playing right now (Read Only)? - public bool isPlaying { - get { - if (audioSource != null) { - return audioSource.isPlaying; - } - return false; - } - } - - /// Is the audio clip looping? - public bool loop { - get { return sourceLoop; } - set { - sourceLoop = value; - if (audioSource != null) { - audioSource.loop = sourceLoop; - } - } - } - [SerializeField] - private bool sourceLoop = false; - - /// Un- / Mutes the source. Mute sets the volume=0, Un-Mute restore the original volume. - public bool mute { - get { return sourceMute; } - set { - sourceMute = value; - if (audioSource != null) { - audioSource.mute = sourceMute; - } - } - } - [SerializeField] - private bool sourceMute = false; - - /// The pitch of the audio source. - public float pitch { - get { return sourcePitch; } - set { - sourcePitch = value; - if (audioSource != null) { - audioSource.pitch = sourcePitch; - } - } - } - [SerializeField] - [Range(-3.0f, 3.0f)] - private float sourcePitch = 1.0f; - - /// Sets the priority of the audio source. - public int priority { - get { return sourcePriority; } - set { - sourcePriority = value; - if(audioSource != null) { - audioSource.priority = sourcePriority; - } - } - } - [SerializeField] - [Range(0, 256)] - private int sourcePriority = 128; - - /// Sets how much this source is affected by 3D spatialization calculations (attenuation, doppler). - public float spatialBlend { - get { return sourceSpatialBlend; } - set { - sourceSpatialBlend = value; - if (audioSource != null) { - audioSource.spatialBlend = sourceSpatialBlend; - } - } - } - [SerializeField] - [Range(0.0f, 1.0f)] - private float sourceSpatialBlend = 1.0f; - - /// Sets the Doppler scale for this audio source. - public float dopplerLevel { - get { return sourceDopplerLevel; } - set { - sourceDopplerLevel = value; - if(audioSource != null) { - audioSource.dopplerLevel = sourceDopplerLevel; - } - } - } - [SerializeField] - [Range(0.0f, 5.0f)] - private float sourceDopplerLevel = 1.0f; - - /// Sets the spread angle (in degrees) in 3D space. - public float spread { - get { return sourceSpread; } - set { - sourceSpread = value; - if(audioSource != null) { - audioSource.spread = sourceSpread; - } - } - } - [SerializeField] - [Range(0.0f, 360.0f)] - private float sourceSpread = 0.0f; - - /// Playback position in seconds. - public float time { - get { - if(audioSource != null) { - return audioSource.time; - } - return 0.0f; - } - set { - if(audioSource != null) { - audioSource.time = value; - } - } - } - - /// Playback position in PCM samples. - public int timeSamples { - get { - if(audioSource != null) { - return audioSource.timeSamples; - } - return 0; - } - set { - if(audioSource != null) { - audioSource.timeSamples = value; - } - } - } - - /// The volume of the audio source (0.0 to 1.0). - public float volume { - get { return sourceVolume; } - set { - sourceVolume = value; - if (audioSource != null) { - audioSource.volume = sourceVolume; - } - } - } - [SerializeField] - [Range(0.0f, 1.0f)] - private float sourceVolume = 1.0f; - - /// Volume rolloff model with respect to the distance. - public AudioRolloffMode rolloffMode { - get { return sourceRolloffMode; } - set { - sourceRolloffMode = value; - if (audioSource != null) { - audioSource.rolloffMode = sourceRolloffMode; - if (rolloffMode == AudioRolloffMode.Custom) { - // Custom rolloff is not supported, set the curve for no distance attenuation. - audioSource.SetCustomCurve(AudioSourceCurveType.CustomRolloff, - AnimationCurve.Linear(sourceMinDistance, 1.0f, - sourceMaxDistance, 1.0f)); - } - } - } - } - [SerializeField] - private AudioRolloffMode sourceRolloffMode = AudioRolloffMode.Logarithmic; - - /// MaxDistance is the distance a sound stops attenuating at. - public float maxDistance { - get { return sourceMaxDistance; } - set { - sourceMaxDistance = Mathf.Clamp(value, sourceMinDistance + GvrAudio.distanceEpsilon, - GvrAudio.maxDistanceLimit); - if(audioSource != null) { - audioSource.maxDistance = sourceMaxDistance; - } - } - } - [SerializeField] - private float sourceMaxDistance = 500.0f; - - /// Within the Min distance the GvrAudioSource will cease to grow louder in volume. - public float minDistance { - get { return sourceMinDistance; } - set { - sourceMinDistance = Mathf.Clamp(value, 0.0f, GvrAudio.minDistanceLimit); - if(audioSource != null) { - audioSource.minDistance = sourceMinDistance; - } - } - } - [SerializeField] - private float sourceMinDistance = 1.0f; - - /// Binaural (HRTF) rendering toggle. - [SerializeField] - private bool hrtfEnabled = true; - - // Unity audio source attached to the game object. - [SerializeField] - private AudioSource audioSource = null; - - // Unique source id. - private int id = -1; - - // Current occlusion value; - private float currentOcclusion = 0.0f; - - // Next occlusion update time in seconds. - private float nextOcclusionUpdate = 0.0f; - - // Denotes whether the source is currently paused or not. - private bool isPaused = false; - - void Awake () { - if (audioSource == null) { - // Ensure the audio source gets created once. - audioSource = gameObject.AddComponent(); - } - audioSource.enabled = false; - audioSource.hideFlags = HideFlags.HideInInspector | HideFlags.HideAndDontSave; - audioSource.playOnAwake = false; - audioSource.bypassReverbZones = true; -#if UNITY_5_5_OR_NEWER - audioSource.spatializePostEffects = true; -#endif // UNITY_5_5_OR_NEWER - OnValidate(); - if (Application.platform != RuntimePlatform.Android) { - // TODO: GvrAudio bug on Android with Unity 2017 - - // Route the source output to |GvrAudioMixer|. - AudioMixer mixer = (Resources.Load("GvrAudioMixer") as AudioMixer); - if(mixer != null) { - audioSource.outputAudioMixerGroup = mixer.FindMatchingGroups("Master")[0]; - } else { - Debug.LogError("GVRAudioMixer could not be found in Resources. Make sure that the GVR SDK " + - "Unity package is imported properly."); - } - } - } - - void OnEnable () { - audioSource.enabled = true; - if (playOnAwake && !isPlaying && InitializeSource()) { - Play(); - } - } - - void Start () { - if (playOnAwake && !isPlaying) { - Play(); - } - } - - void OnDisable () { - Stop(); - audioSource.enabled = false; - } - - void OnDestroy () { - Destroy(audioSource); - } - - void OnApplicationPause (bool pauseStatus) { - if (pauseStatus) { - Pause(); - } else { - UnPause(); - } - } - - void Update () { - if (disableOnStop && isPlaying == false) { - gameObject.SetActive(false); - } - - // Update occlusion state. - if (!occlusionEnabled) { - currentOcclusion = 0.0f; - } else if (Time.time >= nextOcclusionUpdate) { - nextOcclusionUpdate = Time.time + GvrAudio.occlusionDetectionInterval; - currentOcclusion = GvrAudio.ComputeOcclusion(transform); - } - // Update source. - if (!isPlaying && !isPaused) { - Stop(); - } else { - audioSource.SetSpatializerFloat((int) GvrAudio.SpatializerData.Gain, - GvrAudio.ConvertAmplitudeFromDb(gainDb)); - audioSource.SetSpatializerFloat((int) GvrAudio.SpatializerData.MinDistance, - sourceMinDistance); - GvrAudio.UpdateAudioSource(id, this, currentOcclusion); - } - } - - /// Provides a block of the currently playing source's output data. - /// - /// @note The array given in samples will be filled with the requested data before spatialization. - public void GetOutputData(float[] samples, int channel) { - if (audioSource != null) { - audioSource.GetOutputData(samples, channel); - } - } - - /// Provides a block of the currently playing audio source's spectrum data. - /// - /// @note The array given in samples will be filled with the requested data before spatialization. - public void GetSpectrumData(float[] samples, int channel, FFTWindow window) { - if (audioSource != null) { - audioSource.GetSpectrumData(samples, channel, window); - } - } - - /// Pauses playing the clip. - public void Pause () { - if (audioSource != null) { - isPaused = true; - audioSource.Pause(); - } - } - - /// Plays the clip. - public void Play () { - if (audioSource != null && InitializeSource()) { - audioSource.Play(); - isPaused = false; - } else { - Debug.LogWarning ("GVR Audio source not initialized. Audio playback not supported " + - "until after Awake() and OnEnable(). Try calling from Start() instead."); - } - } - - /// Plays the clip with a delay specified in seconds. - public void PlayDelayed (float delay) { - if (audioSource != null && InitializeSource()) { - audioSource.PlayDelayed(delay); - isPaused = false; - } else { - Debug.LogWarning ("GVR Audio source not initialized. Audio playback not supported " + - "until after Awake() and OnEnable(). Try calling from Start() instead."); - } - } - - /// Plays an AudioClip. - public void PlayOneShot (AudioClip clip) { - PlayOneShot(clip, 1.0f); - } - - /// Plays an AudioClip, and scales its volume. - public void PlayOneShot (AudioClip clip, float volume) { - if (audioSource != null && InitializeSource()) { - audioSource.PlayOneShot(clip, volume); - isPaused = false; - } else { - Debug.LogWarning ("GVR Audio source not initialized. Audio playback not supported " + - "until after Awake() and OnEnable(). Try calling from Start() instead."); - } - } - - /// Plays the clip at a specific time on the absolute time-line that AudioSettings.dspTime reads - /// from. - public void PlayScheduled (double time) { - if (audioSource != null && InitializeSource()) { - audioSource.PlayScheduled(time); - isPaused = false; - } else { - Debug.LogWarning ("GVR Audio source not initialized. Audio playback not supported " + - "until after Awake() and OnEnable(). Try calling from Start() instead."); - } - } - - /// Changes the time at which a sound that has already been scheduled to play will end. - public void SetScheduledEndTime(double time) { - if (audioSource != null) { - audioSource.SetScheduledEndTime(time); - } - } - - /// Changes the time at which a sound that has already been scheduled to play will start. - public void SetScheduledStartTime(double time) { - if (audioSource != null) { - audioSource.SetScheduledStartTime(time); - } - } - - /// Stops playing the clip. - public void Stop () { - if (audioSource != null) { - audioSource.Stop(); - ShutdownSource(); - isPaused = true; - } - } - - /// Unpauses the paused playback. - public void UnPause () { - if (audioSource != null) { - audioSource.UnPause(); - isPaused = false; - } - } - - // Initializes the source. - private bool InitializeSource () { - if (Application.platform == RuntimePlatform.Android) { - // TODO: GvrAudio bug on Android with Unity 2017 - - return true; - } - if (id < 0) { - id = GvrAudio.CreateAudioSource(hrtfEnabled); - if (id >= 0) { - GvrAudio.UpdateAudioSource(id, this, currentOcclusion); - audioSource.spatialize = true; - audioSource.SetSpatializerFloat((int) GvrAudio.SpatializerData.Type, - (float) GvrAudio.SpatializerType.Source); - audioSource.SetSpatializerFloat((int) GvrAudio.SpatializerData.Gain, - GvrAudio.ConvertAmplitudeFromDb(gainDb)); - audioSource.SetSpatializerFloat((int) GvrAudio.SpatializerData.MinDistance, - sourceMinDistance); - audioSource.SetSpatializerFloat((int) GvrAudio.SpatializerData.ZeroOutput, 0.0f); - // Source id must be set after all the spatializer parameters, to ensure that the source is - // properly initialized before processing. - audioSource.SetSpatializerFloat((int) GvrAudio.SpatializerData.Id, (float) id); - } - } - return id >= 0; - } - - // Shuts down the source. - private void ShutdownSource () { - if (id >= 0) { - audioSource.SetSpatializerFloat((int) GvrAudio.SpatializerData.Id, -1.0f); - // Ensure that the output is zeroed after shutdown. - audioSource.SetSpatializerFloat((int) GvrAudio.SpatializerData.ZeroOutput, 1.0f); - audioSource.spatialize = false; - GvrAudio.DestroyAudioSource(id); - id = -1; - } - } - - void OnDidApplyAnimationProperties () { - OnValidate(); - } - - void OnValidate () { - clip = sourceClip; - loop = sourceLoop; - mute = sourceMute; - pitch = sourcePitch; - priority = sourcePriority; - spatialBlend = sourceSpatialBlend; - volume = sourceVolume; - dopplerLevel = sourceDopplerLevel; - spread = sourceSpread; - minDistance = sourceMinDistance; - maxDistance = sourceMaxDistance; - rolloffMode = sourceRolloffMode; - } - - void OnDrawGizmosSelected () { - // Draw listener directivity gizmo. - // Note that this is a very suboptimal way of finding the component, to be used in Unity Editor - // only, should not be used to access the component in run time. - GvrAudioListener listener = FindObjectOfType(); - if(listener != null) { - Gizmos.color = GvrAudio.listenerDirectivityColor; - DrawDirectivityGizmo(listener.transform, listenerDirectivityAlpha, - listenerDirectivitySharpness, 180); - } - // Draw source directivity gizmo. - Gizmos.color = GvrAudio.sourceDirectivityColor; - DrawDirectivityGizmo(transform, directivityAlpha, directivitySharpness, 180); - } - - // Draws a 3D gizmo in the Scene View that shows the selected directivity pattern. - private void DrawDirectivityGizmo (Transform target, float alpha, float sharpness, - int resolution) { - Vector2[] points = GvrAudio.Generate2dPolarPattern(alpha, sharpness, resolution); - // Compute |vertices| from the polar pattern |points|. - int numVertices = resolution + 1; - Vector3[] vertices = new Vector3[numVertices]; - vertices[0] = Vector3.zero; - for (int i = 0; i < points.Length; ++i) { - vertices[i + 1] = new Vector3(points[i].x, 0.0f, points[i].y); - } - // Generate |triangles| from |vertices|. Two triangles per each sweep to avoid backface culling. - int[] triangles = new int[6 * numVertices]; - for (int i = 0; i < numVertices - 1; ++i) { - int index = 6 * i; - if (i < numVertices - 2) { - triangles[index] = 0; - triangles[index + 1] = i + 1; - triangles[index + 2] = i + 2; - } else { - // Last vertex is connected back to the first for the last triangle. - triangles[index] = 0; - triangles[index + 1] = numVertices - 1; - triangles[index + 2] = 1; - } - // The second triangle facing the opposite direction. - triangles[index + 3] = triangles[index]; - triangles[index + 4] = triangles[index + 2]; - triangles[index + 5] = triangles[index + 1]; - } - // Construct a new mesh for the gizmo. - Mesh directivityGizmoMesh = new Mesh(); - directivityGizmoMesh.hideFlags = HideFlags.DontSaveInEditor; - directivityGizmoMesh.vertices = vertices; - directivityGizmoMesh.triangles = triangles; - directivityGizmoMesh.RecalculateNormals(); - // Draw the mesh. - Vector3 scale = 2.0f * Mathf.Max(target.lossyScale.x, target.lossyScale.z) * Vector3.one; - Gizmos.DrawMesh(directivityGizmoMesh, target.position, target.rotation, scale); - } -} diff --git a/ProjectSettings/AudioManager.asset b/ProjectSettings/AudioManager.asset index 2a3b0dd62a..df1e8090a2 100644 --- a/ProjectSettings/AudioManager.asset +++ b/ProjectSettings/AudioManager.asset @@ -13,7 +13,7 @@ AudioManager: m_VirtualVoiceCount: 512 m_RealVoiceCount: 32 m_EnableOutputSuspension: 1 - m_SpatializerPlugin: GVR Audio Spatializer + m_SpatializerPlugin: m_AmbisonicDecoderPlugin: m_DisableAudio: 0 m_VirtualizeEffects: 1