本文整理汇总了C#中UnityEngine.AudioSource.SetSpatializerFloat方法的典型用法代码示例。如果您正苦于以下问题:C# AudioSource.SetSpatializerFloat方法的具体用法?C# AudioSource.SetSpatializerFloat怎么用?C# AudioSource.SetSpatializerFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.AudioSource
的用法示例。
在下文中一共展示了AudioSource.SetSpatializerFloat方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetParameter
/// <summary>
/// Sets a Spatial Sound parameter on an AudioSource.
/// </summary>
/// <param name="audioSource">The AudioSource on which the specified parameter will be set.</param>
/// <param name="param">The Spatial Sound parameter to set.</param>
/// <param name="value">The value to set for the Spatial Sound parameter.</param>
private static void SetParameter(AudioSource audioSource, SpatialSoundParameters param, float value)
{
audioSource.SetSpatializerFloat((int)param, value);
}
示例2: SetParameters
/// <summary>
/// Sets the parameters.
/// </summary>
/// <param name="source">Source.</param>
public void SetParameters(ref AudioSource source)
{
#if ENABLE_SPATIALIZER_API
// See if we should enable spatialization
source.spatialize = enableSpatialization;
source.SetSpatializerFloat(0, gain);
// All inputs are floats; convert bool to 0.0 and 1.0
if(useInvSqr == true)
source.SetSpatializerFloat(1, 1.0f);
else
source.SetSpatializerFloat(1, 0.0f);
source.SetSpatializerFloat(2, near);
source.SetSpatializerFloat(3, far);
if(enableRfl == true)
source.SetSpatializerFloat(4, 0.0f);
else
source.SetSpatializerFloat(4, 1.0f);
#endif
}
示例3: SetParameters
/// <summary>
/// Sets the parameters.
/// </summary>
/// <param name="source">Source.</param>
public void SetParameters(ref AudioSource source)
{
#if ENABLE_SPATIALIZER_API
// Check to see if we should disable spatializion
if ((Application.isPlaying == false) ||
(AudioListener.pause == true) ||
(source.isPlaying == false) ||
(source.isActiveAndEnabled == false)
)
{
source.spatialize = false;
return;
}
else
{
source.spatialize = enableSpatialization;
}
source.SetSpatializerFloat(0, gain);
// All inputs are floats; convert bool to 0.0 and 1.0
if(useInvSqr == true)
source.SetSpatializerFloat(1, 1.0f);
else
source.SetSpatializerFloat(1, 0.0f);
source.SetSpatializerFloat(2, near);
source.SetSpatializerFloat(3, far);
if(disableRfl == true)
source.SetSpatializerFloat(4, 1.0f);
else
source.SetSpatializerFloat(4, 0.0f);
#endif
}
示例4: SetParameters
/// <summary>
/// Sets the parameters.
/// </summary>
/// <param name="source">Source.</param>
void SetParameters(ref AudioSource source)
{
#if ENABLE_SPATIALIZER_API
if(dirtyParams == true)
{
source.spatialize = enableSpatialization;
source.SetSpatializerFloat(0, gain);
// All inputs are floats; convert bool to 0.0 and 1.0
if(useInvSqr == true)
source.SetSpatializerFloat(1, 1.0f);
else
source.SetSpatializerFloat(1, 0.0f);
source.SetSpatializerFloat(2, near);
source.SetSpatializerFloat(3, far);
if(disableRfl == true)
source.SetSpatializerFloat(4, 1.0f);
else
source.SetSpatializerFloat(4, 0.0f);
dirtyParams = false;
}
#endif
}
示例5: ShutdownChannelSet
// 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;
}
示例6: InitializeChannelSet
// 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.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);
}
示例7: ShutdownChannelSet
// Shuts down given channel set of the soundfield.
private void ShutdownChannelSet(AudioSource source, int channelSet)
{
source.SetSpatializerFloat(0, -1.0f);
source.spatialize = false;
}
示例8: InitializeChannelSet
// Initializes given channel set of the soundfield.
private void InitializeChannelSet(AudioSource source, int channelSet)
{
source.spatialize = true;
source.SetSpatializerFloat(0, (float)id);
source.SetSpatializerFloat(1, (float)GvrAudio.SpatializerType.Soundfield);
source.SetSpatializerFloat(2, (float)GvrAudio.numFoaChannels);
source.SetSpatializerFloat(3, (float)channelSet);
}