Applying API changes

parent 97173de9
...@@ -61,7 +61,7 @@ public class VAUAdapter : MonoBehaviour ...@@ -61,7 +61,7 @@ public class VAUAdapter : MonoBehaviour
_VA.Reset(); _VA.Reset();
if (DefaultHRIRPath.Length > 0) if (DefaultHRIRPath.Length > 0)
_DefaultHRIRID = _VA.LoadHRIRDataset(DefaultHRIRPath, "UnityDefaultHRIR"); _DefaultHRIRID = _VA.CreateDirectivityFromFile(DefaultHRIRPath);
} }
} }
......
...@@ -17,15 +17,15 @@ public class VAUAudiofileSignalSource : VAUSignalSource ...@@ -17,15 +17,15 @@ public class VAUAudiofileSignalSource : VAUSignalSource
if (!VAUAdapter.VA.IsConnected()) if (!VAUAdapter.VA.IsConnected())
return; return;
_ID = VAUAdapter.VA.CreateAudiofileSignalSource(FilePath, Name); _ID = VAUAdapter.VA.CreateSignalSourceBufferFromFile(FilePath, Name);
Debug.Assert(_ID.Length > 0, "Could not create audio file signal source '" + Name + "' file from path " + FilePath); Debug.Assert(_ID.Length > 0, "Could not create audio file signal source '" + Name + "' file from path " + FilePath);
} }
void Start() void Start()
{ {
VAUAdapter.VA.SetAudiofileSignalSourceIsLooping(_ID, IsLooping); VAUAdapter.VA.SetSignalSourceBufferLooping(_ID, IsLooping);
if (PlayOnStart) if (PlayOnStart)
VAUAdapter.VA.SetAudiofileSignalSourcePlaybackAction(_ID, "PLAY"); VAUAdapter.VA.SetSignalSourceBufferPlaybackAction(_ID, "PLAY");
} }
void OnDestroy() void OnDestroy()
......
...@@ -20,13 +20,13 @@ public class VAUDirectivity : MonoBehaviour { ...@@ -20,13 +20,13 @@ public class VAUDirectivity : MonoBehaviour {
void Start () void Start ()
{ {
if (FilePath.Length > 0) if (FilePath.Length > 0)
_ID = VAUAdapter.VA.LoadDirectivity(FilePath, Name); _ID = VAUAdapter.VA.CreateDirectivityFromFile(FilePath);
} }
private void OnDestroy() private void OnDestroy()
{ {
if (_ID != -1) if (_ID != -1)
VAUAdapter.VA.FreeDirectivity(_ID); VAUAdapter.VA.DeleteDirectivity(_ID);
_ID = -1; _ID = -1;
} }
} }
...@@ -21,13 +21,13 @@ public class VAUHRIRDataset : MonoBehaviour { ...@@ -21,13 +21,13 @@ public class VAUHRIRDataset : MonoBehaviour {
void Start () void Start ()
{ {
if (FilePath.Length > 0) if (FilePath.Length > 0)
_ID = VAUAdapter.VA.LoadHRIRDataset(FilePath, Name); _ID = VAUAdapter.VA.CreateDirectivityFromFile(FilePath);
} }
private void OnDestroy() private void OnDestroy()
{ {
if (_ID != -1) if (_ID != -1)
VAUAdapter.VA.FreeHRIRDataset(_ID); VAUAdapter.VA.DeleteDirectivity(_ID);
_ID = -1; _ID = -1;
} }
} }
...@@ -4,9 +4,9 @@ using System.Collections; ...@@ -4,9 +4,9 @@ using System.Collections;
using VA; using VA;
public class VAUListener : MonoBehaviour { public class VAUSoundReceiver : MonoBehaviour {
public string Name = "Listener"; public string Name = "SoundReceiver";
[Tooltip("Number of reverbzones used for determining the current reverb.")] [Tooltip("Number of reverbzones used for determining the current reverb.")]
public int NumMaxReverbZones = 2; public int NumMaxReverbZones = 2;
...@@ -47,19 +47,19 @@ public class VAUListener : MonoBehaviour { ...@@ -47,19 +47,19 @@ public class VAUListener : MonoBehaviour {
void Start() void Start()
{ {
_VA = VAUAdapter.VA; _VA = VAUAdapter.VA;
_ID = _VA.CreateListener(Name); _ID = _VA.CreateSoundReceiver(Name);
_VA.SetListenerAuralizationMode(_ID, "all"); _VA.SetSoundReceiverAuralizationMode(_ID, "all");
if (HRIR) if (HRIR)
_VA.SetListenerHRIRDataset(_ID, HRIR.ID); _VA.SetSoundReceiverDirectivity(_ID, HRIR.ID);
else if( VAUAdapter.DefaultHRIRID != -1 ) else if( VAUAdapter.DefaultHRIRID != -1 )
_VA.SetListenerHRIRDataset(_ID, VAUAdapter.DefaultHRIRID); _VA.SetSoundReceiverDirectivity(_ID, VAUAdapter.DefaultHRIRID);
_VA.SetListenerAnthropometricData(_ID, HeadWidth, HeadHeight, HeadDepth); _VA.SetSoundReceiverAnthropometricData(_ID, HeadWidth, HeadHeight, HeadDepth);
ShadowHeadWidth = HeadWidth; ShadowHeadWidth = HeadWidth;
ShadowHeadHeight = HeadHeight; ShadowHeadHeight = HeadHeight;
ShadowHeadDepth = HeadDepth; ShadowHeadDepth = HeadDepth;
SetListenerPositionOrientation(); SetSoundReceiverPositionOrientation();
_VA.SetArtificialReverberationTime(VAAudioRenderer, 0.3f); _VA.SetArtificialReverberationTime(VAAudioRenderer, 0.3f);
reverbZones = FindObjectsOfType(typeof(AudioReverbZone)) as AudioReverbZone[]; reverbZones = FindObjectsOfType(typeof(AudioReverbZone)) as AudioReverbZone[];
...@@ -68,17 +68,17 @@ public class VAUListener : MonoBehaviour { ...@@ -68,17 +68,17 @@ public class VAUListener : MonoBehaviour {
void OnEnable() void OnEnable()
{ {
if (GetComponent<VAUAuralizationMode>() != null) if (GetComponent<VAUAuralizationMode>() != null)
GetComponent<VAUAuralizationMode>().AuraStringChanged += OnListenerAuralizationModeChanged; GetComponent<VAUAuralizationMode>().AuraStringChanged += OnSoundReceiverAuralizationModeChanged;
} }
void Update () void Update ()
{ {
SetListenerPositionOrientation(); SetSoundReceiverPositionOrientation();
SetActiveReverbZones(); SetActiveReverbZones();
if( HeadWidth != ShadowHeadWidth || HeadHeight != ShadowHeadHeight || HeadDepth != ShadowHeadDepth ) if( HeadWidth != ShadowHeadWidth || HeadHeight != ShadowHeadHeight || HeadDepth != ShadowHeadDepth )
{ {
_VA.SetListenerAnthropometricData(_ID, HeadWidth, HeadHeight, HeadDepth); _VA.SetSoundReceiverAnthropometricData(_ID, HeadWidth, HeadHeight, HeadDepth);
ShadowHeadWidth = HeadWidth; ShadowHeadWidth = HeadWidth;
ShadowHeadHeight = HeadHeight; ShadowHeadHeight = HeadHeight;
ShadowHeadDepth = HeadDepth; ShadowHeadDepth = HeadDepth;
...@@ -86,7 +86,7 @@ public class VAUListener : MonoBehaviour { ...@@ -86,7 +86,7 @@ public class VAUListener : MonoBehaviour {
} }
// Uses the View- and Up-Vector to transmit the position of the listener to VA // Uses the View- and Up-Vector to transmit the position of the listener to VA
void SetListenerPositionOrientation() void SetSoundReceiverPositionOrientation()
{ {
_VA = VAUAdapter.VA; _VA = VAUAdapter.VA;
t = GetComponent<Transform>(); t = GetComponent<Transform>();
...@@ -95,8 +95,8 @@ public class VAUListener : MonoBehaviour { ...@@ -95,8 +95,8 @@ public class VAUListener : MonoBehaviour {
Vector3 view = q * Vector3.forward; Vector3 view = q * Vector3.forward;
Vector3 view_ogl = new Vector3(view.x, view.y, -view.z); Vector3 view_ogl = new Vector3(view.x, view.y, -view.z);
Vector3 up_ogl = new Vector3(up.x, up.y, -up.z); Vector3 up_ogl = new Vector3(up.x, up.y, -up.z);
_VA.SetListenerPosition(_ID, t.transform.position.x, t.transform.position.y, -t.transform.position.z); _VA.SetSoundReceiverPosition(_ID, new VAVec3( t.transform.position.x, t.transform.position.y, -t.transform.position.z ));
_VA.SetListenerOrientationVU(_ID, view_ogl.x, view_ogl.y, view_ogl.z, up_ogl.x, up_ogl.y, up_ogl.z); _VA.SetSoundReceiverOrientationVU(_ID, new VAVec3( view_ogl.x, view_ogl.y, view_ogl.z ), new VAVec3( up_ogl.x, up_ogl.y, up_ogl.z ));
} }
void SetActiveReverbZones() void SetActiveReverbZones()
...@@ -145,16 +145,16 @@ public class VAUListener : MonoBehaviour { ...@@ -145,16 +145,16 @@ public class VAUListener : MonoBehaviour {
} }
void OnListenerAuralizationModeChanged(string AuraMode) void OnSoundReceiverAuralizationModeChanged(string AuraMode)
{ {
_VA.SetListenerAuralizationMode(_ID, AuraMode); _VA.SetSoundReceiverAuralizationMode(_ID, AuraMode);
} }
private void OnDestroy() private void OnDestroy()
{ {
if (GetComponent<VAUAuralizationMode>() != null) if (GetComponent<VAUAuralizationMode>() != null)
GetComponent<VAUAuralizationMode>().AuraStringChanged -= OnListenerAuralizationModeChanged; GetComponent<VAUAuralizationMode>().AuraStringChanged -= OnSoundReceiverAuralizationModeChanged;
_VA.DeleteListener(_ID); _VA.DeleteSoundReceiver(_ID);
} }
} }
...@@ -41,7 +41,7 @@ public class VAUSoundSource : MonoBehaviour ...@@ -41,7 +41,7 @@ public class VAUSoundSource : MonoBehaviour
return; return;
// Add sound source // Add sound source
_ID = _VA.CreateSoundSource(this.name, 0, 1.0); _ID = _VA.CreateSoundSource(this.name);
_VA.SetSoundSourceAuralizationMode(_ID, "all"); _VA.SetSoundSourceAuralizationMode(_ID, "all");
// Connect to directivity, if linked or attached // Connect to directivity, if linked or attached
...@@ -67,11 +67,11 @@ public class VAUSoundSource : MonoBehaviour ...@@ -67,11 +67,11 @@ public class VAUSoundSource : MonoBehaviour
bool IsLooping = GetComponent<AudioSource>().loop; bool IsLooping = GetComponent<AudioSource>().loop;
bool PlayOnAwake = GetComponent<AudioSource>().playOnAwake; bool PlayOnAwake = GetComponent<AudioSource>().playOnAwake;
_AudiofileSignalSource = _VA.CreateAudiofileSignalSource(FilePath, Name); _AudiofileSignalSource = _VA.CreateSignalSourceBufferFromFile(FilePath, Name);
Debug.Assert(_AudiofileSignalSource.Length > 0, "Could not create integrated audio file signal source '" + Name + "' file from path " + FilePath); Debug.Assert(_AudiofileSignalSource.Length > 0, "Could not create integrated audio file signal source '" + Name + "' file from path " + FilePath);
_VA.SetAudiofileSignalSourceIsLooping(_AudiofileSignalSource, IsLooping); _VA.SetSignalSourceBufferLooping(_AudiofileSignalSource, IsLooping);
if (PlayOnAwake) if (PlayOnAwake)
_VA.SetAudiofileSignalSourcePlaybackAction(_AudiofileSignalSource, "play"); _VA.SetSignalSourceBufferPlaybackAction(_AudiofileSignalSource, "play");
_VA.SetSoundSourceSignalSource(_ID, _AudiofileSignalSource); _VA.SetSoundSourceSignalSource(_ID, _AudiofileSignalSource);
} }
...@@ -108,7 +108,8 @@ public class VAUSoundSource : MonoBehaviour ...@@ -108,7 +108,8 @@ public class VAUSoundSource : MonoBehaviour
Vector3 view = q * Vector3.forward; Vector3 view = q * Vector3.forward;
Vector3 view_ogl = new Vector3(view.x, view.y, -view.z); Vector3 view_ogl = new Vector3(view.x, view.y, -view.z);
Vector3 up_ogl = new Vector3(up.x, up.y, -up.z); Vector3 up_ogl = new Vector3(up.x, up.y, -up.z);
_VA.SetSoundSourcePositionOrientationVU(_ID, t.transform.position.x, t.transform.position.y, -t.transform.position.z, view_ogl.x, view_ogl.y, view_ogl.z, up_ogl.x, up_ogl.y, up_ogl.z); _VA.SetSoundSourcePosition (_ID, new VAVec3 (t.transform.position.x, t.transform.position.y, -t.transform.position.z));
_VA.SetSoundSourceOrientationVU(_ID, new VAVec3( view_ogl.x, view_ogl.y, view_ogl.z ), new VAVec3( up_ogl.x, up_ogl.y, up_ogl.z ));
} }
void OnSoundSourceAuralizationModeChanged(string AuraMode) void OnSoundSourceAuralizationModeChanged(string AuraMode)
...@@ -119,7 +120,7 @@ public class VAUSoundSource : MonoBehaviour ...@@ -119,7 +120,7 @@ public class VAUSoundSource : MonoBehaviour
public void OnEnable() public void OnEnable()
{ {
if (enable) if (enable)
_VA.SetAudiofileSignalSourcePlaybackAction(_AudiofileSignalSource, "play"); _VA.SetSignalSourceBufferPlaybackAction(_AudiofileSignalSource, "play");
} }
public void OnDisable() public void OnDisable()
...@@ -127,9 +128,9 @@ public class VAUSoundSource : MonoBehaviour ...@@ -127,9 +128,9 @@ public class VAUSoundSource : MonoBehaviour
if (GetComponent<VAUAuralizationMode>()) if (GetComponent<VAUAuralizationMode>())
GetComponent<VAUAuralizationMode>().AuraStringChanged -= OnSoundSourceAuralizationModeChanged; GetComponent<VAUAuralizationMode>().AuraStringChanged -= OnSoundSourceAuralizationModeChanged;
if (stopOnDisable) if (stopOnDisable)
_VA.SetAudiofileSignalSourcePlaybackAction(_AudiofileSignalSource, "stop"); _VA.SetSignalSourceBufferPlaybackAction(_AudiofileSignalSource, "stop");
else else
_VA.SetAudiofileSignalSourcePlaybackAction(_AudiofileSignalSource, "pause"); _VA.SetSignalSourceBufferPlaybackAction(_AudiofileSignalSource, "pause");
} }
private void OnDestroy() private void OnDestroy()
......
...@@ -17,7 +17,7 @@ public class VAUTextToSpeechSignalSource : VAUSignalSource ...@@ -17,7 +17,7 @@ public class VAUTextToSpeechSignalSource : VAUSignalSource
if (!VAUAdapter.VA.IsConnected()) if (!VAUAdapter.VA.IsConnected())
return; return;
_ID = VAUAdapter.VA.CreateTextToSpeechSignalSource(Name); _ID = VAUAdapter.VA.CreateSignalSourceTextToSpeech(Name);
} }
void Start() void Start()
......
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