diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2020-11-28 01:41:29 +0100 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2020-11-28 01:41:29 +0100 |
| commit | 88fde9b1b8adaaa290d4eb75c4434b58c2aac5d2 (patch) | |
| tree | 412dba3fcac26d43cb7abcb007b0bd3387e3e3d1 | |
| parent | 8b5546bef973652778a60280ab2ebbc528ad1e48 (diff) | |
| download | mum-88fde9b1b8adaaa290d4eb75c4434b58c2aac5d2.tar.gz | |
include_bytes instead of static filepaths
| -rw-r--r-- | mumd/src/audio.rs | 26 | ||||
| -rw-r--r-- | mumd/src/resources/channel_join.wav (renamed from resources/channel_join.wav) | bin | 32002 -> 32002 bytes | |||
| -rw-r--r-- | mumd/src/resources/channel_leave.wav (renamed from resources/channel_leave.wav) | bin | 32002 -> 32002 bytes | |||
| -rw-r--r-- | mumd/src/resources/connect.wav (renamed from resources/connect.wav) | bin | 32002 -> 32002 bytes | |||
| -rw-r--r-- | mumd/src/resources/deafen.wav (renamed from resources/deafen.wav) | bin | 32002 -> 32002 bytes | |||
| -rw-r--r-- | mumd/src/resources/disconnect.wav (renamed from resources/disconnect.wav) | bin | 303364 -> 303364 bytes | |||
| -rw-r--r-- | mumd/src/resources/mute.wav (renamed from resources/mute.wav) | bin | 32002 -> 32002 bytes | |||
| -rw-r--r-- | mumd/src/resources/undeafen.wav (renamed from resources/undeafen.wav) | bin | 32002 -> 32002 bytes | |||
| -rw-r--r-- | mumd/src/resources/unmute.wav (renamed from resources/unmute.wav) | bin | 32002 -> 32002 bytes |
9 files changed, 13 insertions, 13 deletions
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/resources/channel_join.wav b/mumd/src/resources/channel_join.wav Binary files differindex 82ee4d4..82ee4d4 100644 --- a/resources/channel_join.wav +++ b/mumd/src/resources/channel_join.wav diff --git a/resources/channel_leave.wav b/mumd/src/resources/channel_leave.wav Binary files differindex 82ee4d4..82ee4d4 100644 --- a/resources/channel_leave.wav +++ b/mumd/src/resources/channel_leave.wav diff --git a/resources/connect.wav b/mumd/src/resources/connect.wav Binary files differindex 82ee4d4..82ee4d4 100644 --- a/resources/connect.wav +++ b/mumd/src/resources/connect.wav diff --git a/resources/deafen.wav b/mumd/src/resources/deafen.wav Binary files differindex 82ee4d4..82ee4d4 100644 --- a/resources/deafen.wav +++ b/mumd/src/resources/deafen.wav diff --git a/resources/disconnect.wav b/mumd/src/resources/disconnect.wav Binary files differindex fb2ca76..fb2ca76 100644 --- a/resources/disconnect.wav +++ b/mumd/src/resources/disconnect.wav diff --git a/resources/mute.wav b/mumd/src/resources/mute.wav Binary files differindex 82ee4d4..82ee4d4 100644 --- a/resources/mute.wav +++ b/mumd/src/resources/mute.wav diff --git a/resources/undeafen.wav b/mumd/src/resources/undeafen.wav Binary files differindex 82ee4d4..82ee4d4 100644 --- a/resources/undeafen.wav +++ b/mumd/src/resources/undeafen.wav diff --git a/resources/unmute.wav b/mumd/src/resources/unmute.wav Binary files differindex 82ee4d4..82ee4d4 100644 --- a/resources/unmute.wav +++ b/mumd/src/resources/unmute.wav |
