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