From e2fe6cc5a32e635f307ef8dedbddb57c9691ce47 Mon Sep 17 00:00:00 2001 From: Hailey Somerville <hailey@hailey.lol> Date: Mon, 25 Dec 2023 20:51:22 +1100 Subject: [PATCH] wire up alsa config to bark.toml config --- bark.toml | 3 +++ bark/src/config.rs | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/bark.toml b/bark.toml index cf0555b..f82bd04 100644 --- a/bark.toml +++ b/bark.toml @@ -1 +1,4 @@ multicast = "224.100.100.100:1530" + +[source.input] +device = "pipewire:NODE=Bark" diff --git a/bark/src/config.rs b/bark/src/config.rs index ca9d8d0..8d3d231 100644 --- a/bark/src/config.rs +++ b/bark/src/config.rs @@ -15,17 +15,17 @@ pub struct Config { #[derive(Deserialize, Default)] pub struct Source { - device: Option<String>, + input: Device, delay_ms: Option<u64>, } #[derive(Deserialize, Default)] pub struct Receive { - output: Output, + output: Device, } #[derive(Deserialize, Default)] -pub struct Output { +pub struct Device { device: Option<String>, period: Option<u64>, buffer: Option<u64>, @@ -39,8 +39,10 @@ fn set_env_option<T: ToString>(name: &str, value: Option<T>) { pub fn load_into_env(config: &Config) { set_env_option("BARK_MULTICAST", config.multicast); - set_env_option("BARK_SOURCE_DEVICE", config.source.device.as_ref()); set_env_option("BARK_SOURCE_DELAY_MS", config.source.delay_ms); + set_env_option("BARK_SOURCE_INPUT_DEVICE", config.source.input.device.as_ref()); + set_env_option("BARK_SOURCE_INPUT_PERIOD", config.source.input.period); + set_env_option("BARK_SOURCE_INPUT_BUFFER", config.source.input.buffer); set_env_option("BARK_RECEIVE_OUTPUT_DEVICE", config.receive.output.device.as_ref()); set_env_option("BARK_RECEIVE_OUTPUT_PERIOD", config.receive.output.period); set_env_option("BARK_RECEIVE_OUTPUT_BUFFER", config.receive.output.buffer);