From 31359a459094c8b9e4667230bce9bf029a985562 Mon Sep 17 00:00:00 2001 From: Acid Date: Sat, 26 Jun 2021 11:58:17 +0200 Subject: [PATCH 1/3] Add feature flag to enable wasm for bevy_audio --- Cargo.toml | 3 +++ crates/bevy_audio/Cargo.toml | 1 + crates/bevy_internal/Cargo.toml | 3 +++ docs/cargo_features.md | 1 + 4 files changed, 8 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 9e8551ffc3dafc..e7a3235b729458 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,6 +66,9 @@ mp3 = ["bevy_internal/mp3"] vorbis = ["bevy_internal/vorbis"] wav = ["bevy_internal/wav"] +# WASM support for audio +wasm_audio = ["bevy_internal/wasm_audio"] + serialize = ["bevy_internal/serialize"] # Display server protocol support (X11 is enabled by default) diff --git a/crates/bevy_audio/Cargo.toml b/crates/bevy_audio/Cargo.toml index b082e7d7d1e373..045916d0e30804 100644 --- a/crates/bevy_audio/Cargo.toml +++ b/crates/bevy_audio/Cargo.toml @@ -30,3 +30,4 @@ mp3 = ["rodio/mp3"] flac = ["rodio/flac"] wav = ["rodio/wav"] vorbis = ["rodio/vorbis"] +wasm_audio = ["rodio/wasm-bindgen"] diff --git a/crates/bevy_internal/Cargo.toml b/crates/bevy_internal/Cargo.toml index 9d557aff5d1675..401df91c5af32d 100644 --- a/crates/bevy_internal/Cargo.toml +++ b/crates/bevy_internal/Cargo.toml @@ -32,6 +32,9 @@ mp3 = ["bevy_audio/mp3"] vorbis = ["bevy_audio/vorbis"] wav = ["bevy_audio/wav"] +# WASM support for audio +wasm_audio = ["bevy_audio/wasm_audio"] + serialize = ["bevy_input/serialize"] # Display server protocol support (X11 is enabled by default) diff --git a/docs/cargo_features.md b/docs/cargo_features.md index 7dc65b95761671..2005fcba70a0a0 100644 --- a/docs/cargo_features.md +++ b/docs/cargo_features.md @@ -31,6 +31,7 @@ |flac|FLAC audio format support. It's included in bevy_audio feature.| |wav|WAV audio format support.| |vorbis|Vorbis audio format support.| +|wasm_audio|WASM audio support.| |serialize|Enables serialization of `bevy_input` types.| |wayland|Enable this to use Wayland display server protocol other than X11.| |subpixel_glyph_atlas|Enable this to cache glyphs using subpixel accuracy. This increases texture memory usage as each position requires a separate sprite in the glyph atlas, but provide more accurate character spacing.| From 06ca94ce23ead816917939ce9f5c3656c7861127 Mon Sep 17 00:00:00 2001 From: Acid Date: Sun, 27 Jun 2021 20:48:44 +0200 Subject: [PATCH 2/3] Note on supported formats --- docs/cargo_features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cargo_features.md b/docs/cargo_features.md index 2005fcba70a0a0..14ae82a52581ef 100644 --- a/docs/cargo_features.md +++ b/docs/cargo_features.md @@ -31,7 +31,7 @@ |flac|FLAC audio format support. It's included in bevy_audio feature.| |wav|WAV audio format support.| |vorbis|Vorbis audio format support.| -|wasm_audio|WASM audio support.| +|wasm_audio|WASM audio support. (Currently only works with flac, wav and vorbis. Not with mp3)| |serialize|Enables serialization of `bevy_input` types.| |wayland|Enable this to use Wayland display server protocol other than X11.| |subpixel_glyph_atlas|Enable this to cache glyphs using subpixel accuracy. This increases texture memory usage as each position requires a separate sprite in the glyph atlas, but provide more accurate character spacing.| From 61c00e7d2247b4c07b6a95fb4b1b437fa42a1572 Mon Sep 17 00:00:00 2001 From: Ixentus Date: Sun, 27 Jun 2021 21:06:08 +0200 Subject: [PATCH 3/3] Update Cargo.toml Co-authored-by: MinerSebas <66798382+MinerSebas@users.noreply.github.com> --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index e7a3235b729458..a5afe0c416224c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,7 +66,7 @@ mp3 = ["bevy_internal/mp3"] vorbis = ["bevy_internal/vorbis"] wav = ["bevy_internal/wav"] -# WASM support for audio +# WASM support for audio (Currently only works with flac, wav and vorbis. Not with mp3) wasm_audio = ["bevy_internal/wasm_audio"] serialize = ["bevy_internal/serialize"]