diff --git a/crates/sound/src/lib.rs b/crates/sound/src/lib.rs index 3c73338..fb3b176 100644 --- a/crates/sound/src/lib.rs +++ b/crates/sound/src/lib.rs @@ -53,11 +53,11 @@ pub struct SoundConfig { impl SoundConfig { /// Create a new instance of the SoundConfig struct, containing the /// parameters to be fed into the sound-backend server. - pub fn new(socket: String, multi_thread: bool) -> Self { + pub fn new(socket: String, multi_thread: bool, audio_backend_name: String) -> Self { Self { socket, multi_thread, - audio_backend_name: "null".to_string(), + audio_backend_name, } } diff --git a/crates/sound/src/main.rs b/crates/sound/src/main.rs index 542fdb6..7f3c844 100644 --- a/crates/sound/src/main.rs +++ b/crates/sound/src/main.rs @@ -12,6 +12,9 @@ struct SoundArgs { /// vhost-user Unix domain socket path. #[clap(long)] socket: String, + /// audio backend to be used (supported: null) + #[clap(long)] + backend: String, } impl TryFrom for SoundConfig { @@ -19,8 +22,9 @@ impl TryFrom for SoundConfig { fn try_from(cmd_args: SoundArgs) -> Result { let socket = cmd_args.socket.trim().to_string(); + let backend = cmd_args.backend.trim().to_string(); - Ok(SoundConfig::new(socket, false)) + Ok(SoundConfig::new(socket, false, backend)) } } @@ -43,6 +47,7 @@ mod tests { fn from_args(socket: &str) -> Self { SoundArgs { socket: socket.to_string(), + backend: "null".to_string(), } } }