From 6b9d837c447c520106b0d888103ad77af93046f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Sat, 19 Jun 2021 16:32:30 +0200 Subject: documentation --- mumd/src/audio.rs | 2 ++ mumd/src/audio/sound_effects.rs | 3 +++ 2 files changed, 5 insertions(+) diff --git a/mumd/src/audio.rs b/mumd/src/audio.rs index 785bf7c..a04f0da 100644 --- a/mumd/src/audio.rs +++ b/mumd/src/audio.rs @@ -97,6 +97,8 @@ impl AudioOutput { Ok(res) } + /// Sets the sound effects according to some overrides, using some default + /// value if an event isn't overriden. pub fn load_sound_effects(&mut self, overrides: &[SoundEffect]) { self.sounds = sound_effects::load_sound_effects(overrides, self.device.num_channels()); } diff --git a/mumd/src/audio/sound_effects.rs b/mumd/src/audio/sound_effects.rs index ae96fa3..49cb009 100644 --- a/mumd/src/audio/sound_effects.rs +++ b/mumd/src/audio/sound_effects.rs @@ -74,6 +74,8 @@ impl TryFrom<&str> for NotificationEvents { } } +/// Loads files into an "event -> data"-map, with support for overriding +/// specific events with another sound file. pub fn load_sound_effects(overrides: &[SoundEffect], num_channels: usize) -> HashMap> { let overrides: HashMap<_, _> = overrides .iter() @@ -164,6 +166,7 @@ fn unpack_ogg(data: Cow<[u8]>) -> (Vec, AudioSpec) { } #[cfg(not(feature = "ogg"))] +/// Fallback to default sound effect since ogg is disabled. fn unpack_ogg(_: Cow<[u8]>) -> (Vec, AudioSpec) { warn!("Can't open .ogg without the ogg-feature enabled."); unpack_wav(get_default_sfx()) -- cgit v1.2.1