Working audio input selector. Doesn't actually store the state anywhere yet.

This commit is contained in:
Chloe Fontenot 🏳️‍⚧️ 2024-11-15 12:58:56 -06:00
parent 6ac800d29b
commit c1ca8aeaaf
7 changed files with 523 additions and 11 deletions

448
Cargo.lock generated
View File

@ -8,6 +8,37 @@ version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
[[package]]
name = "aho-corasick"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr",
]
[[package]]
name = "alsa"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed7572b7ba83a31e20d1b48970ee402d2e3e0537dcfe0a3ff4d6eb7508617d43"
dependencies = [
"alsa-sys",
"bitflags 2.6.0",
"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]] [[package]]
name = "android-tzdata" name = "android-tzdata"
version = "0.1.1" version = "0.1.1"
@ -29,6 +60,24 @@ version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
[[package]]
name = "bindgen"
version = "0.70.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f"
dependencies = [
"bitflags 2.6.0",
"cexpr",
"clang-sys",
"itertools",
"proc-macro2",
"quote",
"regex",
"rustc-hash",
"shlex",
"syn",
]
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.3.2" version = "1.3.2"
@ -59,6 +108,12 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "bytes"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da"
[[package]] [[package]]
name = "cairo" name = "cairo"
version = "0.0.4" version = "0.0.4"
@ -98,9 +153,26 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1aeb932158bd710538c73702db6945cb68a8fb08c519e6e12706b94263b36db8" checksum = "1aeb932158bd710538c73702db6945cb68a8fb08c519e6e12706b94263b36db8"
dependencies = [ dependencies = [
"jobserver",
"libc",
"shlex", "shlex",
] ]
[[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]] [[package]]
name = "cfg-expr" name = "cfg-expr"
version = "0.17.0" version = "0.17.0"
@ -131,12 +203,33 @@ dependencies = [
"windows-targets 0.52.6", "windows-targets 0.52.6",
] ]
[[package]]
name = "clang-sys"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
dependencies = [
"glob",
"libc",
"libloading",
]
[[package]] [[package]]
name = "color_quant" name = "color_quant"
version = "1.1.0" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
[[package]]
name = "combine"
version = "4.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd"
dependencies = [
"bytes",
"memchr",
]
[[package]] [[package]]
name = "core-foundation" name = "core-foundation"
version = "0.9.4" version = "0.9.4"
@ -189,6 +282,49 @@ dependencies = [
"libc", "libc",
] ]
[[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.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ce857aa0b77d77287acc1ac3e37a05a8c95a2af3647d23b15f263bdaeb7562b"
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",
"js-sys",
"libc",
"mach2",
"ndk",
"ndk-context",
"oboe",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"windows",
]
[[package]] [[package]]
name = "crc32fast" name = "crc32fast"
version = "1.4.2" version = "1.4.2"
@ -198,6 +334,12 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "dasp_sample"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f"
[[package]] [[package]]
name = "dirs" name = "dirs"
version = "5.0.1" version = "5.0.1"
@ -240,6 +382,12 @@ dependencies = [
"wio", "wio",
] ]
[[package]]
name = "either"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
[[package]] [[package]]
name = "equivalent" name = "equivalent"
version = "1.0.1" version = "1.0.1"
@ -260,6 +408,7 @@ name = "fft2midi"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"cairo", "cairo",
"cpal",
"gdk-pixbuf", "gdk-pixbuf",
"gtk4", "gtk4",
"libadwaita", "libadwaita",
@ -576,6 +725,12 @@ dependencies = [
"system-deps", "system-deps",
] ]
[[package]]
name = "glob"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]] [[package]]
name = "gobject-sys" name = "gobject-sys"
version = "0.20.4" version = "0.20.4"
@ -716,7 +871,7 @@ dependencies = [
"iana-time-zone-haiku", "iana-time-zone-haiku",
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",
"windows-core", "windows-core 0.52.0",
] ]
[[package]] [[package]]
@ -752,6 +907,46 @@ dependencies = [
"hashbrown", "hashbrown",
] ]
[[package]]
name = "itertools"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
dependencies = [
"either",
]
[[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",
"log",
"thiserror",
"walkdir",
"windows-sys 0.45.0",
]
[[package]]
name = "jni-sys"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
[[package]]
name = "jobserver"
version = "0.1.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "jpeg-decoder" name = "jpeg-decoder"
version = "0.3.1" version = "0.3.1"
@ -836,6 +1031,15 @@ version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
[[package]]
name = "mach2"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.7.4" version = "2.7.4"
@ -851,6 +1055,12 @@ dependencies = [
"autocfg", "autocfg",
] ]
[[package]]
name = "minimal-lexical"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]] [[package]]
name = "miniz_oxide" name = "miniz_oxide"
version = "0.8.0" version = "0.8.0"
@ -861,6 +1071,45 @@ dependencies = [
"simd-adler32", "simd-adler32",
] ]
[[package]]
name = "ndk"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7"
dependencies = [
"bitflags 2.6.0",
"jni-sys",
"log",
"ndk-sys",
"num_enum",
"thiserror",
]
[[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",
]
[[package]]
name = "nom"
version = "7.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
dependencies = [
"memchr",
"minimal-lexical",
]
[[package]] [[package]]
name = "num" name = "num"
version = "0.1.42" version = "0.1.42"
@ -897,6 +1146,17 @@ dependencies = [
"rustc-serialize", "rustc-serialize",
] ]
[[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",
]
[[package]] [[package]]
name = "num-integer" name = "num-integer"
version = "0.1.46" version = "0.1.46"
@ -938,6 +1198,50 @@ dependencies = [
"autocfg", "autocfg",
] ]
[[package]]
name = "num_enum"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179"
dependencies = [
"num_enum_derive",
]
[[package]]
name = "num_enum_derive"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "oboe"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8b61bebd49e5d43f5f8cc7ee2891c16e0f41ec7954d36bcb6c14c5e0de867fb"
dependencies = [
"jni",
"ndk",
"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]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.20.2" version = "1.20.2"
@ -1145,6 +1449,41 @@ dependencies = [
"thiserror", "thiserror",
] ]
[[package]]
name = "regex"
version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]]
name = "rustc-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]] [[package]]
name = "rustc-serialize" name = "rustc-serialize"
version = "0.3.25" version = "0.3.25"
@ -1375,6 +1714,18 @@ dependencies = [
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b"
dependencies = [
"cfg-if",
"js-sys",
"wasm-bindgen",
"web-sys",
]
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.95" version = "0.2.95"
@ -1451,6 +1802,16 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 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]] [[package]]
name = "windows-core" name = "windows-core"
version = "0.52.0" version = "0.52.0"
@ -1460,6 +1821,34 @@ dependencies = [
"windows-targets 0.52.6", "windows-targets 0.52.6",
] ]
[[package]]
name = "windows-core"
version = "0.54.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65"
dependencies = [
"windows-result",
"windows-targets 0.52.6",
]
[[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-sys"
version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
dependencies = [
"windows-targets 0.42.2",
]
[[package]] [[package]]
name = "windows-sys" name = "windows-sys"
version = "0.48.0" version = "0.48.0"
@ -1478,6 +1867,21 @@ dependencies = [
"windows-targets 0.52.6", "windows-targets 0.52.6",
] ]
[[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]] [[package]]
name = "windows-targets" name = "windows-targets"
version = "0.48.5" version = "0.48.5"
@ -1509,6 +1913,12 @@ dependencies = [
"windows_x86_64_msvc 0.52.6", "windows_x86_64_msvc 0.52.6",
] ]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
[[package]] [[package]]
name = "windows_aarch64_gnullvm" name = "windows_aarch64_gnullvm"
version = "0.48.5" version = "0.48.5"
@ -1521,6 +1931,12 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
[[package]] [[package]]
name = "windows_aarch64_msvc" name = "windows_aarch64_msvc"
version = "0.48.5" version = "0.48.5"
@ -1533,6 +1949,12 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
name = "windows_i686_gnu"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
[[package]] [[package]]
name = "windows_i686_gnu" name = "windows_i686_gnu"
version = "0.48.5" version = "0.48.5"
@ -1551,6 +1973,12 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
[[package]] [[package]]
name = "windows_i686_msvc" name = "windows_i686_msvc"
version = "0.48.5" version = "0.48.5"
@ -1563,6 +1991,12 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 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]] [[package]]
name = "windows_x86_64_gnu" name = "windows_x86_64_gnu"
version = "0.48.5" version = "0.48.5"
@ -1575,6 +2009,12 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 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]] [[package]]
name = "windows_x86_64_gnullvm" name = "windows_x86_64_gnullvm"
version = "0.48.5" version = "0.48.5"
@ -1587,6 +2027,12 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 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]] [[package]]
name = "windows_x86_64_msvc" name = "windows_x86_64_msvc"
version = "0.48.5" version = "0.48.5"

