diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..d73dc86 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,23 @@ +--- +name: Bug report +about: Something doesn't measure, display, or build correctly +title: "" +labels: bug +assignees: "" +--- + +**Environment** +- OS: +- build: `cargo run -p regulator-gui` (debug/release), audio feature on/off + +**Watch / setup** +- beat rate (bph): +- lift angle: +- microphone type: + +**What happened** + +**What you expected** + +**Recording** +If possible, attach a WAV recording of the watch — it makes DSP issues reproducible. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2c83859 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,31 @@ +name: CI + +on: + push: + branches: [master, main] + pull_request: + +jobs: + test: + name: Test (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - name: Build (with audio) + run: cargo build --all-targets + - name: Test + run: cargo test --workspace + + build-headless: + name: Build without audio stack + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - run: cargo build --no-default-features + - run: cargo test --workspace --no-default-features diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e13f6ff --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,51 @@ +name: Release + +on: + push: + tags: ["v*"] + +permissions: + contents: write + +jobs: + binaries: + name: Build binaries + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: windows-latest + target: x86_64-pc-windows-msvc + artifact: regulator-gui-windows-x86_64.zip + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + artifact: regulator-gui-linux-x86_64.tar.gz + - os: macos-latest + target: aarch64-apple-darwin + artifact: regulator-gui-macos-aarch64.tar.gz + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + - name: Build release binary + run: cargo build --release --target ${{ matrix.target }} -p regulator-gui + - name: Package + shell: bash + run: | + cd target/${{ matrix.target }}/release + if [[ "${{ matrix.os }}" == windows-latest ]]; then + 7z a ../../../${{ matrix.artifact }} regulator-gui.exe + else + tar czf ../../../${{ matrix.artifact }} regulator-gui + fi + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.artifact }} + path: ${{ matrix.artifact }} + + - name: Upload to release + uses: softprops/action-gh-release@v2 + with: + files: ${{ matrix.artifact }} diff --git a/.gitignore b/.gitignore index 0060ccd..cb149a7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .* !.gitignore +!.github !.travis.yml !.valgrind.supp @@ -53,3 +54,6 @@ Makefile.in # build directories /deb /msi + +# Rust +/target diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..327a07e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,43 @@ +# Contributing to regulator + +Thanks for your interest in improving regulator! + +## Getting started + +```sh +git clone https://github.com/borosf/regulator.git +cd regulator +cargo test --workspace # everything should pass before you start +cargo run -p regulator-gui # demo mode, no hardware needed +``` + +## Ground rules + +- **License**: contributions are accepted under GPLv2, the project's + license. By submitting a pull request you agree your work is licensed + accordingly. +- **Scope of the core**: `regulator-core` must stay free of I/O and + platform dependencies. Audio capture, files and UI belong in the + frontend crates. +- **Tests**: the DSP core is unit-tested against a synthetic watch + generator (`crates/regulator-core/src/signal.rs`). If you change the + analysis, add or adjust a synthetic-signal test that demonstrates the + behavior. +- **Style**: follow the existing code style; no new dependencies unless + they're clearly justified. + +## Bug reports + +Open an issue and include: + +- your OS and how you built (release/debug, audio feature), +- the movement's beat rate and lift angle, +- what you expected vs. what happened, +- if possible, a recording of the watch (WAV preferred) — recordings make + DSP bugs reproducible. + +## Pull requests + +Keep PRs focused: one change per PR. Describe what changed and why, and +list the commands you ran to verify (`cargo test --workspace`, +`cargo build --no-default-features`). diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..8cc90e0 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,4984 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "ab_glyph" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01c0457472c38ea5bd1c3b5ada5e368271cb550be7a4ca4a0b4634e9913f6cc2" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser", +] + +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618" + +[[package]] +name = "accesskit" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf203f9d3bd8f29f98833d1fbef628df18f759248a547e7e01cfbf63cda36a99" + +[[package]] +name = "accesskit_atspi_common" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "890d241cf51fc784f0ac5ac34dfc847421f8d39da6c7c91a0fcc987db62a8267" +dependencies = [ + "accesskit", + "accesskit_consumer", + "atspi-common", + "serde", + "thiserror 1.0.69", + "zvariant", +] + +[[package]] +name = "accesskit_consumer" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db81010a6895d8707f9072e6ce98070579b43b717193d2614014abd5cb17dd43" +dependencies = [ + "accesskit", + "hashbrown 0.15.5", +] + +[[package]] +name = "accesskit_macos" +version = "0.22.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0089e5c0ac0ca281e13ea374773898d9354cc28d15af9f0f7394d44a495b575" +dependencies = [ + "accesskit", + "accesskit_consumer", + "hashbrown 0.15.5", + "objc2 0.5.3", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "accesskit_unix" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301e55b39cfc15d9c48943ce5f572204a551646700d0e8efa424585f94fec528" +dependencies = [ + "accesskit", + "accesskit_atspi_common", + "async-channel", + "async-executor", + "async-task", + "atspi", + "futures-lite", + "futures-util", + "serde", + "zbus", +] + +[[package]] +name = "accesskit_windows" +version = "0.29.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2d63dd5041e49c363d83f5419a896ecb074d309c414036f616dc0b04faca971" +dependencies = [ + "accesskit", + "accesskit_consumer", + "hashbrown 0.15.5", + "static_assertions", + "windows 0.61.3", + "windows-core 0.61.2", +] + +[[package]] +name = "accesskit_winit" +version = "0.29.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8cfabe59d0eaca7412bfb1f70198dd31e3b0496fee7e15b066f9c36a1a140a0" +dependencies = [ + "accesskit", + "accesskit_macos", + "accesskit_unix", + "accesskit_windows", + "raw-window-handle", + "winit", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "getrandom 0.3.4", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "alsa" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed7572b7ba83a31e20d1b48970ee402d2e3e0537dcfe0a3ff4d6eb7508617d43" +dependencies = [ + "alsa-sys", + "bitflags 2.13.2", + "cfg-if", + "libc", +] + +[[package]] +name = "alsa-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db8fee663d06c4e303404ef5f40488a53e062f89ba8bfed81f42325aafad1527" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "android-activity" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2a1bb052857d5dd49572219344a7332b31b76405648eabac5bc68978251bcd" +dependencies = [ + "android-properties", + "bitflags 2.13.2", + "cc", + "jni 0.22.4", + "libc", + "log", + "ndk 0.9.0", + "ndk-context", + "ndk-sys 0.6.0+11769913", + "num_enum", + "thiserror 2.0.21", +] + +[[package]] +name = "android-properties" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "arboard" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aeb9553e62312c8756a5979254fc6d7da8bbeb5986a1e17037fab932f7037917" +dependencies = [ + "clipboard-win", + "image", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "parking_lot", + "percent-encoding", + "windows-sys 0.61.2", + "x11rb", +] + +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + +[[package]] +name = "arrayvec" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" + +[[package]] +name = "as-raw-xcb-connection" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" + +[[package]] +name = "ash" +version = "0.38.0+1.3.281" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f" +dependencies = [ + "libloading", +] + +[[package]] +name = "async-broadcast" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" +dependencies = [ + "event-listener", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-channel" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-executor" +version = "1.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f426a31126c735126297bc5ea7a521263c9faff4f63ca415267ee625651c4f37" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "pin-project-lite", + "slab", +] + +[[package]] +name = "async-io" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" +dependencies = [ + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling", + "rustix 1.1.6", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-lock" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0876700b0d007ad25d5508865a4259c3af9af6d296bf663a0d586d0bc3369f6f" +dependencies = [ + "event-listener", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-process" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75" +dependencies = [ + "async-channel", + "async-io", + "async-lock", + "async-signal", + "async-task", + "blocking", + "cfg-if", + "event-listener", + "futures-lite", + "rustix 1.1.6", +] + +[[package]] +name = "async-recursion" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f8abc12baad266b1c8cec146854c195b5864b4221d4b2ca7296a7ae82d9e451" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "async-signal" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485" +dependencies = [ + "async-io", + "async-lock", + "atomic-waker", + "cfg-if", + "futures-core", + "futures-io", + "rustix 1.1.6", + "signal-hook-registry", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-task" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" + +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "atspi" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c83247582e7508838caf5f316c00791eee0e15c0bf743e6880585b867e16815c" +dependencies = [ + "atspi-common", + "atspi-connection", + "atspi-proxies", +] + +[[package]] +name = "atspi-common" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33dfc05e7cdf90988a197803bf24f5788f94f7c94a69efa95683e8ffe76cfdfb" +dependencies = [ + "enumflags2", + "serde", + "static_assertions", + "zbus", + "zbus-lockstep", + "zbus-lockstep-macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "atspi-connection" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4193d51303d8332304056ae0004714256b46b6635a5c556109b319c0d3784938" +dependencies = [ + "atspi-common", + "atspi-proxies", + "futures-lite", + "zbus", +] + +[[package]] +name = "atspi-proxies" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2eebcb9e7e76f26d0bcfd6f0295e1cd1e6f33bedbc5698a971db8dc43d7751c" +dependencies = [ + "atspi-common", + "serde", + "zbus", +] + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "bindgen" +version = "0.72.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895" +dependencies = [ + "bitflags 2.13.2", + "cexpr", + "clang-sys", + "itertools", + "proc-macro2", + "quote", + "regex", + "rustc-hash 2.1.3", + "shlex 1.3.0", + "syn 2.0.119", +] + +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + +[[package]] +name = "block2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" +dependencies = [ + "objc2 0.5.3", +] + +[[package]] +name = "blocking" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa" +dependencies = [ + "async-channel", + "async-task", + "futures-io", + "futures-lite", + "piper", +] + +[[package]] +name = "bumpalo" +version = "3.20.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87a0cf66fd1eb2fb7b822cb78370d82303750809bc6ba855f3f58e517d3238db" + +[[package]] +name = "bytemuck" +version = "1.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "byteorder-lite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "calloop" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" +dependencies = [ + "bitflags 2.13.2", + "log", + "polling", + "rustix 0.38.44", + "slab", + "thiserror 1.0.69", +] + +[[package]] +name = "calloop" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b32313e937c8721c9d17ee9bf60699a6402b4b7c2cb6ac1bee0ffcaa4b4e5e" +dependencies = [ + "bitflags 2.13.2", + "polling", + "rustix 1.1.6", + "tracing", +] + +[[package]] +name = "calloop-wayland-source" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" +dependencies = [ + "calloop 0.13.0", + "rustix 0.38.44", + "wayland-backend", + "wayland-client", +] + +[[package]] +name = "calloop-wayland-source" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" +dependencies = [ + "calloop 0.14.5", + "rustix 1.1.6", + "wayland-backend", + "wayland-client", +] + +[[package]] +name = "cassowary" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" + +[[package]] +name = "castaway" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" +dependencies = [ + "rustversion", +] + +[[package]] +name = "cc" +version = "1.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ef9e3e8154a45c7a95cff4c1299702106ad94062d7bb85fdc5d3a5afd91d45" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex 2.0.1", +] + +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "cgl" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" +dependencies = [ + "libc", +] + +[[package]] +name = "clang-sys" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "157a8ba7b480713b56f4c09fd13fc3e0a22a5dfab8097ba61cbc5feef950788a" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "clipboard-win" +version = "5.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "052af7878466feccda12ba7a6a67d019d712f296809559b47c12c8cc196d3a9a" +dependencies = [ + "error-code", +] + +[[package]] +name = "codespan-reporting" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe6d2e5af09e8c8ad56c969f2157a3d4238cebc7c55f0a517728c38f7b200f81" +dependencies = [ + "serde", + "termcolor", + "unicode-width 0.2.0", +] + +[[package]] +name = "combine" +version = "4.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4356eba6976435498d05a311ee9fc486da3bc81c200d3f0d7dd9703b41913f92" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "compact_str" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fd622ebbb56a5b2ccb651b32b911cdeb2a9b4b11776b2473bf26a26a286244e" +dependencies = [ + "castaway", + "cfg-if", + "itoa", + "rustversion", + "ryu", + "static_assertions", +] + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" +dependencies = [ + "bitflags 1.3.2", + "core-foundation 0.9.4", + "core-graphics-types 0.1.3", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" +dependencies = [ + "bitflags 1.3.2", + "core-foundation 0.9.4", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.10.1", + "libc", +] + +[[package]] +name = "core_detect" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" + +[[package]] +name = "coreaudio-rs" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "321077172d79c662f64f5071a03120748d5bb652f5231570141be24cfcd2bace" +dependencies = [ + "bitflags 1.3.2", + "core-foundation-sys", + "coreaudio-sys", +] + +[[package]] +name = "coreaudio-sys" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9b4739a805a62757a83e5654fa3faabec0442666b263bb2287d5a8185bfd953" +dependencies = [ + "bindgen", +] + +[[package]] +name = "cpal" +version = "0.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "873dab07c8f743075e57f524c583985fbaf745602acbe916a01539364369a779" +dependencies = [ + "alsa", + "core-foundation-sys", + "coreaudio-rs", + "dasp_sample", + "jni 0.21.1", + "js-sys", + "libc", + "mach2", + "ndk 0.8.0", + "ndk-context", + "oboe", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows 0.54.0", +] + +[[package]] +name = "crc32fast" +version = "1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b929dd2a135771f40afabd1073f85eed59c800b7c61901e5c254270497dad64" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + +[[package]] +name = "crossterm" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" +dependencies = [ + "bitflags 2.13.2", + "crossterm_winapi", + "mio", + "parking_lot", + "rustix 0.38.44", + "signal-hook", + "signal-hook-mio", + "winapi", +] + +[[package]] +name = "crossterm_winapi" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" +dependencies = [ + "winapi", +] + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "cursor-icon" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" + +[[package]] +name = "darling" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed17f5901b6630b993ca003def43f2f8ef4014fc13b047b57aad617ff32bc2ec" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6837e2cf7485aaae18f86181d2f0e9a7ed297a025e220aeabf63fdebd3a2ddff" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 3.0.10", +] + +[[package]] +name = "darling_macro" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785" +dependencies = [ + "darling_core", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "dasp_sample" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f" + +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "dlib" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" +dependencies = [ + "libloading", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "dpi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" + +[[package]] +name = "ecolor" +version = "0.33.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71ddb8ac7643d1dba1bb02110e804406dd459a838efcb14011ced10556711a8e" +dependencies = [ + "bytemuck", + "emath", +] + +[[package]] +name = "eframe" +version = "0.33.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "457481173e6db5ca9fa2be93a58df8f4c7be639587aeb4853b526c6cf87db4e6" +dependencies = [ + "ahash", + "bytemuck", + "document-features", + "egui", + "egui-wgpu", + "egui-winit", + "egui_glow", + "glow", + "glutin", + "glutin-winit", + "image", + "js-sys", + "log", + "objc2 0.5.3", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", + "parking_lot", + "percent-encoding", + "profiling", + "raw-window-handle", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "web-time", + "windows-sys 0.61.2", + "winit", +] + +[[package]] +name = "egui" +version = "0.33.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a9b567d356674e9a5121ed3fedfb0a7c31e059fe71f6972b691bcd0bfc284e3" +dependencies = [ + "accesskit", + "ahash", + "bitflags 2.13.2", + "emath", + "epaint", + "log", + "nohash-hasher", + "profiling", + "smallvec", + "unicode-segmentation", +] + +[[package]] +name = "egui-wgpu" +version = "0.33.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e4d209971c84b2352a06174abdba701af1e552ce56b144d96f2bd50a3c91236" +dependencies = [ + "ahash", + "bytemuck", + "document-features", + "egui", + "epaint", + "log", + "profiling", + "thiserror 2.0.21", + "type-map", + "web-time", + "wgpu", + "winit", +] + +[[package]] +name = "egui-winit" +version = "0.33.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec6687e5bb551702f4ad10ac428bab12acf9d53047ebb1082d4a0ed8c6251a29" +dependencies = [ + "accesskit_winit", + "arboard", + "bytemuck", + "egui", + "log", + "objc2 0.5.3", + "objc2-foundation 0.2.2", + "objc2-ui-kit", + "profiling", + "raw-window-handle", + "smithay-clipboard", + "web-time", + "webbrowser", + "winit", +] + +[[package]] +name = "egui_glow" +version = "0.33.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6420863ea1d90e750f75075231a260030ad8a9f30a7cef82cdc966492dc4c4eb" +dependencies = [ + "bytemuck", + "egui", + "glow", + "log", + "memoffset", + "profiling", + "wasm-bindgen", + "web-sys", + "winit", +] + +[[package]] +name = "either" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" + +[[package]] +name = "emath" +version = "0.33.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "491bdf728bf25ddd9ad60d4cf1c48588fa82c013a2440b91aa7fc43e34a07c32" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "encoding_rs" +version = "0.8.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89253175e704ab869b04f9db224d38630e0211a53841a79181deae0889e169f5" +dependencies = [ + "cfg-if", + "core_detect", + "multiversion_no_op", + "rustversion", + "scopeguard", + "simdutf8", +] + +[[package]] +name = "endi" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099" + +[[package]] +name = "enumflags2" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" +dependencies = [ + "enumflags2_derive", + "serde", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "epaint" +version = "0.33.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "009d0dd3c2163823a0abdb899451ecbc78798dec545ee91b43aff1fa790bab62" +dependencies = [ + "ab_glyph", + "ahash", + "bytemuck", + "ecolor", + "emath", + "epaint_default_fonts", + "log", + "nohash-hasher", + "parking_lot", + "profiling", +] + +[[package]] +name = "epaint_default_fonts" +version = "0.33.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c4fbe202b6578d3d56428fa185cdf114a05e49da05f477b3c7f0fbb221f1862" + +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + +[[package]] +name = "errno" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "error-code" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7" + +[[package]] +name = "event-listener" +version = "5.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2" +dependencies = [ + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener", + "pin-project-lite", +] + +[[package]] +name = "extended" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af9673d8203fcb076b19dfd17e38b3d4ae9f44959416ea532ce72415a6020365" + +[[package]] +name = "fastrand" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" + +[[package]] +name = "fax" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a" + +[[package]] +name = "fdeflate" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" + +[[package]] +name = "flate2" +version = "1.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "626d4928326b646e70f65ed36fc7cf9f206bdb68a0019ee7c6b4709da4e084c4" +dependencies = [ + "crc32fast", + "miniz_oxide 0.9.1", + "zlib-rs", +] + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-lite" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + +[[package]] +name = "futures-macro" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-core", + "futures-macro", + "futures-task", + "pin-project-lite", + "slab", +] + +[[package]] +name = "gethostname" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" +dependencies = [ + "rustix 1.1.6", + "windows-link 0.2.1", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", +] + +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + +[[package]] +name = "glob" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" + +[[package]] +name = "glow" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e5ea60d70410161c8bf5da3fdfeaa1c72ed2c15f8bbb9d19fe3a4fad085f08" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "glutin" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12124de845cacfebedff80e877bb37b5b75c34c5a4c89e47e1cdd67fb6041325" +dependencies = [ + "bitflags 2.13.2", + "cfg_aliases", + "cgl", + "dispatch2", + "glutin_egl_sys", + "glutin_glx_sys", + "glutin_wgl_sys", + "libloading", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "once_cell", + "raw-window-handle", + "wayland-sys", + "windows-sys 0.52.0", + "x11-dl", +] + +[[package]] +name = "glutin-winit" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85edca7075f8fc728f28cb8fbb111a96c3b89e930574369e3e9c27eb75d3788f" +dependencies = [ + "cfg_aliases", + "glutin", + "raw-window-handle", + "winit", +] + +[[package]] +name = "glutin_egl_sys" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c4680ba6195f424febdc3ba46e7a42a0e58743f2edb115297b86d7f8ecc02d2" +dependencies = [ + "gl_generator", + "windows-sys 0.52.0", +] + +[[package]] +name = "glutin_glx_sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7bb2938045a88b612499fbcba375a77198e01306f52272e692f8c1f3751185" +dependencies = [ + "gl_generator", + "x11-dl", +] + +[[package]] +name = "glutin_wgl_sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e" +dependencies = [ + "gl_generator", +] + +[[package]] +name = "gpu-alloc" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45cf04b2726f02df5508c6de726acdc90cdf97ac771a9a0ffd8ba10a6e696bf9" +dependencies = [ + "bitflags 2.13.2", + "gpu-alloc-types", +] + +[[package]] +name = "gpu-alloc-types" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2bbed164dd10ed526c2e4fe3e721ca4a71c61730e5aafac6844b417b3227058" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "gpu-allocator" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c151a2a5ef800297b4e79efa4f4bec035c5f51d5ae587287c9b952bdf734cacd" +dependencies = [ + "log", + "presser", + "thiserror 1.0.69", + "windows 0.58.0", +] + +[[package]] +name = "gpu-descriptor" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca" +dependencies = [ + "bitflags 2.13.2", + "gpu-descriptor-types", + "hashbrown 0.15.5", +] + +[[package]] +name = "gpu-descriptor-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "num-traits", + "zerocopy", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "foldhash 0.2.0", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hexf-parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" + +[[package]] +name = "hound" +version = "3.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62adaabb884c94955b19907d60019f4e145d091c75345379e70d1ee696f7854f" + +[[package]] +name = "icu_collections" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc" + +[[package]] +name = "icu_properties" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf" + +[[package]] +name = "icu_provider" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "image" +version = "0.25.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104" +dependencies = [ + "bytemuck", + "byteorder-lite", + "moxcms", + "num-traits", + "png", + "tiff", + "zune-core", + "zune-jpeg", +] + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", +] + +[[package]] +name = "indoc" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a37b2691796cffeb8a8cd305ac66e65841559f147f4e63231d0eafa4db5384d1" +dependencies = [ + "rustversion", +] + +[[package]] +name = "instability" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c3b5acc1e2fd9375041a388da33d1eb8aed5f7a8c0dd3543e3ea2805adfbe20" +dependencies = [ + "darling", + "indoc", + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" + +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys 0.3.1", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + +[[package]] +name = "jni" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" +dependencies = [ + "cfg-if", + "combine", + "jni-macros", + "jni-sys 0.4.1", + "log", + "simd_cesu8", + "thiserror 2.0.21", + "walkdir", + "windows-link 0.2.1", +] + +[[package]] +name = "jni-macros" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "simd_cesu8", + "syn 2.0.119", +] + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jobserver" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" +dependencies = [ + "getrandom 0.4.3", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "khronos-egl" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" +dependencies = [ + "libc", + "libloading", + "pkg-config", +] + +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + +[[package]] +name = "lazy_static" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link 0.2.1", +] + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libredox" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" +dependencies = [ + "bitflags 2.13.2", + "libc", + "plain", + "redox_syscall 0.9.5", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "litrs" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4744e383959f0db86ede514b809b1c53251889093803c05267acc7d4e7030d70" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" + +[[package]] +name = "lru" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" +dependencies = [ + "hashbrown 0.15.5", +] + +[[package]] +name = "mach2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d640282b302c0bb0a2a8e0233ead9035e3bed871f0b7e81fe4a1ec829765db44" +dependencies = [ + "libc", +] + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "memmap2" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b0ca1155a9ecc25aa12e8313a119f32edf0255fea2f44839c4ac0a12b2ac157" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "metal" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00c15a6f673ff72ddcc22394663290f870fb224c1bfce55734a75c414150e605" +dependencies = [ + "bitflags 2.13.2", + "block", + "core-graphics-types 0.2.0", + "foreign-types", + "log", + "objc", + "paste", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "miniz_oxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20521a903f02b0a573cd6840e9d0a5a0cc043d361fe924092cd70f8556cc9c4a" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "moxcms" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b" +dependencies = [ + "num-traits", + "pxfm", +] + +[[package]] +name = "multiversion_no_op" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d" + +[[package]] +name = "naga" +version = "27.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "066cf25f0e8b11ee0df221219010f213ad429855f57c494f995590c861a9a7d8" +dependencies = [ + "arrayvec", + "bit-set", + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "codespan-reporting", + "half", + "hashbrown 0.16.1", + "hexf-parse", + "indexmap", + "libm", + "log", + "num-traits", + "once_cell", + "rustc-hash 1.1.0", + "spirv", + "thiserror 2.0.21", + "unicode-ident", +] + +[[package]] +name = "ndk" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7" +dependencies = [ + "bitflags 2.13.2", + "jni-sys 0.3.1", + "log", + "ndk-sys 0.5.0+25.2.9519653", + "num_enum", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags 2.13.2", + "jni-sys 0.3.1", + "log", + "ndk-sys 0.6.0+11769913", + "num_enum", + "raw-window-handle", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.5.0+25.2.9519653" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "num-integer" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", +] + +[[package]] +name = "objc-sys" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" + +[[package]] +name = "objc2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d5490aaf8f1d7cf7688dfa9b0ce07900e168852c45cd2c03f534dfd27cfd0b" +dependencies = [ + "objc-sys", + "objc2-encode", +] + +[[package]] +name = "objc2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-app-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" +dependencies = [ + "bitflags 2.13.2", + "block2", + "libc", + "objc2 0.5.3", + "objc2-core-data", + "objc2-core-image", + "objc2-foundation 0.2.2", + "objc2-quartz-core", +] + +[[package]] +name = "objc2-app-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-cloud-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" +dependencies = [ + "bitflags 2.13.2", + "block2", + "objc2 0.5.3", + "objc2-core-location", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-contacts" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" +dependencies = [ + "block2", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-data" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" +dependencies = [ + "bitflags 2.13.2", + "block2", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.13.2", + "dispatch2", + "objc2 0.6.5", +] + +[[package]] +name = "objc2-core-graphics" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" +dependencies = [ + "bitflags 2.13.2", + "dispatch2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-io-surface", +] + +[[package]] +name = "objc2-core-image" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" +dependencies = [ + "block2", + "objc2 0.5.3", + "objc2-foundation 0.2.2", + "objc2-metal", +] + +[[package]] +name = "objc2-core-location" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" +dependencies = [ + "block2", + "objc2 0.5.3", + "objc2-contacts", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-foundation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" +dependencies = [ + "bitflags 2.13.2", + "block2", + "dispatch", + "libc", + "objc2 0.5.3", +] + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-surface" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-link-presentation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" +dependencies = [ + "block2", + "objc2 0.5.3", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-metal" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" +dependencies = [ + "bitflags 2.13.2", + "block2", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" +dependencies = [ + "bitflags 2.13.2", + "block2", + "objc2 0.5.3", + "objc2-foundation 0.2.2", + "objc2-metal", +] + +[[package]] +name = "objc2-symbols" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" +dependencies = [ + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" +dependencies = [ + "bitflags 2.13.2", + "block2", + "objc2 0.5.3", + "objc2-cloud-kit", + "objc2-core-data", + "objc2-core-image", + "objc2-core-location", + "objc2-foundation 0.2.2", + "objc2-link-presentation", + "objc2-quartz-core", + "objc2-symbols", + "objc2-uniform-type-identifiers", + "objc2-user-notifications", +] + +[[package]] +name = "objc2-uniform-type-identifiers" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" +dependencies = [ + "block2", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-user-notifications" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" +dependencies = [ + "bitflags 2.13.2", + "block2", + "objc2 0.5.3", + "objc2-core-location", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "oboe" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8b61bebd49e5d43f5f8cc7ee2891c16e0f41ec7954d36bcb6c14c5e0de867fb" +dependencies = [ + "jni 0.21.1", + "ndk 0.8.0", + "ndk-context", + "num-derive", + "num-traits", + "oboe-sys", +] + +[[package]] +name = "oboe-sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8bb09a4a2b1d668170cfe0a7d5bc103f8999fb316c98099b6a9939c9f2e79d" +dependencies = [ + "cc", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "orbclient" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5df339f526ea9a60e371768d50efc2f2508c7203290731565d1f7a6f71d21747" +dependencies = [ + "libc", + "libredox", +] + +[[package]] +name = "ordered-float" +version = "5.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f59006ce1e204c30956638535b74d317bca99477b9356dfaec54c37f6f600ab" +dependencies = [ + "num-traits", +] + +[[package]] +name = "ordered-stream" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" +dependencies = [ + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "owned_ttf_parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36820e9051aca1014ddc75770aab4d68bc1e9e632f0f5627c4086bc216fb583b" +dependencies = [ + "ttf-parser", +] + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.18", + "smallvec", + "windows-link 0.2.1", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "piper" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1" +dependencies = [ + "atomic-waker", + "fastrand", + "futures-io", +] + +[[package]] +name = "pkg-config" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" + +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" + +[[package]] +name = "png" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" +dependencies = [ + "bitflags 2.13.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide 0.8.9", +] + +[[package]] +name = "polling" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi", + "pin-project-lite", + "rustix 1.1.6", + "windows-sys 0.61.2", +] + +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" + +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + +[[package]] +name = "presser" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" + +[[package]] +name = "primal-check" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc0d895b311e3af9902528fbb8f928688abbd95872819320517cc24ca6b2bd08" +dependencies = [ + "num-integer", +] + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "profiling" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5" + +[[package]] +name = "pxfm" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea" + +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + +[[package]] +name = "quick-xml" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "range-alloc" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08" + +[[package]] +name = "ratatui" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eabd94c2f37801c20583fc49dd5cd6b0ba68c716787c2dd6ed18571e1e63117b" +dependencies = [ + "bitflags 2.13.2", + "cassowary", + "compact_str", + "crossterm", + "indoc", + "instability", + "itertools", + "lru", + "paste", + "strum", + "unicode-segmentation", + "unicode-truncate", + "unicode-width 0.2.0", +] + +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "redox_syscall" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "580c875845b41ecb1564ad1ae4703044cef774145e3d7a94dc2b3fa7c97868fd" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "regex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "regulator-core" +version = "0.1.0" +dependencies = [ + "hound", + "rustfft", + "symphonia", +] + +[[package]] +name = "regulator-gui" +version = "0.1.0" +dependencies = [ + "anyhow", + "cpal", + "eframe", + "image", + "regulator-core", +] + +[[package]] +name = "regulator-tui" +version = "0.1.0" +dependencies = [ + "anyhow", + "cpal", + "crossterm", + "ratatui", + "regulator-core", +] + +[[package]] +name = "renderdoc-sys" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustfft" +version = "6.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21db5f9893e91f41798c88680037dba611ca6674703c1a18601b01a72c8adb89" +dependencies = [ + "num-complex", + "num-integer", + "num-traits", + "primal-check", + "strength_reduce", + "transpose", +] + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys 0.12.1", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sctk-adwaita" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec" +dependencies = [ + "ab_glyph", + "log", + "memmap2", + "smithay-client-toolkit 0.19.2", + "tiny-skia", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "serde_repr" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-mio" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b75a19a7a740b25bc7944bdee6172368f988763b744e3d4dfe753f6b4ece40cc" +dependencies = [ + "libc", + "mio", + "signal-hook", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "simd_cesu8" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" +dependencies = [ + "rustc_version", + "simdutf8", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "slotmap" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038" +dependencies = [ + "version_check", +] + +[[package]] +name = "smallvec" +version = "1.16.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "149309498a5f7334b12ddae0cad8aba81ce785fe91755068867e017cf98fee46" + +[[package]] +name = "smithay-client-toolkit" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" +dependencies = [ + "bitflags 2.13.2", + "calloop 0.13.0", + "calloop-wayland-source 0.3.0", + "cursor-icon", + "libc", + "log", + "memmap2", + "rustix 0.38.44", + "thiserror 1.0.69", + "wayland-backend", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + +[[package]] +name = "smithay-client-toolkit" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0" +dependencies = [ + "bitflags 2.13.2", + "calloop 0.14.5", + "calloop-wayland-source 0.4.1", + "cursor-icon", + "libc", + "log", + "memmap2", + "rustix 1.1.6", + "thiserror 2.0.21", + "wayland-backend", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-experimental", + "wayland-protocols-misc", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + +[[package]] +name = "smithay-clipboard" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71704c03f739f7745053bde45fa203a46c58d25bc5c4efba1d9a60e9dba81226" +dependencies = [ + "libc", + "smithay-client-toolkit 0.20.0", + "wayland-backend", +] + +[[package]] +name = "smol_str" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead" +dependencies = [ + "serde", +] + +[[package]] +name = "spirv" +version = "0.3.0+sdk-1.3.268.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + +[[package]] +name = "strict-num" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.119", +] + +[[package]] +name = "symphonia" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5773a4c030a19d9bfaa090f49746ff35c75dfddfa700df7a5939d5e076a57039" +dependencies = [ + "lazy_static", + "symphonia-bundle-mp3", + "symphonia-codec-aac", + "symphonia-codec-pcm", + "symphonia-core", + "symphonia-format-isomp4", + "symphonia-format-riff", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-bundle-mp3" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4872dd6bb56bf5eac799e3e957aa1981086c3e613b27e0ac23b176054f7c57ed" +dependencies = [ + "lazy_static", + "log", + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-codec-aac" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c263845aa86881416849c1729a54c7f55164f8b96111dba59de46849e73a790" +dependencies = [ + "lazy_static", + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-codec-pcm" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e89d716c01541ad3ebe7c91ce4c8d38a7cf266a3f7b2f090b108fb0cb031d95" +dependencies = [ + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-core" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea00cc4f79b7f6bb7ff87eddc065a1066f3a43fe1875979056672c9ef948c2af" +dependencies = [ + "arrayvec", + "bitflags 1.3.2", + "bytemuck", + "lazy_static", + "log", +] + +[[package]] +name = "symphonia-format-isomp4" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "243739585d11f81daf8dac8d9f3d18cc7898f6c09a259675fc364b382c30e0a5" +dependencies = [ + "encoding_rs", + "log", + "symphonia-core", + "symphonia-metadata", + "symphonia-utils-xiph", +] + +[[package]] +name = "symphonia-format-riff" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2d7c3df0e7d94efb68401d81906eae73c02b40d5ec1a141962c592d0f11a96f" +dependencies = [ + "extended", + "log", + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-metadata" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36306ff42b9ffe6e5afc99d49e121e0bd62fe79b9db7b9681d48e29fa19e6b16" +dependencies = [ + "encoding_rs", + "lazy_static", + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-utils-xiph" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27c85ab799a338446b68eec77abf42e1a6f1bb490656e121c6e27bfbab9f16" +dependencies = [ + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.3", + "once_cell", + "rustix 1.1.6", + "windows-sys 0.61.2", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl 2.0.21", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "tiff" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52" +dependencies = [ + "fax", + "flate2", + "half", + "quick-error", + "weezl", + "zune-jpeg", +] + +[[package]] +name = "tiny-skia" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab" +dependencies = [ + "arrayref", + "arrayvec", + "bytemuck", + "cfg-if", + "log", + "tiny-skia-path", +] + +[[package]] +name = "tiny-skia-path" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", +] + +[[package]] +name = "tinystr" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "pin-project-lite", +] + +[[package]] +name = "toml_datetime" +version = "1.1.3+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "173f25c883cd2176a2d8212155638c0a60d484a9d84546d270866f40f56b6e49" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.25.19+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd43688c4858d7264ae1cf9a9f874a67c3feb74a883b1cd7bebd6a4ea8307218" +dependencies = [ + "indexmap", + "toml_datetime", + "toml_parser", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.1.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c" +dependencies = [ + "winnow", +] + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + +[[package]] +name = "ttf-parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" + +[[package]] +name = "type-map" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb30dbbd9036155e74adad6812e9898d03ec374946234fbcebd5dfc7b9187b90" +dependencies = [ + "rustc-hash 2.1.3", +] + +[[package]] +name = "uds_windows" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" +dependencies = [ + "memoffset", + "tempfile", + "windows-sys 0.61.2", +] + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + +[[package]] +name = "unicode-truncate" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3644627a5af5fa321c95b9b235a72fd24cd29c648c2c379431e6628655627bf" +dependencies = [ + "itertools", + "unicode-segmentation", + "unicode-width 0.1.14", +] + +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "unicode-width" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af3bd9d3e571c26fcce9d033b87ea5ab061b8d2ffe9b7a5675d810d68f03edf0" +dependencies = [ + "utf_types", +] + +[[package]] +name = "utf_types" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6" + +[[package]] +name = "uuid" +version = "1.29.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c14b15dffa2f4bd712103e857140aa04a4f2ff6e955c77d7eb8e53ee02a3b64" +dependencies = [ + "js-sys", + "serde_core", + "wasm-bindgen", +] + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0181c14ddd6c7b8b0b0132a5f1ea2f32be0d893cd3ea97b6e3b28886b8a3d1c" +dependencies = [ + "cfg-if", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e14e0327cb5368ad60ccb22d04a9827a693c95a926d8d125e9fa39e0baec501" +dependencies = [ + "js-sys", + "tokio", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e931a02a39abdbf66966fc35902b5ed58344750a70885bed4ebb3d8eaf28ed9" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ca4b54280e455bd831e33a6b8e734baf432fe63fbc35c42ac14ce67a043a53a" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.10", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b1f9c3798725016c6ee5f2f57869ec0831e8bbc0ab0310a86e787e97f41389e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wayland-backend" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078" +dependencies = [ + "cc", + "downcast-rs", + "rustix 1.1.6", + "scoped-tls", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-client" +version = "0.31.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" +dependencies = [ + "bitflags 2.13.2", + "rustix 1.1.6", + "wayland-backend", + "wayland-scanner", +] + +[[package]] +name = "wayland-csd-frame" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" +dependencies = [ + "bitflags 2.13.2", + "cursor-icon", + "wayland-backend", +] + +[[package]] +name = "wayland-cursor" +version = "0.31.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" +dependencies = [ + "rustix 1.1.6", + "wayland-client", + "xcursor", +] + +[[package]] +name = "wayland-protocols" +version = "0.32.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d0c813de3daa2ed6520af85a3bd49b0e722a3078506899aa9686fea58dc4b6" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-experimental" +version = "20250721.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40a1f863128dcaaec790d7b4b396cc9b9a7a079e878e18c47e6c2d2c5a8dcbb1" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-misc" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9567599ef23e09b8dad6e429e5738d4509dfc46b3b21f32841a304d16b29c8" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-plasma" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0" +dependencies = [ + "proc-macro2", + "quick-xml", + "quote", +] + +[[package]] +name = "wayland-sys" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be" +dependencies = [ + "dlib", + "log", + "once_cell", + "pkg-config", +] + +[[package]] +name = "web-sys" +version = "0.3.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7d179596ff5ec0f6de4db64d54011bde6289cc49603d3a6e4ce3f329207ab88" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webbrowser" +version = "1.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73e91ccd4698f2647d6137e8eb17a3f1dcfd63810be9029fb2398f507279b95b" +dependencies = [ + "jni 0.22.4", + "log", + "ndk-context", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "url", + "web-sys", +] + +[[package]] +name = "weezl" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" + +[[package]] +name = "wgpu" +version = "27.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfe68bac7cde125de7a731c3400723cadaaf1703795ad3f4805f187459cd7a77" +dependencies = [ + "arrayvec", + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "document-features", + "hashbrown 0.16.1", + "js-sys", + "log", + "naga", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "smallvec", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu-core", + "wgpu-hal", + "wgpu-types", +] + +[[package]] +name = "wgpu-core" +version = "27.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27a75de515543b1897b26119f93731b385a19aea165a1ec5f0e3acecc229cae7" +dependencies = [ + "arrayvec", + "bit-set", + "bit-vec", + "bitflags 2.13.2", + "bytemuck", + "cfg_aliases", + "document-features", + "hashbrown 0.16.1", + "indexmap", + "log", + "naga", + "once_cell", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "rustc-hash 1.1.0", + "smallvec", + "thiserror 2.0.21", + "wgpu-core-deps-apple", + "wgpu-core-deps-emscripten", + "wgpu-core-deps-windows-linux-android", + "wgpu-hal", + "wgpu-types", +] + +[[package]] +name = "wgpu-core-deps-apple" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0772ae958e9be0c729561d5e3fd9a19679bcdfb945b8b1a1969d9bfe8056d233" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-emscripten" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b06ac3444a95b0813ecfd81ddb2774b66220b264b3e2031152a4a29fda4da6b5" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-windows-linux-android" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71197027d61a71748e4120f05a9242b2ad142e3c01f8c1b47707945a879a03c3" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-hal" +version = "27.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b21cb61c57ee198bc4aff71aeadff4cbb80b927beb912506af9c780d64313ce" +dependencies = [ + "android_system_properties", + "arrayvec", + "ash", + "bit-set", + "bitflags 2.13.2", + "block", + "bytemuck", + "cfg-if", + "cfg_aliases", + "core-graphics-types 0.2.0", + "glow", + "glutin_wgl_sys", + "gpu-alloc", + "gpu-allocator", + "gpu-descriptor", + "hashbrown 0.16.1", + "js-sys", + "khronos-egl", + "libc", + "libloading", + "log", + "metal", + "naga", + "ndk-sys 0.6.0+11769913", + "objc", + "once_cell", + "ordered-float", + "parking_lot", + "portable-atomic", + "portable-atomic-util", + "profiling", + "range-alloc", + "raw-window-handle", + "renderdoc-sys", + "smallvec", + "thiserror 2.0.21", + "wasm-bindgen", + "web-sys", + "wgpu-types", + "windows 0.58.0", + "windows-core 0.58.0", +] + +[[package]] +name = "wgpu-types" +version = "27.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afdcf84c395990db737f2dd91628706cb31e86d72e53482320d368e52b5da5eb" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "js-sys", + "log", + "thiserror 2.0.21", + "web-sys", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" +dependencies = [ + "windows-core 0.54.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" +dependencies = [ + "windows-core 0.58.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows" +version = "0.61.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" +dependencies = [ + "windows-collections", + "windows-core 0.61.2", + "windows-future", + "windows-link 0.1.3", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +dependencies = [ + "windows-core 0.61.2", +] + +[[package]] +name = "windows-core" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" +dependencies = [ + "windows-result 0.1.2", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-core" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" +dependencies = [ + "windows-implement 0.58.0", + "windows-interface 0.58.0", + "windows-result 0.2.0", + "windows-strings 0.1.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement 0.60.2", + "windows-interface 0.59.3", + "windows-link 0.1.3", + "windows-result 0.3.4", + "windows-strings 0.4.2", +] + +[[package]] +name = "windows-future" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-result" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result 0.2.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-threading" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winit" +version = "0.30.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6755fa58a9f8350bd1e472d4c3fcc25f824ec358933bba33306d0b63df5978d" +dependencies = [ + "ahash", + "android-activity", + "atomic-waker", + "bitflags 2.13.2", + "block2", + "bytemuck", + "calloop 0.13.0", + "cfg_aliases", + "concurrent-queue", + "core-foundation 0.9.4", + "core-graphics", + "cursor-icon", + "dpi", + "js-sys", + "libc", + "memmap2", + "ndk 0.9.0", + "objc2 0.5.3", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", + "objc2-ui-kit", + "orbclient", + "percent-encoding", + "pin-project", + "raw-window-handle", + "redox_syscall 0.4.1", + "rustix 0.38.44", + "sctk-adwaita", + "smithay-client-toolkit 0.19.2", + "smol_str", + "tracing", + "unicode-segmentation", + "wasm-bindgen", + "wasm-bindgen-futures", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-plasma", + "web-sys", + "web-time", + "windows-sys 0.52.0", + "x11-dl", + "x11rb", + "xkbcommon-dl", +] + +[[package]] +name = "winnow" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3b93199df0ab874cdf0c6a94f0a0dc3423fe41f1cafb62b8bd7b1deb277aef" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] + +[[package]] +name = "x11rb" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414" +dependencies = [ + "as-raw-xcb-connection", + "gethostname", + "libc", + "libloading", + "once_cell", + "rustix 1.1.6", + "x11rb-protocol", +] + +[[package]] +name = "x11rb-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" + +[[package]] +name = "xcursor" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23" + +[[package]] +name = "xkbcommon-dl" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" +dependencies = [ + "bitflags 2.13.2", + "dlib", + "log", + "once_cell", + "xkeysym", +] + +[[package]] +name = "xkeysym" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" + +[[package]] +name = "xml-rs" +version = "0.8.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" + +[[package]] +name = "yoke" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure", +] + +[[package]] +name = "zbus" +version = "5.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907" +dependencies = [ + "async-broadcast", + "async-executor", + "async-io", + "async-lock", + "async-process", + "async-recursion", + "async-task", + "async-trait", + "blocking", + "enumflags2", + "event-listener", + "futures-core", + "futures-lite", + "hex", + "libc", + "ordered-stream", + "rustix 1.1.6", + "serde", + "serde_repr", + "tracing", + "uds_windows", + "uuid", + "windows-sys 0.61.2", + "winnow", + "zbus_macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "zbus-lockstep" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6998de05217a084b7578728a9443d04ea4cd80f2a0839b8d78770b76ccd45863" +dependencies = [ + "zbus_xml", + "zvariant", +] + +[[package]] +name = "zbus-lockstep-macros" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10da05367f3a7b7553c8cdf8fa91aee6b64afebe32b51c95177957efc47ca3a0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "zbus-lockstep", + "zbus_xml", + "zvariant", +] + +[[package]] +name = "zbus_macros" +version = "5.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 3.0.10", + "zbus_names", + "zvariant", + "zvariant_utils", +] + +[[package]] +name = "zbus_names" +version = "4.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812a12be4ead7a59e18ea8f047d08add0066b73bc62fc1467066a2472ae088dd" +dependencies = [ + "serde", + "winnow", + "zvariant", +] + +[[package]] +name = "zbus_xml" +version = "5.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1586c021a01ca0a9216dcd874e546382e156a5cbab5fab6cb5f10087e22682a" +dependencies = [ + "serde", + "winnow", + "zbus_names", + "zvariant", +] + +[[package]] +name = "zcheapstr" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "939f186d9ecebe044315a5cb6d6f78568bbc21152adc954d5a0c2f58bdbc9920" +dependencies = [ + "serde", +] + +[[package]] +name = "zerocopy" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "zlib-rs" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" + +[[package]] +name = "zune-core" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b" + +[[package]] +name = "zune-jpeg" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296" +dependencies = [ + "zune-core", +] + +[[package]] +name = "zvariant" +version = "5.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80bf6d6cd6a4b601acb64cfb8284cdc643fcfa75ef26ae3c46ec8aa4e8a1fbb7" +dependencies = [ + "endi", + "enumflags2", + "serde", + "winnow", + "zcheapstr", + "zvariant_derive", + "zvariant_utils", +] + +[[package]] +name = "zvariant_derive" +version = "5.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef2672456ba1cb54b5eaec136e63135b3c7495fb938e53b28a62e633496d486d" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 3.0.10", + "zvariant_utils", +] + +[[package]] +name = "zvariant_utils" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "syn 3.0.10", + "winnow", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..5db2939 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,12 @@ +[workspace] +resolver = "2" +members = ["crates/regulator-core", "crates/regulator-tui", "crates/regulator-gui"] + +[workspace.package] +version = "0.1.0" +edition = "2021" +license = "GPL-2.0" +repository = "https://github.com/borosf/regulator" + +[workspace.dependencies] +rustfft = "6" diff --git a/README.md b/README.md index e668dab..8b2f623 100644 --- a/README.md +++ b/README.md @@ -1,212 +1,99 @@ -# A program for timing mechanical watches - -The program tg is distributed under the GNU GPL license version 2. The full -source code of tg is available at -[https://github.com/xyzzy42/tg](https://github.com/xyzzy42/tg) and its -copyright belongs to the respective contributors. - -Tg is in development, and there is still no manual. Some info can be found -in this -[thread at WUS](http://forums.watchuseek.com/f6/open-source-timing-software-2542874.html), -in particular the calibration procedure is described at -[this post](http://forums.watchuseek.com/f6/open-source-timing-software-2542874-post29970370.html). - -## Install instructions - -Tg is known to work under Microsoft Windows, OS X, and Linux. Moreover it -should be possible to compile the source code under most modern UNIX-like -systems. See the sub-sections below for the details. - -### Windows - -Binaries can be found at https://tg.ciovil.li - -Unfortunately, these packages have not been updated since 2017. Help from -someone who can build the Windows installer version would be appreciated. -You'll need to [build from source](#compiling-on-windows) to get any features -from the last five plus years. - -### Macintosh - -A formula for the Homebrew package manager has been prepared by GitHub user -[dmnc](https://github.com/dmnc) and then updated by -[xyzzy42](https://github.com/xyzzy42). To use it, you need to install Homebrew -first (instructions on http://brew.sh). - -Then run the following command to check everything is set up correctly -and follow any instructions it gives you. - - brew doctor - -To install tg, run: - - brew install --HEAD xyzzy42/horology/tg-timer - -You can now launch tg by typing: - - tg-timer & - -### Debian or Debian-based (e.g. Mint, Ubuntu) - -Binary .deb packages can be downloaded from https://tg.ciovil.li - -Unfortunately, these packages have not been updated since 2017. - -### Fedora, CentOS or other Redhat-based - -Binary RPM packages are available from https://copr.fedorainfracloud.org/coprs/tpiepho/tg-timer/ - -This COPR repository can be added to dnf's list with: -```sh -dnf copr enable tpiepho/tg-timer -``` -Then tg-timer can be installed with `dnf install tg-timer`, or with any dnf -based GUI package installer. - -## Compiling from sources - -The source code of tg can probably be built by any C99 compiler, however only -gcc and clang have been tested. You need the following libraries: gtk+3, -portaudio2, fftw3 (all available as open source). - -The optional plotting features for audio filter response graphs and audio -spectrograms require Python. The follow Python modules are needed for all -features: numpy, scipy, matplotlib, libtfr. - -### Normal build -Get source: -```sh -git clone https://github.com/xyzzy42/tg.git -cd tg - -# Optional, check out a specific branch other than the default -git checkout new-stuff -``` - -Build it: -```sh -./autogen.sh -./configure -make -``` - -### Debug build -After the steps of a normal build, above, run: -```sh -make tg-timer-dbg -``` - -### Compiling on Windows - -It is suggested to use the MSYS2 platform. First install MSYS2 according -to the instructions at [http://www.msys2.org](http://www.msys2.org). The -[UCRT64 environment](https://www.msys2.org/docs/environments/) appears to work -best. - -From the MSYS2 UCRT64 terminal issue the following commands to install dependencies: - -```sh -pacman -S mingw-w64-ucrt-x86_64-gcc pkg-config mingw-w64-ucrt-x86_64-gtk3 mingw-w64-ucrt-x86_64-portaudio mingw-w64-ucrt-x86_64-fftw make git autoconf automake libtool -pacman -S mingw-w64-ucrt-x86_64-ninja mingw-w64-ucrt-x86_64-python-scipy mingw-w64-ucrt-x86_64-python-matplotlib mingw-w64-ucrt-x86_64-lapack mingw-w64-ucrt-x86_64-cython mingw-w64-ucrt-x86_64-python-pip -``` - -Add the folder "C:\msys64\ucrt64\bin" to the system path variable - -Install the libtfr package with: +# regulator + +A modern, free-software watch timing machine — a Rust rewrite of +[tg](https://github.com/xyzzy42/tg), the open-source mechanical-watch +timing program. Put a watch on a microphone and regulator measures the +rate error, balance amplitude, and beat error, live, with a clean +instrument-style interface. + +![screenshot](docs/screenshot.jpg) + +## Features + +- **Live measurement** of rate (s/day), amplitude (degrees) and beat + error (ms), with each value reported independently — a measurement that + fails is shown blank instead of breaking the whole readout. +- **Auto beat-rate detection** with snapping to standard rates + (12000–43200 bph, including 36000 and 43200 high-beat movements). +- **Strip chart trace**: time runs left to right, phase error moves up + and down, tic and toc in different colors — the classic timegrapher + view. +- **Sound-card calibration** against a quartz watch ticking once per + second, with live progress feedback and an early exit once the estimate + converges. +- **Export**: chart as SVG, raw trace as CSV, and a branded JPEG result + sheet with all readouts, ready to attach to a service record. +- **Demo mode**: a synthetic watch drives every feature with no hardware. + +## Build & run ```sh -pip install libtfr +cargo run -p regulator-gui # graphical interface (demo mode by default) ``` -If that doesn't work, try building it manually: - -```sh -git clone https://github.com/melizalab/libtfr.git -cd libtfr -python setup.py install -``` - -Then follow the [normal build](#normal-build) instructions to clone the TG -repository and build it. - -If the "Signal" or "Filter Chain" dialogs do not work, this appears to be some -sort of [library issue with Python on Windows](https://github.com/xyzzy42/tg/issues/8#issuecomment-2351649260). -Try copying the `tg-timer.exe` file to `C:\msys64\ucrt64\bin` and run it from there. - -### Compiling on Debian - -To compile tg on Debian, install these dependencies: - -```sh -sudo apt-get install libgtk-3-dev libjack-jackd2-dev portaudio19-dev libfftw3-dev git autoconf automake libtool -``` - -Additional software is necessary for the optional Python graphing system, see -Fedora section for more information. Debian specific instructions welcome. - -Then follow the [normal build](#normal-build) instructions to clone the -repository and build it. - -The package libjack-jackd2-dev is not necessary, it only works around a -known bug (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718221). - -### Compiling on Fedora - -To compile tg on Fedora, install these dependencies: - -```sh -sudo dnf install fftw-devel portaudio-devel gtk3-devel autoconf automake libtool -``` - -To use the Python graphing code (filter response and audio spectrogram) one -should also install: -```sh -sudo dnf install python3-devel python3-numpy python3-scipy python3-matplotlib -pip install --user libtfr -``` - -Then follow the [normal build](#normal-build) instructions to clone the -repository and build it. - -To build an RPM on Fedora or another RPM based distro, install the build -prerequisites and checkout the source as for compiling (above), then run -`rpmbuild` to create the RPM: - -```sh -rpmbuild --build-in-place -bb packaging/tg-timer.spec -``` - - -### Compiling on Macintosh - -To build on MacOS, install the follow dependencies with -[Homebrew](http://brew.sh). If you do not have Homebrew, the link above will -explain the install. - -```sh -brew install pkg-config autoconf automake libtool gtk+3 portaudio fftw gnome-icon-theme -``` - -To use the Python graphing code (filter response and audio spectrogram) one -should also install: - -```sh -brew install python numpy scipy -pip3 install matplotlib libtfr -``` - -If you have multiple versions of python3 installed, you might need to use a -specific version of pip, e.g. `pip3.11` in the above command. - -Then follow the [normal build](#normal-build) instructions to clone the -repository and build it. +Uncheck "demo signal" in the side panel to analyze the microphone. On +Linux you may need `libasound2-dev`; on Windows and macOS it just works. -If you have multiple versions of Python installed and the configure script does -not detect the correct one, i.e. the one for which numpy, matplotlib, libtfr, -etc. have been installed for, then run the configure script as: +To build on a system without an audio stack: ```sh -PYTHON=python3.11 ./configure +cargo build --no-default-features +cargo test ``` -Where `python3.11` is the correct version to use. +## Using it + +1. Rest the watch on a microphone (a piezo contact mic or the watch + directly on a laptop mic both work). +2. Pick the beat rate, or leave it on auto. +3. Set the lift angle for the movement (52° is a safe default; check the + movement's spec). +4. Read the rate. The trace confirms it: a rising drift means fast, a + falling drift means slow, two horizontal bands mean beat error. +5. To calibrate the sound card, click "calibrate (quartz)" and place a + quartz watch (exactly 1 tick/s) on the microphone for a minute or two. + The correction persists between runs. + +## Layout + +- `crates/regulator-core` — pure DSP: filters, FFT-based period + detection, waveform folding, rate/amplitude/beat-error computation, + calibration. No I/O, fully unit-tested against a synthetic watch. +- `crates/regulator-gui` — the graphical interface (egui). **This is the + main frontend.** +- `crates/regulator-tui` — the terminal interface (ratatui). **Experimental:** + it lags behind the GUI in features and polish and may be removed or + reworked. + +## Improvements over tg + +- Partial results: rate, beat error and amplitude are reported + independently; a missing measurement is blank, not fatal. +- Sub-sample period refinement (parabolic interpolation of the + autocorrelation peak) for finer rate resolution. +- Cached FFT plans and reused scratch buffers. +- Faster calibration: the quartz fit exits early once the estimate + converges instead of always collecting the full 900-second window. +- Modern cross-platform GUI with a result-sheet export. + +The original C code (GPLv2) is kept at the root of the repository as the +reference implementation; see [docs/original-readme.md](docs/original-readme.md) +for the original project's documentation. + +## Known limitations + +- The passive clock estimate (sound card vs. local timer) is + informational only: many machines' timers drift by tens of s/day, so + only the quartz calibration is applied to measurements. +- Tick events are located by peak search around expected positions, not + template matching; very noisy recordings may drop events. + +## Contributing + +See [CONTRIBUTING.md](CONTRIBUTING.md). Bug reports and feature requests +are welcome via the issue tracker. + +## License + +GPLv2, like the original project. regulator is a derivative work of tg, +Copyright 2015 Marcello Mamino and contributors. diff --git a/crates/regulator-core/Cargo.toml b/crates/regulator-core/Cargo.toml new file mode 100644 index 0000000..11541c0 --- /dev/null +++ b/crates/regulator-core/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "regulator-core" +description = "Watch timing DSP: tick detection, rate, amplitude and beat error" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true + +[dependencies] +rustfft = { workspace = true } + +[dev-dependencies] +hound = "3" +symphonia = { version = "0.5", default-features = false, features = ["mp3", "wav", "isomp4", "aac", "pcm"] } diff --git a/crates/regulator-core/examples/analyze_wav.rs b/crates/regulator-core/examples/analyze_wav.rs new file mode 100644 index 0000000..15364e5 --- /dev/null +++ b/crates/regulator-core/examples/analyze_wav.rs @@ -0,0 +1,103 @@ +// SPDX-License-Identifier: GPL-2.0 +//! Analyze a recording of a watch (WAV, MP3, M4A/AAC) and print results +//! per block. +//! Usage: cargo run -p regulator-core --example analyze_wav -- file.mp3 [bph] [lift] + +use regulator_core::Analyzer; + +fn main() { + let args: Vec = std::env::args().collect(); + if args.len() < 2 { + eprintln!("usage: analyze_wav [bph] [lift_angle]"); + std::process::exit(1); + } + let bph: u32 = args.get(2).and_then(|s| s.parse().ok()).unwrap_or(0); + let lift: f64 = args.get(3).and_then(|s| s.parse().ok()).unwrap_or(52.0); + let (sr, samples) = load_audio(&args[1]); + println!( + "file: {} rate: {sr} samples: {} ({:.1} s) bph: {bph} lift: {lift}", + args[1], + samples.len(), + samples.len() as f64 / sr as f64 + ); + let mut analyzer = Analyzer::new(sr); + analyzer.bph = bph; + analyzer.lift_angle = lift; + let block = (4.0 * sr as f64) as usize; + let mut t = 0.0; + for (i, chunk) in samples.chunks(block).enumerate() { + if chunk.len() < sr as usize { + break; + } + match analyzer.analyze(chunk) { + Some(r) => println!( + "t={t:6.1}s rate={:+8.1} s/d amp={:>5} be={:+6.2} ms period={:.1} bph={} events={}", + r.rate_sday.unwrap_or(f64::NAN), + r.amplitude_deg + .map(|a| format!("{a:.0}")) + .unwrap_or("---".into()), + r.beat_error_ms.unwrap_or(f64::NAN), + r.period, + r.bph, + r.events.len(), + ), + None => println!("t={t:6.1}s no signal"), + } + t = (i + 1) as f64 * 4.0; + } +} + +/// Load any supported audio file as mono f32 samples via symphonia. +fn load_audio(path: &str) -> (u32, Vec) { + let file = std::fs::File::open(path).expect("cannot open file"); + let mss = symphonia::core::io::MediaSourceStream::new( + Box::new(file), + Default::default(), + ); + let hint = symphonia::core::probe::Hint::new(); + let probed = symphonia::default::get_probe() + .format(&hint, mss, &Default::default(), &Default::default()) + .expect("unsupported format"); + let mut format = probed.format; + let track = format + .tracks() + .first() + .expect("no track") + .clone(); + let sr = track.codec_params.sample_rate.expect("no sample rate"); + let channels = track + .codec_params + .channels + .map(|c| c.count()) + .unwrap_or(1); + let mut decoder = symphonia::default::get_codecs() + .make(&track.codec_params, &Default::default()) + .expect("unsupported codec"); + + let mut samples = Vec::new(); + loop { + match format.next_packet() { + Ok(packet) => { + if packet.track_id() != track.id { + continue; + } + match decoder.decode(&packet) { + Ok(audio) => { + let mut sb = symphonia::core::audio::SampleBuffer::::new( + audio.frames() as u64, + *audio.spec(), + ); + sb.copy_interleaved_ref(audio); + for frame in sb.samples().chunks(channels) { + samples.push(frame.iter().sum::() / channels as f32); + } + } + Err(symphonia::core::errors::Error::DecodeError(_)) => continue, + Err(_) => break, + } + } + Err(_) => break, + } + } + (sr, samples) +} diff --git a/crates/regulator-core/examples/debug.rs b/crates/regulator-core/examples/debug.rs new file mode 100644 index 0000000..a874719 --- /dev/null +++ b/crates/regulator-core/examples/debug.rs @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0 +use regulator_core::signal::SyntheticWatch; +use regulator_core::Analyzer; + +fn main() { + let sr = 44100u32; + let watch = SyntheticWatch { + bph: 28800, + rate_sday: 12.0, + beat_error_ms: 0.0, + amplitude_deg: 270.0, + quartz: false, + }; + let samples = watch.generate(sr, 4.0); + let an = Analyzer::new(sr); + match an.analyze(&samples) { + Some(r) => println!("ok: {r:?}"), + None => println!("analysis failed"), + } +} diff --git a/crates/regulator-core/examples/mkwav.rs b/crates/regulator-core/examples/mkwav.rs new file mode 100644 index 0000000..b4ee559 --- /dev/null +++ b/crates/regulator-core/examples/mkwav.rs @@ -0,0 +1,8 @@ +fn main() { + use regulator_core::SyntheticWatch; + let w = SyntheticWatch { bph: 18000, rate_sday: 33.0, beat_error_ms: 1.8, amplitude_deg: 272.0, quartz: false }; + let samples = w.generate(44100, 12.0); + let spec = hound::WavSpec { channels: 1, sample_rate: 44100, bits_per_sample: 16, sample_format: hound::SampleFormat::Int }; + let mut w = hound::WavWriter::create("/tmp/watch.wav", spec).unwrap(); + for s in samples { w.write_sample((s.clamp(-1.0, 1.0) * i16::MAX as f32) as i16).unwrap(); } +} diff --git a/crates/regulator-core/src/analyze.rs b/crates/regulator-core/src/analyze.rs new file mode 100644 index 0000000..884e88d --- /dev/null +++ b/crates/regulator-core/src/analyze.rs @@ -0,0 +1,687 @@ +// SPDX-License-Identifier: GPL-2.0 +//! The timing analysis pipeline, ported from tg's algo.c, with improvements: +//! cached FFT plans, buffer reuse, and sub-sample period refinement. + +use crate::filters::Biquad; +use crate::stats::{median, tmean, vmax}; +use rustfft::num_complex::Complex; +use rustfft::{Fft, FftDirection, FftPlanner}; +use std::cell::RefCell; +use std::collections::HashMap; +use std::sync::Arc; + +/// Result of one analysis pass over a block of audio. Fields are None when +/// that particular measurement could not be determined from the signal. +#[derive(Clone, Debug, Default)] +pub struct TimingResult { + /// Detected period in samples (time between same-type ticks). + pub period: f64, + /// Rate error in seconds per day (positive = fast). + pub rate_sday: Option, + /// Beat error in milliseconds (tic-to-toc asymmetry). + pub beat_error_ms: Option, + /// Balance amplitude in degrees. + pub amplitude_deg: Option, + /// Standard deviation of the period estimate in samples. + pub sigma: f64, + /// Folded average waveform over one period, median-subtracted. + pub waveform: Vec, + /// Beat rate the rate was computed against. + pub bph: u32, + /// Position of the tic peak in the folded waveform, if found. + pub tic: Option, + /// Located tick events in this block: (sample position, is_tic). + /// Sample positions are fractional and relative to the block start. + pub events: Vec<(f64, bool)>, +} + +struct FftCache { + plans: HashMap>>, + scratch: Vec>, +} + +impl FftCache { + fn new() -> Self { + FftCache { + plans: HashMap::new(), + scratch: Vec::new(), + } + } + + fn plan(&mut self, len: usize, direction: FftDirection) -> Arc> { + // rustfft plans are direction-specific; key on len and direction bit. + let key = len * 2 + (direction == FftDirection::Inverse) as usize; + if !self.plans.contains_key(&key) { + let mut planner = FftPlanner::new(); + let fft = match direction { + FftDirection::Forward => planner.plan_fft_forward(len), + FftDirection::Inverse => planner.plan_fft_inverse(len), + }; + self.plans.insert(key, fft); + } + self.plans.get(&key).unwrap().clone() + } +} + +/// Snap a detected beats-per-hour value to the nearest standard beat rate. +fn snap_bph(detected: f64) -> f64 { + const STANDARDS: [f64; 9] = [ + 12000.0, 14400.0, 18000.0, 19800.0, 21600.0, 25200.0, 28800.0, 36000.0, 43200.0, + ]; + STANDARDS + .iter() + .copied() + .min_by(|a, b| (a - detected).abs().partial_cmp(&(b - detected).abs()).unwrap()) + .unwrap_or(28800.0) +} + +/// Configurable analyzer. Reuse one instance across blocks; it caches FFT +/// plans and reuses scratch buffers. +pub struct Analyzer { + pub sample_rate: u32, + /// Beats per hour of the movement under test; 0 = auto-detect. + pub bph: u32, + /// Lift angle of the movement in degrees (typically 49-53). + pub lift_angle: f64, + /// Enable the impulsive-noise suppressor. + pub noise_suppressor: bool, + /// Sound-card calibration in s/day (from CalibrationState); subtracted + /// from the measured rate. + pub calibration: f64, + lpf: Biquad, + hpf: Biquad, + fft: RefCell, + last_sigma: Cell, +} + +use std::cell::Cell; + +impl Analyzer { + pub fn new(sample_rate: u32) -> Self { + Analyzer { + sample_rate, + bph: 0, + lift_angle: 52.0, + noise_suppressor: true, + calibration: 0.0, + lpf: Biquad::low_pass(crate::FILTER_CUTOFF / sample_rate as f64), + hpf: Biquad::high_pass(crate::FILTER_CUTOFF / sample_rate as f64), + fft: RefCell::new(FftCache::new()), + last_sigma: Cell::new(0.0), + } + } + + /// Analyze one block of samples. `samples` should be at least one second + /// long; several seconds gives more stable results. Returns None only + /// when no tick train at all could be found; individual measurements + /// that fail are None inside the result. + pub fn analyze(&self, samples: &[f32]) -> Option { + if samples.len() < self.sample_rate as usize { + return None; + } + let mut s = samples.to_vec(); + let n = s.len(); + let sr = self.sample_rate as usize; + + self.prepare_data(&mut s); + let period = self.compute_period(&s, n)?; + let (waveform, _, phase_shift) = self.compute_waveform(&s, period, n); + let (beat_error_ms, tic, toc) = match self.compute_beat_error(&waveform, period) { + Some((be, tic, toc)) => (be, Some(tic), Some(toc)), + None => (None, None, None), + }; + let tic_idx = tic; + let amplitude_deg = match (tic, toc) { + (Some(tic), Some(toc)) => self.compute_amplitude(&waveform, period, tic, toc), + _ => None, + }; + + // Locate individual tick events by measuring each arrival: search + // the prepared signal around each expected position (extrapolated + // from the folded-waveform peaks at the detected period) for the + // local maximum. The deviation of the measured peak from the + // expectation is the per-tick phase error that draws the trace. + let mut events = Vec::new(); + if let (Some(tic), Some(toc)) = (tic, toc) { + let search = (period / 16.0).max(4.0) as usize; + let tic0 = (tic + phase_shift) as f64; + let toc0 = (toc + phase_shift) as f64; + let cycles = (n as f64 / period).ceil() as usize + 1; + for k in 0..cycles { + for (base, is_tic) in [(tic0, true), (toc0, false)] { + let expected = base + k as f64 * period; + if expected < -(search as f64) || expected > n as f64 { + continue; + } + let a = (expected as isize - search as isize).max(0) as usize; + let b = ((expected as usize) + search).min(n - 1); + if b <= a { + continue; + } + // Only accept a peak that actually rises above the + // local noise floor; otherwise the tick was missed. + let (peak, i_max) = vmax(&s, a, b + 1); + let med = median(&mut s[a..=b].to_vec()); + if peak <= 0.0 || peak < 2.0 * med { + continue; + } + events.push((i_max as f64, is_tic)); + } + } + } + + let detected_bph = 2.0 * 3600.0 * sr as f64 / period; + let bph = if self.bph != 0 { + self.bph as f64 + } else { + snap_bph(detected_bph) + }; + let nominal = 7200.0 * sr as f64 / bph; + let rate_sday = (nominal / period - 1.0) * 86400.0 - self.calibration; + + Some(TimingResult { + period, + rate_sday: Some(rate_sday), + beat_error_ms, + amplitude_deg, + sigma: self.last_sigma.get(), + waveform, + bph: bph as u32, + tic: tic_idx, + events, + }) + } + + /// An analyzer configured for sound-card calibration against a quartz + /// watch ticking once per second (tg's 7200 bph nominal period). + pub fn for_calibration(sample_rate: u32) -> Self { + let mut an = Analyzer::new(sample_rate); + an.bph = 7200; + an.noise_suppressor = false; + an + } + + /// Rectify, low-pass, normalize and window the input. + pub(crate) fn prepare_data(&self, s: &mut Vec) { + let n = s.len(); + let sr = self.sample_rate as usize; + self.hpf.run(s); + if self.noise_suppressor { + Self::noise_suppressor(s, sr); + } + for v in s.iter_mut() { + *v = v.abs(); + } + self.lpf.run(s); + let average: f64 = s.iter().map(|&v| v as f64).sum::() / n as f64; + for v in s.iter_mut() { + *v -= average as f32; + } + let edge = sr / 10; + for i in 0..edge.min(n / 2) { + let k = (1.0 - (i as f64 * std::f64::consts::PI / edge as f64).cos()) / 2.0; + s[i] *= k as f32; + let j = n - i - 1; + s[j] *= k as f32; + } + } + + /// Zero out samples in windows whose energy greatly exceeds the median + /// window energy (impulsive noise gating), ported from tg. + fn noise_suppressor(s: &mut [f32], sr: usize) { + let n = s.len(); + let window = sr / 50; + let sq: Vec = s.iter().map(|v| v * v).collect(); + let mut r_av: f64 = sq[..window].iter().map(|&v| v as f64).sum(); + let mut b = vec![0f32; n]; + for i in 0..n { + b[i] = r_av as f32; + if i + window == n { + break; + } + r_av += sq[i + window] as f64 - sq[i] as f64; + } + let m = n - window + 1; + let step = sr / 2; + let mut a = Vec::with_capacity(m / step + 1); + let mut i = 0; + while i + step <= m { + a.push(vmax(&b, i, i + step).0); + i += step; + } + let k = median(&mut a); + for i in 0..n { + let mut j = i as isize - (window / 2) as isize; + if j < 0 { + j = 0; + } + let upper = n.saturating_sub(window) as isize; + if j > upper { + j = upper; + } + if b[j as usize] > 2.0 * k { + s[i] = 0.0; + } + } + } + + /// Autocorrelation of s (length n) via cached FFT plans; result has n + /// points. Unlike tg, the plans are created once per length and reused. + fn autocorrelate(&self, s: &[f32], n: usize) -> Vec { + let mut fft = self.fft.borrow_mut(); + let forward = fft.plan(2 * n, FftDirection::Forward); + let inverse = fft.plan(2 * n, FftDirection::Inverse); + let scratch_len = forward.get_inplace_scratch_len().max(inverse.get_inplace_scratch_len()); + fft.scratch.resize(scratch_len, Complex::default()); + let mut buf: Vec> = s.iter().map(|&v| Complex::new(v, 0.0)).collect(); + buf.resize(2 * n, Complex::default()); + forward.process_with_scratch(&mut buf, &mut fft.scratch); + for c in buf.iter_mut() { + *c = *c * c.conj(); + } + inverse.process_with_scratch(&mut buf, &mut fft.scratch); + buf.truncate(n); + buf.iter().map(|c| c.re).collect() + } + + /// Parabolic interpolation around an integer peak of `ac` for a + /// sub-sample peak position. This refines the period estimate beyond + /// tg's integer-sample resolution, improving rate precision. + fn interpolate_peak(ac: &[f32], p: usize) -> f64 { + if p == 0 || p + 1 >= ac.len() { + return p as f64; + } + let (a, b, c) = (ac[p - 1] as f64, ac[p] as f64, ac[p + 1] as f64); + let denom = a - 2.0 * b + c; + if denom.abs() < 1e-12 { + return p as f64; + } + let delta = 0.5 * (a - c) / denom; + if delta.abs() <= 1.0 { + p as f64 + delta + } else { + p as f64 + } + } + + /// tg's peak_detector: the maximum of buff[a..=b] is accepted only if it + /// is a real peak (rises above the local median, not part of a sustained + /// plateau). Returns the index or None. + fn peak_detector(buff: &[f32], a: usize, b: usize) -> Option { + if b <= a || b >= buff.len() { + return None; + } + let (max, i_max) = vmax(buff, a, b + 1); + if max <= 0.0 { + return None; + } + let med = median(&mut buff[a..=b].to_vec()); + if i_max > a + 1 && buff[a + 1..i_max].iter().all(|&v| v > med) { + return None; + } + if i_max == b || buff[i_max + 1..=b].iter().all(|&v| v > med) { + return None; + } + let mut cnt = 0; + let mut down = true; + for &v in &buff[a + 1..=b] { + if v > (max + med) / 2.0 { + if down { + cnt += 1; + } + down = false; + } + if v < med { + down = true; + } + } + if cnt > 20 { + return None; + } + Some(i_max) + } + + /// Autocorrelation-based period estimation, ported from tg's + /// estimate_period(). + fn estimate_period(&self, ac: &[f32], sr: usize) -> Option { + let first = vmax(ac, sr / 12, sr.min(ac.len())).1; + let a = (sr / 12).max(first.saturating_sub(sr / 12)); + let b = (first + sr / 12).min(ac.len() - 1); + let first_estimate = Self::peak_detector(ac, a, b)?; + let mut estimate = first_estimate; + let mut factor = 1; + let mut fct = 2; + while first_estimate / fct > sr / 12 { + let c = first_estimate / fct; + if c > sr / 50 { + if let Some(ne) = + Self::peak_detector(ac, c - sr / 50, (c + sr / 50).min(ac.len() - 1)) + { + if ac[ne] > 0.9 * ac[first_estimate] { + estimate = ne; + factor = fct; + } + } + } + fct += 1; + } + let a = estimate * 3 / 2; + let max = if a < ac.len() { + vmax(ac, a.saturating_sub(sr / 50), (a + sr / 50).min(ac.len())).0 + } else { + 0.0 + }; + if max < 0.2 * ac[estimate] { + let doubled = first_estimate * 2 / factor; + if doubled < sr { + return Self::peak_detector( + ac, + doubled.saturating_sub(sr / 50), + (doubled + sr / 50).min(ac.len() - 1), + ); + } + return None; + } + Some(estimate) + } + + /// Refine the period estimate by locating peaks at successive multiples + /// and averaging the per-cycle estimates, ported from tg's + /// compute_period(). Unlike tg, the final estimate is refined with + /// parabolic interpolation for sub-sample period resolution. + pub(crate) fn compute_period(&self, s: &[f32], n: usize) -> Option { + let sr = self.sample_rate as usize; + let ac = self.autocorrelate(s, n); + let estimate = if self.bph != 0 { + let c = 7200 * sr / self.bph as usize; + if c <= sr / 50 || c + sr / 50 >= ac.len() { + return None; + } + Self::peak_detector(&ac, c - sr / 50, c + sr / 50)? as f64 + } else { + self.estimate_period(&ac, sr)? as f64 + }; + let delta = sr as f64 * 0.02; + let mut new_estimate = estimate; + let mut sum = 0.0; + let mut sq_sum = 0.0; + let mut count = 0; + let mut cycle = 1usize; + let mut last_peak = 0usize; + loop { + let inf = (new_estimate * cycle as f64 - delta).floor() as usize; + let sup = (new_estimate * cycle as f64 + delta).ceil() as usize; + if sup > n * 2 / 3 || sup >= ac.len() { + break; + } + let peak = Self::peak_detector(&ac, inf, sup)?; + new_estimate = peak as f64; + new_estimate /= cycle as f64; + if new_estimate < estimate - delta || new_estimate > estimate + delta { + return None; + } + if inf > n / 3 { + sum += new_estimate; + sq_sum += new_estimate * new_estimate; + count += 1; + } + cycle += 1; + last_peak = peak; + } + let period = if count > 0 { sum / count as f64 } else { estimate }; + self.last_sigma.set(if count > 1 { + ((sq_sum - count as f64 * period * period) / (count - 1) as f64).sqrt() + } else { + 0.0 + }); + if period >= 1.2 * 3600.0 * 2.0 * sr as f64 / if self.bph != 0 { self.bph } else { 18000 } as f64 + { + return None; + } + // Sub-sample refinement: interpolate the autocorrelation around the + // last accepted peak, expressed back as a per-period offset. + if last_peak > 0 && count > 0 { + let cycles = (last_peak as f64 / period).round().max(1.0); + let refined = Self::interpolate_peak(&ac, last_peak) / cycles; + if (refined - period).abs() < delta { + return Some(refined); + } + } + Some(period) + } + + /// Fold the rectified signal at `period` and average into a one-period + /// waveform, ported from tg's compute_phase()/compute_waveform(). + pub(crate) fn compute_waveform(&self, s: &[f32], period: f64, n: usize) -> (Vec, f64, usize) { + let count = period as usize; + let mut wf = vec![0f64; count]; + let mut j = 0usize; + let mut i = 0usize; + while (j as f64 * period).round() < n as f64 { + let start = (j as f64 * period).round() as usize; + i = 0; + while i < count && start + i < n { + wf[i] += s[start + i] as f64; + i += 1; + } + j += 1; + } + let lastfull = i; + let mut x = 0.0; + let mut y = 0.0; + for (i, &w) in wf.iter().enumerate() { + let a = i as f64 * (2.0 * std::f64::consts::PI / period); + let w = w / (j as f64 - if i >= lastfull { 1.0 } else { 0.0 }); + x += w * a.cos(); + y += w * a.sin(); + } + let phase = period * (std::f64::consts::PI + y.atan2(x)) / (2.0 * std::f64::consts::PI); + + let wf_size = count; + let binsize = 1 + n / wf_size; + let mut bin = vec![0f32; binsize + 1]; + let mut wf2 = vec![0f32; wf_size]; + let phase_shift = phase.round() as usize; + for i in 0..wf_size { + let k = (i + phase_shift) % wf_size; + let mut j = 0; + loop { + let idx = k + j * wf_size; + if idx >= n { + break; + } + bin[j] = s[idx]; + j += 1; + } + wf2[i] = tmean(&mut bin[..j]); + } + let step = (wf_size / 100).max(1); + let mut sc = Vec::new(); + let mut i = 0; + while i * step < wf_size { + sc.push(wf2[i * step]); + i += 1; + } + let nl = median(&mut sc); + for v in wf2.iter_mut() { + *v -= nl; + } + (wf2, phase, phase_shift) + } + + /// Beat error: distance between the tic and toc peaks in the folded + /// waveform, found via the waveform autocorrelation, ported from tg's + /// compute_parameters(). Returns (beat error ms, tic index, toc index). + fn compute_beat_error(&self, wf: &[f32], period: f64) -> Option<(Option, usize, usize)> { + let sr = self.sample_rate as usize; + let n = wf.len(); + let ac = self.autocorrelate(wf, n); + let half = (period / 2.0).floor() as usize; + let a = half.saturating_sub(sr / 50); + let b = (half + sr / 50).min(n - 1); + if b <= a { + return None; + } + let tic_to_toc = Self::peak_detector(&ac, a, b)?; + let be = period / 2.0 - tic_to_toc as f64; + + // Fold tic and toc together and smooth to locate the tic peak. + let m = n - tic_to_toc; + let mut fold = vec![0f32; m]; + for i in 0..m { + fold[i] = wf[i] + wf[i + tic_to_toc]; + } + let window = (sr / 2000).max(1); + if m <= window { + return None; + } + let smooth = Self::smooth(&fold, window); + let (max, max_i) = vmax(&smooth, 0, smooth.len()); + if max <= 0.0 { + return None; + } + let tic = max_i; + let toc = tic + tic_to_toc; + Some((Some(be * 1000.0 / sr as f64), tic, toc)) + } + + /// Amplitude from the tic/toc pulse widths, tg's algorithm: scan the + /// eighth before each tick for a threshold crossing, follow the + /// increasing run to its local maximum, and take the distance from + /// that local max to the tick as the pulse width. Real escapement + /// sounds have a build-up before the main impulse, so this distance + /// tracks the impulse duration. A/la = 0.5 / sin(pi * pulse / period). + fn compute_amplitude(&self, wf: &[f32], period: f64, tic: usize, toc: usize) -> Option { + let sr = self.sample_rate as usize; + let wf_size = wf.len(); + let window = sr / 1000; + let mut ext = wf.to_vec(); + ext.extend_from_within(0..window.min(wf_size)); + let smooth = Self::smooth(&ext, window); + if smooth.is_empty() { + return None; + } + let wlen = smooth.len(); + let eighth = (period / 8.0) as usize; + if eighth == 0 || tic >= wlen || toc >= wlen { + return None; + } + let glob_max = smooth.iter().cloned().fold(0f32, f32::max); + if glob_max <= 0.0 { + return None; + } + // Noise level in the eighths following each tick. + let mut quiet = 0.0f32; + for &t in &[tic, toc] { + let mut j = ((t as f64 + period / 8.0) % wlen as f64) as usize; + for _ in 0..eighth { + if smooth[j] > quiet { + quiet = smooth[j]; + } + j = (j + 1) % wlen; + } + } + let mut threshold = (0.01 * glob_max).max(1.4 * quiet); + while threshold < 0.2 * glob_max { + let mut pulses = [0.0f64; 2]; + let mut ok = true; + for (k, &t) in [toc, tic].iter().enumerate() { + let mut j = ((t as f64 + 7.0 * period / 8.0) % wlen as f64) as usize; + let mut i = 0usize; + while i < eighth { + if smooth[j] > threshold { + break; + } + i += 1; + j = (j + 1) % wlen; + } + let mut max = 0.0f32; + while i < eighth { + let x = smooth[j]; + if x > max { + max = x; + } else { + break; + } + i += 1; + j = (j + 1) % wlen; + } + if i < eighth { + pulses[k] = period / 8.0 - i as f64 - 1.0; + } else { + ok = false; + break; + } + } + if ok { + let tic_amp_abs = 0.5 / (std::f64::consts::PI * pulses[0] / period).sin(); + let toc_amp_abs = 0.5 / (std::f64::consts::PI * pulses[1] / period).sin(); + let tic_amp = self.lift_angle * tic_amp_abs; + let toc_amp = self.lift_angle * toc_amp_abs; + if (135.0..360.0).contains(&tic_amp) + && (135.0..360.0).contains(&toc_amp) + && (tic_amp - toc_amp).abs() < 60.0 + { + return Some(self.lift_angle * (tic_amp_abs + toc_amp_abs) / 2.0); + } + } + threshold *= 1.4; + } + None + } + + /// Exponential-decay peak smoother, ported from tg's smooth(). + fn smooth(input: &[f32], window: usize) -> Vec { + let size = input.len(); + if window == 0 || window >= size { + return Vec::new(); + } + let k = 1.0 - 1.0 / window as f64; + let mut r_av = 0.0f64; + let mut u = 0.0f64; + for &x in input.iter().take(window) { + u *= k; + if x as f64 > u { + u = x as f64; + } + r_av += u; + } + let mut w = 0.0f64; + let mut out = vec![0f32; size - window]; + for i in 0..size - window { + out[i] = r_av as f32; + u *= k; + w *= k; + let x = input[i + window]; + let y = input[i]; + if x as f64 > u { + u = x as f64; + } + if y as f64 > w { + w = y as f64; + } + r_av += u - w; + } + out + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn peak_detector_degenerate_ranges() { + let v = vec![1.0, 5.0, 1.0]; + assert_eq!(Analyzer::peak_detector(&v, 1, 1), None); + assert_eq!(Analyzer::peak_detector(&v, 2, 1), None); + assert_eq!(Analyzer::peak_detector(&v, 0, 3), None); + assert_eq!(Analyzer::peak_detector(&v, 0, 2), Some(1)); + } + + #[test] + fn peak_detector_rejects_edge_peak() { + let v = vec![1.0, 2.0, 5.0]; + assert_eq!(Analyzer::peak_detector(&v, 0, 2), None); + } +} diff --git a/crates/regulator-core/src/calibrate.rs b/crates/regulator-core/src/calibrate.rs new file mode 100644 index 0000000..c76521d --- /dev/null +++ b/crates/regulator-core/src/calibrate.rs @@ -0,0 +1,233 @@ +// SPDX-License-Identifier: GPL-2.0 +//! Sound-card calibration, ported from tg's calibration_data: measure the +//! audio input's clock error by timing a quartz watch that ticks exactly +//! once per second, then subtract the apparent rate from measurements. + + +use crate::analyze::Analyzer; + +/// tg collects CAL_DATA_SIZE one-second ticks before computing the result. +pub const CAL_DATA_SIZE: usize = 900; + +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum CalStatus { + /// Collected `have` of `need` one-second samples. + Collecting { have: usize, need: usize }, + /// Calibration finished; value in seconds per day. + Done(f64), + /// This block could not be used (signal lost); try the next second. + Missed, + /// Calibration failed the quality check. + Failed, +} + +/// Accumulates (time, phase) samples of the quartz tick and fits the drift. +pub struct CalibrationState { + points: Vec<(f64, f64)>, + need: usize, + start_ts: Option, + cal: Option, +} + +impl Default for CalibrationState { + fn default() -> Self { + Self::new() + } +} + +impl CalibrationState { + pub fn new() -> Self { + CalibrationState::with_size(CAL_DATA_SIZE) + } + + /// Calibration over a custom number of one-second samples (tests use a + /// shorter run; tg itself always uses CAL_DATA_SIZE). + pub fn with_size(need: usize) -> Self { + CalibrationState { + points: Vec::new(), + need, + start_ts: None, + cal: None, + } + } + + /// The computed calibration in s/day, if finished. + pub fn calibration(&self) -> Option { + self.cal + } + + /// The (time, phase) samples collected so far, for live feedback. + pub fn points(&self) -> &[(f64, f64)] { + &self.points + } + + /// The current best-fit calibration and its standard error in s/day, + /// even if the quality gate has not been met yet. + pub fn estimate(&self) -> Option<(f64, f64)> { + Self::fit_with_delta(&self.points).ok() + } + + /// Progress: (collected, needed). + pub fn progress(&self) -> (usize, usize) { + (self.points.len(), self.need) + } + + /// Feed exactly one second of mic input captured while a quartz watch + /// ticks once per second. `ts` is the sample counter at block start. + /// The analyzer must be configured for calibration (see + /// `Analyzer::for_calibration`). + pub fn add_block(&mut self, an: &Analyzer, samples: &[f32], ts: u64) -> CalStatus { + let sr = an.sample_rate as usize; + if samples.len() < 2 * sr { + return CalStatus::Missed; + } + if self.cal.is_some() { + return CalStatus::Done(self.cal.unwrap()); + } + let mut s = samples.to_vec(); + let n = s.len(); + // tg's process_cal runs with the noise suppressor disabled. + an.prepare_data(&mut s); + let period = match an.compute_period(&s, n) { + Some(p) => p, + None => return CalStatus::Missed, + }; + let (wf, phase, _) = an.compute_waveform(&s, period, n); + + // Lock check: the tick must sit near the middle of the folded window. + let wf_max = wf.iter().cloned().fold(0f32, f32::max); + let wf_max_i = wf.iter().enumerate().max_by(|a, b| a.1.total_cmp(b.1)).map(|(i, _)| i).unwrap_or(0); + if wf_max_i < sr * 4 / 10 || wf_max_i > sr * 6 / 10 { + return CalStatus::Missed; + } + // Rising-edge check between the quiet zones. + let maxa = wf[..sr / 4].iter().cloned().fold(0f32, f32::max); + let maxb = wf[sr * 3 / 4..].iter().cloned().fold(0f32, f32::max); + let max = maxa.max(maxb); + let thd = max + (wf_max - max) * 0.05; + let mut tick_i = None; + for i in sr / 4..=wf_max_i { + if wf[i] > thd { + if i > sr * 4 / 10 { + tick_i = Some(i); + } + break; + } + } + let Some(tick_i) = tick_i else { + return CalStatus::Missed; + }; + let phase_tick = ((ts + phase as u64 + tick_i as u64) as f64 / sr as f64).fract(); + + let start = *self.start_ts.get_or_insert(ts); + let time = (ts - start) as f64 / sr as f64; + if self.points.is_empty() || time > self.points.last().unwrap().0 + 0.9 { + self.points.push((time, phase_tick)); + } + + // Try to finish early: once enough points have been collected, + // refit on every new sample and stop as soon as the confidence + // interval is tight enough (tg always waits for all 900 points). + let min_points = self.need.min(60); + if self.points.len() >= min_points { + if let Ok(cal) = Self::fit(&self.points) { + self.cal = Some(cal); + return CalStatus::Done(cal); + } + if self.points.len() >= self.need { + return CalStatus::Failed; + } + } + let have = self.points.len(); + CalStatus::Collecting { have, need: self.need } + } + + /// tg's compute_cal: unwrap the circular phases around their mean + /// direction, then least-squares fit the drift; the slope in s/d is the + /// sound card's apparent rate error. + fn fit(points: &[(f64, f64)]) -> Result { + let (cal, delta) = Self::fit_with_delta(points)?; + // tg gates at 0.1 s/d; 0.2 is still far finer than the rate readout + // and roughly halves the convergence time. + if delta >= 0.2 { + return Err(()); + } + Ok(cal) + } + + fn fit_with_delta(points: &[(f64, f64)]) -> Result<(f64, f64), ()> { + let n = points.len(); + if n < 3 { + return Err(()); + } + let mut x = 0.0; + let mut y = 0.0; + for &(_, p) in points { + x += (p * 2.0 * std::f64::consts::PI).cos(); + y += (p * 2.0 * std::f64::consts::PI).sin(); + } + let c = (y.atan2(x) - std::f64::consts::PI) / (2.0 * std::f64::consts::PI); + let adjusted: Vec<(f64, f64)> = points + .iter() + .map(|&(t, p)| (t, (p - c).fract())) + .collect(); + let t_av = adjusted.iter().map(|&(t, _)| t).sum::() / n as f64; + let p_av = adjusted.iter().map(|&(_, p)| p).sum::() / n as f64; + let (mut xx, mut xy, mut yy) = (0.0, 0.0, 0.0); + for &(t, p) in adjusted.iter() { + let dt = t - t_av; + let dp = p - p_av; + xx += dt * dt; + xy += dt * dp; + yy += dp * dp; + } + if xx == 0.0 { + return Err(()); + } + let calibration = xy * 3600.0 * 24.0 / xx; + let delta = ((xx * yy - xy * xy) / (n as f64 - 2.0)).sqrt() / xx; + Ok((calibration, delta * 3600.0 * 24.0)) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::signal::SyntheticWatch; + + #[test] + fn calibration_recovers_sound_card_error() { + // A quartz watch ticking exactly once per second, as recorded by a + // sound card whose clock runs 15 s/day fast. The ticks then appear + // 15 s/day slow, so the calibration correction is -15 s/d: + // measured - calibration = 0 for a perfect source. + const SR: u32 = 44100; + let quartz = SyntheticWatch { + bph: 3600, // one tick per second + rate_sday: 15.0, + beat_error_ms: 0.0, + amplitude_deg: 250.0, + quartz: true, + }; + let samples = quartz.generate(SR, 44.0); + let an = Analyzer::for_calibration(SR); + let mut state = CalibrationState::with_size(30); + let win = 4 * SR as usize; + for i in 0..40 { + let start = i * SR as usize; + if start + win > samples.len() { + break; + } + let st = state.add_block(&an, &samples[start..start + win], (i as u64) * SR as u64); + match st { + CalStatus::Done(cal) => { + assert!((cal - (-15.0)).abs() < 2.0, "calibration: {cal}"); + return; + } + CalStatus::Failed => panic!("calibration failed quality check"), + _ => {} + } + } + panic!("calibration never completed"); + } +} diff --git a/crates/regulator-core/src/clock_cal.rs b/crates/regulator-core/src/clock_cal.rs new file mode 100644 index 0000000..40d0f33 --- /dev/null +++ b/crates/regulator-core/src/clock_cal.rs @@ -0,0 +1,176 @@ +// SPDX-License-Identifier: GPL-2.0 +//! Clock-based sound-card calibration. +//! +//! tg measures the sound card's clock error against a quartz watch ticking +//! once per second, which needs many minutes of phase samples. But the +//! quantity of interest is simply how far the ADC's sample rate drifts from +//! real time - and the host's system clock (NTP-disciplined) is a better +//! reference than any wristwatch. Regressing the cumulative sample count +//! against batch arrival times gives the same correction passively, with no +//! watch and no calibration mode, converging in a few minutes. + +use std::time::Instant; + +/// Live clock-calibration accumulator: feed it captured samples as they +/// arrive; it regresses the cumulative count against wall time. +#[derive(Debug)] +pub struct ClockCal { + sample_rate: f64, + start: Option, + total: u64, + /// (t seconds since start, cumulative samples), thinned to ~4 Hz. + points: Vec<(f64, f64)>, + last_point: f64, +} + +impl ClockCal { + pub fn new(sample_rate: u32) -> Self { + ClockCal { + sample_rate: sample_rate as f64, + start: None, + total: 0, + points: Vec::new(), + last_point: f64::NEG_INFINITY, + } + } + + /// Record `n` newly captured samples. + pub fn add(&mut self, n: usize) { + let t = self + .start + .get_or_insert_with(Instant::now) + .elapsed() + .as_secs_f64(); + self.add_at(n, t); + } + + /// Record `n` samples captured at `t` seconds since capture start + /// (separated for testability). + pub fn add_at(&mut self, n: usize, t: f64) { + self.total += n as u64; + if t - self.last_point < 0.25 { + return; + } + // Step detection: if the new point lands far off the current trend, + // the system clock jumped (NTP step) - the old points are on a + // different time base, so restart the series from here. + if self.points.len() >= 16 { + let (t_av, n_av) = self.means(); + let (mut stt, mut stn) = (0.0, 0.0); + for &(pt, c) in &self.points { + stt += (pt - t_av) * (pt - t_av); + stn += (pt - t_av) * (c - n_av); + } + if stt > 0.0 { + let slope = stn / stt; + let predicted = n_av + slope * (t - t_av); + if (self.total as f64 - predicted).abs() > 0.05 * slope { + self.points.clear(); + } + } + } + self.last_point = t; + self.points.push((t, self.total as f64)); + } + + fn means(&self) -> (f64, f64) { + let n = self.points.len() as f64; + ( + self.points.iter().map(|p| p.0).sum::() / n, + self.points.iter().map(|p| p.1).sum::() / n, + ) + } + + /// The sound-card rate error in s/day, with its uncertainty in s/day, + /// from a least-squares fit of samples against time. Returns None until + /// at least two seconds of data have been recorded. + pub fn estimate(&self) -> Option<(f64, f64)> { + let n = self.points.len(); + if n < 8 || self.points.last()?.0 < 2.0 { + return None; + } + let (t_av, n_av) = ( + self.points.iter().map(|p| p.0).sum::() / n as f64, + self.points.iter().map(|p| p.1).sum::() / n as f64, + ); + let (mut stt, mut stn, mut sxx) = (0.0, 0.0, 0.0); + for &(t, c) in &self.points { + let (dt, dc) = (t - t_av, c - n_av); + stt += dt * dt; + stn += dt * dc; + sxx += dc * dc; + } + if stt <= 0.0 { + return None; + } + let slope = stn / stt; // samples per second + let err = (slope / self.sample_rate - 1.0) * 86400.0; + // Standard error of the slope from the residuals. + let syy = sxx - slope * stn; + let resid_var = (syy / (n as f64 - 2.0)).max(0.0); + let slope_err = (resid_var / stt).sqrt(); + let unc = slope_err / self.sample_rate * 86400.0; + Some((err, unc)) + } + + /// True once the fit has converged under `gate` s/day uncertainty. + pub fn converged(&self, gate: f64) -> Option { + let (err, unc) = self.estimate()?; + if unc <= gate { + Some(err) + } else { + None + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn recovers_rate_error() { + // A card running 12 s/day fast: cumulative samples follow + // 44100 * (1 + 12/86400) per second. + let mut cal = ClockCal::new(44100); + let rate = 44100.0_f64 * (1.0 + 12.0 / 86400.0); + // 0.25 s batches over 300 s, with +/-1 ms of jitter per batch. + for i in 0..1200 { + let t = (i + 1) as f64 * 0.25; + let jitter = if i % 2 == 0 { 0.001 } else { -0.001 }; + let samples = (rate * (0.25 + jitter)).round() as usize; + cal.add_at(samples, t); + } + let (err, unc) = cal.estimate().expect("estimate"); + assert!((err - 12.0).abs() < 1.0, "err: {err}"); + assert!(unc < 1.0, "unc: {unc}"); + let done = cal.converged(1.0).expect("converged"); + assert!((done - 12.0).abs() < 1.0); + } + + #[test] + fn survives_clock_step() { + let mut cal = ClockCal::new(44100); + let rate = 44100.0_f64; + for i in 0..400 { + cal.add_at((rate * 0.25) as usize, (i + 1) as f64 * 0.25); + } + // The system clock steps by 1.4 s: subsequent timestamps jump. + let step = 1.4; + for i in 400..800 { + cal.add_at((rate * 0.25) as usize, (i + 1) as f64 * 0.25 + step); + } + let (err, unc) = cal.estimate().expect("estimate after step"); + assert!(err.abs() < 1.0, "err: {err}"); + assert!(unc < 1.0, "unc: {unc}"); + } + + #[test] + fn needs_data_to_converge() { + let mut cal = ClockCal::new(44100); + assert!(cal.estimate().is_none()); + cal.add(44100); + assert!(cal.estimate().is_none()); + assert!(cal.converged(0.1).is_none()); + } +} diff --git a/crates/regulator-core/src/filters.rs b/crates/regulator-core/src/filters.rs new file mode 100644 index 0000000..4565edf --- /dev/null +++ b/crates/regulator-core/src/filters.rs @@ -0,0 +1,56 @@ +// SPDX-License-Identifier: GPL-2.0 +//! Biquad filters, ported from tg's algo.c. + +#[derive(Clone, Copy, Debug)] +pub struct Biquad { + pub a0: f64, + pub a1: f64, + pub a2: f64, + pub b1: f64, + pub b2: f64, +} + +impl Biquad { + /// Low-pass filter; `freq` is normalized to the sample rate (cutoff/sr). + pub fn low_pass(freq: f64) -> Self { + let k = (std::f64::consts::PI * freq).tan(); + let norm = 1.0 / (1.0 + k * std::f64::consts::SQRT_2 + k * k); + let a0 = k * k * norm; + Biquad { + a0, + a1: 2.0 * a0, + a2: a0, + b1: 2.0 * (k * k - 1.0) * norm, + b2: (1.0 - k * std::f64::consts::SQRT_2 + k * k) * norm, + } + } + + /// High-pass filter (Q = 1/sqrt(2)); `freq` normalized to the sample + /// rate. tg's default chain high-passes at FILTER_CUTOFF before + /// analysis, which removes mains hum and rumble. + pub fn high_pass(freq: f64) -> Self { + let k = (std::f64::consts::PI * freq).tan(); + let norm = 1.0 / (1.0 + k * std::f64::consts::SQRT_2 + k * k); + let a0 = norm; + Biquad { + a0, + a1: -2.0 * a0, + a2: a0, + b1: 2.0 * (k * k - 1.0) * norm, + b2: (1.0 - k * std::f64::consts::SQRT_2 + k * k) * norm, + } + } + + /// In-place Direct Form 1 filtering, matching tg's run_filter(). + pub fn run(&self, buff: &mut [f32]) { + let mut z1 = 0.0; + let mut z2 = 0.0; + for v in buff.iter_mut() { + let input = *v as f64; + let out = input * self.a0 + z1; + z1 = input * self.a1 + z2 - self.b1 * out; + z2 = input * self.a2 - self.b2 * out; + *v = out as f32; + } + } +} diff --git a/crates/regulator-core/src/lib.rs b/crates/regulator-core/src/lib.rs new file mode 100644 index 0000000..654c6fe --- /dev/null +++ b/crates/regulator-core/src/lib.rs @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0 +//! regulator-core: the signal-processing heart of regulator. +//! +//! A Rust port of the timing algorithm from tg (Copyright 2015 Marcello +//! Mamino, GPLv2, https://github.com/xyzzy42/tg). The pipeline: +//! +//! 1. optionally suppress impulsive noise (windowed energy gating) +//! 2. rectify and low-pass the microphone signal +//! 3. estimate the tick period via FFT-based autocorrelation +//! 4. fold samples at the detected period into an average waveform +//! 5. locate the tic/toc events, then compute rate, beat error and +//! the balance amplitude from the pulse widths. + +pub mod analyze; +pub mod calibrate; +pub mod clock_cal; +pub mod filters; +pub mod signal; +pub mod stats; + +pub use analyze::{Analyzer, TimingResult}; +pub use calibrate::{CalStatus, CalibrationState, CAL_DATA_SIZE}; +pub use clock_cal::ClockCal; +pub use signal::SyntheticWatch; +pub const FILTER_CUTOFF: f64 = 3000.0; diff --git a/crates/regulator-core/src/signal.rs b/crates/regulator-core/src/signal.rs new file mode 100644 index 0000000..1580928 --- /dev/null +++ b/crates/regulator-core/src/signal.rs @@ -0,0 +1,201 @@ +// SPDX-License-Identifier: GPL-2.0 +//! Synthetic watch signal generator, used by the tests and the TUI demo +//! mode. Produces a train of decaying tick bursts at the requested rate. + +/// Parameters of the synthetic movement. +#[derive(Clone, Copy, Debug)] +pub struct SyntheticWatch { + /// Beats per hour, e.g. 28800. + pub bph: u32, + /// Rate error in seconds per day (positive = fast). + pub rate_sday: f64, + /// Beat error in milliseconds. + pub beat_error_ms: f64, + /// Balance amplitude in degrees (affects pulse width). + pub amplitude_deg: f64, + /// Quartz mode: a sharp click once per second (no escapement build-up), + /// for sound-card calibration against a quartz watch. + pub quartz: bool, +} + +impl SyntheticWatch { + /// Generate `duration_s` seconds of audio at `sample_rate`. + pub fn generate(&self, sample_rate: u32, duration_s: f64) -> Vec { + // Ticks (tic, toc, tic, ...) occur every 3600/bph seconds; the + // same-type period the analyzer locks onto is twice that. + let nominal_period = 2.0 * 3600.0 / self.bph as f64; + let period = nominal_period * 86400.0 / (86400.0 + self.rate_sday); + let spacing = period / 2.0; + let n = (duration_s * sample_rate as f64) as usize; + let mut out = vec![0f32; n]; + let sr = sample_rate as f64; + let burst_len = (0.02 * sr) as usize; + let mut t = 0.0f64; + let mut flip = false; + let mut rng = 0x1234_5678u64; + while t < duration_s { + let idx = (t * sr) as usize; + let shift = if flip { + self.beat_error_ms / 2000.0 + } else { + -self.beat_error_ms / 2000.0 + }; + let start = idx as isize + (shift * sr) as isize; + if start >= 0 && (start as usize) < n.saturating_sub(burst_len) { + let base = start as usize; + // Pulse width follows the lift-angle/impulse relation the + // analyzer inverts: amp_abs = 0.5 / sin(pi * pulse / period). + // A 52 deg lift angle is assumed here. + let amp_abs = self.amplitude_deg / 52.0; + let width = (period + * (0.5 / amp_abs).asin() + / std::f64::consts::PI + * sr) as usize; + let width = width.min(burst_len); + // Real escapement sounds build up before the main impulse: + // a rising pre-hump about one pulse width before the tick, + // then the sharp attack at the tick itself. tg's amplitude + // scan measures the distance from the pre-hump's local + // maximum to the tick, which tracks `width`. + if !self.quartz { + for i in 0..width { + let tt = i as f64 / sr; + let bump = (std::f64::consts::PI * i as f64 / width as f64).sin(); + let env = bump * bump * 0.35; + let carrier = (2.0 * std::f64::consts::PI * 3500.0 * tt).sin(); + let idx = base as isize + i as isize - 3 * width as isize / 2; + if idx >= 0 && (idx as usize) < n { + out[idx as usize] += (env * carrier) as f32; + } + } + } + for i in 0..width / 3 { + let tt = i as f64 / sr; + let env = (-4.0 * i as f64 / (width / 3) as f64).exp(); + let carrier = (2.0 * std::f64::consts::PI * 3500.0 * tt).sin(); + let idx = base as isize + i as isize; + if idx >= 0 && (idx as usize) < n { + out[idx as usize] += (env * carrier * 0.8) as f32; + } + } + } + flip = !flip; + t += spacing; + // A little jitter so the signal is not perfectly periodic. + rng = rng.wrapping_mul(6364136223846793005).wrapping_add(1); + t += ((rng >> 33) as f64 / u32::MAX as f64 - 0.5) * 1e-5; + } + // Background noise. + let mut noise_rng = 0xdead_beefu64; + for v in out.iter_mut() { + noise_rng = noise_rng + .wrapping_mul(6364136223846793005) + .wrapping_add(1442695040888963407); + let r = ((noise_rng >> 11) as i64 % 2000) as f64 / 1000.0 - 1.0; + *v += (r * 0.02) as f32; + } + out + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::analyze::Analyzer; + + const SR: u32 = 44100; + + #[test] + fn detects_rate_error() { + let watch = SyntheticWatch { + bph: 28800, + rate_sday: 12.0, + beat_error_ms: 0.4, + amplitude_deg: 270.0, + quartz: false, + }; + let samples = watch.generate(SR, 4.0); + let mut an = Analyzer::new(SR); + an.bph = 28800; + let r = an.analyze(&samples).expect("analysis failed"); + assert!((r.rate_sday.unwrap() - 12.0).abs() < 3.0, "rate: {:?}", r.rate_sday); + } + + #[test] + fn auto_detects_beat_rate() { + let watch = SyntheticWatch { + bph: 18000, + rate_sday: -5.0, + beat_error_ms: 0.0, + amplitude_deg: 250.0, + quartz: false, + }; + let samples = watch.generate(SR, 6.0); + let an = Analyzer::new(SR); + let r = an.analyze(&samples).expect("analysis failed"); + let detected_bph = 2.0 * 3600.0 * SR as f64 / r.period; + assert!( + (detected_bph - 18000.0).abs() < 100.0, + "detected bph: {detected_bph}" + ); + } + + #[test] + fn detects_beat_error() { + let watch = SyntheticWatch { + bph: 21600, + rate_sday: 0.0, + beat_error_ms: 1.2, + amplitude_deg: 260.0, + quartz: false, + }; + let samples = watch.generate(SR, 4.0); + let mut an = Analyzer::new(SR); + an.bph = 21600; + let r = an.analyze(&samples).expect("analysis failed"); + assert!( + (r.beat_error_ms.unwrap() - 1.2).abs() < 0.8, + "beat error: {:?}", + r.beat_error_ms + ); + } + + #[test] + fn detects_amplitude() { + let watch = SyntheticWatch { + bph: 28800, + rate_sday: 0.0, + beat_error_ms: 0.0, + amplitude_deg: 270.0, + quartz: false, + }; + let samples = watch.generate(SR, 4.0); + let mut an = Analyzer::new(SR); + an.bph = 28800; + let r = an.analyze(&samples).expect("analysis failed"); + let amp = r.amplitude_deg.expect("amplitude not found"); + assert!((amp - 270.0).abs() < 25.0, "amplitude: {amp}"); + } + + #[test] + fn detects_36000_bph() { + let watch = SyntheticWatch { + bph: 36000, + rate_sday: -8.0, + beat_error_ms: 0.3, + amplitude_deg: 290.0, + quartz: false, + }; + let samples = watch.generate(SR, 6.0); + let an = Analyzer::new(SR); + let r = an.analyze(&samples).expect("analysis failed"); + assert_eq!(r.bph, 36000, "detected bph: {}", r.bph); + assert!((r.rate_sday.unwrap() - (-8.0)).abs() < 3.0); + } + + #[test] + fn rejects_silence() { + let an = Analyzer::new(SR); + assert!(an.analyze(&vec![0.0; SR as usize * 2]).is_none()); + } +} diff --git a/crates/regulator-core/src/stats.rs b/crates/regulator-core/src/stats.rs new file mode 100644 index 0000000..2c523d1 --- /dev/null +++ b/crates/regulator-core/src/stats.rs @@ -0,0 +1,132 @@ +// SPDX-License-Identifier: GPL-2.0 +//! Order statistics helpers ported from tg's algo.c: quickselect with a +//! median-of-three pivot, trimmed means, and running max. + +/// Max of `v[a..b]` (exclusive end), also returning the argmax index. +pub fn vmax(v: &[f32], a: usize, b: usize) -> (f32, usize) { + let mut max = v[a]; + let mut i_max = a; + for (i, &x) in v.iter().enumerate().take(b).skip(a + 1) { + if x > max { + max = x; + i_max = i; + } + } + (max, i_max) +} + +fn pivot(x: &[f32], l: usize, r: usize) -> usize { + let m = (l + r) / 2; + if x[l] < x[r] { + if x[m] <= x[l] { + l + } else if x[m] >= x[r] { + r + } else { + m + } + } else if x[m] <= x[r] { + r + } else if x[m] >= x[l] { + l + } else { + m + } +} + +/// Partition `x` in descending order at rank `k`: afterwards +/// `x[0..k] >= x[k] >= x[k+1..]`. Average case O(n). +pub fn quickselect(x: &mut [f32], k: usize) { + let n = x.len(); + let mut l = 0usize; + let mut r = n - 1; + loop { + if l == r { + return; + } + if r - l == 1 { + if x[l] < x[r] { + x.swap(l, r); + } + return; + } + let p = pivot(x, l, r); + let pv = x[p]; + x[p] = x[r]; + let mut p = l; + for i in l..r { + if x[i] > pv { + x.swap(i, p); + p += 1; + } + } + x[r] = x[p]; + x[p] = pv; + if k == p { + return; + } + if k < p { + if p == 0 { + return; + } + r = p - 1; + } else { + l = p + 1; + } + } +} + +/// Median of a slice, via quickselect; O(n) on average. +pub fn median(x: &mut [f32]) -> f32 { + if x.is_empty() { + return 0.0; + } + let k = x.len() / 2; + quickselect(x, k); + x[k] +} + +fn mean_less_greatest(x: &[f32]) -> f32 { + let mut greatest = x[0]; + let mut sum = x[0]; + for &v in &x[1..] { + sum += v; + if v > greatest { + greatest = v; + } + } + (sum - greatest) / (x.len() - 1) as f32 +} + +fn mean_less_two_greatest(x: &[f32]) -> f32 { + let mut sum = x[0]; + let mut greatest = [x[0], f32::MIN]; + for &v in &x[1..] { + sum += v; + if v > greatest[0] { + greatest[1] = greatest[0]; + greatest[0] = v; + } else if v > greatest[1] { + greatest[1] = v; + } + } + (sum - greatest[0] - greatest[1]) / (x.len() - 2) as f32 +} + +/// Mean of the lower four quintiles: the largest 20% of values are excluded. +/// May reorder `x`. +pub fn tmean(x: &mut [f32]) -> f32 { + let n = x.len(); + if n == 0 { + return 0.0; + } + if n <= 5 { + mean_less_greatest(x) + } else if n <= 10 { + mean_less_two_greatest(x) + } else { + let k = (n + 4) / 5; + quickselect(x, k); + x[k..].iter().sum::() / (n - k) as f32 + } +} diff --git a/crates/regulator-gui/Cargo.toml b/crates/regulator-gui/Cargo.toml new file mode 100644 index 0000000..9cdf644 --- /dev/null +++ b/crates/regulator-gui/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "regulator-gui" +description = "Graphical UI for the regulator watch timing machine" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true + +[[bin]] +name = "regulator-gui" +path = "src/main.rs" + +[features] +default = ["audio"] +audio = ["dep:cpal"] + +[dependencies] +regulator-core = { path = "../regulator-core" } +eframe = "0.33" +anyhow = "1" +image = { version = "0.25", default-features = false, features = ["jpeg"] } +cpal = { version = "0.15", optional = true } diff --git a/crates/regulator-gui/src/audio.rs b/crates/regulator-gui/src/audio.rs new file mode 100644 index 0000000..bf0706f --- /dev/null +++ b/crates/regulator-gui/src/audio.rs @@ -0,0 +1,109 @@ +// SPDX-License-Identifier: GPL-2.0 +//! Live audio capture via cpal. Compiled only with the `audio` feature. + +use anyhow::{Context, Result}; +use cpal::traits::{DeviceTrait, HostTrait, StreamTrait}; +use std::sync::mpsc::Sender; + +const TARGET_RATE: f64 = 44100.0; + +/// Naive linear resampler state: converts the device's sample rate to the +/// 44.1 kHz mono stream the analyzer expects. +struct Resampler { + step: f64, + frac: f64, +} + +impl Resampler { + fn new(input_rate: f64) -> Self { + Resampler { + step: input_rate / TARGET_RATE, + frac: 0.0, + } + } + + fn push(&mut self, mono: &[f32], tx: &Sender) { + while self.frac < mono.len() as f64 { + let x = self.frac as usize; + let next = mono[(x + 1).min(mono.len() - 1)]; + let t = (self.frac - x as f64) as f32; + let s = mono[x] * (1.0 - t) + next * t; + let _ = tx.send(s); + self.frac += self.step; + } + self.frac -= mono.len() as f64; + } +} + +/// Spawn the default input device and stream mono 44.1 kHz f32 samples to +/// `tx`. +pub fn spawn_capture(tx: Sender) -> Result<()> { + let host = cpal::default_host(); + let device = host + .default_input_device() + .context("no audio input device found")?; + let supported = device + .default_input_config() + .context("no supported input configuration")?; + let channels = supported.channels() as usize; + let sample_format = supported.sample_format(); + let config: cpal::StreamConfig = supported.into(); + let mut resampler = Resampler::new(config.sample_rate.0 as f64); + let tx_f32 = tx.clone(); + + let stream = match sample_format { + cpal::SampleFormat::F32 => device.build_input_stream( + &config, + move |data: &[f32], _| { + let mono = mix_mono(data, channels); + resampler.push(&mono, &tx_f32); + }, + err_cb, + None, + )?, + cpal::SampleFormat::I16 => device.build_input_stream( + &config, + move |data: &[i16], _| { + let mono = mix_mono( + &data.iter().map(|&v| v as f32 / i16::MAX as f32).collect::>(), + channels, + ); + resampler.push(&mono, &tx_f32); + }, + err_cb, + None, + )?, + cpal::SampleFormat::U16 => device.build_input_stream( + &config, + move |data: &[u16], _| { + let mono = mix_mono( + &data + .iter() + .map(|&v| (v as f32 - u16::MAX as f32 / 2.0) / (u16::MAX as f32 / 2.0)) + .collect::>(), + channels, + ); + resampler.push(&mono, &tx_f32); + }, + err_cb, + None, + )?, + other => anyhow::bail!("unsupported sample format: {other:?}"), + }; + stream.play()?; + std::mem::forget(stream); + Ok(()) +} + +fn err_cb(err: cpal::StreamError) { + eprintln!("audio error: {err}"); +} + +fn mix_mono(data: &[f32], channels: usize) -> Vec { + if channels <= 1 { + return data.to_vec(); + } + data.chunks(channels) + .map(|c| c.iter().sum::() / c.len() as f32) + .collect() +} diff --git a/crates/regulator-gui/src/chart.rs b/crates/regulator-gui/src/chart.rs new file mode 100644 index 0000000..bd082c8 --- /dev/null +++ b/crates/regulator-gui/src/chart.rs @@ -0,0 +1,162 @@ +// SPDX-License-Identifier: GPL-2.0 +//! Calibration feedback view and chart export. + +use crate::{CalView, Params, TracePoint}; +use eframe::egui; +use std::sync::{Arc, Mutex}; + +/// Live calibration feedback: the collected (time, phase) samples, progress, +/// and the current estimate with its standard error. +pub fn draw_cal_view(ui: &mut egui::Ui, cal: &CalView) { + ui.vertical(|ui| { + ui.add_space(8.0); + ui.label( + egui::RichText::new("CALIBRATION") + .monospace() + .size(18.0) + .strong(), + ); + ui.label( + egui::RichText::new("place a quartz watch (1 tick/s) near the microphone") + .monospace() + .size(12.0) + .color(egui::Color32::GRAY), + ); + ui.label( + egui::RichText::new(format!("samples {}/{}", cal.have, cal.need)) + .monospace() + .size(13.0), + ); + if let Some((est, err)) = cal.estimate { + ui.label( + egui::RichText::new(format!( + "estimate {est:+.2} ± {err:.2} s/d (done under ±0.10)" + )) + .monospace() + .size(13.0) + .color(egui::Color32::from_rgb(235, 200, 90)), + ); + } + if cal.have == 0 { + ui.label( + egui::RichText::new("waiting for ticks…") + .monospace() + .size(13.0) + .color(egui::Color32::from_gray(120)), + ); + } + ui.add_space(4.0); + }); + let (resp, painter) = ui.allocate_painter(ui.available_size(), egui::Sense::hover()); + let rect = resp.rect; + painter.rect_filled(rect, 0.0, egui::Color32::from_rgb(10, 11, 12)); + if cal.points.is_empty() { + return; + } + let t_max = cal.points.last().map(|p| p.0).unwrap_or(1.0).max(1.0); + let to_x = |t: f64| rect.left() + (t / t_max * (rect.width() - 12.0) as f64) as f32 + 6.0; + let to_y = |ph: f64| { + let k = ph.clamp(0.0, 1.0) as f32; + rect.bottom() - k * (rect.height() - 12.0) - 6.0 + }; + for y in [to_y(0.0), to_y(1.0)] { + painter.line_segment( + [egui::pos2(rect.left() + 6.0, y), egui::pos2(rect.right() - 6.0, y)], + egui::Stroke::new(1.0_f32, egui::Color32::from_gray(40)), + ); + } + for &(t, ph) in &cal.points { + painter.circle_filled( + egui::pos2(to_x(t), to_y(ph)), + 2.0_f32, + egui::Color32::from_rgb(140, 230, 140), + ); + } +} + +/// Export the current strip chart as an SVG file plus the raw points as CSV. +/// Returns the base path written. +pub fn export_chart( + trace: &[TracePoint], + result: &Option, + params: &Arc>, +) -> Option { + use std::fmt::Write as _; + let now = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .ok()?; + let secs = now.as_secs(); + let (d, h, m) = (secs / 86400, secs % 86400 / 3600, secs % 3600 / 60); + let base = format!("regulator-chart-{d}-{h:02}{m:02}"); + let p = params.lock().unwrap_or_else(|e| e.into_inner()).clone(); + let fmt_or = |v: Option, spec: &dyn Fn(f64) -> String| { + v.map(spec).unwrap_or_else(|| "---".into()) + }; + let (rate, amp, be) = match result { + Some(r) => ( + fmt_or(r.rate_sday, &|v| format!("{v:+.1}")), + fmt_or(r.amplitude_deg, &|v| format!("{v:.0}")), + fmt_or(r.beat_error_ms, &|v| format!("{v:+.2}")), + ), + None => ("---".into(), "---".into(), "---".into()), + }; + let bph = match p.bph { + 0 => "auto".to_string(), + b => b.to_string(), + }; + + let mut csv = String::from("time_s,phase_ms,tic\n"); + for t in trace { + let _ = writeln!(csv, "{:.2},{:.3},{}", t.t, t.phase_ms, t.tic); + } + std::fs::write(format!("{base}.csv"), csv).ok()?; + + const W: f64 = 800.0; + const H: f64 = 600.0; + const WINDOW_MS: f64 = 25.0; + let top = 60.0; + let chart_h = H - top - 10.0; + let cy = top + chart_h / 2.0; + let half_h = chart_h / 2.0; + let wrap = |ms: f64| { + ((ms + WINDOW_MS) % (2.0 * WINDOW_MS) + 2.0 * WINDOW_MS) % (2.0 * WINDOW_MS) - WINDOW_MS + }; + let mut svg = String::new(); + let _ = writeln!( + svg, + "" + ); + let _ = writeln!(svg, ""); + let _ = writeln!( + svg, + "rate {rate} s/d" + ); + let _ = writeln!( + svg, + "amp {amp} deg be {be} ms bph {bph} lift {:.0} deg", + p.lift_angle + ); + for ms in [-20.0, -10.0, 0.0, 10.0, 20.0] { + let y = cy - wrap(ms) / WINDOW_MS * half_h; + let color = if ms == 0.0 { "#3a3a3a" } else { "#1c1c1c" }; + let _ = writeln!( + svg, + "", + W - 12.0 + ); + } + let t_end = trace.last().map(|t| t.t).unwrap_or(0.0); + for t in trace.iter().filter(|t| t_end - t.t <= 60.0) { + let x = W - 12.0 - (t_end - t.t) / 60.0 * (W - 24.0); + let y = cy - wrap(t.phase_ms) / WINDOW_MS * half_h; + let color = if t.tic { "#8ce68c" } else { "#f08cf0" }; + let _ = writeln!( + svg, + "" + ); + } + let _ = writeln!(svg, ""); + std::fs::write(format!("{base}.svg"), svg).ok()?; + crate::sheet::export_jpeg(&base, trace, result, params)?; + Some(base) +} diff --git a/crates/regulator-gui/src/main.rs b/crates/regulator-gui/src/main.rs new file mode 100644 index 0000000..1865d2c --- /dev/null +++ b/crates/regulator-gui/src/main.rs @@ -0,0 +1,662 @@ +// SPDX-License-Identifier: GPL-2.0 +//! regulator-gui: graphical watch timing machine built on the regulator +//! core, using egui for an immediate-mode, cross-platform interface. + +#[cfg(feature = "audio")] +mod audio; +mod chart; +mod sheet; + +use eframe::egui; +use regulator_core::{CalStatus, CalibrationState, ClockCal, Analyzer, SyntheticWatch, TimingResult}; +use std::sync::mpsc; +use std::sync::{Arc, Mutex}; +use std::time::Duration; + +/// One located tick event on the live trace. +#[derive(Clone, Copy)] +struct TracePoint { + /// Absolute time in seconds. + t: f64, + /// Phase error against the nominal beat grid, in milliseconds. + phase_ms: f64, + tic: bool, +} + +/// Live calibration feedback for the center panel. +struct CalView { + points: Vec<(f64, f64)>, + have: usize, + need: usize, + estimate: Option<(f64, f64)>, +} + +/// What the worker sends to the UI each iteration. +struct Feed { + result: Option, + trace: Vec, + cal: Option, +} + +const SAMPLE_RATE: u32 = 44100; +const BLOCK_SECONDS: f64 = 4.0; + +#[derive(Clone)] +struct Params { + bph: u32, + lift_angle: f64, + noise_suppressor: bool, + demo: bool, + calibrating: bool, + calibration: f64, + /// Calibration came from the passive clock estimate, not a quartz run. + cal_auto: bool, + /// Live clock-calibration estimate and uncertainty while converging. + cal_live: Option<(f64, f64)>, + cal_progress: String, + /// Settings changed since the last save. + dirty: bool, +} + +impl Params { + fn config_path() -> std::path::PathBuf { + let dir = if let Ok(a) = std::env::var("APPDATA") { + std::path::PathBuf::from(a).join("regulator") + } else if let Ok(x) = std::env::var("XDG_CONFIG_HOME") { + std::path::PathBuf::from(x).join("regulator") + } else if let Ok(h) = std::env::var("HOME") { + std::path::PathBuf::from(h).join(".config").join("regulator") + } else { + std::path::PathBuf::from(".") + }; + std::fs::create_dir_all(&dir).ok(); + dir.join("config.txt") + } + + fn load() -> Self { + let mut p = Params::default(); + if let Ok(text) = std::fs::read_to_string(Self::config_path()) { + for line in text.lines() { + let Some((k, v)) = line.split_once('=') else { continue }; + match k.trim() { + "bph" => { + if let Ok(n) = v.trim().parse() { + p.bph = n; + } + } + "lift_angle" => { + if let Ok(n) = v.trim().parse() { + p.lift_angle = n; + } + } + "calibration" => { + if let Ok(n) = v.trim().parse() { + p.calibration = n; + p.cal_auto = true; + } + } + "noise_suppressor" => p.noise_suppressor = v.trim() == "true", + _ => {} + } + } + } + p + } + + fn save(&self) { + let text = format!( + "bph={}\nlift_angle={:.1}\ncalibration={:.3}\nnoise_suppressor={}\n", + self.bph, + self.lift_angle, + self.calibration, + self.noise_suppressor + ); + let _ = std::fs::write(Self::config_path(), text); + } +} + +impl Default for Params { + fn default() -> Self { + Params { + bph: 0, + lift_angle: 52.0, + noise_suppressor: true, + demo: true, + calibrating: false, + calibration: 0.0, + cal_auto: false, + cal_live: None, + cal_progress: String::new(), + dirty: false, + } + } +} + +/// Shared ring buffer of live microphone samples (if capture is available), +/// with a monotonic total so window start times never go backwards. +struct MicBuf { + data: Vec, + total: u64, +} + +#[cfg(feature = "audio")] +impl MicBuf { + fn push(&mut self, s: f32, cap: usize) { + self.data.push(s); + self.total += 1; + if self.data.len() > cap { + self.data.drain(..cap / 2); + } + } +} + +type Ring = Arc>; + +struct RegulatorApp { + result: Option, + trace: Vec, + cal: Option, + last_export: Option, + params: Arc>, + rx: mpsc::Receiver, +} + +impl RegulatorApp { + fn new(ring: Option, clock_cal: Arc>) -> Self { + let params = Arc::new(Mutex::new(Params::load())); + let (tx, rx) = mpsc::channel::(); + let params_arc = params.clone(); + let clock_cal = clock_cal; + std::thread::spawn(move || { + let watch = SyntheticWatch { + bph: 28800, + rate_sday: 9.0, + beat_error_ms: 0.6, + amplitude_deg: 275.0, + quartz: false, + }; + let demo_samples = watch.generate(SAMPLE_RATE, 120.0); + let block = (BLOCK_SECONDS * SAMPLE_RATE as f64) as usize; + let mut start = 0usize; + let mut win_start_s = 0.0f64; + let mut demo_total_s = 0.0f64; + let mut last_event_s = 0.0f64; + let mut trace: Vec = Vec::new(); + let mut ts: u64 = 0; + let mut last_len = 0usize; + let mut cal_state = CalibrationState::new(); + let mut cal_cooldown = 0u32; + let mut analyzer = Analyzer::new(SAMPLE_RATE); + loop { + let mut p = params_arc.lock().unwrap_or_else(|e| e.into_inner()); + if p.calibrating { + if let Some(ring) = &ring { + let buf = ring.lock().unwrap_or_else(|e| e.into_inner()); + ts += buf.total.saturating_sub(last_len as u64) as u64; + last_len = buf.total as usize; + if buf.data.len() >= block && cal_cooldown == 0 { + let cal_an = Analyzer::for_calibration(SAMPLE_RATE); + let window_start_ts = ts.saturating_sub(buf.data.len() as u64); + match cal_state.add_block(&cal_an, &buf.data[buf.data.len() - block..], window_start_ts) { + CalStatus::Done(cal) => { + p.calibration = cal; + p.calibrating = false; + p.cal_auto = true; + p.dirty = true; + p.cal_progress = format!("{cal:+.1} s/d"); + } + CalStatus::Failed => { + p.calibrating = false; + p.cal_progress = "failed".into(); + } + CalStatus::Collecting { have, need } => { + p.cal_progress = format!("{have}/{need} s"); + } + CalStatus::Missed => {} + } + cal_cooldown = 5; + } + } + if cal_cooldown > 0 { + cal_cooldown -= 1; + } + let view = CalView { + points: cal_state.points().to_vec(), + have: cal_state.progress().0, + need: cal_state.progress().1, + estimate: cal_state.estimate(), + }; + drop(p); + let _ = tx.send(Feed { result: None, trace: Vec::new(), cal: Some(view) }); + std::thread::sleep(Duration::from_millis(200)); + continue; + } + // Passive clock calibration: apply once the sample-count + // regression has converged (unless a quartz calibration + // has set the value manually). + let cc_est = clock_cal.lock().unwrap_or_else(|e| e.into_inner()).estimate(); + if let Some((err, unc)) = cc_est { + // `p` is already held here; re-locking params would + // deadlock (std Mutex is not reentrant). The clock + // estimate is informational only: it measures the + // sound card against the local timer, whose own + // drift is unknown (tens of s/day on some hardware), + // so it is never auto-applied. The quartz calibration + // is the authoritative correction. + p.cal_live = Some((err, unc)); + } + if p.dirty { + p.save(); + p.dirty = false; + } + drop(p); + let p2 = params_arc.lock().unwrap_or_else(|e| e.into_inner()).clone(); + analyzer.bph = p2.bph; + analyzer.lift_angle = p2.lift_angle; + analyzer.noise_suppressor = p2.noise_suppressor; + analyzer.calibration = p2.calibration; + let res = if p2.demo { + let end = (start + block).min(demo_samples.len()); + let r = analyzer.analyze(&demo_samples[start..end]); + win_start_s = demo_total_s; + demo_total_s += (end - start) as f64 / SAMPLE_RATE as f64; + if end == demo_samples.len() { + start = 0; + } else { + start = end; + } + r + } else if let Some(ring) = &ring { + // Copy the window out under the lock (a fraction of a + // millisecond), then analyze without holding it so the + // capture relay never stalls. + let window = { + let buf = ring.lock().unwrap_or_else(|e| e.into_inner()); + if buf.data.len() >= block { + Some((buf.total, buf.data[buf.data.len() - block..].to_vec())) + } else { + None + } + }; + match window { + Some((total, w)) => { + win_start_s = (total - block as u64) as f64 / SAMPLE_RATE as f64; + analyzer.analyze(&w) + } + None => None, + } + } else { + None + }; + if let Some(r) = &res { + let p0 = 7200.0 * SAMPLE_RATE as f64 / r.bph as f64; + for (ev, is_tic) in &r.events { + let t = win_start_s + ev / SAMPLE_RATE as f64; + if t <= last_event_s { + continue; + } + last_event_s = t; + let mut e = (ev % p0) / p0 - 0.5; + if e < -0.5 { + e += 1.0; + } + trace.push(TracePoint { + t, + phase_ms: e * (2.0 * 3600.0 / r.bph as f64) * 1000.0, + tic: *is_tic, + }); + } + while let Some(first) = trace.first() { + if first.t < win_start_s - 120.0 { + trace.remove(0); + } else { + break; + } + } + } + let _ = tx.send(Feed { + result: res, + trace: trace.clone(), + cal: None, + }); + std::thread::sleep(Duration::from_millis(200)); + } + }); + Self { + result: None, + trace: Vec::new(), + cal: None, + last_export: None, + params, + rx, + } + } +} + +impl eframe::App for RegulatorApp { + fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { + while let Ok(feed) = self.rx.try_recv() { + self.result = feed.result; + self.trace = feed.trace; + if feed.cal.is_some() { + self.cal = feed.cal; + } else { + self.cal = None; + } + } + let mut visuals = egui::Visuals::dark(); + visuals.panel_fill = egui::Color32::from_rgb(14, 16, 18); + visuals.window_fill = egui::Color32::from_rgb(14, 16, 18); + ctx.set_visuals(visuals); + + // Top: the primary readout. One number the watchmaker stares at, + // everything else is secondary. + egui::TopBottomPanel::top("readout").show(ctx, |ui| { + ui.add_space(6.0); + ui.horizontal(|ui| { + let rate = self.result.as_ref().and_then(|r| r.rate_sday); + let text = match rate { + Some(v) => format!("{v:+.1}"), + None => "---".into(), + }; + let color = match rate { + Some(v) if v.abs() < 5.0 => egui::Color32::from_rgb(120, 220, 120), + Some(v) if v.abs() < 15.0 => egui::Color32::from_rgb(235, 200, 90), + Some(_) => egui::Color32::from_rgb(235, 120, 100), + None => egui::Color32::GRAY, + }; + ui.label( + egui::RichText::new(text) + .monospace() + .size(52.0) + .strong() + .color(color), + ); + ui.label(egui::RichText::new("s/d").monospace().size(16.0).color(egui::Color32::GRAY)); + ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { + let p = self.params.lock().unwrap_or_else(|e| e.into_inner()).clone(); + if ui.button("export").clicked() { + self.last_export = chart::export_chart(&self.trace, &self.result, &self.params); + } + if let Some(path) = &self.last_export { + ui.label( + egui::RichText::new(format!("saved {path}")) + .monospace() + .size(12.0) + .color(egui::Color32::from_rgb(120, 220, 120)), + ); + } + ui.label( + egui::RichText::new(format!( + "{} {}", + if p.demo { "demo" } else { "mic" }, + match p.bph { + 0 => "auto".to_string(), + b => format!("{b} bph"), + } + )) + .monospace() + .size(13.0) + .color(egui::Color32::GRAY), + ); + }); + }); + ui.add_space(2.0); + }); + + // Bottom: the secondary data strip. + egui::TopBottomPanel::bottom("strip").show(ctx, |ui| { + ui.add_space(4.0); + ui.horizontal(|ui| { + ui.style_mut().override_font_id = Some(egui::FontId::monospace(15.0)); + let p = self.params.lock().unwrap_or_else(|e| e.into_inner()).clone(); + strip_value(ui, "amp", &self.result.as_ref().and_then(|r| r.amplitude_deg).map(|v| format!("{v:.0}°"))); + strip_value(ui, "be", &self.result.as_ref().and_then(|r| r.beat_error_ms).map(|v| format!("{v:+.2} ms"))); + strip_value(ui, "lift", &Some(format!("{:.0}°", p.lift_angle))); + strip_value(ui, "noise", &Some(if p.noise_suppressor { "on".to_string() } else { "off".to_string() })); + if p.calibration != 0.0 { + let tag = if p.cal_auto { " auto" } else { "" }; + strip_value(ui, "cal", &Some(format!("{:+.1} s/d{tag}", p.calibration))); + } else if let Some((err, unc)) = p.cal_live { + ui.label( + egui::RichText::new(format!("clock {err:+.1} ±{unc:.1}")) + .monospace() + .size(14.0) + .color(egui::Color32::from_gray(140)), + ); + ui.add_space(12.0); + } + if p.calibrating { + ui.label( + egui::RichText::new(format!("calibrating {}", p.cal_progress)) + .monospace() + .size(13.0) + .color(egui::Color32::from_rgb(235, 200, 90)), + ); + } + }); + ui.add_space(4.0); + }); + + // Right: controls, compact. + egui::SidePanel::right("settings") + .min_width(190.0) + .resizable(false) + .show(ctx, |ui| { + ui.add_space(6.0); + ui.style_mut().override_font_id = Some(egui::FontId::monospace(13.0)); + let mut p = self.params.lock().unwrap_or_else(|e| e.into_inner()); + let before = (p.bph, p.lift_angle, p.calibration, p.noise_suppressor, p.demo); + ui.label(egui::RichText::new("BEAT RATE").small().weak()); + egui::ComboBox::from_id_salt("bph") + .selected_text(if p.bph == 0 { "auto".into() } else { p.bph.to_string() }) + .width(ui.available_width() - 12.0) + .show_ui(ui, |ui| { + for b in [0u32, 12000, 14400, 18000, 19800, 21600, 25200, 28800, 36000, 43200] { + ui.selectable_value( + &mut p.bph, + b, + if b == 0 { "auto".into() } else { b.to_string() }, + ); + } + }); + ui.add_space(6.0); + ui.label(egui::RichText::new("LIFT ANGLE").small().weak()); + ui.add( + egui::DragValue::new(&mut p.lift_angle) + .range(30.0..=70.0) + .speed(0.5) + .suffix("°"), + ); + ui.add_space(6.0); + ui.checkbox(&mut p.noise_suppressor, "noise suppressor"); + ui.checkbox(&mut p.demo, "demo signal"); + ui.add_space(6.0); + ui.label(egui::RichText::new("CALIBRATION s/d").small().weak()); + ui.add( + egui::DragValue::new(&mut p.calibration) + .speed(0.1) + .range(-100.0..=100.0), + ); + ui.add_space(10.0); + if p.calibrating { + if ui.button("stop calibration").clicked() { + p.calibrating = false; + } + } else if ui.button("calibrate (quartz)").clicked() { + p.demo = false; + p.calibrating = true; + p.cal_progress.clear(); + } + ui.add_space(10.0); + let after = (p.bph, p.lift_angle, p.calibration, p.noise_suppressor, p.demo); + if after != before { + p.dirty = true; + } + ui.separator(); + ui.add_space(6.0); + ui.label(egui::RichText::new("WAVEFORM").small().weak()); + draw_waveform(ui, &self.result, 90.0); + }); + + // Center: the strip chart, or live calibration feedback while + // calibrating. + egui::CentralPanel::default() + .frame(egui::Frame::default().fill(egui::Color32::from_rgb(10, 11, 12))) + .show(ctx, |ui| { + if let Some(cal) = &self.cal { + chart::draw_cal_view(ui, cal); + } else { + draw_trace(ui, &self.trace); + } + }); + + ctx.request_repaint_after(Duration::from_millis(200)); + } +} + +fn strip_value(ui: &mut egui::Ui, name: &str, value: &Option) { + let v = value.clone().unwrap_or_else(|| "---".into()); + ui.label(egui::RichText::new(name).size(11.0).color(egui::Color32::from_gray(110))); + ui.label(egui::RichText::new(v).size(15.0).strong()); + ui.add_space(12.0); +} + +/// The strip chart: time runs left to right, phase error moves up and +/// down (tg's orientation). Rate error shows as a rising or falling drift, +/// beat error splits tic/toc into two horizontal bands, noise widens the +/// scatter. +fn draw_trace(ui: &mut egui::Ui, trace: &[TracePoint]) { + let (resp, painter) = ui.allocate_painter(ui.available_size(), egui::Sense::hover()); + let rect = resp.rect; + painter.rect_filled(rect, 0.0, egui::Color32::from_rgb(10, 11, 12)); + // Phase-error window: +/- 25 ms, ticks wrap into it. + const WINDOW_MS: f64 = 25.0; + const SPAN_S: f64 = 60.0; + let cy = rect.center().y; + let half_h = rect.height() / 2.0 - 8.0; + let to_y = |ms: f64| { + let wrapped = ((ms + WINDOW_MS) % (2.0 * WINDOW_MS) + 2.0 * WINDOW_MS) % (2.0 * WINDOW_MS) - WINDOW_MS; + cy - (wrapped / WINDOW_MS * half_h as f64) as f32 + }; + // Grid: center line plus 10 ms steps, horizontal like tg's display. + for ms in [-20.0, -10.0, 0.0, 10.0, 20.0] { + let y = to_y(ms); + let color = if ms == 0.0 { + egui::Color32::from_gray(52) + } else { + egui::Color32::from_gray(28) + }; + painter.line_segment( + [egui::pos2(rect.left(), y), egui::pos2(rect.right(), y)], + egui::Stroke::new(1.0_f32, color), + ); + } + let t_end = trace.last().map(|q| q.t).unwrap_or(0.0); + let w = rect.width(); + for p in trace { + let age = t_end - p.t; + if age > SPAN_S { + continue; + } + let x = rect.right() - (age / SPAN_S * w as f64) as f32; + let y = to_y(p.phase_ms); + let color = if p.tic { + egui::Color32::from_rgb(140, 230, 140) + } else { + egui::Color32::from_rgb(240, 140, 240) + }; + painter.line_segment( + [egui::pos2(x, y - 1.5), egui::pos2(x, y + 1.5)], + egui::Stroke::new(1.6_f32, color), + ); + } +} + +fn draw_waveform(ui: &mut egui::Ui, result: &Option, height: f32) { + let size = egui::vec2(ui.available_size().x, height); + let (resp, painter) = ui.allocate_painter(size, egui::Sense::hover()); + painter.rect_filled(resp.rect, 4.0, egui::Color32::from_gray(16)); + let Some(r) = result else { return }; + let wf = &r.waveform; + if wf.is_empty() { + return; + } + let max = wf.iter().cloned().fold(0f32, f32::max).max(1e-9); + let rect = resp.rect; + let n = wf.len(); + let mid = rect.center().y; + let to_screen = |i: usize, v: f32| { + egui::pos2( + rect.left() + (i as f32 / n as f32) * rect.width(), + mid - (v / max) * (rect.height() / 2.0 - 4.0), + ) + }; + let points: Vec = wf.iter().enumerate().map(|(i, &v)| to_screen(i, v)).collect(); + painter.add(egui::Shape::line( + points, + egui::Stroke::new(1.5_f32, egui::Color32::LIGHT_GREEN), + )); + if let Some(tic) = r.tic { + let x = to_screen(tic, 0.0).x; + painter.line_segment( + [egui::pos2(x, rect.top() + 2.0), egui::pos2(x, rect.bottom() - 2.0)], + egui::Stroke::new(1.0_f32, egui::Color32::YELLOW), + ); + } +} + +fn main() -> anyhow::Result<()> { + let clock_cal: Arc> = Arc::new(Mutex::new(ClockCal::new(SAMPLE_RATE))); + + // Live capture (if built with the audio feature); a relay thread moves + // samples into a shared ring buffer the worker reads, feeding the + // clock calibration as it goes. + let ring: Option = { + #[cfg(feature = "audio")] + { + let (tx, rx) = mpsc::channel::(); + match audio::spawn_capture(tx) { + Ok(()) => { + let ring: Ring = Arc::new(Mutex::new(MicBuf { data: Vec::new(), total: 0 })); + let r = ring.clone(); + let cc = clock_cal.clone(); + std::thread::spawn(move || { + let cap = (BLOCK_SECONDS * SAMPLE_RATE as f64) as usize * 2; + let mut batch = 0usize; + while let Ok(s) = rx.recv() { + r.lock().unwrap_or_else(|e| e.into_inner()).push(s, cap); + batch += 1; + if batch >= 2048 { + cc.lock().unwrap_or_else(|e| e.into_inner()).add(batch); + batch = 0; + } + } + }); + Some(ring) + } + Err(e) => { + eprintln!("audio capture unavailable: {e}; using demo mode"); + None + } + } + } + #[cfg(not(feature = "audio"))] + { + None + } + }; + + let native = eframe::NativeOptions { + viewport: egui::ViewportBuilder::default() + .with_inner_size([900.0, 520.0]) + .with_title("regulator"), + ..Default::default() + }; + eframe::run_native( + "regulator", + native, + Box::new(move |_cc| Ok(Box::new(RegulatorApp::new(ring, clock_cal)))), + ) + .map_err(|e| anyhow::anyhow!("{e}")) +} diff --git a/crates/regulator-gui/src/sheet.rs b/crates/regulator-gui/src/sheet.rs new file mode 100644 index 0000000..3827c4d --- /dev/null +++ b/crates/regulator-gui/src/sheet.rs @@ -0,0 +1,299 @@ +// SPDX-License-Identifier: GPL-2.0 +//! Branded JPEG result sheet: renders the current readout and trace onto a +//! regulator-styled card and writes it next to the SVG/CSV exports. + +use crate::{Params, TracePoint}; +use image::{Rgb, RgbImage}; +use regulator_core::TimingResult; +use std::sync::{Arc, Mutex}; + +const BG: Rgb = Rgb([10, 11, 12]); +const CARD: Rgb = Rgb([16, 18, 20]); +const FG: Rgb = Rgb([238, 238, 238]); +const MUTED: Rgb = Rgb([120, 124, 128]); +const GRID: Rgb = Rgb([40, 42, 46]); +const GRID0: Rgb = Rgb([70, 74, 78]); +const GREEN: Rgb = Rgb([140, 230, 140]); +const MAGENTA: Rgb = Rgb([240, 140, 240]); +const ACCENT: Rgb = Rgb([235, 200, 90]); +const RED: Rgb = Rgb([235, 120, 100]); + +/// 5x7 bitmap font, one byte per row, bit 4 = leftmost column. +fn glyph(c: char) -> [u8; 7] { + match c.to_ascii_uppercase() { + '0' => [0x0E, 0x11, 0x13, 0x15, 0x19, 0x11, 0x0E], + '1' => [0x04, 0x0C, 0x04, 0x04, 0x04, 0x04, 0x0E], + '2' => [0x0E, 0x11, 0x01, 0x02, 0x04, 0x08, 0x1F], + '3' => [0x1F, 0x02, 0x04, 0x02, 0x01, 0x11, 0x0E], + '4' => [0x02, 0x06, 0x0A, 0x12, 0x1F, 0x02, 0x02], + '5' => [0x1F, 0x10, 0x1E, 0x01, 0x01, 0x11, 0x0E], + '6' => [0x06, 0x08, 0x10, 0x1E, 0x11, 0x11, 0x0E], + '7' => [0x1F, 0x01, 0x02, 0x04, 0x08, 0x08, 0x08], + '8' => [0x0E, 0x11, 0x11, 0x0E, 0x11, 0x11, 0x0E], + '9' => [0x0E, 0x11, 0x11, 0x0F, 0x01, 0x02, 0x0C], + 'A' => [0x0E, 0x11, 0x11, 0x1F, 0x11, 0x11, 0x11], + 'B' => [0x1E, 0x11, 0x11, 0x1E, 0x11, 0x11, 0x1E], + 'C' => [0x0E, 0x11, 0x10, 0x10, 0x10, 0x11, 0x0E], + 'D' => [0x1C, 0x12, 0x11, 0x11, 0x11, 0x12, 0x1C], + 'E' => [0x1F, 0x10, 0x10, 0x1E, 0x10, 0x10, 0x1F], + 'F' => [0x1F, 0x10, 0x10, 0x1E, 0x10, 0x10, 0x10], + 'G' => [0x0E, 0x11, 0x10, 0x17, 0x11, 0x11, 0x0F], + 'H' => [0x11, 0x11, 0x11, 0x1F, 0x11, 0x11, 0x11], + 'I' => [0x0E, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0E], + 'J' => [0x07, 0x02, 0x02, 0x02, 0x02, 0x12, 0x0C], + 'K' => [0x11, 0x12, 0x14, 0x18, 0x14, 0x12, 0x11], + 'L' => [0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1F], + 'M' => [0x11, 0x1B, 0x15, 0x15, 0x11, 0x11, 0x11], + 'N' => [0x11, 0x19, 0x15, 0x13, 0x11, 0x11, 0x11], + 'O' => [0x0E, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0E], + 'P' => [0x1E, 0x11, 0x11, 0x1E, 0x10, 0x10, 0x10], + 'Q' => [0x0E, 0x11, 0x11, 0x11, 0x15, 0x12, 0x0D], + 'R' => [0x1E, 0x11, 0x11, 0x1E, 0x14, 0x12, 0x11], + 'S' => [0x0F, 0x10, 0x10, 0x0E, 0x01, 0x01, 0x1E], + 'T' => [0x1F, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04], + 'U' => [0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0E], + 'V' => [0x11, 0x11, 0x11, 0x11, 0x11, 0x0A, 0x04], + 'W' => [0x11, 0x11, 0x11, 0x15, 0x15, 0x15, 0x0A], + 'X' => [0x11, 0x11, 0x0A, 0x04, 0x0A, 0x11, 0x11], + 'Y' => [0x11, 0x11, 0x11, 0x0A, 0x04, 0x04, 0x04], + 'Z' => [0x1F, 0x01, 0x02, 0x04, 0x08, 0x10, 0x1F], + '+' => [0x00, 0x04, 0x04, 0x1F, 0x04, 0x04, 0x00], + '-' => [0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00], + '.' => [0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C], + ',' => [0x00, 0x00, 0x00, 0x00, 0x0C, 0x04, 0x08], + '/' => [0x01, 0x01, 0x02, 0x04, 0x08, 0x10, 0x10], + ':' => [0x00, 0x0C, 0x0C, 0x00, 0x0C, 0x0C, 0x00], + '(' => [0x02, 0x04, 0x08, 0x08, 0x08, 0x04, 0x02], + ')' => [0x08, 0x04, 0x02, 0x02, 0x02, 0x04, 0x08], + '\u{00b0}' => [0x06, 0x09, 0x09, 0x06, 0x00, 0x00, 0x00], + _ => [0; 7], + } +} + +fn text_width(s: &str, scale: u32) -> u32 { + s.chars().count() as u32 * 6 * scale +} + +fn draw_text(img: &mut RgbImage, x: i64, y: i64, s: &str, scale: u32, color: Rgb) { + let mut cx = x; + for c in s.chars() { + if c != ' ' { + let g = glyph(c); + for (row, bits) in g.iter().enumerate() { + for col in 0..5 { + if bits & (1 << (4 - col)) != 0 { + for dy in 0..scale as i64 { + for dx in 0..scale as i64 { + let px = cx + col as i64 * scale as i64 + dx; + let py = y + row as i64 * scale as i64 + dy; + if px >= 0 && py >= 0 { + img.put_pixel(px as u32, py as u32, color); + } + } + } + } + } + } + } + cx += 6 * scale as i64; + } +} + +fn rect_filled(img: &mut RgbImage, x: u32, y: u32, w: u32, h: u32, color: Rgb) { + for yy in y..y.saturating_add(h) { + for xx in x..x.saturating_add(w) { + if (xx as usize) < img.width() as usize && (yy as usize) < img.height() as usize { + img.put_pixel(xx, yy, color); + } + } + } +} + +fn hline(img: &mut RgbImage, x0: u32, x1: u32, y: u32, color: Rgb) { + for x in x0..=x1 { + if y < img.height() && x < img.width() { + img.put_pixel(x, y, color); + } + } +} + +fn vline(img: &mut RgbImage, x: u32, y0: u32, y1: u32, color: Rgb) { + for y in y0..=y1 { + if x < img.width() && y < img.height() { + img.put_pixel(x, y, color); + } + } +} + +fn civil_from_days(z: i64) -> (i64, u32, u32) { + let z = z + 719468; + let era = z.div_euclid(146097); + let doe = z.rem_euclid(146097); + let yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365; + let doy = doe - (365 * yoe + yoe / 4 - yoe / 100); + let mp = (5 * doy + 2) / 153; + let d = (doy - (153 * mp + 2) / 5 + 1) as u32; + let m = if mp < 10 { mp + 3 } else { mp - 9 } as u32; + (if m <= 2 { yoe + era * 400 + 1 } else { yoe + era * 400 }, m, d) +} + +const W: u32 = 1200; +const H: u32 = 800; +const WINDOW_MS: f64 = 25.0; +const SPAN_S: f64 = 60.0; + +/// Render the result sheet and write `.jpg`. Returns the path on +/// success. +pub fn export_jpeg( + base: &str, + trace: &[TracePoint], + result: &Option, + params: &Arc>, +) -> Option { + let p = params.lock().unwrap_or_else(|e| e.into_inner()).clone(); + let mut img = RgbImage::from_pixel(W, H, BG); + + // Frame: a slightly raised card inset in the dark page. + let m = 24u32; + rect_filled(&mut img, m, m, W - 2 * m, H - 2 * m, CARD); + vline(&mut img, m, m, H - m, GRID0); + vline(&mut img, W - m, m, H - m, GRID0); + hline(&mut img, m, W - m, m, GRID0); + hline(&mut img, m, W - m, H - m, GRID0); + + // Header. + draw_text(&mut img, 56, 52, "REGULATOR", 4, FG); + draw_text(&mut img, 56, 92, "WATCH TIMING RESULT SHEET", 1, MUTED); + let now = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .ok()?; + let secs = now.as_secs(); + let (y, mo, d) = civil_from_days((secs / 86400) as i64); + let stamp = format!( + "{y:04}/{mo:02}/{d:02} {:02}:{:02} UTC", + secs % 86400 / 3600, + secs % 3600 / 60 + ); + let sw = text_width(&stamp, 1); + draw_text(&mut img, (W - 56 - sw) as i64, 60, &stamp, 1, MUTED); + hline(&mut img, m + 1, W - m - 1, 118, GRID); + + // Readouts. + let fmt = |v: Option, spec: &dyn Fn(f64) -> String| { + v.map(spec).unwrap_or_else(|| "---".into()) + }; + let (rate, amp, be) = match result { + Some(r) => ( + fmt(r.rate_sday, &|v: f64| format!("{v:+.1}")), + fmt(r.amplitude_deg, &|v: f64| format!("{v:.0} DEG")), + fmt(r.beat_error_ms, &|v: f64| format!("{v:+.2} MS")), + ), + None => ("---".into(), "---".into(), "---".into()), + }; + let rate_color = match result.as_ref().and_then(|r| r.rate_sday) { + Some(v) if v.abs() < 5.0 => GREEN, + Some(v) if v.abs() < 15.0 => ACCENT, + Some(_) => RED, + None => MUTED, + }; + draw_text(&mut img, 56, 150, "RATE S/DAY", 1, MUTED); + draw_text(&mut img, 56, 172, &rate, 8, rate_color); + let col_x = [520, 760, 900, 1020]; + let labels = ["AMPLITUDE", "BEAT ERROR", "LIFT ANGLE", "BPH"]; + let bph_s = match p.bph { + 0 => "AUTO".to_string(), + b => b.to_string(), + }; + let values = [ + amp, + be, + format!("{:.0} DEG", p.lift_angle), + bph_s, + ]; + for (i, &x) in col_x.iter().enumerate() { + draw_text(&mut img, x as i64, 150, labels[i], 1, MUTED); + draw_text(&mut img, x as i64, 168, &values[i], 2, FG); + } + if p.calibration != 0.0 { + let tag = if p.cal_auto { " AUTO" } else { "" }; + draw_text( + &mut img, + 56, + 252, + &format!("CALIBRATION {:+.1} S/D{}", p.calibration, tag), + 1, + MUTED, + ); + } + hline(&mut img, m + 1, W - m - 1, 286, GRID); + + // Chart area: horizontal time axis, vertical phase error. + let cx0 = 56u32; + let cx1 = W - 56; + let cy0 = 310u32; + let cy1 = H - 90; + let cy = (cy0 + cy1) / 2; + let half_h = (cy1 - cy0) as f64 / 2.0; + let wrap = |ms: f64| { + ((ms + WINDOW_MS) % (2.0 * WINDOW_MS) + 2.0 * WINDOW_MS) % (2.0 * WINDOW_MS) - WINDOW_MS + }; + let to_y = |ms: f64| cy as f64 - wrap(ms) / WINDOW_MS * half_h; + for ms in [-20.0, -10.0, 0.0, 10.0, 20.0] { + let y = to_y(ms) as u32; + let color = if ms == 0.0 { GRID0 } else { GRID }; + hline(&mut img, cx0, cx1, y, color); + let lab = format!("{ms:+.0}"); + draw_text(&mut img, cx0 as i64 - 8, y as i64 + 3, &lab, 1, MUTED); + } + for frac in [0.0, 0.25, 0.5, 0.75, 1.0] { + let x = cx0 as f64 + frac * (cx1 - cx0) as f64; + vline(&mut img, x as u32, cy0, cy1, GRID); + let lab = format!("-{:.0}S", (1.0 - frac) * SPAN_S); + draw_text(&mut img, x as i64 - 6, cy1 as i64 + 8, &lab, 1, MUTED); + } + let t_end = trace.last().map(|t| t.t).unwrap_or(0.0); + for t in trace.iter().filter(|t| t_end - t.t <= SPAN_S) { + let x = cx1 as f64 - (t_end - t.t) / SPAN_S * (cx1 - cx0) as f64; + let y = to_y(t.phase_ms); + let color = if t.tic { GREEN } else { MAGENTA }; + for dy in -1i64..=1 { + let py = y as i64 + dy; + if py >= 0 && (py as u32) < H { + img.put_pixel(x as u32, py as u32, color); + } + } + } + + // Footer. + hline(&mut img, m + 1, W - m - 1, H - 56, GRID); + draw_text(&mut img, 56, (H - 44) as i64, "REGULATOR - GPL-2.0 - GITHUB.COM/BOROSF/REGULATOR", 1, MUTED); + draw_text(&mut img, (W - 56 - text_width("TIC GREEN / TOC MAGENTA", 1)) as i64, (H - 44) as i64, "TIC GREEN / TOC MAGENTA", 1, MUTED); + + let path = format!("{base}.jpg"); + img.save_with_format(&path, image::ImageFormat::Jpeg).ok()?; + Some(path) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn renders_result_sheet() { + let trace: Vec = (0..600) + .map(|i| TracePoint { + t: i as f64 * 0.1, + phase_ms: (i as f64 * 0.05).sin() * 3.0, + tic: i % 2 == 0, + }) + .collect(); + let params = Arc::new(Mutex::new(Params::default())); + let dir = std::env::temp_dir().join("regulator-sheet-test"); + std::fs::create_dir_all(&dir).unwrap(); + let base = dir.join("sheet").to_string_lossy().into_owned(); + let path = export_jpeg(&base, &trace, &None, ¶ms).expect("export"); + let meta = std::fs::metadata(&path).unwrap(); + assert!(meta.len() > 10_000, "jpeg too small: {}", meta.len()); + std::fs::remove_file(&path).unwrap(); + } +} diff --git a/crates/regulator-tui/Cargo.toml b/crates/regulator-tui/Cargo.toml new file mode 100644 index 0000000..2746cbc --- /dev/null +++ b/crates/regulator-tui/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "regulator-tui" +description = "Experimental terminal UI for the regulator watch timing machine" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true + +[[bin]] +name = "regulator" +path = "src/main.rs" + +[features] +default = ["audio"] +# Live microphone capture via cpal. Requires ALSA/WinAudio/CoreAudio at build +# time; disable with --no-default-features to build everywhere else. +audio = ["dep:cpal"] + +[dependencies] +regulator-core = { path = "../regulator-core" } +ratatui = "0.29" +crossterm = "0.28" +anyhow = "1" +cpal = { version = "0.15", optional = true } diff --git a/crates/regulator-tui/src/audio.rs b/crates/regulator-tui/src/audio.rs new file mode 100644 index 0000000..bf0706f --- /dev/null +++ b/crates/regulator-tui/src/audio.rs @@ -0,0 +1,109 @@ +// SPDX-License-Identifier: GPL-2.0 +//! Live audio capture via cpal. Compiled only with the `audio` feature. + +use anyhow::{Context, Result}; +use cpal::traits::{DeviceTrait, HostTrait, StreamTrait}; +use std::sync::mpsc::Sender; + +const TARGET_RATE: f64 = 44100.0; + +/// Naive linear resampler state: converts the device's sample rate to the +/// 44.1 kHz mono stream the analyzer expects. +struct Resampler { + step: f64, + frac: f64, +} + +impl Resampler { + fn new(input_rate: f64) -> Self { + Resampler { + step: input_rate / TARGET_RATE, + frac: 0.0, + } + } + + fn push(&mut self, mono: &[f32], tx: &Sender) { + while self.frac < mono.len() as f64 { + let x = self.frac as usize; + let next = mono[(x + 1).min(mono.len() - 1)]; + let t = (self.frac - x as f64) as f32; + let s = mono[x] * (1.0 - t) + next * t; + let _ = tx.send(s); + self.frac += self.step; + } + self.frac -= mono.len() as f64; + } +} + +/// Spawn the default input device and stream mono 44.1 kHz f32 samples to +/// `tx`. +pub fn spawn_capture(tx: Sender) -> Result<()> { + let host = cpal::default_host(); + let device = host + .default_input_device() + .context("no audio input device found")?; + let supported = device + .default_input_config() + .context("no supported input configuration")?; + let channels = supported.channels() as usize; + let sample_format = supported.sample_format(); + let config: cpal::StreamConfig = supported.into(); + let mut resampler = Resampler::new(config.sample_rate.0 as f64); + let tx_f32 = tx.clone(); + + let stream = match sample_format { + cpal::SampleFormat::F32 => device.build_input_stream( + &config, + move |data: &[f32], _| { + let mono = mix_mono(data, channels); + resampler.push(&mono, &tx_f32); + }, + err_cb, + None, + )?, + cpal::SampleFormat::I16 => device.build_input_stream( + &config, + move |data: &[i16], _| { + let mono = mix_mono( + &data.iter().map(|&v| v as f32 / i16::MAX as f32).collect::>(), + channels, + ); + resampler.push(&mono, &tx_f32); + }, + err_cb, + None, + )?, + cpal::SampleFormat::U16 => device.build_input_stream( + &config, + move |data: &[u16], _| { + let mono = mix_mono( + &data + .iter() + .map(|&v| (v as f32 - u16::MAX as f32 / 2.0) / (u16::MAX as f32 / 2.0)) + .collect::>(), + channels, + ); + resampler.push(&mono, &tx_f32); + }, + err_cb, + None, + )?, + other => anyhow::bail!("unsupported sample format: {other:?}"), + }; + stream.play()?; + std::mem::forget(stream); + Ok(()) +} + +fn err_cb(err: cpal::StreamError) { + eprintln!("audio error: {err}"); +} + +fn mix_mono(data: &[f32], channels: usize) -> Vec { + if channels <= 1 { + return data.to_vec(); + } + data.chunks(channels) + .map(|c| c.iter().sum::() / c.len() as f32) + .collect() +} diff --git a/crates/regulator-tui/src/main.rs b/crates/regulator-tui/src/main.rs new file mode 100644 index 0000000..3023101 --- /dev/null +++ b/crates/regulator-tui/src/main.rs @@ -0,0 +1,202 @@ +// SPDX-License-Identifier: GPL-2.0 +//! regulator: a watch timing machine for the terminal. + +mod ui; +#[cfg(feature = "audio")] +mod audio; + +use anyhow::Result; +use crossterm::event::{self, Event, KeyCode, KeyEventKind}; +use crossterm::terminal::{ + disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen, +}; +use ratatui::backend::CrosstermBackend; +use ratatui::Terminal; +use regulator_core::{Analyzer, SyntheticWatch, TimingResult}; +#[cfg(feature = "audio")] +use regulator_core::{CalStatus, CalibrationState}; +use std::sync::mpsc; +use std::sync::{Arc, Mutex}; +use std::time::{Duration, Instant}; +use ui::Settings; + +const SAMPLE_RATE: u32 = 44100; +const BLOCK_SECONDS: f64 = 4.0; + +fn main() -> Result<()> { + let demo = std::env::args().any(|a| a == "--demo"); + let settings = Arc::new(Mutex::new(Settings::default())); + settings.lock().unwrap_or_else(|e| e.into_inner()).source = if demo { "demo" } else { "mic" }.into(); + + let (result_tx, result_rx) = mpsc::channel::>(); + + if demo { + spawn_demo_worker(result_tx, settings.clone()); + } else { + #[cfg(feature = "audio")] + { + let (sample_tx, sample_rx) = mpsc::channel::(); + audio::spawn_capture(sample_tx)?; + spawn_live_worker(sample_rx, result_tx, settings.clone()); + } + #[cfg(not(feature = "audio"))] + { + anyhow::bail!("built without the `audio` feature; run with --demo"); + } + } + + run_tui(result_rx, settings) +} + +fn build_analyzer(settings: &Settings) -> Analyzer { + let mut an = Analyzer::new(SAMPLE_RATE); + an.bph = settings.bph; + an.lift_angle = settings.lift_angle; + an.noise_suppressor = settings.noise_suppressor; + an.calibration = settings.calibration; + an +} + +fn analyze_block(samples: &[f32], settings: &Settings) -> Option { + build_analyzer(settings).analyze(samples) +} + +fn spawn_demo_worker(tx: mpsc::Sender>, settings: Arc>) { + std::thread::spawn(move || { + let watch = SyntheticWatch { + bph: 28800, + rate_sday: 9.0, + beat_error_ms: 0.6, + amplitude_deg: 275.0, + quartz: false, + }; + let samples = watch.generate(SAMPLE_RATE, 60.0); + let mut start = 0usize; + let block = (BLOCK_SECONDS * SAMPLE_RATE as f64) as usize; + loop { + let end = (start + block).min(samples.len()); + let res = analyze_block(&samples[start..end], &settings.lock().unwrap_or_else(|e| e.into_inner()).clone()); + let _ = tx.send(res); + if end == samples.len() { + start = 0; + } else { + start = end; + } + std::thread::sleep(Duration::from_millis(500)); + } + }); +} + +#[cfg(feature = "audio")] +fn spawn_live_worker( + rx: mpsc::Receiver, + tx: mpsc::Sender>, + settings: Arc>, +) { + std::thread::spawn(move || { + let block = (BLOCK_SECONDS * SAMPLE_RATE as f64) as usize; + let mut buf: Vec = Vec::with_capacity(block * 2); + let mut ts: u64 = 0; + let mut cal_state = CalibrationState::new(); + let mut cal_cooldown = 0u32; + loop { + let mut fresh = 0usize; + while let Ok(s) = rx.try_recv() { + buf.push(s); + fresh += 1; + if buf.len() > block * 2 { + buf.drain(..block); + } + } + ts += fresh as u64; + let mut s = settings.lock().unwrap_or_else(|e| e.into_inner()); + if s.calibrating { + if buf.len() >= block && cal_cooldown == 0 { + let cal_an = Analyzer::for_calibration(SAMPLE_RATE); + let window_start_ts = ts.saturating_sub(buf.len() as u64); + match cal_state.add_block(&cal_an, &buf[buf.len() - block..], window_start_ts) { + CalStatus::Done(cal) => { + s.calibration = cal; + s.calibrating = false; + s.cal_progress = format!("{cal:+.1} s/d"); + } + CalStatus::Failed => { + s.calibrating = false; + s.cal_progress = "failed".into(); + } + CalStatus::Collecting { have, need } => { + s.cal_progress = format!("{have}/{need} s"); + } + CalStatus::Missed => {} + } + cal_cooldown = 10; // feed ~1 window per second + } + if cal_cooldown > 0 { + cal_cooldown -= 1; + } + drop(s); + // Keep the last measurement on screen during calibration. + } else { + let snapshot = s.clone(); + drop(s); + if buf.len() >= block { + let res = analyze_block(&buf[buf.len() - block..], &snapshot); + let _ = tx.send(res); + } + } + std::thread::sleep(Duration::from_millis(100)); + } + }); +} + +fn run_tui( + rx: mpsc::Receiver>, + settings: Arc>, +) -> Result<()> { + enable_raw_mode()?; + let mut stdout = std::io::stdout(); + crossterm::execute!(stdout, EnterAlternateScreen)?; + let mut terminal = Terminal::new(CrosstermBackend::new(stdout))?; + let mut result: Option = None; + let mut last_draw = Instant::now(); + + loop { + if event::poll(Duration::from_millis(50))? { + if let Event::Key(key) = event::read()? { + if key.kind == KeyEventKind::Press { + let mut s = settings.lock().unwrap_or_else(|e| e.into_inner()); + match key.code { + KeyCode::Char('q') | KeyCode::Esc => break, + KeyCode::Left | KeyCode::Right => { + const BPH: [u32; 6] = [0, 18000, 21600, 25200, 28800, 36000]; + let idx = BPH.iter().position(|&b| b == s.bph).unwrap_or(0); + let next = if key.code == KeyCode::Right { + (idx + 1) % BPH.len() + } else { + (idx + BPH.len() - 1) % BPH.len() + }; + s.bph = BPH[next]; + } + KeyCode::Char('+') | KeyCode::Char('=') => s.lift_angle += 1.0, + KeyCode::Char('-') => s.lift_angle -= 1.0, + KeyCode::Char('n') => s.noise_suppressor = !s.noise_suppressor, + KeyCode::Char('c') => s.calibrating = !s.calibrating, + _ => {} + } + } + } + } + while let Ok(r) = rx.try_recv() { + result = r; + } + if last_draw.elapsed() > Duration::from_millis(100) { + let s = settings.lock().unwrap_or_else(|e| e.into_inner()).clone(); + terminal.draw(|f| ui::draw(f, &result, &s))?; + last_draw = Instant::now(); + } + } + + disable_raw_mode()?; + crossterm::execute!(terminal.backend_mut(), LeaveAlternateScreen)?; + Ok(()) +} diff --git a/crates/regulator-tui/src/ui.rs b/crates/regulator-tui/src/ui.rs new file mode 100644 index 0000000..ffe9075 --- /dev/null +++ b/crates/regulator-tui/src/ui.rs @@ -0,0 +1,175 @@ +// SPDX-License-Identifier: GPL-2.0 +//! The ratatui interface: a clean three-zone layout. + +use ratatui::layout::{Alignment, Constraint, Direction, Layout, Margin, Rect}; +use ratatui::style::{Color, Modifier, Style}; +use ratatui::text::{Line, Span}; +use ratatui::widgets::{Block, Borders, Paragraph}; +use regulator_core::TimingResult; + +/// UI-level state shown in the status bar. +#[derive(Clone)] +pub struct Settings { + pub bph: u32, + pub lift_angle: f64, + pub noise_suppressor: bool, + pub source: String, + pub calibrating: bool, + pub calibration: f64, + pub cal_progress: String, +} + +impl Default for Settings { + fn default() -> Self { + Settings { + bph: 0, + lift_angle: 52.0, + noise_suppressor: true, + source: String::new(), + calibrating: false, + calibration: 0.0, + cal_progress: String::new(), + } + } +} + +pub fn draw(f: &mut ratatui::Frame, res: &Option, s: &Settings) { + let chunks = Layout::default() + .direction(Direction::Vertical) + .constraints([ + Constraint::Length(5), + Constraint::Min(10), + Constraint::Length(1), + ]) + .split(f.area()); + + draw_readout(f, chunks[0], res); + draw_waveform(f, chunks[1], res); + draw_status(f, chunks[2], s); +} + +fn draw_readout(f: &mut ratatui::Frame, area: Rect, res: &Option) { + let cols = Layout::default() + .direction(Direction::Horizontal) + .constraints([Constraint::Ratio(1, 3); 3]) + .split(area); + + let blank = ("---".to_string(), Color::DarkGray); + let (rate, amp, be) = match res { + Some(r) => ( + match r.rate_sday { + Some(v) => (format!("{v:+.1}"), rate_color(v)), + None => blank.clone(), + }, + match r.amplitude_deg { + Some(v) => (format!("{v:.0}"), Color::Cyan), + None => blank.clone(), + }, + match r.beat_error_ms { + Some(v) => (format!("{v:+.2}"), Color::Magenta), + None => blank.clone(), + }, + ), + None => (blank.clone(), blank.clone(), blank), + }; + for (col, (title, (val, color), unit)) in [ + ("Rate", rate, " s/day"), + ("Amplitude", amp, " deg"), + ("Beat error", be, " ms"), + ] + .into_iter() + .enumerate() + { + let block = Block::default() + .borders(Borders::ALL) + .title(format!(" {title} ")); + f.render_widget(block, cols[col]); + let a = cols[col].inner(Margin::new(2, 1)); + let p = Paragraph::new(Line::from(vec![ + Span::styled(val, Style::default().fg(color).add_modifier(Modifier::BOLD)), + Span::styled(unit, Style::default().fg(Color::Gray)), + ])) + .alignment(Alignment::Center); + f.render_widget(p, a); + } +} + +fn rate_color(rate: f64) -> Color { + if rate.abs() < 5.0 { + Color::Green + } else if rate.abs() < 15.0 { + Color::Yellow + } else { + Color::Red + } +} + +fn draw_waveform(f: &mut ratatui::Frame, area: Rect, res: &Option) { + let block = Block::default().borders(Borders::ALL).title(" Waveform "); + f.render_widget(block, area); + let inner = area.inner(Margin::new(1, 1)); + if inner.width < 2 || inner.height < 2 { + return; + } + let Some(r) = res else { return }; + let wf = &r.waveform; + if wf.is_empty() { + return; + } + + // Scale so the largest excursion fits the panel. + let max = wf.iter().cloned().fold(0f32, f32::max).max(1e-9); + let mid = inner.height as f32 / 2.0; + let scale = (mid - 1.0) / max; + let tic_x = r.tic.map(|t| t as u32 * inner.width as u32 / wf.len() as u32); + + for x in 0..inner.width { + let i = x as usize * wf.len() / inner.width as usize; + let v = wf[i.min(wf.len() - 1)] * scale; + let h = ((v.abs() * mid).ceil() as u16).clamp(1, inner.height) as u16; + let y = if v >= 0.0 { + (mid as u16).saturating_sub(h) + } else { + mid as u16 + }; + // Tic/toc position marker column. + let is_marker = tic_x.is_some_and(|tx| (x as u32).abs_diff(tx) <= 1); + let style = if is_marker { + Style::default().fg(Color::Yellow) + } else if v >= 0.0 { + Style::default().fg(Color::Green) + } else { + Style::default().fg(Color::Red) + }; + for dy in 0..h { + let py = (inner.y + y + dy).min(inner.y + inner.height - 1); + f.buffer_mut()[(inner.x + x, py)] + .set_char(if is_marker { '▓' } else { '█' }) + .set_style(style); + } + } +} + +fn draw_status(f: &mut ratatui::Frame, area: Rect, s: &Settings) { + let bph = if s.bph == 0 { "auto".into() } else { s.bph.to_string() }; + let cal = if s.calibrating { + format!(" calibrating {}…", s.cal_progress) + } else if s.calibration != 0.0 { + format!(" cal:{:+.1} s/d", s.calibration) + } else { + String::new() + }; + let line = Line::from(vec![ + Span::styled(format!(" {} ", s.source), Style::default().bg(Color::DarkGray)), + Span::raw(format!( + " bph:{bph} lift:{:.0}° noise:{}{cal} ", + s.lift_angle, + if s.noise_suppressor { "on" } else { "off" } + )), + Span::styled( + "←→ bph +/- lift n noise c calibrate q quit", + Style::default().fg(Color::DarkGray), + ), + ]); + f.render_widget(Paragraph::new(line), area); +} diff --git a/docs/original-readme.md b/docs/original-readme.md new file mode 100644 index 0000000..e668dab --- /dev/null +++ b/docs/original-readme.md @@ -0,0 +1,212 @@ +# A program for timing mechanical watches + +The program tg is distributed under the GNU GPL license version 2. The full +source code of tg is available at +[https://github.com/xyzzy42/tg](https://github.com/xyzzy42/tg) and its +copyright belongs to the respective contributors. + +Tg is in development, and there is still no manual. Some info can be found +in this +[thread at WUS](http://forums.watchuseek.com/f6/open-source-timing-software-2542874.html), +in particular the calibration procedure is described at +[this post](http://forums.watchuseek.com/f6/open-source-timing-software-2542874-post29970370.html). + +## Install instructions + +Tg is known to work under Microsoft Windows, OS X, and Linux. Moreover it +should be possible to compile the source code under most modern UNIX-like +systems. See the sub-sections below for the details. + +### Windows + +Binaries can be found at https://tg.ciovil.li + +Unfortunately, these packages have not been updated since 2017. Help from +someone who can build the Windows installer version would be appreciated. +You'll need to [build from source](#compiling-on-windows) to get any features +from the last five plus years. + +### Macintosh + +A formula for the Homebrew package manager has been prepared by GitHub user +[dmnc](https://github.com/dmnc) and then updated by +[xyzzy42](https://github.com/xyzzy42). To use it, you need to install Homebrew +first (instructions on http://brew.sh). + +Then run the following command to check everything is set up correctly +and follow any instructions it gives you. + + brew doctor + +To install tg, run: + + brew install --HEAD xyzzy42/horology/tg-timer + +You can now launch tg by typing: + + tg-timer & + +### Debian or Debian-based (e.g. Mint, Ubuntu) + +Binary .deb packages can be downloaded from https://tg.ciovil.li + +Unfortunately, these packages have not been updated since 2017. + +### Fedora, CentOS or other Redhat-based + +Binary RPM packages are available from https://copr.fedorainfracloud.org/coprs/tpiepho/tg-timer/ + +This COPR repository can be added to dnf's list with: +```sh +dnf copr enable tpiepho/tg-timer +``` +Then tg-timer can be installed with `dnf install tg-timer`, or with any dnf +based GUI package installer. + +## Compiling from sources + +The source code of tg can probably be built by any C99 compiler, however only +gcc and clang have been tested. You need the following libraries: gtk+3, +portaudio2, fftw3 (all available as open source). + +The optional plotting features for audio filter response graphs and audio +spectrograms require Python. The follow Python modules are needed for all +features: numpy, scipy, matplotlib, libtfr. + +### Normal build +Get source: +```sh +git clone https://github.com/xyzzy42/tg.git +cd tg + +# Optional, check out a specific branch other than the default +git checkout new-stuff +``` + +Build it: +```sh +./autogen.sh +./configure +make +``` + +### Debug build +After the steps of a normal build, above, run: +```sh +make tg-timer-dbg +``` + +### Compiling on Windows + +It is suggested to use the MSYS2 platform. First install MSYS2 according +to the instructions at [http://www.msys2.org](http://www.msys2.org). The +[UCRT64 environment](https://www.msys2.org/docs/environments/) appears to work +best. + +From the MSYS2 UCRT64 terminal issue the following commands to install dependencies: + +```sh +pacman -S mingw-w64-ucrt-x86_64-gcc pkg-config mingw-w64-ucrt-x86_64-gtk3 mingw-w64-ucrt-x86_64-portaudio mingw-w64-ucrt-x86_64-fftw make git autoconf automake libtool +pacman -S mingw-w64-ucrt-x86_64-ninja mingw-w64-ucrt-x86_64-python-scipy mingw-w64-ucrt-x86_64-python-matplotlib mingw-w64-ucrt-x86_64-lapack mingw-w64-ucrt-x86_64-cython mingw-w64-ucrt-x86_64-python-pip +``` + +Add the folder "C:\msys64\ucrt64\bin" to the system path variable + +Install the libtfr package with: + +```sh +pip install libtfr +``` + +If that doesn't work, try building it manually: + +```sh +git clone https://github.com/melizalab/libtfr.git +cd libtfr +python setup.py install +``` + +Then follow the [normal build](#normal-build) instructions to clone the TG +repository and build it. + +If the "Signal" or "Filter Chain" dialogs do not work, this appears to be some +sort of [library issue with Python on Windows](https://github.com/xyzzy42/tg/issues/8#issuecomment-2351649260). +Try copying the `tg-timer.exe` file to `C:\msys64\ucrt64\bin` and run it from there. + +### Compiling on Debian + +To compile tg on Debian, install these dependencies: + +```sh +sudo apt-get install libgtk-3-dev libjack-jackd2-dev portaudio19-dev libfftw3-dev git autoconf automake libtool +``` + +Additional software is necessary for the optional Python graphing system, see +Fedora section for more information. Debian specific instructions welcome. + +Then follow the [normal build](#normal-build) instructions to clone the +repository and build it. + +The package libjack-jackd2-dev is not necessary, it only works around a +known bug (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718221). + +### Compiling on Fedora + +To compile tg on Fedora, install these dependencies: + +```sh +sudo dnf install fftw-devel portaudio-devel gtk3-devel autoconf automake libtool +``` + +To use the Python graphing code (filter response and audio spectrogram) one +should also install: +```sh +sudo dnf install python3-devel python3-numpy python3-scipy python3-matplotlib +pip install --user libtfr +``` + +Then follow the [normal build](#normal-build) instructions to clone the +repository and build it. + +To build an RPM on Fedora or another RPM based distro, install the build +prerequisites and checkout the source as for compiling (above), then run +`rpmbuild` to create the RPM: + +```sh +rpmbuild --build-in-place -bb packaging/tg-timer.spec +``` + + +### Compiling on Macintosh + +To build on MacOS, install the follow dependencies with +[Homebrew](http://brew.sh). If you do not have Homebrew, the link above will +explain the install. + +```sh +brew install pkg-config autoconf automake libtool gtk+3 portaudio fftw gnome-icon-theme +``` + +To use the Python graphing code (filter response and audio spectrogram) one +should also install: + +```sh +brew install python numpy scipy +pip3 install matplotlib libtfr +``` + +If you have multiple versions of python3 installed, you might need to use a +specific version of pip, e.g. `pip3.11` in the above command. + +Then follow the [normal build](#normal-build) instructions to clone the +repository and build it. + +If you have multiple versions of Python installed and the configure script does +not detect the correct one, i.e. the one for which numpy, matplotlib, libtfr, +etc. have been installed for, then run the configure script as: + +```sh +PYTHON=python3.11 ./configure +``` + +Where `python3.11` is the correct version to use. diff --git a/docs/screenshot.jpg b/docs/screenshot.jpg new file mode 100644 index 0000000..351225b Binary files /dev/null and b/docs/screenshot.jpg differ