@@ -6,6 +6,7 @@ mod graphics;
66pub mod image;
77pub mod light;
88pub mod material;
9+ pub mod midi;
910pub mod render;
1011pub mod sketch;
1112mod surface;
@@ -34,8 +35,6 @@ use crate::{
3435 surface:: SurfacePlugin ,
3536} ;
3637
37- use processing_midi:: MidiPlugin ;
38-
3938static IS_INIT : OnceLock < ( ) > = OnceLock :: new ( ) ;
4039
4140thread_local ! {
@@ -270,7 +269,7 @@ fn create_app(config: Config) -> App {
270269 geometry:: GeometryPlugin ,
271270 LightPlugin ,
272271 material:: MaterialPlugin ,
273- MidiPlugin ,
272+ midi :: MidiPlugin ,
274273 ) ) ;
275274 app. add_systems ( First , ( clear_transient_meshes, activate_cameras) )
276275 . add_systems (
@@ -1342,3 +1341,29 @@ pub fn gltf_light(gltf_entity: Entity, index: usize) -> error::Result<Entity> {
13421341 . unwrap ( )
13431342 } )
13441343}
1344+
1345+ #[ cfg( not( target_arch = "wasm32" ) ) ]
1346+ pub fn midi_refresh_ports ( ) -> error:: Result < ( ) > {
1347+ app_mut ( |app| {
1348+ let world = app. world_mut ( ) ;
1349+ world. run_system_cached ( midi:: refresh_ports) . unwrap ( )
1350+ } )
1351+ }
1352+
1353+ #[ cfg( not( target_arch = "wasm32" ) ) ]
1354+ pub fn midi_connect ( port : usize ) -> error:: Result < ( ) > {
1355+ app_mut ( |app| {
1356+ let world = app. world_mut ( ) ;
1357+ world. run_system_cached_with ( midi:: connect, port) . unwrap ( )
1358+ } )
1359+ }
1360+
1361+ #[ cfg( not( target_arch = "wasm32" ) ) ]
1362+ pub fn midi_play_notes ( note : u8 ) -> error:: Result < ( ) > {
1363+ app_mut ( |app| {
1364+ let world = app. world_mut ( ) ;
1365+ world
1366+ . run_system_cached_with ( midi:: play_notes, note)
1367+ . unwrap ( )
1368+ } )
1369+ }
0 commit comments