feat: add PlayOnTrigger for music-synced audio playback
- Add PlayOnTrigger method to AudioSystem for scheduling audio playback on music sync events (beat/bar/grid) - Rename ButtonInvoker to SetStateBind for better clarity - Update PlaySoundBind to support both direct playback and trigger-based playback with callback flags - Add CallbackFlags enum (MusicSyncBeat, MusicSyncBar, MusicSyncGrid) - Update Metronome demo to use new callback flag naming convention - Add test audio file sfx_notice_test.wav - Update scene UI to demonstrate PlayOnTrigger functionality
This commit is contained in:
@@ -3,6 +3,10 @@ using UnityEngine;
|
||||
|
||||
namespace OCES
|
||||
{
|
||||
/// <summary>
|
||||
/// Drag this component to any game object.
|
||||
/// Then you will get a metronome :)
|
||||
/// </summary>
|
||||
public class Metronome : MonoBehaviour
|
||||
{
|
||||
void Start()
|
||||
@@ -10,17 +14,17 @@ namespace OCES
|
||||
AudioSystem.Instance.OnBeat += u =>
|
||||
{
|
||||
AudioSystem.Instance.Play(52);
|
||||
Debug.Log($"Container {u} is OnBeat");
|
||||
Debug.Log($"Container {u} is MusicSyncBeat");
|
||||
};
|
||||
AudioSystem.Instance.OnBar += u =>
|
||||
{
|
||||
AudioSystem.Instance.Play(53);
|
||||
Debug.Log($"Container {u} is OnBar");
|
||||
Debug.Log($"Container {u} is MusicSyncBar");
|
||||
};
|
||||
AudioSystem.Instance.OnGrid += u =>
|
||||
{
|
||||
AudioSystem.Instance.Play(54);
|
||||
Debug.Log($"Container {u} is OnGrid");
|
||||
Debug.Log($"Container {u} is MusicSyncGrid");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user