Skip to main content

maolan_engine/
lib.rs

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