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

SetSignalSourcePlaying added

parent a4f4ddf4
...@@ -16,6 +16,7 @@ public class VAUSoundSource : MonoBehaviour { ...@@ -16,6 +16,7 @@ public class VAUSoundSource : MonoBehaviour {
private Transform t; private Transform t;
private bool islooping; private bool islooping;
private bool ismuted; private bool ismuted;
private bool isplaying;
public int ID public int ID
{ {
...@@ -38,11 +39,16 @@ public class VAUSoundSource : MonoBehaviour { ...@@ -38,11 +39,16 @@ public class VAUSoundSource : MonoBehaviour {
_VA = VAUAdapter.VA; _VA = VAUAdapter.VA;
SoundSource = _VA.CreateSoundSource(this.name, 0, Gain); SoundSource = _VA.CreateSoundSource(this.name, 0, Gain);
_VA.SetSoundSourceAuralizationMode(SoundSource, "all"); _VA.SetSoundSourceAuralizationMode(SoundSource, "all");
islooping = GetComponent<AudioSource>().loop; islooping = GetComponent<AudioSource>().loop;
ismuted = GetComponent<AudioSource>().mute;
isplaying = GetComponent<AudioSource>().isPlaying;
if (directivitypath == "") if (directivitypath == "")
directivity = VAUAdapter.DefaultDirectivity; directivity = VAUAdapter.DefaultDirectivity;
else else
directivity = _VA.LoadDirectivity(directivitypath, "SoundSource " + SoundSource + " Directivity"); directivity = _VA.LoadDirectivity(directivitypath, "SoundSource " + SoundSource + " Directivity");
if (GetComponent<AudioSource>() != null) if (GetComponent<AudioSource>() != null)
{ {
if (GetComponent<AudioSource>().clip != null) if (GetComponent<AudioSource>().clip != null)
...@@ -70,7 +76,8 @@ public class VAUSoundSource : MonoBehaviour { ...@@ -70,7 +76,8 @@ public class VAUSoundSource : MonoBehaviour {
{ {
SetSoundSourcePositionOrientation(); SetSoundSourcePositionOrientation();
SetSoundSourcePlaybackState(); SetSoundSourceMuted();
SetSignalSourcePlaying();
//_VA.SetSoundSourceVolume(SoundSource, Volume); <- flaot ändern //_VA.SetSoundSourceVolume(SoundSource, Volume); <- flaot ändern
} }
...@@ -87,7 +94,18 @@ public class VAUSoundSource : MonoBehaviour { ...@@ -87,7 +94,18 @@ public class VAUSoundSource : MonoBehaviour {
_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);
} }
void SetSoundSourcePlaybackState() void SetSignalSourcePlaying()
{
if(GetComponent<AudioSource>().isPlaying != isplaying)
{
isplaying = GetComponent<AudioSource>().isPlaying;
if (isplaying)
_VA.SetAudiofileSignalSourcePlaybackAction(SignalSource, "PLAYING");
else
_VA.SetAudiofileSignalSourcePlaybackAction(SignalSource, "PAUSED");
}
}
void SetSoundSourceMuted()
{ {
if (ismuted != GetComponent<AudioSource>().mute) if (ismuted != GetComponent<AudioSource>().mute)
{ {
...@@ -100,11 +118,13 @@ public class VAUSoundSource : MonoBehaviour { ...@@ -100,11 +118,13 @@ public class VAUSoundSource : MonoBehaviour {
{ {
_VA.SetSoundSourceAuralizationMode(SoundSource, AuraMode); _VA.SetSoundSourceAuralizationMode(SoundSource, AuraMode);
} }
public void OnDisable() public void OnDisable()
{ {
if (GetComponent<VAUAuralizationMode>() != null) if (GetComponent<VAUAuralizationMode>() != null)
GetComponent<VAUAuralizationMode>().AuraStringChanged -= OnSoundSourceAuralizationModeChanged; GetComponent<VAUAuralizationMode>().AuraStringChanged -= OnSoundSourceAuralizationModeChanged;
} }
void OnDestroy() void OnDestroy()
{ {
if (_VA.IsConnected()) if (_VA.IsConnected())
......
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