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

Adding playback state display for audio file signal source class

parent 8b5a0ee7
......@@ -10,7 +10,10 @@ public class VAUSignalSourceAudioFile : VAUSignalSource
[Tooltip("Will loop the audio signal source.")]
public bool IsLooping = true;
[Tooltip("Will immediately start the signal source payback.")]
public bool PlayOnStart = true;
public bool PlayOnStart = true;
[Tooltip("Playback state")]
public string PlaybackState = "invalid";
void Awake()
{
......@@ -28,15 +31,20 @@ public class VAUSignalSourceAudioFile : VAUSignalSource
Debug.LogError( "Could not enable signal source '" + FilePath + "', not connected to VA" );
return;
}
_ID = VAUAdapter.VA.CreateSignalSourceBufferFromFile (FilePath, Name);
Debug.Assert (_ID.Length > 0, "Could not create audio file signal source '" + Name + "' from file path " + FilePath);
_ID = VAUAdapter.VA.CreateSignalSourceBufferFromFile(FilePath, Name);
Debug.Assert(_ID.Length > 0, "Could not create audio file signal source '" + Name + "' from file path " + FilePath);
//Debug.Log("Created audio file signal source with id '" + _ID + "'");
VAUAdapter.VA.SetSignalSourceBufferLooping (_ID, IsLooping);
}
void Start()
{
if (PlayOnStart)
{
VAUAdapter.VA.SetSignalSourceBufferPlaybackAction(_ID, "PLAY");
}
UpdatePlaybackState();
}
void OnDestroy()
......@@ -44,4 +52,16 @@ public class VAUSignalSourceAudioFile : VAUSignalSource
if (_ID.Length > 0)
VAUAdapter.VA.DeleteSignalSource(_ID);
}
void Update()
{
UpdatePlaybackState();
//Debug.Log("Current play state for signal souce " + _ID + ": " + VAUAdapter.VA.GetSignalSourceBufferPlaybackState(_ID));
}
private void UpdatePlaybackState()
{
if (_ID.Length > 0)
PlaybackState = VAUAdapter.VA.GetSignalSourceBufferPlaybackState(_ID);
}
}
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