View File

@ -9,3 +9,4 @@ gdk-pixbuf = "0.20.4"
gtk = { version = "0.9.4", package = "gtk4", features = ["v4_12", "gnome_47"] } gtk = { version = "0.9.4", package = "gtk4", features = ["v4_12", "gnome_47"] }
adw = { package = "libadwaita", version = "0.7.1", features = ["v1_6"] } adw = { package = "libadwaita", version = "0.7.1", features = ["v1_6"] }
plotters = "0.3.7" plotters = "0.3.7"
cpal = "*"

View File

@ -5,4 +5,4 @@ Libraries used:
https://gtk-rs.org/gtk4-rs/git/book/hello_world.html <br> https://gtk-rs.org/gtk4-rs/git/book/hello_world.html <br>
https://docs.rs/rustfft/latest/rustfft/ <br> https://docs.rs/rustfft/latest/rustfft/ <br>
https://docs.rs/crate/midir/latest <br> https://docs.rs/crate/midir/latest <br>
https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/ https://docs.rs/cpal/latest/cpal/

13
src/audio_processor.rs Normal file
View File

@ -0,0 +1,13 @@
use cpal::traits::HostTrait;
pub struct AudioProcessor {
//selected_input_device: usize;
}
impl AudioProcessor {
fn new() -> AudioProcessor {
AudioProcessor {
// selected_input_device: cpal::
}
}
}

