mirror of
https://github.com/robbert-vdh/nih-plug.git
synced 2026-07-01 02:36:54 +00:00
Move standalone backends to their own modules
This commit is contained in:
36
src/wrapper/standalone/backend/jack.rs
Normal file
36
src/wrapper/standalone/backend/jack.rs
Normal file
@@ -0,0 +1,36 @@
|
||||
use anyhow::{Context, Result};
|
||||
use jack::{Client, ClientOptions};
|
||||
|
||||
use super::super::config::WrapperConfig;
|
||||
use super::Backend;
|
||||
use crate::buffer::Buffer;
|
||||
|
||||
/// Uses JACK audio and MIDI.
|
||||
pub struct Jack {
|
||||
config: WrapperConfig,
|
||||
client: Client,
|
||||
}
|
||||
|
||||
impl Backend for Jack {
|
||||
fn run(&mut self, cb: impl FnMut(&mut Buffer) -> bool) {
|
||||
// TODO: Create an async client and do The Thing (tm)
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Jack {
|
||||
/// Initialize the JACK backend. Returns an error if this failed for whatever reason.
|
||||
pub fn new(name: &str, config: WrapperConfig) -> Result<Self> {
|
||||
let (client, status) = Client::new(name, ClientOptions::NO_START_SERVER)
|
||||
.context("Error while initializing the JACK client")?;
|
||||
if !status.is_empty() {
|
||||
anyhow::bail!("The JACK server returned an error: {status:?}");
|
||||
}
|
||||
|
||||
// TODO: Register ports
|
||||
// TODO: Connect output
|
||||
// TODO: Command line argument to connect the inputs?
|
||||
|
||||
Ok(Self { config, client })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user