Crate bevy_audio

Source
Expand description

Audio support for the game engine Bevy

fn main() {
   App::new()
        .add_plugins((MinimalPlugins, AssetPlugin::default(), AudioPlugin::default()))
        .add_systems(Startup, play_background_audio)
        .run();
}

fn play_background_audio(asset_server: Res<AssetServer>, mut commands: Commands) {
    commands.spawn((
        AudioPlayer::new(asset_server.load("background_audio.ogg")),
        PlaybackSettings::LOOP,
    ));
}

Modules§

prelude
The audio prelude.

Structs§

AudioLoader
Loads files as AudioSource Assets
AudioPlayer
A component for playing a sound.
AudioPlugin
Adds support for audio playback to a Bevy Application
AudioSink
Used to control audio during playback.
AudioSource
A source of audio data
DefaultSpatialScale
The default scale factor applied to the positions of audio sources and listeners for spatial audio. Can be overridden for individual sounds in PlaybackSettings.
GlobalVolume
Use this Resource to control the global volume of all audio.
Pitch
A source of sine wave sound
PlaybackSettings
Initial settings to be used when audio starts playing.
SpatialAudioSink
Used to control spatial audio during playback.
SpatialListener
Settings for the listener for spatial audio sources.
SpatialScale
A scale factor applied to the positions of audio sources and listeners for spatial audio.

Enums§

PlaybackMode
The way Bevy manages the sound playback.
Volume
A Volume represents an audio source’s volume level.

Traits§

AddAudioSource
A trait that allows adding a custom audio source to the object. This is implemented for App to allow registering custom Decodable types.
AudioSinkPlayback
Common interactions with an audio sink.
CpalSample
A trait for working generically across different Sample format types.
Decodable
A type implementing this trait can be converted to a rodio::Source type.
Sample
Represents a value of a single sample.
Source
A source of samples.