待机功能基本实现

This commit is contained in:
2024-11-06 15:44:35 +08:00
parent 8e2bf7f59b
commit ab0678aa3b
14 changed files with 317 additions and 151 deletions

View File

@@ -7,17 +7,17 @@ import (
)
// SoundStart 开始词播报
func SoundStart(t *tts.AliTTS) leaf.HandlerFunc {
func SoundStart() leaf.HandlerFunc {
return func(c *leaf.Context) {
pm := leaf.Value[*schema.PlayModal](c, PayloadJSONKey)
t.Sound(pm.TTS.Start)
tts.DefaultTTS.Sound(pm.TTS.Start)
defer func() {
switch leaf.Value[leaf.EndType](c, leaf.EndKey) {
case leaf.EndTimer:
t.Sound(pm.TTS.End)
tts.DefaultTTS.Sound(pm.TTS.End)
case leaf.EndStop:
t.Sound(pm.TTS.Stop)
tts.DefaultTTS.Sound(pm.TTS.Stop)
}
}()