@@ -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;
@@ -36,8 +37,6 @@ use crate::{
3637 surface:: SurfacePlugin ,
3738} ;
3839
39- use processing_midi:: MidiPlugin ;
40-
4140static IS_INIT : OnceLock < ( ) > = OnceLock :: new ( ) ;
4241
4342thread_local ! {
@@ -281,7 +280,7 @@ fn create_app(config: Config) -> App {
281280 geometry:: GeometryPlugin ,
282281 LightPlugin ,
283282 material:: MaterialPlugin ,
284- MidiPlugin ,
283+ midi :: MidiPlugin ,
285284 ) ) ;
286285 app. add_systems ( First , ( clear_transient_meshes, activate_cameras) )
287286 . add_systems (
@@ -1394,3 +1393,29 @@ pub fn gltf_light(gltf_entity: Entity, index: usize) -> error::Result<Entity> {
13941393 . unwrap ( )
13951394 } )
13961395}
1396+
1397+ #[ cfg( not( target_arch = "wasm32" ) ) ]
1398+ pub fn midi_refresh_ports ( ) -> error:: Result < ( ) > {
1399+ app_mut ( |app| {
1400+ let world = app. world_mut ( ) ;
1401+ world. run_system_cached ( midi:: refresh_ports) . unwrap ( )
1402+ } )
1403+ }
1404+
1405+ #[ cfg( not( target_arch = "wasm32" ) ) ]
1406+ pub fn midi_connect ( port : usize ) -> error:: Result < ( ) > {
1407+ app_mut ( |app| {
1408+ let world = app. world_mut ( ) ;
1409+ world. run_system_cached_with ( midi:: connect, port) . unwrap ( )
1410+ } )
1411+ }
1412+
1413+ #[ cfg( not( target_arch = "wasm32" ) ) ]
1414+ pub fn midi_play_notes ( note : u8 ) -> error:: Result < ( ) > {
1415+ app_mut ( |app| {
1416+ let world = app. world_mut ( ) ;
1417+ world
1418+ . run_system_cached_with ( midi:: play_notes, note)
1419+ . unwrap ( )
1420+ } )
1421+ }
0 commit comments