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;
23pub use plugins::clap_proc;
24#[cfg(all(unix, not(target_os = "macos")))]
25pub use plugins::lv2;
26#[cfg(all(unix, not(target_os = "macos")))]
27pub use plugins::lv2_proc;
28pub use plugins::vst3;
29pub use plugins::vst3_proc;
30
31use tokio::sync::mpsc::{Sender, channel};
32use tokio::task::JoinHandle;
33
34#[cfg(target_os = "macos")]
35pub fn discover_coreaudio_devices() -> Vec<String> {
36    hw::coreaudio::device::list_devices()
37        .into_iter()
38        .map(|d| d.name)
39        .collect()
40}
41
42pub fn init() -> (Sender<message::Message>, JoinHandle<()>) {
43    let (tx, rx) = channel::<message::Message>(32);
44    let mut engine = engine::Engine::new(rx, tx.clone());
45    let handle = tokio::spawn(async move {
46        engine.init().await;
47        engine.work().await;
48    });
49    (tx.clone(), handle)
50}