Commit 1c1edc20 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Fixing bug on sound source destruction (attempt to stop signal source failed,...

Fixing bug on sound source destruction (attempt to stop signal source failed, because of the Unity-random destruction chain
parent 2b8adcb2
......@@ -72,7 +72,7 @@ public class VAUSoundReceiver : MonoBehaviour {
{
if (GetComponent<VAUAuralizationMode>() != null)
GetComponent<VAUAuralizationMode>().AuraStringChanged -= OnSoundReceiverAuralizationModeChanged;
VAUAdapter.VA.DeleteSoundReceiver(_ID);
VAUAdapter.VA.DeleteSoundReceiver(ID);
}
}
......@@ -6,8 +6,16 @@ using VA;
public class VAUSoundReceiverTracking : MonoBehaviour
{
[Tooltip("Set the corresponding receiver that should be updated")]
public VAUSoundReceiver Receiver = null;
[Tooltip("Set the corresponding receiver that should be updated")]
public VAUSoundReceiver Receiver = null;
[Tooltip("Updates position of user")]
public bool PositionTracking = true;
[Tooltip("Updates orientation of user")]
public bool OrientationTracking = true;
void Start()
{
......@@ -33,8 +41,16 @@ public class VAUSoundReceiverTracking : MonoBehaviour
Quaternion q = GetComponent<Transform>().transform.rotation; // Unity coordinate system
VAQuat qOrientOpenGL = new VAQuat( q.x, q.y, -q.z, q.w ); // OpenGL coordinate system
VAUAdapter.VA.SetSoundReceiverRealWorldHeadPose(Receiver.ID, v3PosOpenGL, qOrientOpenGL );
Debug.Log( "performed update, new q:" + p + q );
if( !PositionTracking )
{
v3PosOpenGL = VAUAdapter.VA.GetSoundReceiverRealWorldPosition (Receiver.ID);
}
if( !OrientationTracking )
{
qOrientOpenGL = VAUAdapter.VA.GetSoundReceiverRealWorldOrientation (Receiver.ID);
}
VAUAdapter.VA.SetSoundReceiverRealWorldHeadPose (Receiver.ID, v3PosOpenGL, qOrientOpenGL);
}
private void OnDestroy()
......
......@@ -136,10 +136,13 @@ public class VAUSoundSource : MonoBehaviour
{
if (GetComponent<VAUAuralizationMode>())
GetComponent<VAUAuralizationMode>().AuraStringChanged -= OnSoundSourceAuralizationModeChanged;
if (stopOnDisable)
_VA.SetSignalSourceBufferPlaybackAction(_AudiofileSignalSource, "stop");
else
_VA.SetSignalSourceBufferPlaybackAction(_AudiofileSignalSource, "pause");
if (_AudiofileSignalSource != null) {
if (stopOnDisable)
_VA.SetSignalSourceBufferPlaybackAction (_AudiofileSignalSource, "stop");
else
_VA.SetSignalSourceBufferPlaybackAction (_AudiofileSignalSource, "pause");
}
}
private void OnDestroy()
......@@ -147,12 +150,12 @@ public class VAUSoundSource : MonoBehaviour
_VA = VAUAdapter.VA;
if (_VA.IsConnected())
{
_VA.SetSoundSourceSignalSource(_ID, "");
_VA.DeleteSoundSource(_ID);
_VA.SetSoundSourceSignalSource(_ID, "");
_VA.DeleteSoundSource(ID);
// Temptative signal source deletion
if (_AudiofileSignalSource != null)
_VA.DeleteSignalSource(_AudiofileSignalSource);
if (_AudiofileSignalSource != null)
_VA.DeleteSignalSource (_AudiofileSignalSource);
}
}
}
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