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