// // Initializes the propagator. // void InitializePropagator() { Phonon.ReverbSettings settings = new Phonon.ReverbSettings(); settings.rays = ReverbGlobalSettings.GetBakeSettings().Value.Rays; settings.bounces = ReverbGlobalSettings.GetBakeSettings().Value.Bounces; settings.samplingRate = AudioSettings.outputSampleRate; settings.duration = ReverbGlobalSettings.GetBakeSettings().Value.Duration; Phonon.Reverb.iplCreateReverbEstimator(AcousticSceneExporter.Scene, settings, (int) (Phonon.ReverbType.Parametric) | (int) (Phonon.ReverbType.Convolution), ref estimator); }
// // Begins the bake process. // static void BeginBake() { // Update the status. Status = ReverbBakeStatus.InProgress; // Update zone counters. ZonesBaked = 0; ZonesToBake = 1; AcousticSceneExporter.ExportScene(); AcousticGrid acousticGrid = GameObject.FindObjectOfType<AcousticGrid>(); bakeGrid = acousticGrid.LoadGrid(); bakeSettings = new Phonon.ReverbSettings(); bakeSettings.rays = ReverbGlobalSettings.GetBakeSettings().Value.Rays; bakeSettings.bounces = ReverbGlobalSettings.GetBakeSettings().Value.Bounces; bakeSettings.samplingRate = AudioSettings.outputSampleRate; bakeSettings.duration = ReverbGlobalSettings.GetBakeSettings().Value.Duration; bool bakeParametric = ReverbGlobalSettings.GetBakeSettings().BakeParametricReverb; bool bakeConvolution = ReverbGlobalSettings.GetBakeSettings().BakeConvolutionReverb; bakeTypeFlags = 0; if (bakeParametric) bakeTypeFlags |= (int)Phonon.ReverbType.Parametric; if (bakeConvolution) bakeTypeFlags |= (int)Phonon.ReverbType.Convolution; bakeCallback = new Phonon.BakeCallback(AdvanceProgress); // Start the actual baking process. #if (UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN) bakeCallbackPointer = Marshal.GetFunctionPointerForDelegate(bakeCallback); bakeCallbackHandle = GCHandle.Alloc(bakeCallbackPointer); GC.Collect(); #endif bakeThread = new Thread(new ThreadStart(BakeThread)); bakeThread.Start(); }
public static extern Error iplBakeReverb(IntPtr scene, IntPtr grid, ReverbSettings settings, int typeFlags, BakeCallback callback);
public static extern Error iplCreateReverbEstimator(IntPtr scene, ReverbSettings settings, int typeFlags, [In, Out] ref IntPtr estimator);
// // Initializes the runtime. // void InitializeRuntime() { Phonon.ReverbSettings settings = new Phonon.ReverbSettings(); settings.rays = ReverbGlobalSettings.GetBakeSettings().Value.Rays; settings.bounces = ReverbGlobalSettings.GetBakeSettings().Value.Bounces; settings.samplingRate = AudioSettings.outputSampleRate; settings.duration = ReverbGlobalSettings.GetBakeSettings().Value.Duration; if (Phonon.AudioEngineComponent.GetAudioEngine() == Phonon.AudioEngine.Unity) { int frameSize, numBuffers; AudioSettings.GetDSPBufferSize(out frameSize, out numBuffers); Phonon.Reverb.iplCreateReverbContext((uint) AudioSettings.outputSampleRate, (uint) frameSize, (uint) 2, settings.duration, ref context); Phonon.Reverb.iplCreateReverbRenderer(context, ref convolutionRenderer); } // Add a reverb filter if needed. if (Phonon.AudioEngineComponent.GetAudioEngine() == Phonon.AudioEngine.Unity) { reverbFilter = gameObject.GetComponent<AudioReverbFilter>(); if (reverbFilter == null) reverbFilter = gameObject.AddComponent<AudioReverbFilter>(); reverbFilter.reverbPreset = AudioReverbPreset.User; } if (Phonon.AudioEngineComponent.GetAudioEngine() == Phonon.AudioEngine.Wwise) { Phonon.ReverbWwise.iplWwiseSetReverbSettings(settings); } else if (Phonon.AudioEngineComponent.GetAudioEngine() == Phonon.AudioEngine.FMODStudio) { Phonon.ReverbFMODStudio.iplFMODInitialize(settings); } }