演奏模式
热键
services/hotkey.rs 在演奏模式下注册 F1 / F2;听歌模式不保持脚本热键。RootView 根据 PlayMode 同步注册状态。事件进入 MainTask::Hotkey,由 ClxState::handle_hotkey 处理。
| 按键 | 条件与行为 |
|---|---|
| F1 | PlayMode::Script、已选曲、未在演奏弹窗中 → start_script_playback |
| F2 | 将 script_continue 置 false |
回放线程
start_script_playback:
script_continue = true,打开演奏中弹窗标志thread::spawn- 在线程内
clx_core::new_shared_enigo()(Windows 上跨线程创建 Enigo 会导致模拟失效) api::get_music_notationrun_script_notationMainTask::ScriptFinished
谱面语义
与 Tauri player.play 相同:
rust
for v in notation {
if !flag.load(Ordering::SeqCst) { break; }
if let Some(ms) = v.as_f64() { /* 亦处理 u64/i64 */
thread::sleep(Duration::from_millis(ms as u64));
} else if let Some(s) = v.as_str() {
for ch in s.chars() {
clx_core::click(&mut *enigo.lock().unwrap(), &ch.to_string())?;
}
}
}按键原语在 crates/clx-core。F 键是否需 fn 的提示文案见 core / fkey_hint。