Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
149
Cargo.lock
generated
149
Cargo.lock
generated
@@ -240,16 +240,6 @@ dependencies = [
|
|||||||
"cc",
|
"cc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "colored"
|
|
||||||
version = "2.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
|
|
||||||
dependencies = [
|
|
||||||
"lazy_static",
|
|
||||||
"windows-sys 0.52.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "combine"
|
name = "combine"
|
||||||
version = "4.6.7"
|
version = "4.6.7"
|
||||||
@@ -279,16 +269,6 @@ dependencies = [
|
|||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "console_log"
|
|
||||||
version = "1.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "be8aed40e4edbf4d3b4431ab260b63fdc40f5780a4766824329ea0f1eefe3c0f"
|
|
||||||
dependencies = [
|
|
||||||
"log",
|
|
||||||
"web-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "core-foundation"
|
name = "core-foundation"
|
||||||
version = "0.9.4"
|
version = "0.9.4"
|
||||||
@@ -411,15 +391,6 @@ 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 = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f"
|
checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "deranged"
|
|
||||||
version = "0.5.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c"
|
|
||||||
dependencies = [
|
|
||||||
"powerfmt",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dispatch"
|
name = "dispatch"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
@@ -538,7 +509,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -559,16 +530,6 @@ dependencies = [
|
|||||||
"simd-adler32",
|
"simd-adler32",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "fern"
|
|
||||||
version = "0.7.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4316185f709b23713e41e3195f90edef7fb00c3ed4adc79769cf09cc762a3b29"
|
|
||||||
dependencies = [
|
|
||||||
"colored",
|
|
||||||
"log",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "find-msvc-tools"
|
name = "find-msvc-tools"
|
||||||
version = "0.1.9"
|
version = "0.1.9"
|
||||||
@@ -729,11 +690,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
|
checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"js-sys",
|
|
||||||
"libc",
|
"libc",
|
||||||
"r-efi",
|
"r-efi",
|
||||||
"wasip2",
|
"wasip2",
|
||||||
"wasm-bindgen",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1291,10 +1250,8 @@ dependencies = [
|
|||||||
"notan_glyph",
|
"notan_glyph",
|
||||||
"notan_graphics",
|
"notan_graphics",
|
||||||
"notan_input",
|
"notan_input",
|
||||||
"notan_log",
|
|
||||||
"notan_macro",
|
"notan_macro",
|
||||||
"notan_math",
|
"notan_math",
|
||||||
"notan_random",
|
|
||||||
"notan_text",
|
"notan_text",
|
||||||
"notan_utils",
|
"notan_utils",
|
||||||
]
|
]
|
||||||
@@ -1425,21 +1382,6 @@ dependencies = [
|
|||||||
"notan_math",
|
"notan_math",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "notan_log"
|
|
||||||
version = "0.14.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2f2cb4b9804e0718e910ff0653463126a930d3a4017dc356ee8d0b2f700e8f50"
|
|
||||||
dependencies = [
|
|
||||||
"console_log",
|
|
||||||
"fern",
|
|
||||||
"js-sys",
|
|
||||||
"log",
|
|
||||||
"notan_app",
|
|
||||||
"time",
|
|
||||||
"wasm-bindgen",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "notan_macro"
|
name = "notan_macro"
|
||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
@@ -1464,17 +1406,6 @@ dependencies = [
|
|||||||
"glam",
|
"glam",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "notan_random"
|
|
||||||
version = "0.14.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "eec9025695fc94bcb967f0f64a7192b27f2ffb9d52036c2dc0a43b13941c2dcb"
|
|
||||||
dependencies = [
|
|
||||||
"getrandom",
|
|
||||||
"rand",
|
|
||||||
"rand_pcg",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "notan_text"
|
name = "notan_text"
|
||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
@@ -1569,12 +1500,6 @@ dependencies = [
|
|||||||
"num-traits",
|
"num-traits",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num-conv"
|
|
||||||
version = "0.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c6673768db2d862beb9b39a78fdcb1a69439615d5794a1be50caa9bc92c81967"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-integer"
|
name = "num-integer"
|
||||||
version = "0.1.46"
|
version = "0.1.46"
|
||||||
@@ -1638,15 +1563,6 @@ dependencies = [
|
|||||||
"syn 2.0.117",
|
"syn 2.0.117",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num_threads"
|
|
||||||
version = "0.1.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "objc-sys"
|
name = "objc-sys"
|
||||||
version = "0.3.5"
|
version = "0.3.5"
|
||||||
@@ -2033,12 +1949,6 @@ dependencies = [
|
|||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "powerfmt"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ppv-lite86"
|
name = "ppv-lite86"
|
||||||
version = "0.2.21"
|
version = "0.2.21"
|
||||||
@@ -2131,15 +2041,6 @@ dependencies = [
|
|||||||
"getrandom",
|
"getrandom",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rand_pcg"
|
|
||||||
version = "0.9.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b48ac3f7ffaab7fac4d2376632268aa5f89abdb55f7ebf8f4d11fffccb2320f7"
|
|
||||||
dependencies = [
|
|
||||||
"rand_core",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "raw-window-handle"
|
name = "raw-window-handle"
|
||||||
version = "0.6.2"
|
version = "0.6.2"
|
||||||
@@ -2224,7 +2125,7 @@ dependencies = [
|
|||||||
"errno",
|
"errno",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys 0.4.15",
|
"linux-raw-sys 0.4.15",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2237,7 +2138,7 @@ dependencies = [
|
|||||||
"errno",
|
"errno",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys 0.12.1",
|
"linux-raw-sys 0.12.1",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2543,39 +2444,6 @@ dependencies = [
|
|||||||
"syn 2.0.117",
|
"syn 2.0.117",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "time"
|
|
||||||
version = "0.3.47"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c"
|
|
||||||
dependencies = [
|
|
||||||
"deranged",
|
|
||||||
"itoa",
|
|
||||||
"libc",
|
|
||||||
"num-conv",
|
|
||||||
"num_threads",
|
|
||||||
"powerfmt",
|
|
||||||
"serde_core",
|
|
||||||
"time-core",
|
|
||||||
"time-macros",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "time-core"
|
|
||||||
version = "0.1.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "time-macros"
|
|
||||||
version = "0.2.27"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215"
|
|
||||||
dependencies = [
|
|
||||||
"num-conv",
|
|
||||||
"time-core",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tiny-skia"
|
name = "tiny-skia"
|
||||||
version = "0.11.4"
|
version = "0.11.4"
|
||||||
@@ -2898,7 +2766,7 @@ version = "0.1.11"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2916,6 +2784,15 @@ dependencies = [
|
|||||||
"windows-targets",
|
"windows-targets",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.59.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-sys"
|
name = "windows-sys"
|
||||||
version = "0.61.2"
|
version = "0.61.2"
|
||||||
|
|||||||
@@ -5,6 +5,6 @@ edition = "2024"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.102"
|
anyhow = "1.0.102"
|
||||||
notan = "0.14.0"
|
notan = { version = "0.14.0", default-features = false, features = ["backend", "draw", "shaderc"] }
|
||||||
midly = "0.5.3"
|
midly = "0.5.3"
|
||||||
serialport = "4.9.0"
|
serialport = "4.9.0"
|
||||||
|
|||||||
@@ -63,6 +63,7 @@
|
|||||||
commonBuildInputs = with pkgs;
|
commonBuildInputs = with pkgs;
|
||||||
[
|
[
|
||||||
openssl
|
openssl
|
||||||
|
shaderc
|
||||||
]
|
]
|
||||||
++ pkgs.lib.optionals (!isDarwin) (
|
++ pkgs.lib.optionals (!isDarwin) (
|
||||||
[
|
[
|
||||||
@@ -75,6 +76,7 @@
|
|||||||
commonNativeBuildInputs = with pkgs; [
|
commonNativeBuildInputs = with pkgs; [
|
||||||
pkg-config
|
pkg-config
|
||||||
cmake
|
cmake
|
||||||
|
git
|
||||||
python312
|
python312
|
||||||
makeWrapper
|
makeWrapper
|
||||||
];
|
];
|
||||||
|
|||||||
BIN
src/assets/Ubuntu-B.ttf
Normal file
BIN
src/assets/Ubuntu-B.ttf
Normal file
Binary file not shown.
20
src/main.rs
20
src/main.rs
@@ -170,18 +170,23 @@ struct SingerApp {
|
|||||||
tx: Sender<SerialCommand>,
|
tx: Sender<SerialCommand>,
|
||||||
rx: Receiver<SerialStatus>,
|
rx: Receiver<SerialStatus>,
|
||||||
connected: Option<String>,
|
connected: Option<String>,
|
||||||
|
font: Font,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SingerApp {
|
impl SingerApp {
|
||||||
pub fn new() -> Self {
|
pub fn new(gfx: &mut Graphics) -> Self {
|
||||||
let (tx_cmd, rx_cmd) = mpsc::channel();
|
let (tx_cmd, rx_cmd) = mpsc::channel();
|
||||||
let (tx_status, rx_status) = mpsc::channel();
|
let (tx_status, rx_status) = mpsc::channel();
|
||||||
Self::spawn_serial_worker(rx_cmd, tx_status);
|
Self::spawn_serial_worker(rx_cmd, tx_status);
|
||||||
|
let font = gfx
|
||||||
|
.create_font(include_bytes!("assets/Ubuntu-B.ttf"))
|
||||||
|
.expect("failed to load embedded font");
|
||||||
Self {
|
Self {
|
||||||
song_state: None,
|
song_state: None,
|
||||||
tx: tx_cmd,
|
tx: tx_cmd,
|
||||||
rx: rx_status,
|
rx: rx_status,
|
||||||
connected: None,
|
connected: None,
|
||||||
|
font,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,12 +266,21 @@ impl SingerApp {
|
|||||||
};
|
};
|
||||||
draw.rect((14.0, 14.0), (20.0, 20.0)).color(status_color);
|
draw.rect((14.0, 14.0), (20.0, 20.0)).color(status_color);
|
||||||
|
|
||||||
|
let status_text = match &self.connected {
|
||||||
|
Some(name) => format!("Serial connected: {name}"),
|
||||||
|
None => "Serial disconnected".to_string(),
|
||||||
|
};
|
||||||
|
draw.text(&self.font, &status_text)
|
||||||
|
.position(44.0, 30.0)
|
||||||
|
.size(22.0)
|
||||||
|
.color(Color::BLACK);
|
||||||
|
|
||||||
gfx.render(&draw);
|
gfx.render(&draw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn setup(_gfx: &mut Graphics) -> SingerApp {
|
fn setup(gfx: &mut Graphics) -> SingerApp {
|
||||||
SingerApp::new()
|
SingerApp::new(gfx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(_app: &mut notan::app::App, state: &mut SingerApp) {
|
fn update(_app: &mut notan::app::App, state: &mut SingerApp) {
|
||||||
|
|||||||
Reference in New Issue
Block a user