Crate micro_musicbox

source ·
Expand description

micro_musicbox provides a convenience wrapper around bevy_kira_audio, handling all the setup for the common game audio scenario. This includes channel management, giving you control of the audio levels for your music, ambiance, sound effects and UI separately from the start.

§Quickstart

  • Implement SuppliesAudio for a resource (or use the built-in impl on AssetServer)
  • Include the MusixBocPlugin plugin, or the CombinedAudioPlugins plugin group in your app, providing your SuppliesAudio impl as the generic parameter
  • Use MusicBox<T: SuppliesAudio> as a parameter on a system
  • Call one of the MusicBox::play_* methods to play sounds
fn main() {
    App::new()
        .add_plugins(AssetPlugin::default())
        .add_plugins(CombinedAudioPlugins::<AssetServer>::new())
        .add_systems(Startup, |mut music_box: MusicBox<AssetServer>| {
            music_box.play_music("music/bing_bong.mp3");
        });
}

Modules§

Structs§

  • A Bevy plugin group that adds bevy_kira_audio as well as the plugin required to be able to use a MusicBox
  • A Bevy plugin that sets up all of the audio channels, creates the required settings resources, and configures syncing volume levels for a MusicBox that uses the supplied T parameter for fetching audio