VAURendererArtificialReverb.cs 1.38 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class VAURendererArtificialReverb : MonoBehaviour : VAURendererController
{
	public string RendererID = "";

	public double RoomReverberationTime = 1.2; // s
	public double RoomSurfaceArea = 220.0; // m^2
	public double RoomVolume = 600.0; // m^3
	
	private double RoomReverberationTimeShadow;
	private double RoomSurfaceAreaShadow;
	private double RoomVolumeShadow;

    void Start ()
    {
		VAUAdapter.VA.SetArtificialRevberationTime( RendererID, RoomReverberationTime );
		VAUAdapter.VA.SetArtificialSurfaceArea( RendererID, RoomSurfaceArea );
		VAUAdapter.VA.SetArtificialRoomVolume( RendererID, RoomVolume );
		
		RoomReverberationTimeShadow = OutputMuted;
        RoomSurfaceAreaShadow = RoomSurfaceArea;
        RoomVolumeShadow = RoomVolume;
    }
	
	void Update()
	{
		if( RoomReverberationTime != RoomReverberationTimeShadow )
		{
	    	VAUAdapter.VA.SetArtificialRevberationTime( RendererID, RoomReverberationTime );
			RoomReverberationTimeShadow = RoomReverberationTime;
		}
		if( RoomSurfaceArea != RoomSurfaceAreaShadow )
		{
			VAUAdapter.VA.SetArtificialSurfaceArea( RendererID, RoomSurfaceArea );
			RoomSurfaceAreaShadow = RoomSurfaceArea;
		}
		if( RoomVolume != RoomVolumeShadow )
		{
			VAUAdapter.VA.SetArtificialRoomVolume( RendererID, RoomVolume );
			RoomVolumeShadow = RoomVolume;
		}
	}
}