Convert Music to ogg/vorbis and load in build.rs #14

Merged
msrd0 merged 4 commits from music into main 2024-07-07 13:29:43 +00:00
13 changed files with 5 additions and 5 deletions
Showing only changes of commit ae0dac72c9 - Show all commits

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
assets/sounds/bzz.ogg Normal file

Binary file not shown.

View file

@ -69,7 +69,7 @@ impl AssetsWriter {
const_name
}
fn add_mp3<P: AsRef<Path> + Copy>(&mut self, canonical_path: P) -> String {
fn add_ogg<P: AsRef<Path> + Copy>(&mut self, canonical_path: P) -> String {
let const_name = Self::asset_name(canonical_path);
writeln!(self.file, "// {}", canonical_path.as_ref().display()).unwrap();
writeln!(
@ -206,8 +206,8 @@ fn process_dir<P: AsRef<Path> + Copy>(
groups.pop();
} else if path.extension().map(|ext| ext == "svg").unwrap_or(false) {
process_svg(&path, dir, writer, groups);
} else if path.extension().map(|ext| ext == "mp3").unwrap_or(false) {
process_mp3(&path, dir, writer, groups);
} else if path.extension().map(|ext| ext == "ogg").unwrap_or(false) {
process_ogg(&path, dir, writer, groups);
}
}
}
@ -258,13 +258,13 @@ fn process_svg<P: AsRef<Path> + Copy, Q: AsRef<Path>>(
);
}
fn process_mp3<P: AsRef<Path> + Copy, Q: AsRef<Path>>(
fn process_ogg<P: AsRef<Path> + Copy, Q: AsRef<Path>>(
file: P,
dir: Q,
writer: &mut AssetsWriter,
groups: &[String]
) {
let const_name = writer.add_mp3(
let const_name = writer.add_ogg(
&file
.as_ref()
.canonicalize()