From 2ba1056c56435f8d98110eca18dba90dc344de66 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Wed, 01 Jul 2026 23:57:44 +0800
Subject: [PATCH] Polish Windows overlay preview
---
privatevoice.src/internal/engine/engine.go | 30 +++++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/privatevoice.src/internal/engine/engine.go b/privatevoice.src/internal/engine/engine.go
index 74a0066..aed8e7f 100755
--- a/privatevoice.src/internal/engine/engine.go
+++ b/privatevoice.src/internal/engine/engine.go
@@ -2,6 +2,7 @@
import (
"fmt"
+ "time"
"voicesnap/internal/config"
"voicesnap/internal/language"
"voicesnap/internal/logger"
@@ -17,6 +18,33 @@
// HardwareInfo returns a human-readable description of the hardware backend being used.
HardwareInfo() string
// Close releases engine resources.
+ Close()
+}
+
+// StreamingEngine is implemented by engines that can expose partial results
+// while audio is still being captured.
+type StreamingEngine interface {
+ NewStreamingSession() (StreamingSession, error)
+}
+
+// ReleaseTailCaptureEngine is implemented by engines that need a short audio
+// capture grace period after the user releases the recording hotkey.
+type ReleaseTailCaptureEngine interface {
+ ReleaseTailCaptureDelay() time.Duration
+}
+
+// HoldPreCaptureEngine is implemented by engines that should start capturing
+// audio immediately on hold-to-talk key down, before the activation delay has
+// confirmed that the hotkey was not part of a key combination.
+type HoldPreCaptureEngine interface {
+ HoldPreCaptureEnabled() bool
+}
+
+// StreamingSession receives incremental 16kHz mono PCM and returns the current
+// best transcript for the active utterance.
+type StreamingSession interface {
+ Accept(samples []float32) (string, error)
+ Finish() (string, error)
Close()
}
@@ -90,7 +118,7 @@
func isSupportedBackend(backend string) bool {
switch backend {
- case model.BackendSenseVoice, model.BackendMoonshine, model.BackendNemoTransducer, model.BackendQwen3ASR:
+ case model.BackendSenseVoice, model.BackendMoonshine, model.BackendTransducer, model.BackendNemoTransducer, model.BackendQwen3ASR, model.BackendXASRStreaming:
return true
default:
return false
--
Gitblit v1.9.3