From 67bfc6c4cf525f1fc4b315ec6a9edc8d121a268c Mon Sep 17 00:00:00 2001 From: Louis Pearson Date: Wed, 3 Jul 2019 13:13:38 -0600 Subject: [PATCH] Add field to turn off audio in settings --- voxygen/src/main.rs | 8 +++++++- voxygen/src/settings.rs | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/voxygen/src/main.rs b/voxygen/src/main.rs index 8e091ad6ba..431a80c70f 100644 --- a/voxygen/src/main.rs +++ b/voxygen/src/main.rs @@ -84,8 +84,14 @@ pub trait PlayState { fn main() { // Set up the global state. let settings = Settings::load(); + let audio = if settings.audio.audio_on { + AudioFrontend::new() + } else { + AudioFrontend::no_audio() + }; + let mut global_state = GlobalState { - audio: AudioFrontend::new(), // TODO: Provide `AudioFrontend::no_audio()` feature during initialisation, the config will be stored in `ron` object list. + audio, window: Window::new(&settings).expect("Failed to create window!"), settings, }; diff --git a/voxygen/src/settings.rs b/voxygen/src/settings.rs index 01ab21fa8c..17f08105cd 100644 --- a/voxygen/src/settings.rs +++ b/voxygen/src/settings.rs @@ -144,6 +144,7 @@ pub struct AudioSettings { /// Audio Device that Voxygen will use to play audio. pub audio_device: Option, + pub audio_on: bool, } impl Default for AudioSettings { @@ -153,6 +154,7 @@ impl Default for AudioSettings { music_volume: 0.5, sfx_volume: 0.5, audio_device: None, + audio_on: true, } } }