Bro_Audio icon indicating copy to clipboard operation
Bro_Audio copied to clipboard

[Bug] Using IAudioPlayer.SetScheduledStartTime() or IAudioPlayer.SetDelay() doesn't fully setup the player before playing

Open Zallist opened this issue 2 months ago • 0 comments

When using IAudioPlayer.SetScheduledStartTime() or IAudioPlayer.SetDelay() you're not guaranteed to fully setup or trigger everything that a normal play would, since AudioSource.PlayScheduled() runs on the DSP thread and can start playing music before the frame's Update cycle runs.

Missing things:

  • Trigger any MusicPlayer decorators
  • Assign an outputAudioMixerGroup (AudioTrack)
  • Trigger SetPlayPosition() for trimmed audio
  • Trigger OnStart() callbacks, or an initial OnUpdate()
  • Whatever else happens AFTER yield return WaitForScheduledStartTime(); in PlayControl()

This is most apparent when playing a very short sound clip set to trigger between frames, with all output mixer groups muted. The sound can still be heard and has a null output mixer group.

Workaround for now: BroAudio.Play(sound).OnStart(p => p.SetScheduledStartTime(dspTime))

Since this causes all the normal setup to be done before triggering PlayScheduled.

Zallist avatar Nov 11 '25 22:11 Zallist