mirror of
https://github.com/Melorise/TamaASR.git
synced 2026-11-07 14:39:32 +00:00
整合 Linux Fcitx5 实时输入、网页后端、设置页、悬浮球、托盘和发行打包能力。 AI-assisted-by: Codex AI-model: gpt-5.6-sol AI-reasoning-effort: medium Co-authored-by: Codex <codex@openai.com>
29 lines
916 B
C
29 lines
916 B
C
#pragma once
|
|
|
|
enum class VoiceKeyAction {
|
|
Pass,
|
|
Start,
|
|
Stop,
|
|
ConsumeHeldTrigger,
|
|
Cancel,
|
|
};
|
|
|
|
inline VoiceKeyAction classifyVoiceKeyEvent(bool isRelease, bool held,
|
|
bool triggerMatches,
|
|
bool rawSymbolMatches,
|
|
bool repeat, bool modifier,
|
|
bool sessionPending) {
|
|
if (!isRelease && triggerMatches) {
|
|
return (repeat || held) ? VoiceKeyAction::ConsumeHeldTrigger
|
|
: VoiceKeyAction::Start;
|
|
}
|
|
if (held && rawSymbolMatches) {
|
|
return isRelease ? VoiceKeyAction::Stop
|
|
: VoiceKeyAction::ConsumeHeldTrigger;
|
|
}
|
|
if (!sessionPending || isRelease || modifier) {
|
|
return VoiceKeyAction::Pass;
|
|
}
|
|
return VoiceKeyAction::Cancel;
|
|
}
|