diff --git a/backend/src/init.rs b/backend/src/init.rs index fad3909d4..78088899e 100644 --- a/backend/src/init.rs +++ b/backend/src/init.rs @@ -4,12 +4,14 @@ use std::process::Stdio; use std::time::Duration; use color_eyre::eyre::eyre; +use helpers::NonDetachingJoinHandle; use patch_db::{DbHandle, LockReceipt, LockType}; use tokio::process::Command; use crate::context::rpc::RpcContextConfig; use crate::db::model::ServerStatus; use crate::install::PKG_DOCKER_DIR; +use crate::sound::CIRCLE_OF_5THS_SHORT; use crate::util::Invoke; use crate::version::VersionT; use crate::Error; @@ -196,6 +198,17 @@ pub async fn init(cfg: &RpcContextConfig) -> Result { || &*receipts.server_version.get(&mut handle).await? < &crate::version::Current::new().semver(); + let song = if should_rebuild { + Some(NonDetachingJoinHandle::from(tokio::spawn(async { + loop { + CIRCLE_OF_5THS_SHORT.play().await.unwrap(); + tokio::time::sleep(Duration::from_secs(10)).await; + } + }))) + } else { + None + }; + let log_dir = cfg.datadir().join("main/logs"); if tokio::fs::metadata(&log_dir).await.is_err() { tokio::fs::create_dir_all(&log_dir).await?; @@ -331,6 +344,8 @@ pub async fn init(cfg: &RpcContextConfig) -> Result { }?; } + drop(song); + tracing::info!("System initialized."); Ok(InitResult { db }) diff --git a/backend/src/sound.rs b/backend/src/sound.rs index f78a4627b..83cb542bf 100644 --- a/backend/src/sound.rs +++ b/backend/src/sound.rs @@ -109,8 +109,8 @@ impl SoundInterface { } pub struct Song { - tempo_qpm: u16, - note_sequence: Notes, + pub tempo_qpm: u16, + pub note_sequence: Notes, } impl<'a, T> Song where @@ -157,8 +157,8 @@ impl Drop for SoundInterface { #[derive(Debug, Clone, Copy, PartialEq, Eq, Arbitrary)] pub struct Note { - semitone: Semitone, - octave: i8, + pub semitone: Semitone, + pub octave: i8, } impl Note { pub fn frequency(&self) -> f64 { diff --git a/system-images/compat/Cargo.lock b/system-images/compat/Cargo.lock index 84f6787b9..dd0531638 100644 --- a/system-images/compat/Cargo.lock +++ b/system-images/compat/Cargo.lock @@ -177,17 +177,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "barrage" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be5951c75bdabb58753d140dd5802f12ff3a483cb2e16fb5276e111b94b19e87" -dependencies = [ - "concurrent-queue", - "event-listener", - "spin 0.9.3", -] - [[package]] name = "base32" version = "0.4.0" @@ -406,12 +395,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" -[[package]] -name = "cache-padded" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" - [[package]] name = "cc" version = "1.0.73" @@ -569,15 +552,6 @@ dependencies = [ "serde_yaml 0.8.25", ] -[[package]] -name = "concurrent-queue" -version = "1.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c" -dependencies = [ - "cache-padded", -] - [[package]] name = "const-oid" version = "0.9.0" @@ -2486,7 +2460,6 @@ name = "patch-db" version = "0.1.0" dependencies = [ "async-trait", - "barrage", "fd-lock-rs", "futures", "imbl 1.0.1", @@ -3035,7 +3008,7 @@ dependencies = [ "cc", "libc", "once_cell", - "spin 0.5.2", + "spin", "untrusted", "web-sys", "winapi", @@ -3515,12 +3488,6 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" -[[package]] -name = "spin" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c530c2b0d0bf8b69304b39fe2001993e267461948b890cd037d8ad4293fa1a0d" - [[package]] name = "spki" version = "0.6.0"