vibelang_keys/lib.rs
1//! vibelang-keys - Terminal MIDI Keyboard for VibeLang
2//!
3//! A terminal-based MIDI keyboard that lets you play music using your computer keyboard.
4//! Features include:
5//!
6//! - Piano-style visualization in the terminal
7//! - Multiple keyboard layouts (German QWERTZ, US QWERTY, or custom)
8//! - JACK MIDI output
9//! - OS-level key detection for reliable key release handling
10//! - Configurable via TOML file
11//!
12//! # Usage as a Library
13//!
14//! ```no_run
15//! use vibelang_keys::{VirtualKeyboard, KeyboardConfig};
16//!
17//! // Create a keyboard with default config
18//! let mut keyboard = VirtualKeyboard::new(KeyboardConfig::default());
19//!
20//! // Or load from config file
21//! let config = vibelang_keys::Config::load_or_default();
22//! let mut keyboard = VirtualKeyboard::new(config.to_keyboard_config());
23//!
24//! // Handle key events (uses char, not KeyCode)
25//! if let Some((note, velocity)) = keyboard.key_down('c') {
26//! println!("Play note {} with velocity {}", note, velocity);
27//! }
28//! ```
29
30pub mod config;
31pub mod error;
32pub mod keyboard;
33pub mod midi;
34pub mod os_keyboard;
35pub mod ui;
36
37// Re-export main types
38pub use config::{Config, KeyboardLayout, Theme};
39pub use error::{Error, Result};
40pub use keyboard::{
41 note_name, KeyMapping, KeyboardConfig, VirtualKeyboard, C3_MIDI, DEFAULT_VELOCITY,
42};
43pub use midi::{MidiBackend, MidiOutput};
44pub use os_keyboard::{is_available as os_keyboard_available, OsKeyEvent, OsKeyboardListener};
45pub use ui::{
46 render_keyboard, render_keyboard_compact, render_keyboard_standalone, KeyboardWidget,
47};