Moving PlaybackMode to AudioPlayer and defaulting to PlaybackMode::Remove#16598
Moving PlaybackMode to AudioPlayer and defaulting to PlaybackMode::Remove#16598seivan wants to merge 1 commit intobevyengine:mainfrom
PlaybackMode to AudioPlayer and defaulting to PlaybackMode::Remove#16598Conversation
|
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
PlaybackMode to AudioPlayer and defaulting to PlaybackMode::Remove`PlaybackMode to AudioPlayer and defaulting to PlaybackMode::Remove
a3b503b to
42ffd89
Compare
Adding `PlaybackMode` to `AudioPlayer` Adding convience methods to `AudioPlayer` to create with different `PlaybackMode`s
42ffd89 to
2d14249
Compare
|
Just noting that this would close #12359. I haven't looked closely at the PR yet. |
I actually wanted to remove |
|
For what it's worth, I have changed my opinion since writing up #12359 and I don't personally feel that automatic despawning ore removal by default is the right choice. The current behavior seems like what I would expect when I spawn any other entity. I agree that |
Objective
Fix: #12359
Wanted to make it clear what happens when audio is being played, and the source is related to the
PlaybackMode.You're either playing sound effects that are temporary in lifetime, or constant repeated music.
Some sound effects related to existing entity while others are children of said entities.
I wanted the API to actually reflect that, instead of being split over two components.
It requires explicit input about
PlaybackModeThis break existing code in two places:
AudioPlayer::new()is used it changes default mode toRemove, current default isOnce.Solution
PlaybackModetoPlaybackMode::RemovePlaybackModetoAudioPlayerAudioPlayerto create with differentPlaybackModesTesting
Performance? Since
AudioPlayernow holdsPlaybackModethere can have been a difference in internal optimizations that I might have missed.Run audio examples.
Tested only on
macOS, I don't think it's relevant for other platforms unless there are performance implications with the new defaultremoveforPlaybackMode.Migration Guide
Changed the default behaviour to be
removeIntroducing new functions to create
AudioPlayerExamples:
Old
New
Old
New