From aa634c886044f8c6b5f8dbd65177b6ce3e1a8467 Mon Sep 17 00:00:00 2001 From: mapleafgo Date: Tue, 26 Nov 2024 17:51:40 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9F=B3=E8=89=B2=E5=8F=AF=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.yml | 1 + config/config.go | 1 + game.md | 21 ++++++++++++++++----- internal/routes/play/wait_card.go | 1 + pkg/tts/aliyun.go | 1 + 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/config.yml b/config.yml index e4da68f..757aa1a 100755 --- a/config.yml +++ b/config.yml @@ -16,6 +16,7 @@ aliyun: accessKeySecret: appKey: timeout: 10 # 单位 s + voice: zhifeng_emo game: maxTimeout: 60 # 单位 s cardGroups: diff --git a/config/config.go b/config/config.go index b95bf02..1d7949b 100644 --- a/config/config.go +++ b/config/config.go @@ -14,6 +14,7 @@ type AliyunConfig struct { AccessKeySecret string AppKey string Timeout int + Voice string } type GameConfig struct { diff --git a/game.md b/game.md index 0de7655..a507947 100644 --- a/game.md +++ b/game.md @@ -22,13 +22,24 @@ ```json lines { // 播放文件地址,支持 file:// 本地文件地址、 http(s):// 远程文件地址 - "video": "", + "video": "" } ``` ## 神女除妖(3) -除妖处不需要任何额外的处理,待游戏自然完成即可 +参照 [请求响应文档](https://www.emqx.com/zh/blog/mqtt5-request-response), +发送附带`ResponseTopic`,并订阅`ResponseTopic`,才能接收到响应结果 + +### RequestPayload + +```json lines +{} +``` + +### ResponsePayload + +暂时还未对接除妖设备,不知道返回的数据结构是什么 ```json lines {} @@ -36,8 +47,8 @@ ## 神女授书(4) -参照 [请求响应文档](https://www.emqx.com/zh/blog/mqtt5-request-response),发送附带`ResponseTopic`,并订阅`ResponseTopic` -,才能接收到响应结果 +参照 [请求响应文档](https://www.emqx.com/zh/blog/mqtt5-request-response), +发送附带`ResponseTopic`,并订阅`ResponseTopic`,才能接收到响应结果 ### RequestPayload @@ -78,4 +89,4 @@ } ``` -`wait_card` 为等待插卡的时长,超过时长将直接结束且没有任何现场效果。`wait` 为插卡后持续的现场效果时间。 \ No newline at end of file +`wait_card` 为等待插卡的时长,超过时长将直接结束且没有任何现场效果。`wait` 为插卡后持续的现场效果时间。 diff --git a/internal/routes/play/wait_card.go b/internal/routes/play/wait_card.go index ff400f2..7b53bab 100644 --- a/internal/routes/play/wait_card.go +++ b/internal/routes/play/wait_card.go @@ -28,6 +28,7 @@ func WaitCard(c *leaf.Context) { wait.Add(1) go func() { defer wait.Done() + //TODO: 模拟卡片 3s 插入 time.Sleep(3 * time.Second) a <- "卡片数据" }() diff --git a/pkg/tts/aliyun.go b/pkg/tts/aliyun.go index 7a8c543..c9ae784 100644 --- a/pkg/tts/aliyun.go +++ b/pkg/tts/aliyun.go @@ -71,6 +71,7 @@ func (tts *AliTTS) getToken() error { func (tts *AliTTS) Get(text string) (io.Reader, error) { param := nls.DefaultSpeechSynthesisParam() param.Volume = 100 + param.Voice = tts.Voice err := tts.getToken() if err != nil {