Add a feature based dummy implementation
This commit is contained in:
@@ -1,16 +1,21 @@
|
||||
use crate::audio_engine::AudioBackend;
|
||||
|
||||
pub(crate) struct JackAudioBackend {
|
||||
pub(crate) name: String,
|
||||
pub(crate) feature_jack: bool,
|
||||
pub(crate) running: bool,
|
||||
}
|
||||
|
||||
impl JackAudioBackend {
|
||||
pub(crate) fn new(name: String, running: bool) -> Self {
|
||||
Self { name, running }
|
||||
pub(crate) fn new() -> Self {
|
||||
|
||||
let feature_jack = cfg!(feature = "jack");
|
||||
// TODO: It should be retrieved from the system
|
||||
let running = true;
|
||||
Self { feature_jack, running }
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "jack")]
|
||||
impl AudioBackend for JackAudioBackend {
|
||||
fn start_client(&self) {
|
||||
todo!()
|
||||
@@ -24,3 +29,18 @@ impl AudioBackend for JackAudioBackend {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "jack"))]
|
||||
impl AudioBackend for JackAudioBackend {
|
||||
fn start_client(&self) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn init_client(&self) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn discover(&self) {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#[cfg(feature = "jack")]
|
||||
pub(crate) mod jack_ab;
|
||||
|
||||
pub(crate) trait AudioBackend {
|
||||
|
||||
@@ -7,9 +7,7 @@ use tonic::{Response, transport::Server};
|
||||
use tonic_reflection::server;
|
||||
|
||||
|
||||
use crate::control_pane::ControlPane;
|
||||
#[cfg(feature = "jack") ]
|
||||
use crate::audio_engine::jack_ab::JackAudioBackend;
|
||||
use crate::{audio_engine::jack_ab::JackAudioBackend, control_pane::ControlPane};
|
||||
|
||||
pub(crate) struct Grpc {
|
||||
pub(crate) port: i32,
|
||||
@@ -65,8 +63,8 @@ impl AudioBackend for TermixAudioBackend {
|
||||
) -> Result<Response<BackendList>, tonic::Status> {
|
||||
info!("discovering available backends");
|
||||
let mut response = BackendList::default();
|
||||
if cfg!(feature = "jack") {
|
||||
let jack = JackAudioBackend{ name: "jack".to_string(), running: todo!() };
|
||||
let jack = JackAudioBackend::new();
|
||||
if jack.feature_jack {
|
||||
response.backends.push(Backend {
|
||||
name: "jack".to_string(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user