aboutsummaryrefslogtreecommitdiffstats
path: root/mumd
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2020-11-28 01:46:33 +0100
committerGustav Sörnäs <gustav@sornas.net>2020-11-28 01:46:33 +0100
commit790fdc02d071d0f110eff1b17374f315a1516fb7 (patch)
tree412dba3fcac26d43cb7abcb007b0bd3387e3e3d1 /mumd
parent8b5546bef973652778a60280ab2ebbc528ad1e48 (diff)
parent88fde9b1b8adaaa290d4eb75c4434b58c2aac5d2 (diff)
downloadmum-790fdc02d071d0f110eff1b17374f315a1516fb7.tar.gz
Merge branch 'sound-effects-inside-binary' into 'main'
include_bytes instead of static filepaths Closes #76 See merge request gustav/mum!39
Diffstat (limited to 'mumd')
-rw-r--r--mumd/src/audio.rs26
-rw-r--r--mumd/src/resources/channel_join.wavbin0 -> 32002 bytes
-rw-r--r--mumd/src/resources/channel_leave.wavbin0 -> 32002 bytes
-rw-r--r--mumd/src/resources/connect.wavbin0 -> 32002 bytes
-rw-r--r--mumd/src/resources/deafen.wavbin0 -> 32002 bytes
-rw-r--r--mumd/src/resources/disconnect.wavbin0 -> 303364 bytes
-rw-r--r--mumd/src/resources/mute.wavbin0 -> 32002 bytes
-rw-r--r--mumd/src/resources/undeafen.wavbin0 -> 32002 bytes
-rw-r--r--mumd/src/resources/unmute.wavbin0 -> 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/mumd/src/resources/channel_join.wav b/mumd/src/resources/channel_join.wav
new file mode 100644
index 0000000..82ee4d4
--- /dev/null
+++ b/mumd/src/resources/channel_join.wav
Binary files differ
diff --git a/mumd/src/resources/channel_leave.wav b/mumd/src/resources/channel_leave.wav
new file mode 100644
index 0000000..82ee4d4
--- /dev/null
+++ b/mumd/src/resources/channel_leave.wav
Binary files differ
diff --git a/mumd/src/resources/connect.wav b/mumd/src/resources/connect.wav
new file mode 100644
index 0000000..82ee4d4
--- /dev/null
+++ b/mumd/src/resources/connect.wav
Binary files differ
diff --git a/mumd/src/resources/deafen.wav b/mumd/src/resources/deafen.wav
new file mode 100644
index 0000000..82ee4d4
--- /dev/null
+++ b/mumd/src/resources/deafen.wav
Binary files differ
diff --git a/mumd/src/resources/disconnect.wav b/mumd/src/resources/disconnect.wav
new file mode 100644
index 0000000..fb2ca76
--- /dev/null
+++ b/mumd/src/resources/disconnect.wav
Binary files differ
diff --git a/mumd/src/resources/mute.wav b/mumd/src/resources/mute.wav
new file mode 100644
index 0000000..82ee4d4
--- /dev/null
+++ b/mumd/src/resources/mute.wav
Binary files differ
diff --git a/mumd/src/resources/undeafen.wav b/mumd/src/resources/undeafen.wav
new file mode 100644
index 0000000..82ee4d4
--- /dev/null
+++ b/mumd/src/resources/undeafen.wav
Binary files differ
diff --git a/mumd/src/resources/unmute.wav b/mumd/src/resources/unmute.wav
new file mode 100644
index 0000000..82ee4d4
--- /dev/null
+++ b/mumd/src/resources/unmute.wav
Binary files differ