From 88fde9b1b8adaaa290d4eb75c4434b58c2aac5d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Sat, 28 Nov 2020 01:41:29 +0100 Subject: include_bytes instead of static filepaths --- mumd/src/audio.rs | 26 +++++++++++++------------- mumd/src/resources/channel_join.wav | Bin 0 -> 32002 bytes mumd/src/resources/channel_leave.wav | Bin 0 -> 32002 bytes mumd/src/resources/connect.wav | Bin 0 -> 32002 bytes mumd/src/resources/deafen.wav | Bin 0 -> 32002 bytes mumd/src/resources/disconnect.wav | Bin 0 -> 303364 bytes mumd/src/resources/mute.wav | Bin 0 -> 32002 bytes mumd/src/resources/undeafen.wav | Bin 0 -> 32002 bytes mumd/src/resources/unmute.wav | Bin 0 -> 32002 bytes 9 files changed, 13 insertions(+), 13 deletions(-) create mode 100644 mumd/src/resources/channel_join.wav create mode 100644 mumd/src/resources/channel_leave.wav create mode 100644 mumd/src/resources/connect.wav create mode 100644 mumd/src/resources/deafen.wav create mode 100644 mumd/src/resources/disconnect.wav create mode 100644 mumd/src/resources/mute.wav create mode 100644 mumd/src/resources/undeafen.wav create mode 100644 mumd/src/resources/unmute.wav (limited to 'mumd/src') diff --git a/mumd/src/audio.rs b/mumd/src/audio.rs index d5617fc..d86cb84 100644 --- a/mumd/src/audio.rs +++ b/mumd/src/audio.rs @@ -17,32 +17,32 @@ use tokio::sync::{mpsc, watch}; //TODO? move to mumlib #[cfg(feature = "sound-effects")] -pub const EVENT_SOUNDS: &[(&str, NotificationEvents)] = &[ - ("resources/connect.wav", NotificationEvents::ServerConnect), +pub const EVENT_SOUNDS: &[(&'static [u8], NotificationEvents)] = &[ + (include_bytes!("resources/connect.wav"), NotificationEvents::ServerConnect), ( - "resources/disconnect.wav", + include_bytes!("resources/disconnect.wav"), NotificationEvents::ServerDisconnect, ), ( - "resources/channel_join.wav", + include_bytes!("resources/channel_join.wav"), NotificationEvents::UserConnected, ), ( - "resources/channel_leave.wav", + include_bytes!("resources/channel_leave.wav"), NotificationEvents::UserDisconnected, ), ( - "resources/channel_join.wav", + include_bytes!("resources/channel_join.wav"), NotificationEvents::UserJoinedChannel, ), ( - "resources/channel_leave.wav", + include_bytes!("resources/channel_leave.wav"), NotificationEvents::UserLeftChannel, ), - ("resources/mute.wav", NotificationEvents::Mute), - ("resources/unmute.wav", NotificationEvents::Unmute), - ("resources/deafen.wav", NotificationEvents::Deafen), - ("resources/undeafen.wav", NotificationEvents::Undeafen), + (include_bytes!("resources/mute.wav"), NotificationEvents::Mute), + (include_bytes!("resources/unmute.wav"), NotificationEvents::Unmute), + (include_bytes!("resources/deafen.wav"), NotificationEvents::Deafen), + (include_bytes!("resources/undeafen.wav"), NotificationEvents::Undeafen), ]; const SAMPLE_RATE: u32 = 48000; @@ -223,8 +223,8 @@ impl Audio { #[cfg(feature = "sound-effects")] let sounds = EVENT_SOUNDS .iter() - .map(|(path, event)| { - let reader = hound::WavReader::open(path).unwrap(); + .map(|(bytes, event)| { + let reader = hound::WavReader::new(*bytes).unwrap(); let spec = reader.spec(); let samples = match spec.sample_format { hound::SampleFormat::Float => reader diff --git a/mumd/src/resources/channel_join.wav b/mumd/src/resources/channel_join.wav new file mode 100644 index 0000000..82ee4d4 Binary files /dev/null and b/mumd/src/resources/channel_join.wav differ diff --git a/mumd/src/resources/channel_leave.wav b/mumd/src/resources/channel_leave.wav new file mode 100644 index 0000000..82ee4d4 Binary files /dev/null and b/mumd/src/resources/channel_leave.wav differ diff --git a/mumd/src/resources/connect.wav b/mumd/src/resources/connect.wav new file mode 100644 index 0000000..82ee4d4 Binary files /dev/null and b/mumd/src/resources/connect.wav differ diff --git a/mumd/src/resources/deafen.wav b/mumd/src/resources/deafen.wav new file mode 100644 index 0000000..82ee4d4 Binary files /dev/null and b/mumd/src/resources/deafen.wav differ diff --git a/mumd/src/resources/disconnect.wav b/mumd/src/resources/disconnect.wav new file mode 100644 index 0000000..fb2ca76 Binary files /dev/null and b/mumd/src/resources/disconnect.wav differ diff --git a/mumd/src/resources/mute.wav b/mumd/src/resources/mute.wav new file mode 100644 index 0000000..82ee4d4 Binary files /dev/null and b/mumd/src/resources/mute.wav differ diff --git a/mumd/src/resources/undeafen.wav b/mumd/src/resources/undeafen.wav new file mode 100644 index 0000000..82ee4d4 Binary files /dev/null and b/mumd/src/resources/undeafen.wav differ diff --git a/mumd/src/resources/unmute.wav b/mumd/src/resources/unmute.wav new file mode 100644 index 0000000..82ee4d4 Binary files /dev/null and b/mumd/src/resources/unmute.wav differ -- cgit v1.2.1