More documentation

parent 68454f53
...@@ -7,7 +7,7 @@ using VA; ...@@ -7,7 +7,7 @@ using VA;
// Adapter to VA (singleton) // Adapter to VA (singleton)
/** /**
* Drop this file onto any GameObject. Add a VAUConfig script to the same object to control parameters. * Drop this file onto any GameObject. Add a VAUConfig script to the same object for special settings. Add VAUControl to control the running core.
* */ * */
public class VAUAdapter : MonoBehaviour public class VAUAdapter : MonoBehaviour
{ {
......
...@@ -4,10 +4,19 @@ using UnityEngine; ...@@ -4,10 +4,19 @@ using UnityEngine;
public class VAUConfig : MonoBehaviour { public class VAUConfig : MonoBehaviour {
[Tooltip("Name or IP address where the VA server is running.")]
public string Server = VAUAdapter.Server; public string Server = VAUAdapter.Server;
[Tooltip("TCP/IP port where the VA server is communicating.")]
public int Port = VAUAdapter.Port; public int Port = VAUAdapter.Port;
[Tooltip("Add an additional path where to find files")]
public string AdditionalSearchPath = ""; public string AdditionalSearchPath = "";
[Tooltip("Resets server on startup")]
public bool ResetOnStart = true; public bool ResetOnStart = true;
[Tooltip("Resets server when stopping")]
public bool ResetOnStop = true; public bool ResetOnStop = true;
// Use this for initialization // Use this for initialization
......
...@@ -4,16 +4,16 @@ using UnityEngine; ...@@ -4,16 +4,16 @@ using UnityEngine;
public class VAUController : MonoBehaviour public class VAUController : MonoBehaviour
{ {
[Tooltip("Mute global input")] [Tooltip("Mute global input (audio in)")]
public bool InputMuted = false; public bool InputMuted = false;
[Tooltip("Control global input gain")] [Tooltip("Control global input gain (audio in level)")]
public double InputGain = 1.0; public double InputGain = 1.0;
[Tooltip("Mute global output")] [Tooltip("Mute global output (audio out)")]
public bool OutputMuted = false; public bool OutputMuted = false;
[Tooltip("Control global output gain")] [Tooltip("Control global output gain (audio out level)")]
public double OutputGain = 1.0; public double OutputGain = 1.0;
private bool InputMutedShadow; private bool InputMutedShadow;
......
...@@ -3,14 +3,8 @@ using System.Collections.Generic; ...@@ -3,14 +3,8 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public class VAUDefaultHRIR : VAUDirectivity public class VAUDefaultHRIR : VAUDirectivity
{ {
// The default HRIR create a HRIR database using the default macro $(DefaultHRIR), which is usually defined in the server configuration"
[Tooltip("Absolute or relative path (relative to Assets folder), also use AddSearchPath for special folders.")]
public string HRIRFilePath = "$(DefaultHRIR)";
[Tooltip("Versatile name for this directivity")]
public string HRIRName = "Default head-related transfer function";
VAUDefaultHRIR() VAUDefaultHRIR()
{ {
FilePath = "$(DefaultHRIR)"; FilePath = "$(DefaultHRIR)";
......
...@@ -5,10 +5,10 @@ using UnityEngine; ...@@ -5,10 +5,10 @@ using UnityEngine;
public class VAUDirectivity : MonoBehaviour public class VAUDirectivity : MonoBehaviour
{ {
[Tooltip("Absolute or relative path (relative to Assets folder), also use AddSearchPath for special folders.")] [Tooltip("Absolute or relative path (relative to Assets folder), also use AddSearchPath for special folders.")]
protected string FilePath = ""; public string FilePath = "";
[Tooltip("Versatile name for this directivity")] [Tooltip("Versatile name for this directivity")]
protected string Name = ""; public string Name = "";
protected int _ID = -1; // Stores the internal id that is assigned by VA protected int _ID = -1; // Stores the internal id that is assigned by VA
...@@ -22,12 +22,18 @@ public class VAUDirectivity : MonoBehaviour ...@@ -22,12 +22,18 @@ public class VAUDirectivity : MonoBehaviour
void OnEnable() void OnEnable()
{ {
if (!VAUAdapter.VA.IsConnected())
return;
if (FilePath.Length > 0) if (FilePath.Length > 0)
_ID = VAUAdapter.VA.CreateDirectivityFromFile(FilePath); _ID = VAUAdapter.VA.CreateDirectivityFromFile(FilePath);
} }
private void OnDestroy() private void OnDestroy()
{ {
if (!VAUAdapter.VA.IsConnected())
return;
if (_ID != -1) if (_ID != -1)
VAUAdapter.VA.DeleteDirectivity(_ID); VAUAdapter.VA.DeleteDirectivity(_ID);
_ID = -1; _ID = -1;
......
...@@ -16,13 +16,18 @@ public class VAUSignalSourceAudioFile : VAUSignalSource ...@@ -16,13 +16,18 @@ public class VAUSignalSourceAudioFile : VAUSignalSource
{ {
if (!VAUAdapter.VA.IsConnected()) if (!VAUAdapter.VA.IsConnected())
{ {
Debug.LogError( 'Could not create signal source "' + FilePath + '", not connected to VA' ); Debug.LogError( "Could not awake signal source '" + FilePath + "', not connected to VA" );
return; return;
} }
} }
void OnEnable() void OnEnable()
{ {
if (!VAUAdapter.VA.IsConnected())
{
Debug.LogError( "Could not enable signal source '" + FilePath + "', not connected to VA" );
return;
}
_ID = VAUAdapter.VA.CreateSignalSourceBufferFromFile (FilePath, Name); _ID = VAUAdapter.VA.CreateSignalSourceBufferFromFile (FilePath, Name);
Debug.Assert (_ID.Length > 0, "Could not create audio file signal source '" + Name + "' from file path " + FilePath); Debug.Assert (_ID.Length > 0, "Could not create audio file signal source '" + Name + "' from file path " + FilePath);
VAUAdapter.VA.SetSignalSourceBufferLooping (_ID, IsLooping); VAUAdapter.VA.SetSignalSourceBufferLooping (_ID, IsLooping);
......
...@@ -38,7 +38,7 @@ public class VAUSoundSource : MonoBehaviour ...@@ -38,7 +38,7 @@ public class VAUSoundSource : MonoBehaviour
if (!_VA.IsConnected()) if (!_VA.IsConnected())
{ {
Debug.LogError( 'Could not create sound source, not connected to VA' ); Debug.LogError( "Could not create sound source, not connected to VA" );
return; return;
} }
......
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