Compare commits

...

4 commits

Author SHA1 Message Date
3ca0eb1eea Use simpler algorithm for PC speaker tones
All checks were successful
continuous-integration/drone/push Build is passing
2022-11-27 22:36:39 -05:00
4b0b67c69a Fix whipping input 2022-11-27 22:29:00 -05:00
74d1c120fc Revert "Use FunDSP crate for beepboops"
This reverts commit 9219b6c475.
2022-11-24 00:05:11 -05:00
9dcd94932f Crate updates 2022-11-23 23:57:14 -05:00
8 changed files with 432 additions and 178 deletions

481
Cargo.lock generated
View file

@ -93,6 +93,12 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "base-x"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270"
[[package]]
name = "bindgen"
version = "0.56.0"
@ -139,7 +145,7 @@ version = "0.8.2"
source = "git+https://github.com/amethyst/bracket-lib#cf8eec60ae17f2534a14f3ae643c871202aed192"
dependencies = [
"lazy_static",
"parking_lot",
"parking_lot 0.11.2",
]
[[package]]
@ -148,7 +154,7 @@ version = "0.8.0"
source = "git+https://github.com/amethyst/bracket-lib#cf8eec60ae17f2534a14f3ae643c871202aed192"
dependencies = [
"lazy_static",
"parking_lot",
"parking_lot 0.11.2",
]
[[package]]
@ -233,7 +239,7 @@ dependencies = [
"image",
"lazy_static",
"object-pool",
"parking_lot",
"parking_lot 0.11.2",
"rand",
"spin_sleep",
"ultraviolet",
@ -494,28 +500,28 @@ dependencies = [
[[package]]
name = "cpal"
version = "0.13.5"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74117836a5124f3629e4b474eed03e479abaf98988b4bb317e29f08cfe0e4116"
checksum = "e73413ddcb69c398125f5529714492e070c64c6a090ad5b01d8c082b320a0809"
dependencies = [
"alsa",
"core-foundation-sys 0.8.3",
"coreaudio-rs",
"jni",
"js-sys",
"lazy_static",
"libc",
"mach",
"ndk 0.6.0",
"ndk-glue 0.6.0",
"nix 0.23.1",
"ndk 0.7.0",
"ndk-context",
"nix 0.25.0",
"oboe",
"parking_lot",
"once_cell",
"parking_lot 0.12.1",
"stdweb",
"thiserror",
"wasm-bindgen",
"web-sys",
"winapi 0.3.9",
"windows",
]
[[package]]
@ -723,6 +729,12 @@ dependencies = [
"winapi 0.3.9",
]
[[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"
@ -802,37 +814,12 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
[[package]]
name = "fundsp"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "914385c9ea3226815d12f436c2c60b2e6f88a89af684ed9e24d62e55f1b0dba1"
dependencies = [
"generic-array",
"lazy_static",
"num-complex",
"numeric-array",
"rsor",
"rustfft",
"tinyvec",
]
[[package]]
name = "futures"
version = "0.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678"
[[package]]
name = "generic-array"
version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803"
dependencies = [
"typenum",
"version_check",
]
[[package]]
name = "getrandom"
version = "0.2.4"
@ -893,7 +880,7 @@ dependencies = [
"log",
"objc",
"osmesa-sys",
"parking_lot",
"parking_lot 0.11.2",
"wayland-client",
"wayland-egl",
"winapi 0.3.9",
@ -947,20 +934,21 @@ dependencies = [
[[package]]
name = "hashbrown"
version = "0.11.2"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
dependencies = [
"ahash",
]
[[package]]
name = "hecs"
version = "0.5.2"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddd0e227c3f78ad06fcc590966b327a2f8fef03ef51812dad4fbff5b0a6424bd"
checksum = "11b81e962a0576ee276c1e6cbdce16bed83c7357ce8ff4e9efc8f49e43d2d1a1"
dependencies = [
"hashbrown",
"spin",
]
[[package]]
@ -1006,6 +994,12 @@ dependencies = [
"libc",
]
[[package]]
name = "itoa"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc"
[[package]]
name = "jni"
version = "0.19.0"
@ -1073,10 +1067,10 @@ dependencies = [
"bracket-lib",
"console_error_panic_hook",
"cpal",
"fundsp",
"hecs",
"instant",
"oddio",
"rand",
"specs-derive",
"typenum",
"wasm-bindgen",
@ -1097,9 +1091,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "libc"
version = "0.2.117"
version = "0.2.137"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e74d72e0f9b65b5b4ca49a346af3976df0f9c61d550727f349ecd559f251a26c"
checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89"
[[package]]
name = "libloading"
@ -1326,6 +1320,26 @@ dependencies = [
"thiserror",
]
[[package]]
name = "ndk"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0"
dependencies = [
"bitflags",
"jni-sys",
"ndk-sys 0.4.1+23.1.7779620",
"num_enum 0.5.6",
"raw-window-handle 0.5.0",
"thiserror",
]
[[package]]
name = "ndk-context"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b"
[[package]]
name = "ndk-glue"
version = "0.2.1"
@ -1409,6 +1423,15 @@ dependencies = [
"jni-sys",
]
[[package]]
name = "ndk-sys"
version = "0.4.1+23.1.7779620"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3cf2aae958bd232cac5069850591667ad422d263686d75b52a065f9badeee5a3"
dependencies = [
"jni-sys",
]
[[package]]
name = "net2"
version = "0.2.37"
@ -1457,6 +1480,20 @@ dependencies = [
"memoffset",
]
[[package]]
name = "nix"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e322c04a9e3440c327fca7b6c8a63e6890a32fa2ad689db972425f07e0d22abb"
dependencies = [
"autocfg",
"bitflags",
"cfg-if 1.0.0",
"libc",
"memoffset",
"pin-utils",
]
[[package]]
name = "nom"
version = "5.1.2"
@ -1487,15 +1524,6 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "num-complex"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26873667bbbb7c5182d4a37c1add32cdf09f841af72da53318fdb81543c15085"
dependencies = [
"num-traits",
]
[[package]]
name = "num-derive"
version = "0.3.3"
@ -1602,16 +1630,6 @@ dependencies = [
"syn",
]
[[package]]
name = "numeric-array"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c59a9b227913a685ed84aa0de5ded58274e8bcfa55760faae07bc82aee64ccf"
dependencies = [
"generic-array",
"num-traits",
]
[[package]]
name = "objc"
version = "0.2.7"
@ -1627,7 +1645,7 @@ version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee9a3e7196d09ec86002b939f1576e8e446d58def8fd48fe578e2c72d5328d68"
dependencies = [
"parking_lot",
"parking_lot 0.11.2",
]
[[package]]
@ -1655,18 +1673,18 @@ dependencies = [
[[package]]
name = "oddio"
version = "0.5.0"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33f6d5a128f26322b02ba2741cbdc9f14f1431e757db3b15fd893d5c416f3e20"
checksum = "f0f3379cc7e854d0b0d4a0e310f276faafc46896843b720efe4646faa1b0c734"
dependencies = [
"mint",
]
[[package]]
name = "once_cell"
version = "1.9.0"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5"
checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
[[package]]
name = "osmesa-sys"
@ -1694,7 +1712,17 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
dependencies = [
"instant",
"lock_api",
"parking_lot_core",
"parking_lot_core 0.8.5",
]
[[package]]
name = "parking_lot"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
"parking_lot_core 0.9.4",
]
[[package]]
@ -1711,6 +1739,19 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "parking_lot_core"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0"
dependencies = [
"cfg-if 1.0.0",
"libc",
"redox_syscall",
"smallvec",
"windows-sys",
]
[[package]]
name = "peeking_take_while"
version = "0.1.2"
@ -1723,6 +1764,12 @@ version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
[[package]]
name = "pin-utils"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkg-config"
version = "0.3.24"
@ -1742,13 +1789,10 @@ dependencies = [
]
[[package]]
name = "primal-check"
version = "0.3.1"
name = "ppv-lite86"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01419cee72c1a1ca944554e23d83e483e1bccf378753344e881de28b5487511d"
dependencies = [
"num-integer",
]
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "proc-macro-crate"
@ -1789,10 +1833,22 @@ dependencies = [
[[package]]
name = "rand"
version = "0.8.4"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"libc",
"rand_chacha",
"rand_core",
]
[[package]]
name = "rand_chacha"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
"ppv-lite86",
"rand_core",
]
@ -1801,6 +1857,9 @@ name = "rand_core"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
dependencies = [
"getrandom",
]
[[package]]
name = "rand_xorshift"
@ -1830,6 +1889,15 @@ dependencies = [
"cty",
]
[[package]]
name = "raw-window-handle"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed7e3d950b66e19e0c372f3fa3fbbcf85b1746b571f74e0c2af6042a5c93420a"
dependencies = [
"cty",
]
[[package]]
name = "redox_syscall"
version = "0.2.10"
@ -1866,12 +1934,6 @@ version = "0.6.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
[[package]]
name = "rsor"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b57e3964dc31a38416366d2e8f7675755402a10832d5cf4e4112d66ac77cdda"
[[package]]
name = "rustc-hash"
version = "1.1.0"
@ -1879,17 +1941,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustfft"
version = "6.0.1"
name = "rustc_version"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1d089e5c57521629a59f5f39bca7434849ff89bd6873b521afe389c1c602543"
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
dependencies = [
"num-complex",
"num-integer",
"num-traits",
"primal-check",
"strength_reduce",
"transpose",
"semver",
]
[[package]]
@ -1902,6 +1959,12 @@ dependencies = [
"owned_ttf_parser",
]
[[package]]
name = "ryu"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
[[package]]
name = "safe_arch"
version = "0.5.2"
@ -1932,6 +1995,21 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[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-parser"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "send_wrapper"
version = "0.2.0"
@ -1944,6 +2022,43 @@ version = "1.0.136"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
[[package]]
name = "serde_derive"
version = "1.0.136"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "serde_json"
version = "1.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db"
dependencies = [
"itoa",
"ryu",
"serde",
]
[[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 = "shared_library"
version = "0.1.9"
@ -2011,6 +2126,12 @@ dependencies = [
"syn",
]
[[package]]
name = "spin"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09"
[[package]]
name = "spin_sleep"
version = "1.0.0"
@ -2023,15 +2144,52 @@ dependencies = [
[[package]]
name = "stdweb"
version = "0.1.3"
version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef5430c8e36b713e13b48a9f709cc21e046723fe44ce34587b73a830203b533e"
checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5"
dependencies = [
"discard",
"rustc_version",
"stdweb-derive",
"stdweb-internal-macros",
"stdweb-internal-runtime",
"wasm-bindgen",
]
[[package]]
name = "strength_reduce"
version = "0.2.3"
name = "stdweb-derive"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3ff2f71c82567c565ba4b3009a9350a96a7269eaa4001ebedae926230bc2254"
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 = "strsim"
@ -2076,21 +2234,6 @@ dependencies = [
"syn",
]
[[package]]
name = "tinyvec"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2"
dependencies = [
"tinyvec_macros",
]
[[package]]
name = "tinyvec_macros"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "tokio-executor"
version = "0.1.10"
@ -2122,16 +2265,6 @@ dependencies = [
"serde",
]
[[package]]
name = "transpose"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95f9c900aa98b6ea43aee227fd680550cdec726526aab8ac801549eadb25e39f"
dependencies = [
"num-integer",
"strength_reduce",
]
[[package]]
name = "ttf-parser"
version = "0.6.2"
@ -2396,6 +2529,106 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57b543186b344cc61c85b5aab0d2e3adf4e0f99bc076eff9aa5927bcc0b8a647"
dependencies = [
"windows_aarch64_msvc 0.37.0",
"windows_i686_gnu 0.37.0",
"windows_i686_msvc 0.37.0",
"windows_x86_64_gnu 0.37.0",
"windows_x86_64_msvc 0.37.0",
]
[[package]]
name = "windows-sys"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc 0.42.0",
"windows_i686_gnu 0.42.0",
"windows_i686_msvc 0.42.0",
"windows_x86_64_gnu 0.42.0",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc 0.42.0",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
[[package]]
name = "windows_aarch64_msvc"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2623277cb2d1c216ba3b578c0f3cf9cdebeddb6e66b1b218bb33596ea7769c3a"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
[[package]]
name = "windows_i686_gnu"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3925fd0b0b804730d44d4b6278c50f9699703ec49bcd628020f46f4ba07d9e1"
[[package]]
name = "windows_i686_gnu"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
[[package]]
name = "windows_i686_msvc"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce907ac74fe331b524c1298683efbf598bb031bc84d5e274db2083696d07c57c"
[[package]]
name = "windows_i686_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
[[package]]
name = "windows_x86_64_gnu"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2babfba0828f2e6b32457d5341427dcbb577ceef556273229959ac23a10af33d"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
[[package]]
name = "windows_x86_64_msvc"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4dd6dc7df2d84cf7b33822ed5b86318fb1781948e9663bacd047fc9dd52259d"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
[[package]]
name = "winit"
version = "0.24.0"
@ -2418,7 +2651,7 @@ dependencies = [
"ndk-glue 0.2.1",
"ndk-sys 0.2.2",
"objc",
"parking_lot",
"parking_lot 0.11.2",
"percent-encoding",
"raw-window-handle 0.3.4",
"smithay-client-toolkit",
@ -2451,7 +2684,7 @@ dependencies = [
"ndk-glue 0.3.0",
"ndk-sys 0.2.2",
"objc",
"parking_lot",
"parking_lot 0.11.2",
"percent-encoding",
"raw-window-handle 0.3.4",
"scopeguard",

View file

@ -15,15 +15,15 @@ path = "src/main.rs"
[dependencies]
# bracket-lib = { path = "extern/bracket-lib" }
bracket-lib = { git = "https://github.com/amethyst/bracket-lib" }
hecs = "0.5.1"
hecs = "0.9.0"
specs-derive = "0.4.1"
cpal = { version = "0.13.0", features = ["wasm-bindgen"] }
oddio = "0.5.0"
fundsp = "0.1.0"
cpal = { version = "0.14.1", features = ["wasm-bindgen"] }
oddio = "0.6.2"
typenum = "1.15.0"
console_error_panic_hook = "0.1.7"
wasm-bindgen = "0.2.79"
instant = "0.1.12"
rand = "0.8.5"
[target.'cfg(windows)'.build-dependencies]
winres = "0.1.12"

View file

@ -2,7 +2,7 @@ use instant::Instant;
use std::time::Duration;
use bracket_lib::prelude::*;
use hecs::{Entity, With, Without, World};
use hecs::{Entity, Without, World};
use crate::{
components::monster::*,
@ -16,12 +16,9 @@ use crate::{
pub fn try_move(delta_x: i32, delta_y: i32, world: &mut World, resources: &mut Resources) {
let mut to_kill: Vec<Entity> = Vec::new();
for (player_entity, (player, pos)) in &mut world.query::<(&mut Player, &mut Position)>() {
// The player shouldn't be able to move while whipping
if let Ok(_wants_to_whip) = world.get::<WantsToWhip>(player_entity) {
continue;
}
for (player_entity, (player, pos)) in
&mut world.query::<Without<(&mut Player, &mut Position), &WantsToWhip>>()
{
let now = Instant::now();
if now - player.last_moved > Duration::from_secs_f32(PLAYER_STEP_PERIOD) {
let destination = Point {
@ -32,7 +29,7 @@ pub fn try_move(delta_x: i32, delta_y: i32, world: &mut World, resources: &mut R
if resources.map.in_bounds(destination) {
if try_step(destination, world, resources) {
if let Some(monster_entity) = resources.map.get_tile_content_at(destination) {
if let Ok(monster) = world.get::<Monster>(monster_entity) {
if let Ok(monster) = world.get::<&Monster>(monster_entity) {
resources.stats.add_score(damage_for_kind(monster.kind));
resources.stats.take_gems(damage_for_kind(monster.kind));
if let (Some(sound_effects), Some(sound_output)) =
@ -276,7 +273,7 @@ fn try_step(point: Point, _world: &World, resources: &mut Resources) -> bool {
pub fn whip(world: &mut World, resources: &mut Resources) {
let mut to_add: Vec<Entity> = Vec::new();
for (entity, _) in world.query_mut::<With<Player, With<Position, Without<WantsToWhip, ()>>>>() {
for (entity, _) in world.query_mut::<Without<(&Player, &Position), &WantsToWhip>>() {
if resources.stats.whips > 0 {
to_add.push(entity);
}

View file

@ -1,19 +1,16 @@
use std::{array, iter, time::Duration};
use std::{iter, time::Duration};
use bracket_lib::random::RandomNumberGenerator;
use crate::resources::sound_output::{SoundOutput, SoundSamples};
type Frequency = u32;
type StartFrequency = u32;
type EndFrequency = u32;
type MinFrequency = u32;
type MaxFrequency = u32;
pub enum SoundType {
Silence,
Tone(Frequency),
Sweep(StartFrequency, EndFrequency),
Noise(MinFrequency, MaxFrequency),
}
@ -49,10 +46,12 @@ impl SoundEffects {
pub fn new(sound_output: &SoundOutput) -> Self {
Self {
startup: sound_output.render_sound_effect(&SoundEffect {
sounds: vec![Sound {
sound_type: SoundType::Sweep(1, 350),
duration: Duration::from_secs(1),
}],
sounds: (1..800)
.map(|x| Sound {
sound_type: SoundType::Tone(x / 2),
duration: Duration::from_millis(1),
})
.collect(),
}),
step: sound_output.render_sound_effect(&SoundEffect {
sounds: vec![
@ -92,7 +91,7 @@ impl SoundEffects {
duration: Duration::from_millis(40),
})
.chain((0..4).flat_map(|_| {
array::IntoIter::new([
[
Sound {
sound_type: SoundType::Tone(100),
duration: Duration::from_millis(15),
@ -101,7 +100,7 @@ impl SoundEffects {
sound_type: SoundType::Silence,
duration: Duration::from_millis(15),
},
])
]
}))
.collect(),
}),

View file

@ -4,8 +4,8 @@ use cpal::{
traits::{DeviceTrait, HostTrait, StreamTrait},
SampleRate, Stream,
};
use fundsp::prelude::*;
use oddio::{Frames, FramesSignal, Gain, Handle, Mixer, MonoToStereo, Stop};
use rand::Rng;
use super::sound_effects::{SoundEffect, SoundType};
@ -61,39 +61,65 @@ impl SoundOutput {
}
pub fn render_sound_effect(&self, effect: &SoundEffect) -> SoundSamples {
// Keep these outside the loop to remember phase
let mut half_cycle_counter: u32 = 0;
let mut speaker_out: bool = false;
let effect_buffer: Vec<f32> = effect
.sounds
.iter()
.flat_map(|sound| match sound.sound_type {
SoundType::Silence => (0
..(self.sample_rate.0 as f32 * sound.duration.as_secs_f32()) as usize)
.map(|_| 0f32)
.collect::<Vec<f32>>(),
SoundType::Tone(freq) => {
let mut c = square_hz(freq as f32);
c.reset(Some(self.sample_rate.0 as f64));
SoundType::Silence => {
// Reset phase on silence
half_cycle_counter = 0;
speaker_out = false;
(0..(self.sample_rate.0 as f32 * sound.duration.as_secs_f32()) as usize)
.map(|_| c.get_mono())
.map(|_| 0f32)
.collect::<Vec<f32>>()
}
SoundType::Sweep(start_freq, end_freq) => {
let mut c = lfo(|t| {
lerp(
start_freq as f32,
end_freq as f32,
t * sound.duration.as_secs_f32(),
)
}) >> square();
c.reset(Some(self.sample_rate.0 as f64));
(0..(self.sample_rate.0 as f32 * sound.duration.as_secs_f32()) as usize)
.map(|_| c.get_mono())
.collect::<Vec<f32>>()
SoundType::Tone(freq) => {
// A frequency of 0 is silence
if freq == 0 {
half_cycle_counter = 0;
speaker_out = false;
return (0..(self.sample_rate.0 as f32 * sound.duration.as_secs_f32())
as usize)
.map(|_| 0f32)
.collect::<Vec<f32>>();
}
let mut buffer: Vec<f32> = vec![
0.;
(self.sample_rate.0 as f32 * sound.duration.as_secs_f32())
as usize
];
let half_cycle_counter_upper_bound: u32 = self.sample_rate.0 / freq;
for sample in &mut buffer {
if speaker_out {
*sample = 0.75;
}
half_cycle_counter += 2;
if half_cycle_counter >= half_cycle_counter_upper_bound {
half_cycle_counter %= half_cycle_counter_upper_bound;
speaker_out = !speaker_out;
}
}
buffer
}
SoundType::Noise(min, max) => {
let mut c =
(((white() + dc(1.0)) * dc(max as f32 / 2.0)) + dc(min as f32)) >> square();
(0..(self.sample_rate.0 as f32 * sound.duration.as_secs_f32()) as usize)
.map(|_| c.get_mono())
.map(|i| {
let t = i as f32 / self.sample_rate.0 as f32;
(t * (rand::thread_rng().gen_range(min as f32..max as f32))
* 2.0
* std::f32::consts::PI)
.sin()
.signum()
})
.collect::<Vec<f32>>()
}
})
@ -103,11 +129,10 @@ impl SoundOutput {
}
pub fn play_sound(&mut self, samples: SoundSamples) -> SoundEffectHandle {
let mut gain = oddio::Gain::new(oddio::FramesSignal::from(samples));
gain.set_gain(-10.0);
self.mixer_handle
.control::<oddio::Mixer<_>, _>()
.play(oddio::MonoToStereo::new(oddio::Gain::new(
oddio::FramesSignal::from(samples),
0.50,
)))
.play(oddio::MonoToStereo::new(gain))
}
}

View file

@ -52,7 +52,7 @@ pub fn run(world: &mut World, resources: &mut Resources) {
};
if let Some(e) = resources.map.get_tile_content_at(destination) {
if let Ok(_player) = world.get::<Player>(e) {
if let Ok(_player) = world.get::<&Player>(e) {
// TODO: Sound
resources.map.clear_tile_content_at(Point::from(*position));
resources.stats.take_gems(damage_for_kind(monster.kind));

View file

@ -70,7 +70,7 @@ pub fn run(world: &mut World, resources: &mut Resources) {
if let Some(dest) = destination {
if let Some(e) = resources.map.get_tile_content_at(dest) {
if let Ok(monster) = world.get::<Monster>(e) {
if let Ok(monster) = world.get::<&Monster>(e) {
resources.stats.add_score(damage_for_kind(monster.kind));
to_kill.push(e);
resources.map.clear_tile_content_at(dest);

View file

@ -2,7 +2,7 @@ use bracket_lib::prelude::*;
use crate::graphics::vga_color as vga;
#[derive(PartialEq, Copy, Clone)]
#[derive(Eq, PartialEq, Copy, Clone)]
pub struct TileData {
pub glyph: FontCharType,
pub color_fg: (u8, u8, u8),