Commit fef0e60f authored by Maurice Tayeb Andreas's avatar Maurice Tayeb Andreas

##

parent 805f2a12
...@@ -21,7 +21,9 @@ namespace VA ...@@ -21,7 +21,9 @@ namespace VA
public bool Connect() public bool Connect()
{ {
return NativeConnectLocalNetClient(_NetClient); bool b = NativeConnectLocalNetClient(_NetClient);
Debug.Assert(b, "Not Connected to VA.");
return b;
} }
public bool Connect( string HostIP , int Port ) public bool Connect( string HostIP , int Port )
...@@ -159,7 +161,7 @@ namespace VA ...@@ -159,7 +161,7 @@ namespace VA
return sIdentifier.ToString(); return sIdentifier.ToString();
} }
public void SetSoundSourceVolume(int iSoundSourceID, int dGain) public void SetSoundSourceVolume(int iSoundSourceID, double dGain)
{ {
NativeSetSoundSourceVolume(_NetClient, iSoundSourceID, dGain); NativeSetSoundSourceVolume(_NetClient, iSoundSourceID, dGain);
} }
...@@ -243,9 +245,19 @@ namespace VA ...@@ -243,9 +245,19 @@ namespace VA
NativeSetSoundSourceAuralizationMode(_NetClient, iSoundSourceID, sAuralizationMode); NativeSetSoundSourceAuralizationMode(_NetClient, iSoundSourceID, sAuralizationMode);
} }
public void SetArtificalReverbarationTime(string sRenderer, float fReverTime) public void SetArtificalReverbarationTime(string Renderer, double ReverbTime)
{
NativeSetArtificalReverbarationTime(_NetClient, Renderer, ReverbTime);
}
public void SetInputMuted(bool bMuted)
{ {
NativeSetInputMuted(_NetClient, bMuted);
}
public void SetOutputMuted(bool bMuted)
{
NativeSetOutputMuted(_NetClient, bMuted);
} }
/* /*
* Native imported functions from C++ unmanaged library declared private, so they can not be accessed * Native imported functions from C++ unmanaged library declared private, so they can not be accessed
...@@ -314,7 +326,7 @@ namespace VA ...@@ -314,7 +326,7 @@ namespace VA
[ DllImport( "VANetCSWrapper" ) ] private static extern int NativeGetSoundSourceDirectivity( IntPtr pClient, int iSoundSourceID ); [ DllImport( "VANetCSWrapper" ) ] private static extern int NativeGetSoundSourceDirectivity( IntPtr pClient, int iSoundSourceID );
[ DllImport( "VANetCSWrapper" ) ] private static extern void NativeSetSoundSourceDirectivity( IntPtr pClient, int iSoundSourceID, int iDirectivityID ); [ DllImport( "VANetCSWrapper" ) ] private static extern void NativeSetSoundSourceDirectivity( IntPtr pClient, int iSoundSourceID, int iDirectivityID );
[ DllImport( "VANetCSWrapper" ) ] private static extern double NativeGetSoundSourceVolume( IntPtr pClient, int iSoundSourceID ); [ DllImport( "VANetCSWrapper" ) ] private static extern double NativeGetSoundSourceVolume( IntPtr pClient, int iSoundSourceID );
[ DllImport( "VANetCSWrapper" ) ] private static extern void NativeSetSoundSourceVolume( IntPtr pClient, int iSoundSourceID, int dGain ); [ DllImport( "VANetCSWrapper" ) ] private static extern void NativeSetSoundSourceVolume( IntPtr pClient, int iSoundSourceID, double dGain );
[ DllImport( "VANetCSWrapper" ) ] private static extern bool NativeIsSoundSourceMuted( IntPtr pClient, int iSoundSourceID ); [ DllImport( "VANetCSWrapper" ) ] private static extern bool NativeIsSoundSourceMuted( IntPtr pClient, int iSoundSourceID );
[ DllImport( "VANetCSWrapper" ) ] private static extern void NativeSetSoundSourceMuted( IntPtr pClient, int iSoundSourceID, bool bMuted ); [ DllImport( "VANetCSWrapper" ) ] private static extern void NativeSetSoundSourceMuted( IntPtr pClient, int iSoundSourceID, bool bMuted );
[ DllImport( "VANetCSWrapper" ) ] private static extern void NativeGetSoundSourcePosition( IntPtr pClient, int iSoundSourceID, double x, double y, double z ); [ DllImport( "VANetCSWrapper" ) ] private static extern void NativeGetSoundSourcePosition( IntPtr pClient, int iSoundSourceID, double x, double y, double z );
...@@ -461,5 +473,13 @@ namespace VA ...@@ -461,5 +473,13 @@ namespace VA
[ DllImport( "VANetCSWrapper" ) ] private static extern bool NativeIsReproductionModuleMuted( IntPtr pClient, string sModuleID ); [ DllImport( "VANetCSWrapper" ) ] private static extern bool NativeIsReproductionModuleMuted( IntPtr pClient, string sModuleID );
[ DllImport( "VANetCSWrapper" ) ] private static extern void NativeSetReproductionModuleGain( IntPtr pClient, string sModuleID, double dGain ); [ DllImport( "VANetCSWrapper" ) ] private static extern void NativeSetReproductionModuleGain( IntPtr pClient, string sModuleID, double dGain );
[ DllImport( "VANetCSWrapper" ) ] private static extern double NativeGetReproductionModuleGain( IntPtr pClient, string sModuleID ); [ DllImport( "VANetCSWrapper" ) ] private static extern double NativeGetReproductionModuleGain( IntPtr pClient, string sModuleID );
[DllImport("VANetCSWrapper")]
private static extern void NativeSetArtificalReverbarationTime(IntPtr pClient, string sRendererID, double dReverberationTime);
[DllImport("VANetCSWrapper")]
private static extern void NativeSetArtificalRoomVolume(IntPtr pClient, string sRendererID, double dVolume);
[DllImport("VANetCSWrapper")]
private static extern void NativeSetArtificalSurfaceArea(IntPtr pClient, string sRendererID, double dArea);
} }
} }
using UnityEngine;
using System;
using System.Collections;
using VA;
public class VAUListener : MonoBehaviour {
public string listenername = "Listener";
private int Listener;
private VANet _VA = null;
private Quaternion q;
private Transform t;
public int ID
{
get
{
return Listener;
}
}
// Use this for initialization
void Start()
{
_VA = VAUAdapter.VA;
Listener = _VA.CreateListener(listenername, 0, VAUAdapter.DefaultHRIR);
listenername += " " + Listener;
_VA.SetListenerAuralizationMode(Listener, "all");
Debug.Log(listenername + " created");
_VA.SetListenerHRIRDataset(Listener, VAUAdapter.DefaultHRIR);
SetListenerPositionOrientation();
if (GetComponent<VAUAuralizationMode>() != null)
GetComponent<VAUAuralizationMode>().AuraStringChanged += OnListenerAuralizationModeChanged;
}
// Update is called once per frame
void Update ()
{
SetListenerPositionOrientation();
}
//uses the View- and Up-Vector to transmit the position of the listener to VA
void SetListenerPositionOrientation()
{
t = GetComponent<Transform>();
q = t.rotation;
Vector3 up = q * Vector3.up;
Vector3 view = q * Vector3.forward;
Vector3 view_ogl = new Vector3(view.x, view.y, -view.z);
Vector3 up_ogl = new Vector3(up.x, up.y, -up.z);
_VA.SetListenerPosition(Listener, t.transform.position.x, t.transform.position.y, -t.transform.position.z);
_VA.SetListenerOrientationVU(Listener, view_ogl.x, view_ogl.y, view_ogl.z, up_ogl.x, up_ogl.y, up_ogl.z);
}
void OnListenerAuralizationModeChanged(string AuraMode)
{
_VA.SetListenerAuralizationMode(Listener, AuraMode);
}
void OnDisable()
{
if (GetComponent<VAUAuralizationMode>() != null)
GetComponent<VAUAuralizationMode>().AuraStringChanged -= OnListenerAuralizationModeChanged;
}
void OnDestroy()
{
if (_VA.IsConnected())
{
_VA.DeleteListener(Listener);
}
}
}
using UnityEngine;
using System.Collections;
public class VAUReverbZone : MonoBehaviour {
void OnTriggerEnter(Collider col)
{
GetComponent<AudioReverbZone>().reve
}
}
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