VAURendererArtificialReverb.cs 1.29 KB
Newer Older
1 2 3 4
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

5
public class VAURendererArtificialReverb : VAUAudioRenderer
6 7 8 9 10 11 12 13 14 15 16
{
	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 ()
    {
17 18 19
		VAUAdapter.VA.SetArtificialReverberationTime( ID, RoomReverberationTime );
		VAUAdapter.VA.SetArtificialSurfaceArea( ID, RoomSurfaceArea );
		VAUAdapter.VA.SetArtificialRoomVolume( ID, RoomVolume );
20
		
Dipl.-Ing. Jonas Stienen's avatar
Fixes  
Dipl.-Ing. Jonas Stienen committed
21
		RoomReverberationTimeShadow = RoomReverberationTime;
22 23 24 25 26 27 28 29
        RoomSurfaceAreaShadow = RoomSurfaceArea;
        RoomVolumeShadow = RoomVolume;
    }
	
	void Update()
	{
		if( RoomReverberationTime != RoomReverberationTimeShadow )
		{
30
	    	VAUAdapter.VA.SetArtificialReverberationTime( ID, RoomReverberationTime );
31 32 33 34
			RoomReverberationTimeShadow = RoomReverberationTime;
		}
		if( RoomSurfaceArea != RoomSurfaceAreaShadow )
		{
35
			VAUAdapter.VA.SetArtificialSurfaceArea( ID, RoomSurfaceArea );
36 37 38 39
			RoomSurfaceAreaShadow = RoomSurfaceArea;
		}
		if( RoomVolume != RoomVolumeShadow )
		{
40
			VAUAdapter.VA.SetArtificialRoomVolume( ID, RoomVolume );
41 42 43 44
			RoomVolumeShadow = RoomVolume;
		}
	}
}