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