public void SetInputs(SimulationFlags flags)
        {
            var inputs = new SimulationInputs {
            };

            inputs.source.origin = Common.ConvertVector(transform.position);
            inputs.source.ahead  = Common.ConvertVector(transform.forward);
            inputs.source.up     = Common.ConvertVector(transform.up);
            inputs.source.right  = Common.ConvertVector(transform.right);
            inputs.distanceAttenuationModel.type = DistanceAttenuationModelType.Default;
            inputs.airAbsorptionModel.type       = AirAbsorptionModelType.Default;
            inputs.reverbScaleLow             = 1.0f;
            inputs.reverbScaleMid             = 1.0f;
            inputs.reverbScaleHigh            = 1.0f;
            inputs.hybridReverbTransitionTime = SteamAudioSettings.Singleton.hybridReverbTransitionTime;
            inputs.hybridReverbOverlapPercent = SteamAudioSettings.Singleton.hybridReverbOverlapPercent / 100.0f;
            inputs.baked = (reverbType != ReverbType.Realtime) ? Bool.True : Bool.False;
            if (reverbType == ReverbType.Baked)
            {
                inputs.bakedDataIdentifier = GetBakedDataIdentifier();
            }

            inputs.flags = 0;
            if (applyReverb)
            {
                inputs.flags = inputs.flags | SimulationFlags.Reflections;
            }

            inputs.directFlags = 0;

            mSource.SetInputs(flags, inputs);
        }
Exemplo n.º 2
0
        public SimulationOutputs GetOutputs(SimulationFlags flags)
        {
            var outputs = new SimulationOutputs {
            };

            API.iplSourceGetOutputs(mSource, flags, ref outputs);
            return(outputs);
        }
Exemplo n.º 3
0
        public void UpdateOutputs(SimulationFlags flags)
        {
            var outputs = mSource.GetOutputs(flags);

            if (SteamAudioSettings.Singleton.audioEngine == AudioEngineType.Unity &&
                ((flags & SimulationFlags.Direct) != 0))
            {
                if (distanceAttenuation && distanceAttenuationInput == DistanceAttenuationInput.PhysicsBased)
                {
                    distanceAttenuationValue = outputs.direct.distanceAttenuation;
                }

                if (airAbsorption && airAbsorptionInput == AirAbsorptionInput.SimulationDefined)
                {
                    airAbsorptionLow  = outputs.direct.airAbsorptionLow;
                    airAbsorptionMid  = outputs.direct.airAbsorptionMid;
                    airAbsorptionHigh = outputs.direct.airAbsorptionHigh;
                }

                if (directivity && directivityInput == DirectivityInput.SimulationDefined)
                {
                    directivityValue = outputs.direct.directivity;
                }

                if (occlusion && occlusionInput == OcclusionInput.SimulationDefined)
                {
                    occlusionValue = outputs.direct.occlusion;
                }

                if (transmission && transmissionInput == TransmissionInput.SimulationDefined)
                {
                    transmissionLow  = outputs.direct.transmissionLow;
                    transmissionMid  = outputs.direct.transmissionMid;
                    transmissionHigh = outputs.direct.transmissionHigh;
                }
            }

            if (pathing && ((flags & SimulationFlags.Pathing) != 0))
            {
                outputs.pathing.eqCoeffsLow  = Mathf.Max(0.1f, outputs.pathing.eqCoeffsLow);
                outputs.pathing.eqCoeffsMid  = Mathf.Max(0.1f, outputs.pathing.eqCoeffsMid);
                outputs.pathing.eqCoeffsHigh = Mathf.Max(0.1f, outputs.pathing.eqCoeffsHigh);
            }
        }
Exemplo n.º 4
0
 public void SetSharedInputs(SimulationFlags flags, SimulationSharedInputs sharedInputs)
 {
     API.iplSimulatorSetSharedInputs(mSimulator, flags, ref sharedInputs);
 }
Exemplo n.º 5
0
 public void SetInputs(SimulationFlags flags, SimulationInputs inputs)
 {
     API.iplSourceSetInputs(mSource, flags, ref inputs);
 }
Exemplo n.º 6
0
 public SimulationOutputs GetOutputs(SimulationFlags flags)
 {
     return(mSource.GetOutputs(flags));
 }
