From e1e43f6dfaa3c6c4f2263dff9b941554786500bf Mon Sep 17 00:00:00 2001
From: "Dipl.-Ing. Jonas Stienen" <jst@akustik.rwth-aachen.de>
Date: Thu, 31 Aug 2017 21:18:02 +0200
Subject: [PATCH] Adding gain and mute state controller for rendering and
 reproduction modules

---
 VAURendererController.cs     | 36 ++++++++++++++++++++++++++++++++++++
 VAUReproductionController.cs | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+)
 create mode 100644 VAURendererController.cs
 create mode 100644 VAUReproductionController.cs

diff --git a/VAURendererController.cs b/VAURendererController.cs
new file mode 100644
index 0000000..6b2ffac
--- /dev/null
+++ b/VAURendererController.cs
@@ -0,0 +1,36 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class VAURendererController : MonoBehaviour
+{
+	public string RendererID = "";
+	public bool OutputMuted = false;
+	public double OutputGain = 1.0;
+	
+	private bool OutputMutedShadow;
+	private double OutputGainShadow;
+
+    void Start ()
+    {
+		VAUAdapter.VA.SetRenderingModuleMuted( RendererID, OutputMuted );
+		VAUAdapter.VA.SetRenderingModuleGain( RendererID, OutputGain );
+		
+		OutputMutedShadow = OutputMuted;
+        OutputGainShadow = OutputGain;
+    }
+	
+	void Update()
+	{
+		if( OutputMuted != OutputMutedShadow )
+		{
+			VAUAdapter.VA.SetRenderingModuleMuted( RendererID, OutputMuted );
+			OutputMutedShadow = OutputMuted;
+		}
+		if( OutputGain != OutputGainShadow )
+		{
+			VAUAdapter.VA.SetRenderingModuleGain( RendererID, OutputGain );
+			OutputGainShadow = OutputGain;
+		}
+	}
+}
diff --git a/VAUReproductionController.cs b/VAUReproductionController.cs
new file mode 100644
index 0000000..951216c
--- /dev/null
+++ b/VAUReproductionController.cs
@@ -0,0 +1,36 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class VAUReproductionController : MonoBehaviour
+{
+	public string ReproductionID = "";
+	public bool OutputMuted = false;
+	public double OutputGain = 1.0;
+	
+	private bool OutputMutedShadow;
+	private double OutputGainShadow;
+
+    void Start ()
+    {
+		VAUAdapter.VA.SetReproductionModuleMuted( ReproductionID, OutputMuted );
+		VAUAdapter.VA.SetReproductionModuleGain( ReproductionID, OutputGain );
+		
+		OutputMutedShadow = OutputMuted;
+        OutputGainShadow = OutputGain;
+    }
+	
+	void Update()
+	{
+		if( OutputMuted != OutputMutedShadow )
+		{
+			VAUAdapter.VA.SetReproductionModuleMuted( ReproductionID, OutputMuted );
+			OutputMutedShadow = OutputMuted;
+		}
+		if( OutputGain != OutputGainShadow )
+		{
+			VAUAdapter.VA.SetReproductionModuleGain( ReproductionID, OutputGain );
+			OutputGainShadow = OutputGain;
+		}
+	}
+}
-- 
GitLab