VAUAudioRenderer.cs 959 Bytes
Newer Older
1 2 3 4
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

5
public class VAUAudioRenderer : MonoBehaviour
6
{
7 8 9 10
	[Tooltip("Rendering module identifier")]
	public string ID = "";

	[Tooltip("Mute/unmute rendering output")]
11
	public bool OutputMuted = false;
12 13

	[Tooltip("Control rendering output gain")]
14 15 16 17 18 19 20
	public double OutputGain = 1.0;
	
	private bool OutputMutedShadow;
	private double OutputGainShadow;

    void Start ()
    {
21 22
		VAUAdapter.VA.SetRenderingModuleMuted( ID, OutputMuted );
		VAUAdapter.VA.SetRenderingModuleGain( ID, OutputGain );
23 24 25 26 27 28 29 30 31
		
		OutputMutedShadow = OutputMuted;
        OutputGainShadow = OutputGain;
    }
	
	void Update()
	{
		if( OutputMuted != OutputMutedShadow )
		{
32
			VAUAdapter.VA.SetRenderingModuleMuted( ID, OutputMuted );
33 34 35 36
			OutputMutedShadow = OutputMuted;
		}
		if( OutputGain != OutputGainShadow )
		{
37
			VAUAdapter.VA.SetRenderingModuleGain( ID, OutputGain );
38 39 40 41
			OutputGainShadow = OutputGain;
		}
	}
}