Exemplo n.º 7
0
        public void SetInputs(SimulationFlags flags)
        {
            var listener = SteamAudioManager.GetSteamAudioListener();

            var inputs = new SimulationInputs {
            };

            inputs.source.origin = Common.ConvertVector(transform.position);
            inputs.source.ahead  = Common.ConvertVector(transform.forward);
            inputs.source.up     = Common.ConvertVector(transform.up);
            inputs.source.right  = Common.ConvertVector(transform.right);

            if (SteamAudioSettings.Singleton.audioEngine == AudioEngineType.Unity &&
                distanceAttenuation &&
                distanceAttenuationInput == DistanceAttenuationInput.CurveDriven &&
                reflections &&
                useDistanceCurveForReflections)
            {
                inputs.distanceAttenuationModel = mCurveAttenuationModel;
            }
            else
            {
                inputs.distanceAttenuationModel.type = DistanceAttenuationModelType.Default;
            }

            inputs.airAbsorptionModel.type    = AirAbsorptionModelType.Default;
            inputs.directivity.dipoleWeight   = dipoleWeight;
            inputs.directivity.dipolePower    = dipolePower;
            inputs.occlusionType              = occlusionType;
            inputs.occlusionRadius            = occlusionRadius;
            inputs.numOcclusionSamples        = occlusionSamples;
            inputs.reverbScaleLow             = 1.0f;
            inputs.reverbScaleMid             = 1.0f;
            inputs.reverbScaleHigh            = 1.0f;
            inputs.hybridReverbTransitionTime = SteamAudioSettings.Singleton.hybridReverbTransitionTime;
            inputs.hybridReverbOverlapPercent = SteamAudioSettings.Singleton.hybridReverbOverlapPercent / 100.0f;
            inputs.baked              = (reflectionsType != ReflectionsType.Realtime) ? Bool.True : Bool.False;
            inputs.pathingProbes      = (pathingProbeBatch != null) ? pathingProbeBatch.GetProbeBatch() : IntPtr.Zero;
            inputs.visRadius          = SteamAudioSettings.Singleton.bakingVisibilityRadius;
            inputs.visThreshold       = SteamAudioSettings.Singleton.bakingVisibilityThreshold;
            inputs.visRange           = SteamAudioSettings.Singleton.bakingVisibilityRange;
            inputs.pathingOrder       = SteamAudioSettings.Singleton.bakingAmbisonicOrder;
            inputs.enableValidation   = pathValidation ? Bool.True : Bool.False;
            inputs.findAlternatePaths = findAlternatePaths ? Bool.True : Bool.False;

            if (reflectionsType == ReflectionsType.BakedStaticSource)
            {
                if (currentBakedSource != null)
                {
                    inputs.bakedDataIdentifier = currentBakedSource.GetBakedDataIdentifier();
                }
            }
            else if (reflectionsType == ReflectionsType.BakedStaticListener)
            {
                if (listener != null && listener.currentBakedListener != null)
                {
                    inputs.bakedDataIdentifier = listener.currentBakedListener.GetBakedDataIdentifier();
                }
            }

            inputs.flags = SimulationFlags.Direct;
            if (reflections)
            {
                if ((reflectionsType == ReflectionsType.Realtime) ||
                    (reflectionsType == ReflectionsType.BakedStaticSource && currentBakedSource != null) ||
                    (reflectionsType == ReflectionsType.BakedStaticListener && listener != null && listener.currentBakedListener != null))
                {
                    inputs.flags = inputs.flags | SimulationFlags.Reflections;
                }
            }
            if (pathing)
            {
                if (pathingProbeBatch == null)
                {
                    pathing = false;
                    Debug.LogWarningFormat("Pathing probe batch not set, disabling pathing for source {0}.", gameObject.name);
                }
                else
                {
                    inputs.flags = inputs.flags | SimulationFlags.Pathing;
                }
            }

            inputs.directFlags = 0;
            if (distanceAttenuation)
            {
                inputs.directFlags = inputs.directFlags | DirectSimulationFlags.DistanceAttenuation;
            }
            if (airAbsorption)
            {
                inputs.directFlags = inputs.directFlags | DirectSimulationFlags.AirAbsorption;
            }
            if (directivity)
            {
                inputs.directFlags = inputs.directFlags | DirectSimulationFlags.Directivity;
            }
            if (occlusion)
            {
                inputs.directFlags = inputs.directFlags | DirectSimulationFlags.Occlusion;
            }
            if (transmission)
            {
                inputs.directFlags = inputs.directFlags | DirectSimulationFlags.Transmission;
            }

            mSource.SetInputs(flags, inputs);
        }
 public void UpdateOutputs(SimulationFlags flags)
 {
 }
Exemplo n.º 9
0
 public static extern void iplSourceGetOutputs(IntPtr source, SimulationFlags flags, ref SimulationOutputs outputs);
Exemplo n.º 10
0
 public static extern void iplSourceSetInputs(IntPtr source, SimulationFlags flags, ref SimulationInputs inputs);
Exemplo n.º 11
0
 public static extern void iplSimulatorSetSharedInputs(IntPtr simulator, SimulationFlags flags, ref SimulationSharedInputs sharedInputs);