From c3fabb1f9224cdf8fd68ad186baeffc93c96ce5c Mon Sep 17 00:00:00 2001 From: Eskil Queseth Date: Mon, 16 Nov 2020 02:02:46 +0100 Subject: add sound on users moving --- mumd/src/audio.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'mumd/src/audio.rs') diff --git a/mumd/src/audio.rs b/mumd/src/audio.rs index 53ec2d4..d1ef106 100644 --- a/mumd/src/audio.rs +++ b/mumd/src/audio.rs @@ -17,6 +17,10 @@ use crate::audio::output::SaturatingAdd; pub const EVENT_SOUNDS: &[(&str, NotificationEvents)] = &[ ("resources/connect.wav", NotificationEvents::ServerConnect), ("resources/disconnect.wav", NotificationEvents::ServerDisconnect), + ("resources/channel_join.wav", NotificationEvents::UserConnected), + ("resources/channel_leave.wav", NotificationEvents::UserDisconnected), + ("resources/channel_join.wav", NotificationEvents::UserJoinedChannel), + ("resources/channel_leave.wav", NotificationEvents::UserLeftChannel), ]; const SAMPLE_RATE: u32 = 48000; @@ -25,6 +29,10 @@ const SAMPLE_RATE: u32 = 48000; pub enum NotificationEvents { ServerConnect, ServerDisconnect, + UserConnected, + UserDisconnected, + UserJoinedChannel, + UserLeftChannel, } pub struct Audio { @@ -296,7 +304,7 @@ impl Audio { } } - pub fn play_effect(&mut self, effect: NotificationEvents) { + pub fn play_effect(&self, effect: NotificationEvents) { let samples = self.sounds.get(&effect).unwrap(); let mut play_sounds = self.play_sounds.lock().unwrap(); -- cgit v1.2.1