Merge branch 'desttinghim/no-audio-settings' into 'master'

Add field to disable audio into settings

See merge request veloren/veloren!302
This commit is contained in:
Joshua Barretto 2019-07-03 19:19:00 +00:00
commit 9977322ba6
2 changed files with 9 additions and 1 deletions

View File

@ -84,8 +84,14 @@ pub trait PlayState {
fn main() { fn main() {
// Set up the global state. // Set up the global state.
let settings = Settings::load(); let settings = Settings::load();
let audio = if settings.audio.audio_on {
AudioFrontend::new()
} else {
AudioFrontend::no_audio()
};
let mut global_state = GlobalState { 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!"), window: Window::new(&settings).expect("Failed to create window!"),
settings, settings,
}; };

View File

@ -144,6 +144,7 @@ pub struct AudioSettings {
/// Audio Device that Voxygen will use to play audio. /// Audio Device that Voxygen will use to play audio.
pub audio_device: Option<String>, pub audio_device: Option<String>,
pub audio_on: bool,
} }
impl Default for AudioSettings { impl Default for AudioSettings {
@ -153,6 +154,7 @@ impl Default for AudioSettings {
music_volume: 0.5, music_volume: 0.5,
sfx_volume: 0.5, sfx_volume: 0.5,
audio_device: None, audio_device: None,
audio_on: true,
} }
} }
} }