auxide_midi/lib.rs
1//! # Auxide MIDI
2//!
3//! MIDI input integration and polyphonic synthesizer for Auxide DSP graphs.
4//!
5//! This crate provides:
6//! - MIDI input handling with midir
7//! - Voice allocation and management for polyphonic synthesis
8//! - Real-time-safe parameter updates
9//! - Integration with auxide-dsp nodes
10//!
11//! ## Example
12//!
13//! ```rust
14//! use auxide_midi::{MidiInputHandler, VoiceAllocator, MidiEvent};
15//!
16//! fn example() -> Result<(), Box<dyn std::error::Error>> {
17//! // List available MIDI devices
18//! let devices = MidiInputHandler::list_devices()?;
19//!
20//! // Create voice allocator
21//! let mut voice_allocator = VoiceAllocator::new();
22//!
23//! // Create MIDI input handler
24//! let mut midi_handler = MidiInputHandler::new();
25//!
26//! // Connect to first device if available
27//! if !devices.is_empty() {
28//! midi_handler.connect_device(0)?;
29//!
30//! // Process MIDI events
31//! while let Some(event) = midi_handler.try_recv() {
32//! match event {
33//! MidiEvent::NoteOn(note, vel) => {
34//! if let Some(voice_id) = voice_allocator.allocate_voice(note) {
35//! // Trigger voice
36//! }
37//! }
38//! MidiEvent::NoteOff(note, _) => {
39//! voice_allocator.release_voice(note);
40//! }
41//! _ => {}
42//! }
43//! }
44//! }
45//! Ok(())
46//! }
47//! ```
48
49#![forbid(unsafe_code)]
50
51pub mod conversions;
52pub mod voice_allocator;
53pub mod midi_input;
54pub mod cc_mapping;
55pub mod smoother;
56pub mod voice_state;
57
58pub use conversions::*;
59pub use voice_allocator::*;
60pub use midi_input::*;
61pub use cc_mapping::*;
62pub use smoother::*;
63pub use voice_state::*;