Skip to main content

maolan_engine/
lib.rs

1mod audio;
2pub mod client;
3mod engine;
4pub mod history;
5mod hw;
6pub mod kind;
7pub mod message;
8mod midi;
9pub mod mutex;
10mod osc;
11pub mod plugins;
12mod routing;
13mod rubberband;
14pub mod state;
15mod track;
16pub mod workers;
17pub use workers::worker;
18
19pub use plugins::clap;
20#[cfg(all(unix, not(target_os = "macos")))]
21pub use plugins::lv2;
22pub use plugins::vst3;
23
24use tokio::sync::mpsc::{Sender, channel};
25use tokio::task::JoinHandle;
26
27#[cfg(target_os = "macos")]
28pub fn discover_coreaudio_devices() -> Vec<String> {
29    hw::coreaudio::device::list_devices()
30        .into_iter()
31        .map(|d| d.name)
32        .collect()
33}
34
35pub fn init() -> (Sender<message::Message>, JoinHandle<()>) {
36    let (tx, rx) = channel::<message::Message>(32);
37    let mut engine = engine::Engine::new(rx, tx.clone());
38    let handle = tokio::spawn(async move {
39        engine.init().await;
40        engine.work().await;
41    });
42    (tx.clone(), handle)
43}