From 6d11574759ecfdb42c687bd92fc640cc46ffad9e Mon Sep 17 00:00:00 2001 From: Niklas Eicker Date: Sun, 9 Jun 2024 22:01:43 +0200 Subject: [PATCH 1/5] Update to Bevy 0.14.0-rc.2 --- Cargo.toml | 6 +++--- src/audio.rs | 6 ++---- src/audio_output.rs | 36 ++++++++++++++++++----------------- src/channel/dynamic.rs | 33 +++++++++++--------------------- src/channel/typed.rs | 18 +++++------------- src/source/flac_loader.rs | 23 +++++++++------------- src/source/mp3_loader.rs | 23 +++++++++------------- src/source/ogg_loader.rs | 23 +++++++++------------- src/source/settings_loader.rs | 32 ++++++++++++++----------------- src/source/wav_loader.rs | 23 +++++++++------------- 10 files changed, 90 insertions(+), 133 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 535ebb0..59b71eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ wav = ["kira/wav"] settings_loader = ["dep:ron", "dep:serde", "kira/serde"] [dependencies] -bevy = { version = "0.13", default-features = false, features = ["bevy_asset"] } +bevy = { version = "0.14.0-rc.2", default-features = false, features = ["bevy_asset"] } anyhow = "1.0" uuid = { version = "1", features = ["fast-rng"] } kira = { version = "0.8", default-features = false, features = ["cpal"] } @@ -32,7 +32,7 @@ parking_lot = "0.12" thiserror = "1.0" [dev-dependencies.bevy] -version = "0.13" +version = "0.14.0-rc.2" default-features = false features = [ "bevy_asset", @@ -49,7 +49,7 @@ features = [ "tonemapping_luts", "ktx2", "zstd", - "multi-threaded", + "multi_threaded" ] [[example]] diff --git a/src/audio.rs b/src/audio.rs index e028e13..216c3fb 100644 --- a/src/audio.rs +++ b/src/audio.rs @@ -10,13 +10,13 @@ use bevy::app::{App, PreUpdate}; use bevy::asset::{AssetId, Handle}; use bevy::ecs::system::Resource; use bevy::prelude::{default, IntoSystemConfigs, PostUpdate}; -use bevy::utils::Uuid; use kira::sound::static_sound::{StaticSoundData, StaticSoundHandle}; use kira::sound::EndPosition; use kira::tween::Value; use kira::Volume; use std::marker::PhantomData; use std::time::Duration; +use uuid::Uuid; pub(crate) enum AudioCommand { Play(PlayAudioSettings), @@ -186,9 +186,7 @@ impl<'a> Drop for PlayAudioCommand<'a> { impl<'a> PlayAudioCommand<'a> { pub(crate) fn new(source: Handle, que: &'a dyn AudioCommandQue) -> Self { - let asset_id = AssetId::Uuid { - uuid: Uuid::new_v4(), - }; + let asset_id = AssetId::from(Uuid::new_v4()); Self { instance_handle: Handle::::Weak(asset_id), source, diff --git a/src/audio_output.rs b/src/audio_output.rs index dcf8030..353861d 100644 --- a/src/audio_output.rs +++ b/src/audio_output.rs @@ -464,18 +464,21 @@ mod test { use crate::{Audio, AudioPlugin}; use bevy::asset::{AssetId, AssetPlugin}; use bevy::prelude::*; - use bevy::utils::Uuid; use kira::manager::backend::mock::MockBackend; use kira::manager::AudioManagerSettings; + use uuid::Uuid; #[test] fn keeps_order_of_commands_to_retry() { // we only need this app to conveniently get a assets collection for `AudioSource`... let mut app = App::new(); app.add_plugins((MinimalPlugins, AssetPlugin::default(), AudioPlugin)); - let audio_source_assets = app.world.remove_resource::>().unwrap(); + let audio_source_assets = app + .world_mut() + .remove_resource::>() + .unwrap(); let mut audio_instance_assets = app - .world + .world_mut() .remove_resource::>() .unwrap(); @@ -484,12 +487,10 @@ mod test { instances: HashMap::default(), channels: HashMap::default(), }; - let audio_handle_one: Handle = Handle::::Weak(AssetId::Uuid { - uuid: Uuid::from_u128(1758302748397294), - }); - let audio_handle_two: Handle = Handle::::Weak(AssetId::Uuid { - uuid: Uuid::from_u128(2537024739048739), - }); + let audio_handle_one: Handle = + Handle::::Weak(AssetId::from(Uuid::from_u128(1758302748397294))); + let audio_handle_two: Handle = + Handle::::Weak(AssetId::from(Uuid::from_u128(2537024739048739))); let channel = AudioChannel::