mirror of
https://github.com/bevyengine/bevy
synced 2025-02-16 14:08:32 +00:00
Deduplicate systems in bevy_audio (#10906)
# Objective The `update_emitter_positions`, and `update_listener_positions` systems are added for every call to `add_audio_source`. Instead, add them once in the `AudioPlugin` directly. Also merged the calls to `add_systems`. Caught while working on my schedule visualizer c:
This commit is contained in:
parent
d2614f2d80
commit
a4c27288c7
1 changed files with 5 additions and 4 deletions
|
@ -87,6 +87,10 @@ impl Plugin for AudioPlugin {
|
|||
.run_if(audio_output_available)
|
||||
.after(TransformSystem::TransformPropagate), // For spatial audio transforms
|
||||
)
|
||||
.add_systems(
|
||||
PostUpdate,
|
||||
(update_emitter_positions, update_listener_positions).in_set(AudioPlaySet),
|
||||
)
|
||||
.init_resource::<AudioOutput>();
|
||||
|
||||
#[cfg(any(feature = "mp3", feature = "flac", feature = "wav", feature = "vorbis"))]
|
||||
|
@ -107,11 +111,8 @@ impl AddAudioSource for App {
|
|||
{
|
||||
self.init_asset::<T>().add_systems(
|
||||
PostUpdate,
|
||||
play_queued_audio_system::<T>.in_set(AudioPlaySet),
|
||||
(play_queued_audio_system::<T>, cleanup_finished_audio::<T>).in_set(AudioPlaySet),
|
||||
);
|
||||
self.add_systems(PostUpdate, cleanup_finished_audio::<T>.in_set(AudioPlaySet));
|
||||
self.add_systems(PostUpdate, update_emitter_positions.in_set(AudioPlaySet));
|
||||
self.add_systems(PostUpdate, update_listener_positions.in_set(AudioPlaySet));
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue