More progress

parent 73f38911
......@@ -96,25 +96,8 @@ public class VAUAdapter : MonoBehaviour
_VA.SetGlobalAuralizationMode(AuraMode);
}
void OnDisable()
void OnDestroy()
{
// @todo: probably better to remove these objects directly in C# scripts.
VAUSoundSource[] SoundSources = FindObjectsOfType<VAUSoundSource>();
foreach (VAUSoundSource SoundSource in SoundSources)
{
_VA.SetSoundSourceSignalSource(SoundSource.ID, "");
_VA.DeleteSoundSource(SoundSource.ID);
}
VAUListener[] Listeners = FindObjectsOfType<VAUListener>();
foreach (VAUListener Listener in Listeners)
{
_VA.DeleteListener(Listener.ID);
}
if (GetComponent<VAUAuralizationMode>() != null)
GetComponent<VAUAuralizationMode>().AuraStringChanged -= OnGlobalAuralizationModeChanged;
_VA.Disconnect();
}
......
......@@ -11,6 +11,9 @@ public class VAUAudiofileSignalSource : VAUSignalSource
void Awake()
{
if (!VAUAdapter.VA.IsConnected())
return;
_ID = VAUAdapter.VA.CreateAudiofileSignalSource(FilePath, Name);
Debug.Assert(_ID.Length > 0, "Could not create audio file signal source '" + Name + "' file from path " + FilePath);
}
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class VAUController : MonoBehaviour
{
public bool InputMuted = false;
public double InputGain = 1.0;
public bool OutputMuted = false;
public double OutputGain = 1.0;
private bool InputMutedShadow;
private double InputGainShadow;
private bool OutputMutedShadow;
private double OutputGainShadow;
void Start ()
{
VAUAdapter.VA.SetInputMuted( InputMuted );
VAUAdapter.VA.SetInputGain( InputGain );
VAUAdapter.VA.SetOutputMuted( OutputMuted );
VAUAdapter.VA.SetOutputGain( OutputGain );
InputMutedShadow = InputMuted;
InputGainShadow = InputGain;
OutputMutedShadow = OutputMuted;
OutputGain = OutputGainShadow;
}
void Update()
{
if( InputMuted != InputMutedShadow )
{
VAUAdapter.VA.SetInputMuted( InputMuted );
InputMutedShadow = InputMuted;
}
if( InputGain != InputGainShadow )
{
VAUAdapter.VA.SetInputGain( InputGain );
InputGainShadow = InputGain;
}
if( OutputMuted != OutputMutedShadow )
{
VAUAdapter.VA.SetOutputMuted( OutputMuted );
OutputMutedShadow = OutputMuted;
}
if( OutputGain != OutputGainShadow )
{
VAUAdapter.VA.SetOutputGain( OutputGain );
OutputGainShadow = OutputGain;
}
}
}
......@@ -128,10 +128,7 @@ public class VAUListener : MonoBehaviour {
{
if (GetComponent<VAUAuralizationMode>() != null)
GetComponent<VAUAuralizationMode>().AuraStringChanged -= OnListenerAuralizationModeChanged;
}
void OnDestroy()
{
_VA.DeleteListener(_ID);
}
}
......@@ -24,11 +24,13 @@ public class VAUSoundSource : MonoBehaviour
}
}
// Use this for initialization
void Start()
{
_VA = VAUAdapter.VA;
if (!_VA.IsConnected())
return;
// Add sound source
_ID = _VA.CreateSoundSource(this.name, 0, 1.0);
_VA.SetSoundSourceAuralizationMode(_ID, "all");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment