diff options
| author | Eskil Queseth <eskilq@kth.se> | 2020-11-16 02:02:46 +0100 |
|---|---|---|
| committer | Eskil Queseth <eskilq@kth.se> | 2020-11-16 02:02:46 +0100 |
| commit | c3fabb1f9224cdf8fd68ad186baeffc93c96ce5c (patch) | |
| tree | 0aa213b808210be84d5a53f5a40d03c83d038155 /mumd/src/audio.rs | |
| parent | 8b942cffeb81dbf068dbe7c76584bf68e74e7f17 (diff) | |
| download | mum-c3fabb1f9224cdf8fd68ad186baeffc93c96ce5c.tar.gz | |
add sound on users moving
Diffstat (limited to 'mumd/src/audio.rs')
| -rw-r--r-- | mumd/src/audio.rs | 10 |
1 files changed, 9 insertions, 1 deletions
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(); |
