use bevy::prelude::*; use bevy_kira_audio::prelude::*; /// This example needs to be played in release mode! `cargo run --example stress_test --release` /// A large amount (75) of sounds will be played in every frame. /// /// The main objective here is to demonstrate that the plugin and Kira can handle /// large sound volumes over a longer period of time. /// /// Depending on your machine, the number of sounds you can play before audio issues appear may differ. fn main() { App::new() // We need to increase the queue sizes of the audio backend. // The default is 128 per queue, which is way too low for playing as many sounds // as this example does. .insert_resource(AudioSettings { sound_capacity: 8192, command_capacity: 4096, }) .add_plugins((DefaultPlugins, AudioPlugin)) .add_systems(Startup, prepare) .add_systems(Update, (check, play)) .run(); } #[derive(Resource)] struct LoadingAudioHandle(Handle); #[derive(Resource)] struct AudioHandle(Handle); fn prepare(asset_server: Res, mut commands: Commands, audio: Res