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
					
				| @ -87,6 +87,10 @@ impl Plugin for AudioPlugin { | |||||||
|                     .run_if(audio_output_available) |                     .run_if(audio_output_available) | ||||||
|                     .after(TransformSystem::TransformPropagate), // For spatial audio transforms
 |                     .after(TransformSystem::TransformPropagate), // For spatial audio transforms
 | ||||||
|             ) |             ) | ||||||
|  |             .add_systems( | ||||||
|  |                 PostUpdate, | ||||||
|  |                 (update_emitter_positions, update_listener_positions).in_set(AudioPlaySet), | ||||||
|  |             ) | ||||||
|             .init_resource::<AudioOutput>(); |             .init_resource::<AudioOutput>(); | ||||||
| 
 | 
 | ||||||
|         #[cfg(any(feature = "mp3", feature = "flac", feature = "wav", feature = "vorbis"))] |         #[cfg(any(feature = "mp3", feature = "flac", feature = "wav", feature = "vorbis"))] | ||||||
| @ -107,11 +111,8 @@ impl AddAudioSource for App { | |||||||
|     { |     { | ||||||
|         self.init_asset::<T>().add_systems( |         self.init_asset::<T>().add_systems( | ||||||
|             PostUpdate, |             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 |         self | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 irate
						irate