diff --git a/Cargo.toml b/Cargo.toml index 17910df..0b4cc37 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,25 +21,25 @@ exclude = [ name = "bevy_midi" [dependencies] -midir = "0.9" +midir = "0.10" crossbeam-channel = "0.5.8" [dev-dependencies] -bevy_egui = { version = "0.23", features = ["immutable_ctx"]} -strum = { version = "0.25", features = ["derive"] } -bevy_mod_picking = "0.17" +bevy_egui = { version = "0.27", features = ["immutable_ctx"]} +strum = { version = "0.26", features = ["derive"] } +bevy_mod_picking = "0.18" [dependencies.bevy] -version = "0.12" +version = "0.13" default-features = false features = ["multi-threaded"] [dev-dependencies.bevy] -version = "0.12" +version = "0.13" features = ["bevy_core_pipeline","bevy_asset", "bevy_scene", "bevy_render", "bevy_winit", "bevy_gltf", "bevy_ui", "bevy_text", "zstd", "tonemapping_luts", "ktx2", "hdr"] default-features = false [target.'cfg(target_os = "linux")'.dev-dependencies.bevy] -version = "0.12" +version = "0.13" features = ["x11", "wayland"] default-features = false diff --git a/examples/input.rs b/examples/input.rs index a25caf4..fab1262 100644 --- a/examples/input.rs +++ b/examples/input.rs @@ -5,16 +5,16 @@ use bevy::{ use bevy_midi::prelude::*; const KEY_PORT_MAP: [(KeyCode, usize); 10] = [ - (KeyCode::Key0, 0), - (KeyCode::Key1, 1), - (KeyCode::Key2, 2), - (KeyCode::Key3, 3), - (KeyCode::Key4, 4), - (KeyCode::Key5, 5), - (KeyCode::Key6, 6), - (KeyCode::Key7, 7), - (KeyCode::Key8, 8), - (KeyCode::Key9, 9), + (KeyCode::Digit0, 0), + (KeyCode::Digit1, 1), + (KeyCode::Digit2, 2), + (KeyCode::Digit3, 3), + (KeyCode::Digit4, 4), + (KeyCode::Digit5, 5), + (KeyCode::Digit6, 6), + (KeyCode::Digit7, 7), + (KeyCode::Digit8, 8), + (KeyCode::Digit9, 9), ]; fn main() { @@ -27,6 +27,7 @@ fn main() { .add_plugins(DefaultPlugins.set(LogPlugin { level: Level::WARN, filter: "bevy_midi=debug".to_string(), + update_subscriber: None, })) .add_plugins(MidiInputPlugin) .add_systems(Startup, setup) @@ -44,13 +45,13 @@ fn main() { .run(); } -fn refresh_ports(keys: Res>, input: Res) { - if keys.just_pressed(KeyCode::R) { +fn refresh_ports(keys: Res>, input: Res) { + if keys.just_pressed(KeyCode::KeyR) { input.refresh_ports(); } } -fn connect(keys: Res>, input: Res) { +fn connect(keys: Res>, input: Res) { for (keycode, index) in &KEY_PORT_MAP { if keys.just_pressed(*keycode) { if let Some((_, port)) = input.ports().get(*index) { @@ -60,7 +61,7 @@ fn connect(keys: Res>, input: Res) { } } -fn disconnect(keys: Res>, input: Res) { +fn disconnect(keys: Res>, input: Res) { if keys.just_pressed(KeyCode::Escape) { input.disconnect(); } diff --git a/examples/output.rs b/examples/output.rs index 433c837..f8dc3a7 100644 --- a/examples/output.rs +++ b/examples/output.rs @@ -2,26 +2,26 @@ use bevy::prelude::*; use bevy_midi::prelude::*; const KEY_PORT_MAP: [(KeyCode, usize); 10] = [ - (KeyCode::Key0, 0), - (KeyCode::Key1, 1), - (KeyCode::Key2, 2), - (KeyCode::Key3, 3), - (KeyCode::Key4, 4), - (KeyCode::Key5, 5), - (KeyCode::Key6, 6), - (KeyCode::Key7, 7), - (KeyCode::Key8, 8), - (KeyCode::Key9, 9), + (KeyCode::Digit0, 0), + (KeyCode::Digit1, 1), + (KeyCode::Digit2, 2), + (KeyCode::Digit3, 3), + (KeyCode::Digit4, 4), + (KeyCode::Digit5, 5), + (KeyCode::Digit6, 6), + (KeyCode::Digit7, 7), + (KeyCode::Digit8, 8), + (KeyCode::Digit9, 9), ]; const KEY_NOTE_MAP: [(KeyCode, u8); 7] = [ - (KeyCode::A, 57), - (KeyCode::B, 59), - (KeyCode::C, 60), - (KeyCode::D, 62), - (KeyCode::E, 64), - (KeyCode::F, 65), - (KeyCode::G, 67), + (KeyCode::KeyA, 57), + (KeyCode::KeyB, 59), + (KeyCode::KeyC, 60), + (KeyCode::KeyD, 62), + (KeyCode::KeyE, 64), + (KeyCode::KeyF, 65), + (KeyCode::KeyG, 67), ]; fn main() { @@ -46,13 +46,13 @@ fn main() { .run(); } -fn refresh_ports(input: Res>, output: Res) { - if input.just_pressed(KeyCode::R) { +fn refresh_ports(input: Res>, output: Res) { + if input.just_pressed(KeyCode::KeyR) { output.refresh_ports(); } } -fn connect(input: Res>, output: Res) { +fn connect(input: Res>, output: Res) { for (keycode, index) in &KEY_PORT_MAP { if input.just_pressed(*keycode) { if let Some((_, port)) = output.ports().get(*index) { @@ -62,13 +62,13 @@ fn connect(input: Res>, output: Res) { } } -fn disconnect(input: Res>, output: Res) { +fn disconnect(input: Res>, output: Res) { if input.just_pressed(KeyCode::Escape) { output.disconnect(); } } -fn play_notes(input: Res>, output: Res) { +fn play_notes(input: Res>, output: Res) { for (keycode, note) in &KEY_NOTE_MAP { if input.just_pressed(*keycode) { output.send([0b1001_0000, *note, 127].into()); // Note on, channel 1, max velocity diff --git a/examples/piano.rs b/examples/piano.rs index 84c8dc0..15a7513 100644 --- a/examples/piano.rs +++ b/examples/piano.rs @@ -16,6 +16,7 @@ fn main() { .add_plugins(DefaultPlugins.set(LogPlugin { level: Level::WARN, filter: "bevy_midi=debug".to_string(), + update_subscriber: None, })) .add_plugins(DefaultPickingPlugins) .add_plugins(MidiInputPlugin) @@ -73,8 +74,8 @@ fn setup( let mut white_key_0: Handle = asset_server.load("models/white_key_0.gltf#Mesh0/Primitive0"); let mut white_key_1: Handle = asset_server.load("models/white_key_1.gltf#Mesh0/Primitive0"); let mut white_key_2: Handle = asset_server.load("models/white_key_2.gltf#Mesh0/Primitive0"); - let b_mat = materials.add(Color::rgb(0.1, 0.1, 0.1).into()); - let w_mat = materials.add(Color::rgb(1.0, 1.0, 1.0).into()); + let b_mat = materials.add(Color::rgb(0.1, 0.1, 0.1)); + let w_mat = materials.add(Color::rgb(1.0, 1.0, 1.0)); //Create keyboard layout let pos_black = pos + Vec3::new(0., 0.06, 0.);