當前位置: 首頁>>代碼示例>>C#>>正文


C# AudioSource.SetSpatializerFloat方法代碼示例

本文整理匯總了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);
 }
開發者ID:CameronVetter,項目名稱:HoloToolkit-Unity,代碼行數:10,代碼來源:SpatialSoundSettings.cs

示例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
	}
開發者ID:emomper23,項目名稱:PsychVR,代碼行數:28,代碼來源:ONSPAudioSource.cs

示例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
	}
開發者ID:catarak,項目名稱:neural-network-vr,代碼行數:40,代碼來源:ONSPAudioSource.cs

示例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
	}
開發者ID:natewinck,項目名稱:LightsOut,代碼行數:31,代碼來源:ONSPAudioSource.cs

示例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;
 }
開發者ID:MaTriXy,項目名稱:cardboard-unity,代碼行數:7,代碼來源:GvrAudioSoundfield.cs

示例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);
 }
開發者ID:MaTriXy,項目名稱:cardboard-unity,代碼行數:15,代碼來源:GvrAudioSoundfield.cs

示例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;
 }
開發者ID:CaitieGlover,項目名稱:SyperVR,代碼行數:6,代碼來源:GvrAudioSoundfield.cs

示例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);
 }
開發者ID:CaitieGlover,項目名稱:SyperVR,代碼行數:9,代碼來源:GvrAudioSoundfield.cs


注:本文中的UnityEngine.AudioSource.SetSpatializerFloat方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。