diff options
| author | Eskil Queseth <eskilq@kth.se> | 2020-11-02 21:47:47 +0100 |
|---|---|---|
| committer | Eskil Queseth <eskilq@kth.se> | 2020-11-02 21:47:47 +0100 |
| commit | 0cb39d13bba3dc5ffa3231e6021066e4191a43a4 (patch) | |
| tree | 5c4a14dac57fc84e688932783f02d6c06ff0515b /mumd | |
| parent | 46861ce465d6f1d86e80007742a850fd1cfa9bad (diff) | |
| download | mum-0cb39d13bba3dc5ffa3231e6021066e4191a43a4.tar.gz | |
refactor and add audio out config command
Diffstat (limited to 'mumd')
| -rw-r--r-- | mumd/src/state.rs | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/mumd/src/state.rs b/mumd/src/state.rs index 2060845..4d8c139 100644 --- a/mumd/src/state.rs +++ b/mumd/src/state.rs @@ -39,7 +39,7 @@ pub enum StatePhase { } pub struct State { - config: Option<Config>, + config: Config, server: Option<Server>, audio: Audio, @@ -375,16 +375,12 @@ impl State { } pub fn reload_config(&mut self) { - if let Some(config) = mumlib::config::read_default_cfg() { - self.config = Some(config); - let config = &self.config.as_ref().unwrap(); - if let Some(audio_config) = &config.audio { - if let Some(input_volume) = audio_config.input_volume { - self.audio.set_input_volume(input_volume); - } - } - } else { - warn!("config file not found"); + self.config = mumlib::config::read_default_cfg(); + if let Some(input_volume) = self.config.audio.input_volume { + self.audio.set_input_volume(input_volume); + } + if let Some(output_volume) = self.config.audio.output_volume { + self.audio.set_output_volume(output_volume); } } |
