static public int SetSpatializerFloat(IntPtr l) { try { UnityEngine.AudioSource self = (UnityEngine.AudioSource)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); System.Single a2; checkType(l, 3, out a2); var ret = self.SetSpatializerFloat(a1, a2); pushValue(l, ret); return(1); } catch (Exception e) { return(error(l, e)); } }
static int SetSpatializerFloat(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject <UnityEngine.AudioSource>(L, 1); int arg0 = (int)LuaDLL.luaL_checkinteger(L, 2); float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); bool o = obj.SetSpatializerFloat(arg0, arg1); LuaDLL.lua_pushboolean(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <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); }
/// <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 }
/// <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 }
/// <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 }
// 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; }
// 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); }
// Shuts down given channel set of the soundfield. private void ShutdownChannelSet(AudioSource source, int channelSet) { source.SetSpatializerFloat(0, -1.0f); source.spatialize = false; }
// 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); }