音色可配置

This commit is contained in:
2024-11-26 17:51:40 +08:00
parent 4df77f15d9
commit aa634c8860
5 changed files with 20 additions and 5 deletions

View File

@@ -16,6 +16,7 @@ aliyun:
accessKeySecret: accessKeySecret:
appKey: appKey:
timeout: 10 # 单位 s timeout: 10 # 单位 s
voice: zhifeng_emo
game: game:
maxTimeout: 60 # 单位 s maxTimeout: 60 # 单位 s
cardGroups: cardGroups:

View File

@@ -14,6 +14,7 @@ type AliyunConfig struct {
AccessKeySecret string AccessKeySecret string
AppKey string AppKey string
Timeout int Timeout int
Voice string
} }
type GameConfig struct { type GameConfig struct {

19
game.md
View File

@@ -22,13 +22,24 @@
```json lines ```json lines
{ {
// 播放文件地址,支持 file:// 本地文件地址、 http(s):// 远程文件地址 // 播放文件地址,支持 file:// 本地文件地址、 http(s):// 远程文件地址
"video": "", "video": ""
} }
``` ```
## 神女除妖3 ## 神女除妖3
除妖处不需要任何额外的处理,待游戏自然完成即可 参照 [请求响应文档](https://www.emqx.com/zh/blog/mqtt5-request-response)
发送附带`ResponseTopic`,并订阅`ResponseTopic`,才能接收到响应结果
### RequestPayload
```json lines
{}
```
### ResponsePayload
暂时还未对接除妖设备,不知道返回的数据结构是什么
```json lines ```json lines
{} {}
@@ -36,8 +47,8 @@
## 神女授书4 ## 神女授书4
参照 [请求响应文档](https://www.emqx.com/zh/blog/mqtt5-request-response)发送附带`ResponseTopic`,并订阅`ResponseTopic` 参照 [请求响应文档](https://www.emqx.com/zh/blog/mqtt5-request-response)
,才能接收到响应结果 发送附带`ResponseTopic`,并订阅`ResponseTopic`,才能接收到响应结果
### RequestPayload ### RequestPayload

View File

@@ -28,6 +28,7 @@ func WaitCard(c *leaf.Context) {
wait.Add(1) wait.Add(1)
go func() { go func() {
defer wait.Done() defer wait.Done()
//TODO: 模拟卡片 3s 插入
time.Sleep(3 * time.Second) time.Sleep(3 * time.Second)
a <- "卡片数据" a <- "卡片数据"
}() }()

View File

@@ -71,6 +71,7 @@ func (tts *AliTTS) getToken() error {
func (tts *AliTTS) Get(text string) (io.Reader, error) { func (tts *AliTTS) Get(text string) (io.Reader, error) {
param := nls.DefaultSpeechSynthesisParam() param := nls.DefaultSpeechSynthesisParam()
param.Volume = 100 param.Volume = 100
param.Voice = tts.Voice
err := tts.getToken() err := tts.getToken()
if err != nil { if err != nil {