VAUAudioReproduction.cs 983 Bytes
Newer Older
1 2 3 4
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

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

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

	[Tooltip("Control reproduction output gain")]
14
	public double OutputGain = 1.0;
15

16 17 18 19 20
	private bool OutputMutedShadow;
	private double OutputGainShadow;

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