diff --git a/Cargo.toml b/Cargo.toml index a49601b..7df8890 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,14 +33,14 @@ features = [ [dependencies.bevy] # git = "https://github.com/bevyengine/bevy" -version = "0.11" -default-features = false +version = "0.12" +default-features = false features = ["bevy_asset"] [dependencies.bevy_kira_audio] # git = "https://github.com/NiklasEi/bevy_kira_audio.git" # branch = "bevy_main" -version = "0.16" +version = "0.18" default-features = false features = ["wav"] optional = true @@ -55,7 +55,7 @@ features = ["wav"] [dev-dependencies.bevy] # git = "https://github.com/bevyengine/bevy" -version = "0.11" +version = "0.12" default-features = false features = [ "bevy_core_pipeline", @@ -70,7 +70,7 @@ features = [ "bevy_gilrs", "png", "hdr", - "filesystem_watcher", + "file_watcher", "x11" ] diff --git a/src/dsp_source.rs b/src/dsp_source.rs index 99ea0cb..751ea5f 100644 --- a/src/dsp_source.rs +++ b/src/dsp_source.rs @@ -4,6 +4,7 @@ use { crate::dsp_graph::DspGraph, bevy::reflect::{TypePath, TypeUuid}, + bevy::asset::{Asset}, fundsp::{hacker32::AudioUnit32, wave::Wave32}, std::{cell::RefCell, sync::Arc}, }; @@ -12,7 +13,7 @@ use { /// /// These can be played directly when the [`SourceType`] is dynamic, /// otherwise, the DSP source must be played with a given duration. -#[derive(TypeUuid, Clone, TypePath)] +#[derive(Asset, TypeUuid, Clone, TypePath)] #[uuid = "107a9069-d37d-46a8-92f2-23ec23b73bf6"] pub struct DspSource { pub(crate) dsp_graph: Arc, diff --git a/src/lib.rs b/src/lib.rs index e09eabc..7a5ff71 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,13 +25,13 @@ //! It is more intuitive to remove the parentheses when writing these types of expressions, //! as FunDSP is essentially a domain specific language. //! See the [FunDSP] README for more information. -//! +//! //! [FunDSP]: https://github.com/SamiPerttu/fundsp //! [Bevy]: https://bevyengine.org/ use { backend::{Backend, DefaultBackend}, - bevy::prelude::{AddAsset, App, Plugin}, + bevy::prelude::{App, AssetApp, Plugin}, dsp_graph::DspGraph, dsp_manager::DspManager, dsp_source::{DspSource, SourceType}, @@ -49,8 +49,7 @@ pub mod dsp_source; /// # use bevy::prelude::*; /// # use bevy_fundsp::prelude::*; /// App::new() -/// .add_plugins(DefaultPlugins) -/// .add_plugin(DspPlugin::default()) +/// .add_plugins((DefaultPlugins, DspPlugin::default())) /// .run() /// ``` pub struct DspPlugin { @@ -70,8 +69,7 @@ impl DspPlugin { /// # use bevy::prelude::*; /// # use bevy_fundsp::prelude::*; /// App::new() - /// .add_plugins(DefaultPlugins) - /// .add_plugin(DspPlugin::new(44100.0)) + /// .add_plugins((DefaultPlugins, DspPlugin::new(44100.0))) /// .run() /// ``` #[allow(clippy::must_use_candidate)] @@ -89,7 +87,7 @@ impl Default for DspPlugin { impl Plugin for DspPlugin { fn build(&self, app: &mut App) { app.insert_resource(DspManager::new(self.sample_rate)) - .add_asset::(); + .init_asset::(); DefaultBackend::init_app(app); } @@ -105,8 +103,7 @@ pub trait DspAppExt { /// # use bevy::prelude::*; /// # use bevy_fundsp::prelude::*; /// App::new() - /// .add_plugins(DefaultPlugins) - /// .add_plugin(DspPlugin::default()) + /// .add_plugins((DefaultPlugins, DspPlugin::default())) /// .add_dsp_source(a_simple_440hz_sine_wave, SourceType::Dynamic) /// .run(); ///