예제 #1
0
    //
    // 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);
    }
예제 #2
0
    //
    //      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();
    }
예제 #3
0
		public static extern Error		iplBakeReverb(IntPtr scene, IntPtr grid, ReverbSettings settings, int typeFlags, BakeCallback callback);
예제 #4
0
		public static extern Error		iplCreateReverbEstimator(IntPtr scene, ReverbSettings settings, int typeFlags, [In, Out] ref IntPtr estimator);
예제 #5
0
    //
    // 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);
		}
    }