There's no way it's this easy to add music... (#417)

This commit is contained in:
Dustin Carlino 2020-12-09 13:46:27 -08:00 committed by GitHub
parent 737b35f68d
commit 6e6e975923
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 644 additions and 21 deletions

518
Cargo.lock generated
View File

@ -71,6 +71,28 @@ dependencies = [
"memchr",
]
[[package]]
name = "alsa"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb213f6b3e4b1480a60931ca2035794aa67b73103d254715b1db7b70dcb3c934"
dependencies = [
"alsa-sys",
"bitflags",
"libc",
"nix 0.15.0",
]
[[package]]
name = "alsa-sys"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5a0559bcd3f7a482690d98be41c08a43e92f669b179433e95ddf5e8b8fd36a3"
dependencies = [
"libc",
"pkg-config",
]
[[package]]
name = "andrew"
version = "0.3.1"
@ -138,6 +160,12 @@ dependencies = [
"stable_deref_trait",
]
[[package]]
name = "ascii"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e"
[[package]]
name = "atty"
version = "0.2.14"
@ -169,6 +197,21 @@ dependencies = [
"rustc-demangle",
]
[[package]]
name = "base64"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e"
dependencies = [
"byteorder",
]
[[package]]
name = "base64"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7"
[[package]]
name = "base64"
version = "0.12.3"
@ -191,6 +234,25 @@ dependencies = [
"serde",
]
[[package]]
name = "bindgen"
version = "0.56.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2da379dbebc0b76ef63ca68d8fc6e71c0f13e59432e0987e508c1820e6ab5239"
dependencies = [
"bitflags",
"cexpr",
"clang-sys",
"lazy_static",
"lazycell",
"peeking_take_while",
"proc-macro2",
"quote",
"regex",
"rustc-hash",
"shlex",
]
[[package]]
name = "bitflags"
version = "1.2.1"
@ -256,7 +318,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b036167e76041694579972c28cf4877b4f92da222560ddb49008937b6a6727c"
dependencies = [
"log",
"nix",
"nix 0.18.0",
]
[[package]]
@ -268,7 +330,7 @@ dependencies = [
"semver",
"serde",
"toml",
"url",
"url 2.2.0",
]
[[package]]
@ -294,6 +356,21 @@ version = "1.0.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d"
[[package]]
name = "cesu8"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
[[package]]
name = "cexpr"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27"
dependencies = [
"nom",
]
[[package]]
name = "cfg-if"
version = "0.1.10"
@ -328,6 +405,23 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "chunked_transfer"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7477065d45a8fe57167bf3cf8bcd3729b54cfcb81cca49bda2d038ea89ae82ca"
[[package]]
name = "clang-sys"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0659001ab56b791be01d4b729c44376edc6718cf389a502e579b77b758f3296c"
dependencies = [
"glob",
"libc",
"libloading",
]
[[package]]
name = "clap"
version = "2.33.3"
@ -405,6 +499,30 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aba0709907d231ef5ac2ab2209bd52e16c4788b05fded799f0ec5b6f33895089"
[[package]]
name = "combine"
version = "3.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da3da6baa321ec19e1cc41d31bf599f00c783d0517095cdaf0332e3fe8d20680"
dependencies = [
"ascii",
"byteorder",
"either",
"memchr",
"unreachable",
]
[[package]]
name = "combine"
version = "4.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9417a0c314565e2abffaece67e95a8cb51f9238cd39f3764d9dfdf09e72b20c"
dependencies = [
"bytes",
"memchr",
"pin-project-lite",
]
[[package]]
name = "console_log"
version = "0.2.0"
@ -441,6 +559,16 @@ dependencies = [
"serde",
]
[[package]]
name = "cookie"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "888604f00b3db336d2af898ec3c1d5d0ddf5e6d462220f2ededc33a87ac4bbd5"
dependencies = [
"time",
"url 1.7.2",
]
[[package]]
name = "core-foundation"
version = "0.7.0"
@ -461,6 +589,12 @@ dependencies = [
"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.7.0"
@ -523,6 +657,50 @@ dependencies = [
"objc",
]
[[package]]
name = "coreaudio-rs"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f229761965dad3e9b11081668a6ea00f1def7aa46062321b5ec245b834f6e491"
dependencies = [
"bitflags",
"coreaudio-sys",
]
[[package]]
name = "coreaudio-sys"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b7e3347be6a09b46aba228d6608386739fb70beff4f61e07422da87b0bb31fa"
dependencies = [
"bindgen",
]
[[package]]
name = "cpal"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05631e2089dfa5d3b6ea1cfbbfd092e2ee5deeb69698911bc976b28b746d3657"
dependencies = [
"alsa",
"core-foundation-sys 0.6.2",
"coreaudio-rs",
"jni 0.17.0",
"js-sys",
"lazy_static",
"libc",
"mach",
"ndk",
"ndk-glue",
"nix 0.15.0",
"oboe",
"parking_lot",
"stdweb",
"thiserror",
"web-sys",
"winapi 0.3.9",
]
[[package]]
name = "crc32fast"
version = "1.2.1"
@ -560,7 +738,7 @@ version = "3.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b57a92e9749e10f25a171adcebfafe72991d45e7ec2dcb853e8f83d9dafaeb08"
dependencies = [
"nix",
"nix 0.18.0",
"winapi 0.3.9",
]
@ -724,6 +902,16 @@ dependencies = [
"termcolor",
]
[[package]]
name = "error-chain"
version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc"
dependencies = [
"backtrace",
"version_check",
]
[[package]]
name = "euclid"
version = "0.22.1"
@ -745,6 +933,7 @@ dependencies = [
"map_model",
"rand",
"rand_xorshift",
"rodio",
"serde",
"wasm-bindgen",
"widgetry",
@ -782,6 +971,17 @@ dependencies = [
"serde",
]
[[package]]
name = "fetch_unroll"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5c55005e95bbe15f5f72a73b6597d0dc82ddc97ffe2ca097a99dcd591fefbca"
dependencies = [
"libflate",
"tar",
"ureq",
]
[[package]]
name = "fifteen_min"
version = "0.1.0"
@ -796,6 +996,18 @@ dependencies = [
"widgetry",
]
[[package]]
name = "filetime"
version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c122a393ea57648015bf06fbd3d372378992e86b9ff5a7a497b076a28c79efe"
dependencies = [
"cfg-if 1.0.0",
"libc",
"redox_syscall",
"winapi 0.3.9",
]
[[package]]
name = "fixedbitset"
version = "0.2.0"
@ -868,7 +1080,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00"
dependencies = [
"matches",
"percent-encoding",
"percent-encoding 2.1.0",
]
[[package]]
@ -1335,7 +1547,7 @@ dependencies = [
"serde_json",
"sim",
"tokio",
"url",
"url 2.2.0",
]
[[package]]
@ -1444,7 +1656,7 @@ dependencies = [
"futures-util",
"hyper",
"log",
"rustls",
"rustls 0.18.1",
"tokio",
"tokio-rustls",
"webpki",
@ -1456,6 +1668,17 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
name = "idna"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
dependencies = [
"matches",
"unicode-bidi",
"unicode-normalization",
]
[[package]]
name = "idna"
version = "0.2.0"
@ -1601,6 +1824,34 @@ version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6"
[[package]]
name = "jni"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1981310da491a4f0f815238097d0d43d8072732b5ae5f8bd0d8eadf5bf245402"
dependencies = [
"cesu8",
"combine 3.8.1",
"error-chain",
"jni-sys",
"log",
"walkdir",
]
[[package]]
name = "jni"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36bcc950632e48b86da402c5c077590583da5ac0d480103611d5374e7c967a3c"
dependencies = [
"cesu8",
"combine 4.4.0",
"error-chain",
"jni-sys",
"log",
"walkdir",
]
[[package]]
name = "jni-sys"
version = "0.3.0"
@ -1664,12 +1915,35 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "lewton"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be42bea7971f4ba0ea1e215730c29bc1ff9bd2a9c10013912f42a8dcf8d77c0d"
dependencies = [
"byteorder",
"ogg",
"tinyvec",
]
[[package]]
name = "libc"
version = "0.2.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614"
[[package]]
name = "libflate"
version = "0.1.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9135df43b1f5d0e333385cb6e7897ecd1a43d7d11b91ac003f4d2c2d2401fdd"
dependencies = [
"adler32",
"crc32fast",
"rle-decode-fast",
"take_mut",
]
[[package]]
name = "libloading"
version = "0.6.5"
@ -1776,6 +2050,15 @@ dependencies = [
"sid",
]
[[package]]
name = "mach"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa"
dependencies = [
"libc",
]
[[package]]
name = "malloc_buf"
version = "0.0.6"
@ -2066,6 +2349,19 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "nix"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b2e0b4f3320ed72aaedb9a5ac838690a8047c7b275da22711fddff4f8a14229"
dependencies = [
"bitflags",
"cc",
"cfg-if 0.1.10",
"libc",
"void",
]
[[package]]
name = "nix"
version = "0.18.0"
@ -2088,6 +2384,17 @@ dependencies = [
"version_check",
]
[[package]]
name = "num-derive"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "num-integer"
version = "0.1.43"
@ -2192,6 +2499,38 @@ version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37fd5004feb2ce328a52b0b3d01dbf4ffff72583493900ed15f22d4111c51693"
[[package]]
name = "oboe"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1aadc2b0867bdbb9a81c4d99b9b682958f49dbea1295a81d2f646cca2afdd9fc"
dependencies = [
"jni 0.14.0",
"ndk",
"ndk-glue",
"num-derive",
"num-traits 0.2.12",
"oboe-sys",
]
[[package]]
name = "oboe-sys"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68ff7a51600eabe34e189eec5c995a62f151d8d97e5fbca39e87ca738bb99b82"
dependencies = [
"fetch_unroll",
]
[[package]]
name = "ogg"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13e571c3517af9e1729d4c63571a27edd660ade0667973bfc74a67c660c2b651"
dependencies = [
"byteorder",
]
[[package]]
name = "once_cell"
version = "1.4.1"
@ -2282,6 +2621,18 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ec91767ecc0a0bbe558ce8c9da33c068066c57ecc8bb8477ef8c1ad3ef77c27"
[[package]]
name = "peeking_take_while"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
[[package]]
name = "percent-encoding"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
[[package]]
name = "percent-encoding"
version = "2.1.0"
@ -2444,6 +2795,15 @@ dependencies = [
"unicode-xid",
]
[[package]]
name = "qstring"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d464fae65fff2680baf48019211ce37aaec0c78e9264c84a3e484717f965104e"
dependencies = [
"percent-encoding 2.1.0",
]
[[package]]
name = "quote"
version = "1.0.7"
@ -2600,18 +2960,18 @@ dependencies = [
"log",
"mime",
"mime_guess",
"percent-encoding",
"percent-encoding 2.1.0",
"pin-project-lite",
"rustls",
"rustls 0.18.1",
"serde",
"serde_urlencoded",
"tokio",
"tokio-rustls",
"url",
"url 2.2.0",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"webpki-roots",
"webpki-roots 0.19.0",
"winreg",
]
@ -2630,6 +2990,12 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "rle-decode-fast"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac"
[[package]]
name = "robust"
version = "0.1.2"
@ -2642,6 +3008,16 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d1a6eb3bd241993b09a354047bfba030778b347ac4de4bc0fd80e531e7cbfac8"
[[package]]
name = "rodio"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9683532495146e98878d4948fa1a1953f584cd923f2a5f5c26b7a8701b56943"
dependencies = [
"cpal",
"lewton",
]
[[package]]
name = "roxmltree"
version = "0.13.0"
@ -2675,6 +3051,19 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustls"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b25a18b1bf7387f0145e7f8324e700805aade3842dd3db2e74e4cdeb4677c09e"
dependencies = [
"base64 0.10.1",
"log",
"ring",
"sct",
"webpki",
]
[[package]]
name = "rustls"
version = "0.18.1"
@ -2824,7 +3213,7 @@ dependencies = [
"dtoa",
"itoa",
"serde",
"url",
"url 2.2.0",
]
[[package]]
@ -2837,6 +3226,12 @@ dependencies = [
"libc",
]
[[package]]
name = "shlex"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
[[package]]
name = "sid"
version = "0.6.1"
@ -2922,7 +3317,7 @@ dependencies = [
"lazy_static",
"log",
"memmap",
"nix",
"nix 0.18.0",
"wayland-client",
"wayland-cursor",
"wayland-protocols",
@ -2952,6 +3347,12 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "stdweb"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef5430c8e36b713e13b48a9f709cc21e046723fe44ce34587b73a830203b533e"
[[package]]
name = "stretch"
version = "0.3.2"
@ -3016,6 +3417,24 @@ dependencies = [
"unicode-xid",
]
[[package]]
name = "take_mut"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60"
[[package]]
name = "tar"
version = "0.4.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "489997b7557e9a43e192c527face4feacc78bfbe6eed67fd55c4c9e381cba290"
dependencies = [
"filetime",
"libc",
"redox_syscall",
"xattr",
]
[[package]]
name = "tempfile"
version = "3.1.0"
@ -3160,7 +3579,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e12831b255bcfa39dc0436b01e19fea231a37db570686c06ee72c423479f889a"
dependencies = [
"futures-core",
"rustls",
"rustls 0.18.1",
"tokio",
"webpki",
]
@ -3336,6 +3755,15 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
[[package]]
name = "unreachable"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
dependencies = [
"void",
]
[[package]]
name = "untrusted"
version = "0.7.1"
@ -3355,6 +3783,34 @@ dependencies = [
"walkdir",
]
[[package]]
name = "ureq"
version = "0.11.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "801125e6d1ba6864cf3a5a92cfb2f0b0a3ee73e40602a0cd206ad2f3c040aa96"
dependencies = [
"base64 0.11.0",
"chunked_transfer",
"cookie",
"lazy_static",
"qstring",
"rustls 0.16.0",
"url 2.2.0",
"webpki",
"webpki-roots 0.18.0",
]
[[package]]
name = "url"
version = "1.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a"
dependencies = [
"idna 0.1.5",
"matches",
"percent-encoding 1.0.1",
]
[[package]]
name = "url"
version = "2.2.0"
@ -3362,9 +3818,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e"
dependencies = [
"form_urlencoded",
"idna",
"idna 0.2.0",
"matches",
"percent-encoding",
"percent-encoding 2.1.0",
]
[[package]]
@ -3405,6 +3861,12 @@ version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
[[package]]
name = "void"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
[[package]]
name = "walkdir"
version = "2.3.1"
@ -3515,7 +3977,7 @@ dependencies = [
"bitflags",
"downcast-rs",
"libc",
"nix",
"nix 0.18.0",
"scoped-tls",
"wayland-commons",
"wayland-scanner",
@ -3528,7 +3990,7 @@ version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7602d75560fe6f02cac723609cce658042fe60541b5107999818d29d4dab7cfa"
dependencies = [
"nix",
"nix 0.18.0",
"once_cell",
"smallvec",
"wayland-sys",
@ -3540,7 +4002,7 @@ version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0446b959c5b5b4b2c11f63112fc7cbeb50ecd9f2c340d2b0ea632875685baf04"
dependencies = [
"nix",
"nix 0.18.0",
"wayland-client",
"xcursor",
]
@ -3620,6 +4082,15 @@ dependencies = [
"untrusted",
]
[[package]]
name = "webpki-roots"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91cd5736df7f12a964a5067a12c62fa38e1bd8080aff1f80bc29be7c80d19ab4"
dependencies = [
"webpki",
]
[[package]]
name = "webpki-roots"
version = "0.19.0"
@ -3739,7 +4210,7 @@ dependencies = [
"ndk-sys",
"objc",
"parking_lot",
"percent-encoding",
"percent-encoding 2.1.0",
"raw-window-handle",
"smithay-client-toolkit",
"wasm-bindgen",
@ -3780,6 +4251,15 @@ dependencies = [
"pkg-config",
]
[[package]]
name = "xattr"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c"
dependencies = [
"libc",
]
[[package]]
name = "xcursor"
version = "0.3.2"

View File

@ -72,3 +72,4 @@ Other binary data bundled in:
- Material Design icons (<https://material.io/resources/icons>, Apache license)
- Some Graphics textures (<https://www.kenney.nl/>, CC0 1.0 Universal)
- Snowflake SVG (<https://www.svgrepo.com/page/licensing>, CC0)
- Jingle Bells (<https://soundcloud.com/royaltyfreebackgroundmusic/creative-commons-music-4061>, CC BY-NC-ND)

Binary file not shown.

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M4.34 2.93L2.93 4.34 7.29 8.7 7 9H3v6h4l5 5v-6.59l4.18 4.18c-.65.49-1.38.88-2.18 1.11v2.06c1.34-.3 2.57-.92 3.61-1.75l2.05 2.05 1.41-1.41L4.34 2.93zM19 12c0 .82-.15 1.61-.41 2.34l1.53 1.53c.56-1.17.88-2.48.88-3.87 0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zm-7-8l-1.88 1.88L12 7.76zm4.5 8c0-1.77-1.02-3.29-2.5-4.03v1.79l2.48 2.48c.01-.08.02-.16.02-.24z" fill="white"/></svg>

After

Width:  |  Height:  |  Size: 514 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z" fill="white"/></svg>

After

Width:  |  Height:  |  Size: 341 B

View File

@ -20,6 +20,7 @@ map_gui = { path = "../map_gui" }
map_model = { path = "../map_model" }
rand = "0.7.0"
rand_xorshift = "0.2.0"
rodio = { version = "0.13.0", default-features = false, features = ["vorbis"] }
serde = "1.0.116"
wasm-bindgen = { version = "0.2.68", optional = true }
widgetry = { path = "../widgetry" }

View File

@ -83,10 +83,13 @@ impl State<App> for Results {
_ => {}
}
app.session.update_music(ctx);
Transition::Keep
}
fn draw(&self, g: &mut GfxCtx, _: &App) {
fn draw(&self, g: &mut GfxCtx, app: &App) {
self.panel.draw(g);
app.session.music.draw(g);
}
}

View File

@ -130,11 +130,14 @@ impl State<App> for Picker {
_ => {}
}
app.session.update_music(ctx);
Transition::Keep
}
fn draw(&self, g: &mut GfxCtx, app: &App) {
self.panel.draw(g);
app.session.music.draw(g);
g.redraw(&self.bldgs.draw_all);
for b in &self.current_picks {
g.draw_polygon(Color::PINK, app.map.get_b(*b).polygon.clone());

View File

@ -316,6 +316,8 @@ impl State<App> for Game {
},
_ => {}
}
app.session.update_music(ctx);
}
ctx.request_update(UpdateType::Game);
@ -327,6 +329,7 @@ impl State<App> for Game {
self.status_panel.draw(g);
self.time_panel.draw(g);
self.boost_panel.draw(g);
app.session.music.draw(g);
let santa_tracker = g.upload(GeomBatch::from(vec![(
Color::RED,

View File

@ -10,6 +10,7 @@ mod game;
mod levels;
mod meters;
mod movement;
mod music;
mod session;
mod title;
mod vehicles;
@ -30,6 +31,7 @@ pub fn main() {
if app.opts.dev {
app.session.unlock_all();
}
app.session.music = music::Music::start(ctx, app.session.play_music);
let states = vec![title::TitleScreen::new(ctx, &app)];
(app, states)

108
experiment/src/music.rs Normal file
View File

@ -0,0 +1,108 @@
use std::error::Error;
use std::io::Cursor;
use rodio::{Decoder, OutputStream, Sink};
use widgetry::{
Btn, Checkbox, EventCtx, GfxCtx, HorizontalAlignment, Outcome, Panel, VerticalAlignment,
};
pub struct Music {
inner: Option<Inner>,
}
impl std::default::Default for Music {
fn default() -> Music {
Music::empty()
}
}
struct Inner {
// Have to keep this alive for the background thread to continue
_stream: OutputStream,
sink: Sink,
panel: Panel,
}
impl Music {
pub fn empty() -> Music {
Music { inner: None }
}
pub fn start(ctx: &mut EventCtx, play_music: bool) -> Music {
match Inner::new(ctx, play_music) {
Ok(inner) => Music { inner: Some(inner) },
Err(err) => {
error!("No music, sorry: {}", err);
Music::empty()
}
}
}
pub fn event(&mut self, ctx: &mut EventCtx, play_music: &mut bool) {
if let Some(ref mut inner) = self.inner {
match inner.panel.event(ctx) {
Outcome::Clicked(_) => unreachable!(),
Outcome::Changed => {
if inner.panel.is_checked("play music") {
*play_music = true;
inner.unmute();
} else {
*play_music = false;
inner.mute();
}
}
_ => {}
}
}
}
pub fn draw(&self, g: &mut GfxCtx) {
if let Some(ref inner) = self.inner {
inner.panel.draw(g);
}
}
}
impl Inner {
fn new(ctx: &mut EventCtx, play_music: bool) -> Result<Inner, Box<dyn Error>> {
let (stream, stream_handle) = OutputStream::try_default()?;
let sink = rodio::Sink::try_new(&stream_handle)?;
let raw_bytes =
Cursor::new(include_bytes!("../../data/system/assets/music/jingle_bells.ogg").to_vec());
sink.append(Decoder::new_looped(raw_bytes)?);
if !play_music {
sink.set_volume(0.0);
}
let panel = Panel::new(
Checkbox::new(
play_music,
Btn::svg_def("system/assets/tools/volume_off.svg").build(ctx, "play music", None),
Btn::svg_def("system/assets/tools/volume_on.svg").build(ctx, "mute music", None),
)
.named("play music")
.container(),
)
.aligned(
HorizontalAlignment::LeftInset,
VerticalAlignment::BottomInset,
)
.build(ctx);
Ok(Inner {
_stream: stream,
sink,
panel,
})
}
fn unmute(&mut self) {
self.sink.set_volume(1.0);
}
fn mute(&mut self) {
self.sink.set_volume(0.0);
}
}

View File

@ -3,9 +3,10 @@ use std::collections::HashMap;
use serde::{Deserialize, Serialize};
use abstutil::Timer;
use widgetry::Color;
use widgetry::{Color, EventCtx};
use crate::levels::Level;
use crate::music::Music;
/// Persistent state that lasts across levels.
#[derive(Serialize, Deserialize)]
@ -20,6 +21,10 @@ pub struct Session {
pub current_vehicle: String,
pub vehicles_unlocked: Vec<String>,
pub upzones_unlocked: usize,
#[serde(skip_serializing, skip_deserializing)]
pub music: Music,
pub play_music: bool,
}
#[derive(Serialize, Deserialize)]
@ -73,6 +78,9 @@ impl Session {
current_vehicle: "sleigh".to_string(),
vehicles_unlocked: vec!["sleigh".to_string()],
upzones_unlocked: 0,
music: Music::empty(),
play_music: true,
}
}
@ -127,4 +135,13 @@ impl Session {
}
self.levels_unlocked = self.levels.len();
}
pub fn update_music(&mut self, ctx: &mut EventCtx) {
let play_music = self.play_music;
self.music.event(ctx, &mut self.play_music);
if play_music != self.play_music {
// Save when we mute/unmute
abstutil::write_json(abstutil::path_player("santa.json"), self);
}
}
}

View File

@ -102,6 +102,8 @@ impl State<App> for TitleScreen {
_ => {}
}
app.session.update_music(ctx);
Transition::Keep
}
@ -112,5 +114,6 @@ impl State<App> for TitleScreen {
fn draw(&self, g: &mut GfxCtx, app: &App) {
g.clear(app.cs.dialog_bg);
self.panel.draw(g);
app.session.music.draw(g);
}
}