//! This example illustrates how to load and play an audio file, and control how it's played. use bevy::{audio::Volume, math::ops, prelude::*}; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(Startup, setup) .add_systems(Update, (update_speed, pause, mute, volume)) .run(); } fn setup(mut commands: Commands, asset_server: Res) { commands.spawn(( AudioPlayer::new(asset_server.load("sounds/Windless Slopes.ogg")), MyMusic, )); // example instructions commands.spawn(( Text::new("-/=: Volume Down/Up\nSpace: Toggle Playback\nM: Toggle Mute"), Node { position_type: PositionType::Absolute, bottom: Val::Px(12.0), left: Val::Px(12.0), ..default() }, )); // camera commands.spawn(Camera3d::default()); } #[derive(Component)] struct MyMusic; fn update_speed(music_controller: Query<&AudioSink, With>, time: Res