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

ReverbZone

parent b2aec8fb
...@@ -111,9 +111,9 @@ namespace VA ...@@ -111,9 +111,9 @@ namespace VA
NativeFreeHRIRDataset(_NetClient, HRIR); NativeFreeHRIRDataset(_NetClient, HRIR);
} }
public void SetAudiofileSignalSourcePlaybackAction(string sSignalSourceID, int iPlayState) public void SetAudiofileSignalSourcePlaybackAction(string sSignalSourceID, string sPlayState)
{ {
NativeSetAudiofileSignalSourcePlaybackAction(_NetClient, sSignalSourceID, iPlayState); NativeSetAudiofileSignalSourcePlaybackAction(_NetClient, sSignalSourceID, sPlayState);
} }
public void SetAudiofileSignalSourcePlaybackPosition(string sSignalSourceID, double dPlaybackPosition) public void SetAudiofileSignalSourcePlaybackPosition(string sSignalSourceID, double dPlaybackPosition)
...@@ -286,7 +286,7 @@ namespace VA ...@@ -286,7 +286,7 @@ namespace VA
//[ DllImport( "VANetCSWrapper" ) ] private static extern void NativeGetSignalSourceInfo( IntPtr pClient, string sSignalSourceID, CVASignalSourceInfo& ); //[ DllImport( "VANetCSWrapper" ) ] private static extern void NativeGetSignalSourceInfo( IntPtr pClient, string sSignalSourceID, CVASignalSourceInfo& );
//[ DllImport( "VANetCSWrapper" ) ] private static extern void NativeGetSignalSourceInfos( IntPtr pClient, std::vector<CVASignalSourceInfo>& vssiDest ); //[ DllImport( "VANetCSWrapper" ) ] private static extern void NativeGetSignalSourceInfos( IntPtr pClient, std::vector<CVASignalSourceInfo>& vssiDest );
[ DllImport( "VANetCSWrapper" ) ] private static extern int NativeGetAudiofileSignalSourcePlaybackState( IntPtr pClient, string sSignalSourceID ); [ DllImport( "VANetCSWrapper" ) ] private static extern int NativeGetAudiofileSignalSourcePlaybackState( IntPtr pClient, string sSignalSourceID );
[ DllImport( "VANetCSWrapper" ) ] private static extern void NativeSetAudiofileSignalSourcePlaybackAction( IntPtr pClient, string sSignalSourceID, int iPlayState ); [ DllImport( "VANetCSWrapper" ) ] private static extern void NativeSetAudiofileSignalSourcePlaybackAction( IntPtr pClient, string sSignalSourceID, string sPlayState );
[ DllImport( "VANetCSWrapper" ) ] private static extern void NativeSetAudiofileSignalSourcePlaybackPosition( IntPtr pClient, string sSignalSourceID, double dPlaybackPosition ); [ DllImport( "VANetCSWrapper" ) ] private static extern void NativeSetAudiofileSignalSourcePlaybackPosition( IntPtr pClient, string sSignalSourceID, double dPlaybackPosition );
[ DllImport( "VANetCSWrapper" ) ] private static extern bool NativeGetAudiofileSignalSourceIsLooping( IntPtr pClient, string sSignalSourceID ); [ DllImport( "VANetCSWrapper" ) ] private static extern bool NativeGetAudiofileSignalSourceIsLooping( IntPtr pClient, string sSignalSourceID );
[ DllImport( "VANetCSWrapper" ) ] private static extern void NativeSetAudiofileSignalSourceIsLooping( IntPtr pClient, string sSignalSourceID, bool bLooping ); [ DllImport( "VANetCSWrapper" ) ] private static extern void NativeSetAudiofileSignalSourceIsLooping( IntPtr pClient, string sSignalSourceID, bool bLooping );
......
...@@ -25,7 +25,7 @@ public class VAUListener : MonoBehaviour { ...@@ -25,7 +25,7 @@ public class VAUListener : MonoBehaviour {
{ {
_VA = VAUAdapter.VA; _VA = VAUAdapter.VA;
Listener = _VA.CreateListener(listenername, 0, VAUAdapter.DefaultHRIR); Listener = _VA.CreateListener(listenername, 0, VAUAdapter.DefaultHRIR);
_VA.SetSoundSourceAuralizationMode(Listener, "all"); _VA.SetListenerAuralizationMode(Listener, "all");
Debug.Log("Listener " + Listener + " created"); Debug.Log("Listener " + Listener + " created");
_VA.SetListenerHRIRDataset(Listener, VAUAdapter.DefaultHRIR); _VA.SetListenerHRIRDataset(Listener, VAUAdapter.DefaultHRIR);
if (GetComponent<VAUAuralizationMode>() != null) if (GetComponent<VAUAuralizationMode>() != null)
...@@ -59,4 +59,11 @@ public class VAUListener : MonoBehaviour { ...@@ -59,4 +59,11 @@ public class VAUListener : MonoBehaviour {
if (GetComponent<VAUAuralizationMode>() != null) if (GetComponent<VAUAuralizationMode>() != null)
GetComponent<VAUAuralizationMode>().AuraStringChanged -= OnListenerAuralizationModeChanged; 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)
{
Debug.Log("ReverbZone aktualisiert.");
}
}
...@@ -9,7 +9,7 @@ public class VAUSoundSource : MonoBehaviour { ...@@ -9,7 +9,7 @@ public class VAUSoundSource : MonoBehaviour {
public string directivitypath = ""; public string directivitypath = "";
private int directivity; private int directivity;
private int Gain = 1; private int Gain = 1;
public string SignalSource = ""; private string SignalSource = "";
private VANet _VA = null; private VANet _VA = null;
private int SoundSource; private int SoundSource;
private Quaternion q; private Quaternion q;
...@@ -24,6 +24,13 @@ public class VAUSoundSource : MonoBehaviour { ...@@ -24,6 +24,13 @@ public class VAUSoundSource : MonoBehaviour {
return SoundSource; return SoundSource;
} }
} }
public string SignalSourceID
{
get
{
return SignalSource;
}
}
// Use this for initialization // Use this for initialization
void Start() void Start()
...@@ -41,7 +48,7 @@ public class VAUSoundSource : MonoBehaviour { ...@@ -41,7 +48,7 @@ public class VAUSoundSource : MonoBehaviour {
SignalSource = _VA.CreateAudiofileSignalSource( AssetDatabase.GetAssetPath(GetComponent<AudioSource>().clip), this.name + "_signal"); SignalSource = _VA.CreateAudiofileSignalSource( AssetDatabase.GetAssetPath(GetComponent<AudioSource>().clip), this.name + "_signal");
_VA.SetSoundSourceSignalSource(SoundSource, SignalSource); _VA.SetSoundSourceSignalSource(SoundSource, SignalSource);
Debug.Log(SignalSource + " connected to SoundSource " + SoundSource); Debug.Log(SignalSource + " connected to SoundSource " + SoundSource);
_VA.SetAudiofileSignalSourcePlaybackAction(SignalSource, 2); _VA.SetAudiofileSignalSourcePlaybackAction(SignalSource, "PLAYING");
_VA.SetAudiofileSignalSourceIsLooping(SignalSource, islooping); _VA.SetAudiofileSignalSourceIsLooping(SignalSource, islooping);
} }
if (GetComponent<VAUAuralizationMode>() != null) if (GetComponent<VAUAuralizationMode>() != null)
...@@ -52,6 +59,15 @@ public class VAUSoundSource : MonoBehaviour { ...@@ -52,6 +59,15 @@ public class VAUSoundSource : MonoBehaviour {
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{
SetSoundSourcePosition();
SetSoundSourcePlaybackState();
//_VA.SetSoundSourceVolume(SoundSource, Volume); <- flaot ändern
}
void SetSoundSourcePosition()
{ {
//position and oritentation -> VA //position and oritentation -> VA
t = GetComponent<Transform>(); t = GetComponent<Transform>();
...@@ -60,22 +76,28 @@ public class VAUSoundSource : MonoBehaviour { ...@@ -60,22 +76,28 @@ 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(SoundSource, 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.SetSoundSourcePositionOrientationVU(SoundSource, 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.SetSoundSourceOrientationVU(SoundSource, view_ogl.x, view_ogl.y, view_ogl.z, up_ogl.x, up_ogl.y, up_ogl.z);
//_VA.SetSoundSourcePosition(SoundSource, t.transform.position.x, t.transform.position.y, -t.transform.position.z);
ismuted = GetComponent<AudioSource>().mute;
_VA.SetSoundSourceMuted(SoundSource, ismuted);
//_VA.SetSoundSourceVolume(SoundSource, Volume); <- flaot ändern
} }
void SetSoundSourcePlaybackState()
{
_VA.SetSoundSourceMuted(SoundSource, GetComponent<AudioSource>().mute);
}
void OnSoundSourceAuralizationModeChanged(string AuraMode) void OnSoundSourceAuralizationModeChanged(string AuraMode)
{ {
_VA.SetSoundSourceAuralizationMode(SoundSource, AuraMode); _VA.SetSoundSourceAuralizationMode(SoundSource, AuraMode);
} }
void OnDisable() public void OnDisable()
{ {
if (GetComponent<VAUAuralizationMode>() != null) if (GetComponent<VAUAuralizationMode>() != null)
GetComponent<VAUAuralizationMode>().AuraStringChanged -= OnSoundSourceAuralizationModeChanged; GetComponent<VAUAuralizationMode>().AuraStringChanged -= OnSoundSourceAuralizationModeChanged;
} }
void OnDestroy()
{
if (_VA.IsConnected())
{
_VA.DeleteSoundSource(SoundSource);
}
}
} }
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