From c08aca21298dfefbac59b824004bc12fc34313df Mon Sep 17 00:00:00 2001 From: Acid Date: Thu, 21 Oct 2021 20:57:53 +0200 Subject: [PATCH 1/2] Enable wasm audio by default --- Cargo.toml | 3 --- crates/bevy_audio/Cargo.toml | 3 +-- crates/bevy_internal/Cargo.toml | 3 --- docs/cargo_features.md | 1 - 4 files changed, 1 insertion(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 830f6131abd0d..f2c29419785c7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,9 +68,6 @@ mp3 = ["bevy_internal/mp3"] vorbis = ["bevy_internal/vorbis"] wav = ["bevy_internal/wav"] -# 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"] # Display server protocol support (X11 is enabled by default) diff --git a/crates/bevy_audio/Cargo.toml b/crates/bevy_audio/Cargo.toml index 2e780270dbca0..5a2c2e573c28d 100644 --- a/crates/bevy_audio/Cargo.toml +++ b/crates/bevy_audio/Cargo.toml @@ -18,7 +18,7 @@ bevy_utils = { path = "../bevy_utils", version = "0.5.0" } # other anyhow = "1.0.4" -rodio = { version = "0.14", default-features = false } +rodio = { version = "0.14", default-features = false, features = ["wasm-bindgen"] } parking_lot = "0.11.0" [features] @@ -26,4 +26,3 @@ 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 3ae9121fb7715..821e543d149c9 100644 --- a/crates/bevy_internal/Cargo.toml +++ b/crates/bevy_internal/Cargo.toml @@ -29,9 +29,6 @@ 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 839515e17da37..0bc35f06aaad8 100644 --- a/docs/cargo_features.md +++ b/docs/cargo_features.md @@ -32,7 +32,6 @@ |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. (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 2342af065b0d7cbf6496433d31a4fe61a54128fe Mon Sep 17 00:00:00 2001 From: Acid Date: Tue, 9 Nov 2021 19:29:21 +0100 Subject: [PATCH 2/2] Use wasm feature only when targeting wasm --- crates/bevy_audio/Cargo.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/bevy_audio/Cargo.toml b/crates/bevy_audio/Cargo.toml index 5a2c2e573c28d..ca5c2556fae6e 100644 --- a/crates/bevy_audio/Cargo.toml +++ b/crates/bevy_audio/Cargo.toml @@ -18,9 +18,12 @@ bevy_utils = { path = "../bevy_utils", version = "0.5.0" } # other anyhow = "1.0.4" -rodio = { version = "0.14", default-features = false, features = ["wasm-bindgen"] } +rodio = { version = "0.14", default-features = false } parking_lot = "0.11.0" +[target.'cfg(target_arch = "wasm32")'.dependencies] +rodio = { version = "0.14", default-features = false, features = ["wasm-bindgen"] } + [features] mp3 = ["rodio/mp3"] flac = ["rodio/flac"]