Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should we trigger an event when audio ends or let users reach into PlaybackState in their own systems? #24

Open
mgi388 opened this issue Jun 22, 2024 · 0 comments
Labels
Feature New additions to the API surface

Comments

@mgi388
Copy link
Contributor

mgi388 commented Jun 22, 2024

Summary

Callers can add a AudioFileEndBehavior component to their entity to indicate to bevy-kira-components what it should do when audio ends. This allows callers to have some convenience around entity/audio cleanup without having to poll themselves.

I suggested on Discord that it could be a good idea to additionally fire an event when audio ends, and let callers handle it themselves. I'm currently using Bevy's RemovedComponents to watch for audio ending and then inserting a new AudioFileBundle onto my entity to make it play the next sound in my SFX sequence. Despite bugs such as #23, I think RemovedComponents is working fine for my use case and so I don't actually have a need for such an event right now.

Triggering an event could be a good future escape hatch for cases where bevy-kira-components is too opinionated about ways the user wants to handle audio ended, but I also realised that in the audio_control example it's relatively easy to check the playback state yourself and do what you want. Plus, you can handle any playback state, not just Stopped. So it's not entirely clear to me that we should trigger an event here and so I've created this issue as a way to track that the idea exists, but not that it should necessarily be done (and to be clear that means at some stage this issue could just be closed as wontfix).

I know that in Bevy 0.14 observers are going to be available and there's also a question of whether that feature is appropriate here. It also looks like RemovedComponents is planned to be replaced with observers.

@mgi388 mgi388 added the Feature New additions to the API surface label Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New additions to the API surface
Projects
Development

No branches or pull requests

1 participant