View File

@ -1,6 +1,9 @@
use cpal::traits::{DeviceTrait, HostTrait};
use gtk::prelude::*; use gtk::prelude::*;
use gtk::{self, glib, Application}; use gtk::{self, glib, Application};
mod graph_widget; mod graph_widget;
mod audio_processor;
const APP_ID: &str = "com.chloechristine.ftt2midi"; const APP_ID: &str = "com.chloechristine.ftt2midi";
@ -33,10 +36,18 @@ fn build_ui(app: &Application) {
.object::<gtk::MenuButton>("input_selector") .object::<gtk::MenuButton>("input_selector")
.expect("Couldn't bind to input_selector"); .expect("Couldn't bind to input_selector");
let input_selector_dropdown = builder
.object::<gtk::PopoverMenu>("input_selector_dropdown")
.expect("Couldn't bind to input_selector_dropdown");
let midi_device_selector = builder let midi_device_selector = builder
.object::<gtk::MenuButton>("midi_device_selector") .object::<gtk::MenuButton>("midi_device_selector")
.expect("Couldn't bind to midi_device_selector"); .expect("Couldn't bind to midi_device_selector");
let midi_device_selector_dropdown = builder
.object::<gtk::PopoverMenu>("midi_device_selector_dropdown")
.expect("Couldn't bind to midi_device_selector_dropdown");
let start_button = builder let start_button = builder
.object::<gtk::Button>("start_button") .object::<gtk::Button>("start_button")
.expect("Couldn't bind to start_button"); .expect("Couldn't bind to start_button");
@ -45,11 +56,41 @@ fn build_ui(app: &Application) {
fft_graph.set_height_request(500); fft_graph.set_height_request(500);
fft_graph.set_width_request(500); fft_graph.set_width_request(500);
main_grid.attach(&fft_graph, 0, 0, 1, 1); main_grid.attach(&fft_graph, 0, 0, 1, 1);
//main_grid.attach_next_to(&fft_graph, Some(&control_deck), gtk::PositionType::Top, 1, 0);
input_selector_dropdown.connect_show(move |input_selector_dropdown: &gtk::PopoverMenu| {
// Get audio interfaces and populate the menu
println!("Input selector opened");
let hosts = cpal::available_hosts();
// Build a list of input devices and populate the menu
let device_list_grid = gtk::Box::builder()
.orientation(gtk::Orientation::Vertical)
.build();
for host_id in hosts {
let host = cpal::host_from_id(host_id).expect("Failed to get host");
match host.input_devices() {
Ok(devices) => {
let default_button = gtk::Button::with_label("None Selected");
default_button.connect_clicked(move |_| {
println!("{} {}", -1, "None Selected");
});
device_list_grid.append(&default_button);
for (index, device) in devices.enumerate() {
let label = format!("{}", device.name().unwrap());
println!("{}", label);
let selection_button = gtk::Button::with_label(label.as_str());
selection_button.connect_clicked(move |_| {
println!("{} {}", index, label);
});
device_list_grid.append(&selection_button);
}
}
Err(err) => eprintln!("Error printing input devices: {:?}", err),
}
};
input_selector_dropdown.set_child(Some(&device_list_grid));
});
//start_button.connect_clicked() //start_button.connect_clicked()
window.set_application(Some(app)); window.set_application(Some(app));
// Present the window // Present the window

View File

@ -16,8 +16,8 @@
(1,7,"GtkMenuButton","midi_device_selector",3,None,None,None,3,None,None), (1,7,"GtkMenuButton","midi_device_selector",3,None,None,None,3,None,None),
(1,8,"GtkButton","start_button",3,None,None,None,4,None,None), (1,8,"GtkButton","start_button",3,None,None,None,4,None,None),
(1,9,"GtkGrid","main_grid",1,None,None,None,0,None,None), (1,9,"GtkGrid","main_grid",1,None,None,None,0,None,None),
(1,10,"GtkPopoverMenu",None,7,None,None,None,0,None,None), (1,10,"GtkPopoverMenu","midi_device_selector_dropdown",7,None,None,None,0,None,None),
(1,11,"GtkPopoverMenu",None,6,None,None,None,0,None,None) (1,11,"GtkPopoverMenu","input_selector_dropdown",6,None,None,None,0,None,None)
</object> </object>
<object_property> <object_property>
(1,1,"GtkApplicationWindow","show-menubar","True",None,None,None,None,None,None,None,None,None), (1,1,"GtkApplicationWindow","show-menubar","True",None,None,None,None,None,None,None,None,None),
@ -31,10 +31,14 @@
(1,5,"GtkWidget","margin-start","20",None,None,None,None,None,None,None,None,None), (1,5,"GtkWidget","margin-start","20",None,None,None,None,None,None,None,None,None),
(1,6,"GtkMenuButton","active","True",None,None,None,None,None,None,None,None,None), (1,6,"GtkMenuButton","active","True",None,None,None,None,None,None,None,None,None),
(1,6,"GtkMenuButton","always-show-arrow","True",None,None,None,None,None,None,None,None,None), (1,6,"GtkMenuButton","always-show-arrow","True",None,None,None,None,None,None,None,None,None),
(1,6,"GtkMenuButton","direction","right",None,None,None,None,None,None,None,None,None),
(1,6,"GtkMenuButton","icon-name","multimedia-volume-control",None,None,None,None,None,None,None,None,None), (1,6,"GtkMenuButton","icon-name","multimedia-volume-control",None,None,None,None,None,None,None,None,None),
(1,6,"GtkMenuButton","label","None Selected",None,None,None,None,None,None,None,None,None),
(1,6,"GtkMenuButton","popover",None,None,None,None,None,11,None,None,None,None), (1,6,"GtkMenuButton","popover",None,None,None,None,None,11,None,None,None,None),
(1,7,"GtkMenuButton","active","True",None,None,None,None,None,None,None,None,None), (1,7,"GtkMenuButton","active","True",None,None,None,None,None,None,None,None,None),
(1,7,"GtkMenuButton","always-show-arrow","True",None,None,None,None,None,None,None,None,None), (1,7,"GtkMenuButton","always-show-arrow","True",None,None,None,None,None,None,None,None,None),
(1,7,"GtkMenuButton","direction","right",None,None,None,None,None,None,None,None,None),
(1,7,"GtkMenuButton","label","None Selected",None,None,None,None,None,None,None,None,None),
(1,7,"GtkMenuButton","popover",None,None,None,None,None,10,None,None,None,None), (1,7,"GtkMenuButton","popover",None,None,None,None,None,10,None,None,None,None),
(1,8,"GtkButton","label","Start",None,None,None,None,None,None,None,None,None), (1,8,"GtkButton","label","Start",None,None,None,None,None,None,None,None,None),
(1,8,"GtkWidget","can-target","False",None,None,None,None,None,None,None,None,None), (1,8,"GtkWidget","can-target","False",None,None,None,None,None,None,None,None,None),
@ -44,7 +48,8 @@
(1,9,"GtkWidget","hexpand-set","True",None,None,None,None,None,None,None,None,None), (1,9,"GtkWidget","hexpand-set","True",None,None,None,None,None,None,None,None,None),
(1,9,"GtkWidget","valign","baseline-center",None,None,None,None,None,None,None,None,None), (1,9,"GtkWidget","valign","baseline-center",None,None,None,None,None,None,None,None,None),
(1,9,"GtkWidget","vexpand","True",None,None,None,None,None,None,None,None,None), (1,9,"GtkWidget","vexpand","True",None,None,None,None,None,None,None,None,None),
(1,9,"GtkWidget","vexpand-set","True",None,None,None,None,None,None,None,None,None) (1,9,"GtkWidget","vexpand-set","True",None,None,None,None,None,None,None,None,None),
(1,10,"GtkPopover","position","right",None,None,None,None,None,None,None,None,None)
</object_property> </object_property>
<object_layout_property> <object_layout_property>
(1,3,4,"GtkGridLayoutChild","column","0",None,None,None,None), (1,3,4,"GtkGridLayoutChild","column","0",None,None,None,None),

View File

@ -48,9 +48,11 @@
<object class="GtkMenuButton" id="input_selector"> <object class="GtkMenuButton" id="input_selector">
<property name="active">True</property> <property name="active">True</property>
<property name="always-show-arrow">True</property> <property name="always-show-arrow">True</property>
<property name="direction">right</property>
<property name="icon-name">multimedia-volume-control</property> <property name="icon-name">multimedia-volume-control</property>
<property name="label">None Selected</property>
<property name="popover"> <property name="popover">
<object class="GtkPopoverMenu"/> <object class="GtkPopoverMenu" id="input_selector_dropdown"/>
</property> </property>
<layout> <layout>
<property name="column">1</property> <property name="column">1</property>
@ -64,8 +66,12 @@
<object class="GtkMenuButton" id="midi_device_selector"> <object class="GtkMenuButton" id="midi_device_selector">
<property name="active">True</property> <property name="active">True</property>
<property name="always-show-arrow">True</property> <property name="always-show-arrow">True</property>
<property name="direction">right</property>
<property name="label">None Selected</property>
<property name="popover"> <property name="popover">
<object class="GtkPopoverMenu"/> <object class="GtkPopoverMenu" id="midi_device_selector_dropdown">
<property name="position">right</property>
</object>
</property> </property>
<layout> <layout>
<property name="column">1</property> <property name="column">1</property>