desktop: Bump cpal to 0.15.0

`build_output_stream` now takes in a `timeout` parameter - I've
passed in `None` to keep the current behavior.

cpal addded lots of new `SampleFormat` enum values. For now, I'm
just returning an error if we encounter any of them - a quick test
showed that desktop audio is still working on my Linux machine.
This commit is contained in:
Aaron Hill 2023-01-29 22:35:06 -06:00 committed by Nathan Adams
parent 4c8b225ddd
commit e91f586523
3 changed files with 79 additions and 171 deletions

244
Cargo.lock generated
View File

@ -57,14 +57,14 @@ checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd"
[[package]]
name = "alsa"
version = "0.6.0"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5915f52fe2cf65e83924d037b6c5290b7cee097c6b5c8700746e6168a343fd6b"
checksum = "8512c9117059663fb5606788fbca3619e2a91dac0e3fe516242eab1fa6be5e44"
dependencies = [
"alsa-sys",
"bitflags",
"libc",
"nix 0.23.2",
"nix 0.24.3",
]
[[package]]
@ -206,12 +206,6 @@ dependencies = [
"rustc-demangle",
]
[[package]]
name = "base-x"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270"
[[package]]
name = "base64"
version = "0.13.1"
@ -639,10 +633,16 @@ version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
dependencies = [
"core-foundation-sys",
"core-foundation-sys 0.8.3",
"libc",
]
[[package]]
name = "core-foundation-sys"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b"
[[package]]
name = "core-foundation-sys"
version = "0.8.3"
@ -688,11 +688,12 @@ dependencies = [
[[package]]
name = "coreaudio-rs"
version = "0.10.0"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11894b20ebfe1ff903cbdc52259693389eea03b94918a2def2c30c3bf227ad88"
checksum = "cb17e2d1795b1996419648915df94bc7103c28f7b48062d7acf4652fc371b2ff"
dependencies = [
"bitflags",
"core-foundation-sys 0.6.2",
"coreaudio-sys",
]
@ -707,26 +708,28 @@ dependencies = [
[[package]]
name = "cpal"
version = "0.14.2"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f342c1b63e185e9953584ff2199726bf53850d96610a310e3aca09e9405a2d0b"
checksum = "d34fa7b20adf588f73f094cd9b1d944977c686e37a2759ea217ab174f017e10a"
dependencies = [
"alsa",
"core-foundation-sys",
"core-foundation-sys 0.8.3",
"coreaudio-rs",
"dasp_sample 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"jni 0.19.0",
"js-sys",
"libc",
"mach",
"ndk 0.7.0",
"ndk",
"ndk-context",
"oboe",
"once_cell",
"parking_lot",
"stdweb",
"thiserror",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"windows 0.37.0",
"windows 0.44.0",
]
[[package]]
@ -813,7 +816,7 @@ checksum = "21fd3add36ea31aba1520aa5288714dd63be506106753226d0eb387a93bc9c45"
dependencies = [
"cocoa",
"core-foundation",
"core-foundation-sys",
"core-foundation-sys 0.8.3",
"core-graphics",
"core-text",
"dwrote",
@ -1047,7 +1050,7 @@ dependencies = [
"dasp_peak",
"dasp_ring_buffer",
"dasp_rms",
"dasp_sample",
"dasp_sample 0.11.0 (git+https://github.com/RustAudio/dasp?rev=f05a703)",
"dasp_signal",
"dasp_slice",
"dasp_window",
@ -1062,7 +1065,7 @@ dependencies = [
"dasp_peak",
"dasp_ring_buffer",
"dasp_rms",
"dasp_sample",
"dasp_sample 0.11.0 (git+https://github.com/RustAudio/dasp?rev=f05a703)",
]
[[package]]
@ -1070,7 +1073,7 @@ name = "dasp_frame"
version = "0.11.0"
source = "git+https://github.com/RustAudio/dasp?rev=f05a703#f05a703d247bb504d7e812b51e95f3765d9c5e94"
dependencies = [
"dasp_sample",
"dasp_sample 0.11.0 (git+https://github.com/RustAudio/dasp?rev=f05a703)",
]
[[package]]
@ -1080,7 +1083,7 @@ source = "git+https://github.com/RustAudio/dasp?rev=f05a703#f05a703d247bb504d7e8
dependencies = [
"dasp_frame",
"dasp_ring_buffer",
"dasp_sample",
"dasp_sample 0.11.0 (git+https://github.com/RustAudio/dasp?rev=f05a703)",
]
[[package]]
@ -1089,7 +1092,7 @@ version = "0.11.0"
source = "git+https://github.com/RustAudio/dasp?rev=f05a703#f05a703d247bb504d7e812b51e95f3765d9c5e94"
dependencies = [
"dasp_frame",
"dasp_sample",
"dasp_sample 0.11.0 (git+https://github.com/RustAudio/dasp?rev=f05a703)",
]
[[package]]
@ -1104,9 +1107,15 @@ source = "git+https://github.com/RustAudio/dasp?rev=f05a703#f05a703d247bb504d7e8
dependencies = [
"dasp_frame",
"dasp_ring_buffer",
"dasp_sample",
"dasp_sample 0.11.0 (git+https://github.com/RustAudio/dasp?rev=f05a703)",
]
[[package]]
name = "dasp_sample"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f"
[[package]]
name = "dasp_sample"
version = "0.11.0"
@ -1123,7 +1132,7 @@ dependencies = [
"dasp_peak",
"dasp_ring_buffer",
"dasp_rms",
"dasp_sample",
"dasp_sample 0.11.0 (git+https://github.com/RustAudio/dasp?rev=f05a703)",
"dasp_window",
]
@ -1133,7 +1142,7 @@ version = "0.11.0"
source = "git+https://github.com/RustAudio/dasp?rev=f05a703#f05a703d247bb504d7e812b51e95f3765d9c5e94"
dependencies = [
"dasp_frame",
"dasp_sample",
"dasp_sample 0.11.0 (git+https://github.com/RustAudio/dasp?rev=f05a703)",
]
[[package]]
@ -1141,7 +1150,7 @@ name = "dasp_window"
version = "0.11.0"
source = "git+https://github.com/RustAudio/dasp?rev=f05a703#f05a703d247bb504d7e812b51e95f3765d9c5e94"
dependencies = [
"dasp_sample",
"dasp_sample 0.11.0 (git+https://github.com/RustAudio/dasp?rev=f05a703)",
]
[[package]]
@ -1197,12 +1206,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "discard"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0"
[[package]]
name = "dispatch"
version = "0.2.0"
@ -1251,7 +1254,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e62abb876c07e4754fae5c14cafa77937841f01740637e17d78dc04352f32a5e"
dependencies = [
"cc",
"rustc_version 0.4.0",
"rustc_version",
"toml",
"vswhom",
"winreg",
@ -2017,7 +2020,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765"
dependencies = [
"android_system_properties",
"core-foundation-sys",
"core-foundation-sys 0.8.3",
"iana-time-zone-haiku",
"js-sys",
"wasm-bindgen",
@ -2623,19 +2626,6 @@ dependencies = [
"getrandom",
]
[[package]]
name = "ndk"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2032c77e030ddee34a6787a64166008da93f6a352b629261d0fee232b8742dd4"
dependencies = [
"bitflags",
"jni-sys",
"ndk-sys 0.3.0",
"num_enum",
"thiserror",
]
[[package]]
name = "ndk"
version = "0.7.0"
@ -2644,7 +2634,7 @@ checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0"
dependencies = [
"bitflags",
"jni-sys",
"ndk-sys 0.4.1+23.1.7779620",
"ndk-sys",
"num_enum",
"raw-window-handle 0.5.0",
"thiserror",
@ -2664,10 +2654,10 @@ checksum = "0434fabdd2c15e0aab768ca31d5b7b333717f03cf02037d5a0a3ff3c278ed67f"
dependencies = [
"libc",
"log",
"ndk 0.7.0",
"ndk",
"ndk-context",
"ndk-macro",
"ndk-sys 0.4.1+23.1.7779620",
"ndk-sys",
"once_cell",
"parking_lot",
]
@ -2685,15 +2675,6 @@ dependencies = [
"syn",
]
[[package]]
name = "ndk-sys"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e5a6ae77c8ee183dcbbba6150e2e6b9f3f4196a7666c02a715a95692ec1fa97"
dependencies = [
"jni-sys",
]
[[package]]
name = "ndk-sys"
version = "0.4.1+23.1.7779620"
@ -2735,19 +2716,6 @@ dependencies = [
"nihav_core",
]
[[package]]
name = "nix"
version = "0.23.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c"
dependencies = [
"bitflags",
"cc",
"cfg-if 1.0.0",
"libc",
"memoffset 0.6.5",
]
[[package]]
name = "nix"
version = "0.24.3"
@ -2951,12 +2919,12 @@ dependencies = [
[[package]]
name = "oboe"
version = "0.4.6"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27f63c358b4fa0fbcfefd7c8be5cfc39c08ce2389f5325687e7762a48d30a5c1"
checksum = "8868cc237ee02e2d9618539a23a8d228b9bb3fc2e7a5b11eed3831de77c395d0"
dependencies = [
"jni 0.19.0",
"ndk 0.6.0",
"jni 0.20.0",
"ndk",
"ndk-context",
"num-derive",
"num-traits",
@ -2965,9 +2933,9 @@ dependencies = [
[[package]]
name = "oboe-sys"
version = "0.4.5"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3370abb7372ed744232c12954d920d1a40f1c4686de9e79e800021ef492294bd"
checksum = "7f44155e7fb718d3cfddcf70690b2b51ac4412f347cd9e4fbe511abe9cd7b5f2"
dependencies = [
"cc",
]
@ -3758,22 +3726,13 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustc_version"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
dependencies = [
"semver 0.9.0",
]
[[package]]
name = "rustc_version"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
dependencies = [
"semver 1.0.16",
"semver",
]
[[package]]
@ -3898,27 +3857,12 @@ dependencies = [
"tiny-skia",
]
[[package]]
name = "semver"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
dependencies = [
"semver-parser",
]
[[package]]
name = "semver"
version = "1.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a"
[[package]]
name = "semver-parser"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
version = "1.0.152"
@ -3995,21 +3939,6 @@ dependencies = [
"pkg-config",
]
[[package]]
name = "sha1"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1da05c97445caa12d05e848c4a4fcbbea29e748ac28f7e80e9b010392063770"
dependencies = [
"sha1_smol",
]
[[package]]
name = "sha1_smol"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012"
[[package]]
name = "sha2"
version = "0.10.6"
@ -4143,55 +4072,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "stdweb"
version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5"
dependencies = [
"discard",
"rustc_version 0.2.3",
"stdweb-derive",
"stdweb-internal-macros",
"stdweb-internal-runtime",
"wasm-bindgen",
]
[[package]]
name = "stdweb-derive"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef"
dependencies = [
"proc-macro2",
"quote",
"serde",
"serde_derive",
"syn",
]
[[package]]
name = "stdweb-internal-macros"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11"
dependencies = [
"base-x",
"proc-macro2",
"quote",
"serde",
"serde_derive",
"serde_json",
"sha1",
"syn",
]
[[package]]
name = "stdweb-internal-runtime"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0"
[[package]]
name = "str-buf"
version = "1.0.6"
@ -5128,6 +5008,15 @@ dependencies = [
"windows_x86_64_msvc 0.42.1",
]
[[package]]
name = "windows"
version = "0.44.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e745dab35a0c4c77aa3ce42d595e13d2003d6902d6b08c9ef5fc326d08da12b"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-sys"
version = "0.36.1"
@ -5156,6 +5045,21 @@ dependencies = [
"windows_x86_64_msvc 0.42.1",
]
[[package]]
name = "windows-targets"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc 0.42.1",
"windows_i686_gnu 0.42.1",
"windows_i686_msvc 0.42.1",
"windows_x86_64_gnu 0.42.1",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc 0.42.1",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.1"
@ -5303,7 +5207,7 @@ dependencies = [
"libc",
"log",
"mio",
"ndk 0.7.0",
"ndk",
"ndk-glue",
"objc",
"once_cell",

View File

@ -9,7 +9,7 @@ version.workspace = true
[dependencies]
clap = { version = "4.1.4", features = ["derive"] }
cpal = "0.14.2"
cpal = "0.15.0"
ruffle_core = { path = "../core", features = ["audio", "mp3", "nellymoser"] }
ruffle_render = { path = "../render" }
ruffle_render_wgpu = { path = "../render/wgpu", features = ["clap"] }

View File

@ -41,11 +41,13 @@ impl CpalAudioBackend {
&config,
move |buffer, _| mixer.mix::<f32>(buffer),
error_handler,
None,
),
cpal::SampleFormat::I16 => device.build_output_stream(
&config,
move |buffer, _| mixer.mix::<i16>(buffer),
error_handler,
None,
),
cpal::SampleFormat::U16 => device.build_output_stream(
&config,
@ -59,7 +61,9 @@ impl CpalAudioBackend {
}
},
error_handler,
None,
),
_ => anyhow::bail!("Unsupported sample format {sample_format:?}"),
}?
};