diff --git a/Cargo.lock b/Cargo.lock index 2fa990f..118af68 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1046,6 +1046,7 @@ dependencies = [ "nom 5.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "ringbuf 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustyline 6.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1060,7 +1061,6 @@ dependencies = [ "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "jni 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "ringbuf 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustboyadvance-core 0.1.0", ] diff --git a/bindings/rustboyadvance-jni/Cargo.toml b/bindings/rustboyadvance-jni/Cargo.toml index a31f00d..81d5ea4 100644 --- a/bindings/rustboyadvance-jni/Cargo.toml +++ b/bindings/rustboyadvance-jni/Cargo.toml @@ -13,7 +13,6 @@ crate-type = ["staticlib", "cdylib"] rustboyadvance-core = {path = "../../rustboyadvance-core/"} jni = { version = "0.16", default-features = false } log = {version = "0.4.8", features = ["release_max_level_info", "max_level_debug"]} -ringbuf = "0.2.1" [target.'cfg(target_os="android")'.dependencies] android_log = "0.1.3" diff --git a/bindings/rustboyadvance-jni/src/lib.rs b/bindings/rustboyadvance-jni/src/lib.rs index 56fb1f8..aaeb5ec 100644 --- a/bindings/rustboyadvance-jni/src/lib.rs +++ b/bindings/rustboyadvance-jni/src/lib.rs @@ -20,24 +20,9 @@ use android_log; #[cfg(not(target_os = "android"))] use env_logger; -use ringbuf::{Consumer, Producer, RingBuffer}; - use rustboyadvance_core::prelude::*; use rustboyadvance_core::StereoSample; - -struct AudioRingBuffer { - pub prod: Producer, - pub cons: Consumer, -} - -impl AudioRingBuffer { - fn new() -> AudioRingBuffer { - let rb = RingBuffer::new(4096 * 2); - let (prod, cons) = rb.split(); - - AudioRingBuffer { prod, cons } - } -} +use rustboyadvance_core::util::audio::AudioRingBuffer; struct Hardware { jvm: JavaVM, diff --git a/platform/rustboyadvance-wasm/Cargo.toml b/platform/rustboyadvance-wasm/Cargo.toml index 149cfc8..f8b6e89 100644 --- a/platform/rustboyadvance-wasm/Cargo.toml +++ b/platform/rustboyadvance-wasm/Cargo.toml @@ -45,6 +45,7 @@ features = [ 'WebGlProgram', 'WebGlShader', 'Window', + 'AudioContext', ] diff --git a/platform/rustboyadvance-wasm/app/index.html b/platform/rustboyadvance-wasm/app/index.html index ca0fa13..c97334c 100644 --- a/platform/rustboyadvance-wasm/app/index.html +++ b/platform/rustboyadvance-wasm/app/index.html @@ -7,93 +7,120 @@ RustBoyAdvance -