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§
- Audio
Loader - Loads files as
AudioSourceAssets - Audio
Player - A component for playing a sound.
- Audio
Plugin - Adds support for audio playback to a Bevy Application
- Audio
Sink - Used to control audio during playback.
- Audio
Source - A source of audio data
- Default
Spatial Scale - The default scale factor applied to the positions of audio sources and listeners for
spatial audio. Can be overridden for individual sounds in
PlaybackSettings. - Global
Volume - Use this
Resourceto control the global volume of all audio. - Pitch
- A source of sine wave sound
- Playback
Settings - Initial settings to be used when audio starts playing.
- Spatial
Audio Sink - Used to control spatial audio during playback.
- Spatial
Listener - Settings for the listener for spatial audio sources.
- Spatial
Scale - A scale factor applied to the positions of audio sources and listeners for spatial audio.
Enums§
- Playback
Mode - The way Bevy manages the sound playback.
- Seek
Error - Occurs when try_seek fails because the underlying decoder has an error or does not support seeking.
- Volume
- A
Volumerepresents an audio source’s volume level.
Traits§
- AddAudio
Source - A trait that allows adding a custom audio source to the object.
This is implemented for
Appto allow registering customDecodabletypes. - Audio
Sink Playback - Common interactions with an audio sink.
- Cpal
Sample - A trait for working generically across different Sample format types.
- Decodable
- A type implementing this trait can be converted to a
rodio::Sourcetype. - Sample
- Represents a value of a single sample.
- Source
- A source of samples.