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