Crates.io | bevy_audio_controller_derive |
lib.rs | bevy_audio_controller_derive |
version | |
source | src |
created_at | 2024-11-05 20:27:19.990095 |
updated_at | 2024-12-01 01:53:45.502932 |
description | Derive macros for bevy_audio_controller |
homepage | https://github.com/TurtIeSocks/bevy_audio_controller |
repository | https://github.com/TurtIeSocks/bevy_audio_controller |
max_upload_size | |
id | 1437128 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
An extremely convenient plugin that provides a solid audio controller for Bevy with very minimal boilerplate!
AssetServer
directly and provides a convenient enum so you can avoid "magic strings" in your coderegister_audio_channel
trait to allow you to easily add multiple audio channels to your appAudioChannel
derive macro adds convenient methods to the channel marker structuse bevy::{prelude::*, audio::PlaybackSettings};
use bevy_audio_controller::prelude::*;
#[derive(Component, Default, AudioChannel)]
struct SfxChannel;
type SfxEvent = PlayEvent<SfxChannel>;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(AudioControllerPlugin)
.register_audio_channel::<SfxChannel>()
.add_systems(Update, play_fire)
.run();
}
fn play_fire(mut ew: EventWriter<SfxEvent>) {
// even though this is called on every frame, it will only be played once the previous clip has finished
ew.send(SfxEvent::new(AudioFiles::FireOGG).with_settings(PlaybackSettings::DESPAWN));
}
default
None
inspect
Adds additional reflection traits to the structs used by this plugin to make them available in bevy-egui-inspector
Requires that channel components must also derive Reflect
// If you are using the `inspect` feature conditionally, you can use the following pattern
#[derive(Component, Default, AudioChannel)]
#[cfg_attr(feature = "inspect", derive(Reflect))]
#[cfg_attr(feature = "inspect", reflect(Component))]
struct SfxChannel;
// Otherwise, this is fine
#[derive(Component, Default, AudioChannel, Reflect)]
#[reflect(Component)]
struct MusicChannel;
mp3
Enables support for MP3 audio files.
ogg
Enables support for OGG audio files
flac
Enables support for FLAC audio files
wav
Enables support for WAV audio files
all-codecs
Enables support for all audio codecs
All examples require --features="ogg"
flag to work. If you would like to view more details with bevy-egui-inspector, run with --all-features
instead.
Demonstrates:
Inputs:
cargo run --example basic --features="ogg"
Demonstrates:
cargo run --example channels --features="ogg"
Demonstrates:
Inputs:
cargo run --example event_options --features="ogg"
Demonstrates:
Inputs:
DelayMode::Immediate
cargo run --example ecs --features="ogg"
Demonstrates:
Percent
& Milliseconds
variations of the DelayMode
enum for finer control over when a track is played cargo run --example delays --features="ogg"
Demonstrates:
Inputs:
cargo run --example volume --features="ogg"
Demonstrates:
cargo run --example querying --features="ogg"
bevy | bevy_audio_controller |
---|---|
0.15 | 0.3 |
0.14 | 0.2 |