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:
2026-04-16 14:39:58 +08:00
parent 0fb0c51f65
commit 813f4254c9
11 changed files with 99 additions and 127 deletions
+29
View File
@@ -0,0 +1,29 @@
using UnityEngine;
using UnityEngine.UI;
using OCES.Audio;
using UnityEngine.Audio;
namespace OCES
{
public class SetStateBind : MonoBehaviour
{
public GameState targetGameState;
public bool enableLowpass;
public Text buttonText;
Button m_button;
void Awake()
{
this.buttonText.text = this.buttonText.text.Replace("PlaceHolder", this.targetGameState.ToString());
}
public void OnButtonPressed()
{
AudioSystem.Instance.SetState(this.targetGameState);
AudioSystem.Instance.SetLowpass(this.enableLowpass);
}
}
}