Skip to content

Commit

Permalink
Merge pull request #1 from highras/myc-dev
Browse files Browse the repository at this point in the history
add param srcAltLauguage
  • Loading branch information
yachuangmi authored Jan 6, 2025
2 parents 10b39e8 + 808b097 commit a06f126
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion docs/interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (client *RTVTClient) Login(pid int32, timestamp int64, token string) bool
# StartTranslate

```go
func (client *RTVTClient) StartTranslate(asrResult bool, tempResult bool, transResult bool, srcLanguage string, destLanguage string, userId string, vadSlienceTime int64, codec AudioCodec) (int64, error)
func (client *RTVTClient) StartTranslate(asrResult bool, tempResult bool, transResult bool, srcLanguage string, srcAltLauguage []string, destLanguage string, userId string, vadSlienceTime int64, codec AudioCodec) (int64, error)
```


Expand All @@ -37,6 +37,7 @@ func (client *RTVTClient) StartTranslate(asrResult bool, tempResult bool, transR
| tempResult | if both asrResult and temp Result are true. you can get the recognize temp result. If both tempResult and transResult are true, you can get the translate temp result. |
| transResult | if true, you can get the translate result. |
| srcLanguage | source language |
| srcAltLanguage | alternative languages |
| destLanguage | destination language |
| userId | user id, can be empty |
| vadSlienceTime | vad time. -1 means not use vad cut. 200-2000 means use the vad cut sentence. (milliseconds) |
Expand Down
4 changes: 3 additions & 1 deletion examples/rtvt.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ func main() {
if !succ {
return
}
streamId, _ := rtvtClient.StartTranslate(true, true, true, "zh", "en", "go test user", 2000, rtvt.PCM)

lauguagesArray := []string{"ja", "es"}
streamId, _ := rtvtClient.StartTranslate(true, true, true, "zh", lauguagesArray, "en", "go test user", 2000, rtvt.PCM)
ticker := time.NewTicker(20 * time.Millisecond)
wg := sync.WaitGroup{}
wg.Add(1)
Expand Down
7 changes: 4 additions & 3 deletions rtvtClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ func (client *RTVTClient) Login(pid int32, timestamp int64, token string) (bool,
return true, nil
}

func (client *RTVTClient) voiceStart(asrResult bool, tempResult bool, transResult bool, ttsResult bool, srcLanguage string, destLanguage string, userId string, ttsSpeaker string, vadSlienceTime int64, codec AudioCodec) (int64, error) {
func (client *RTVTClient) voiceStart(asrResult bool, tempResult bool, transResult bool, ttsResult bool, srcLanguage string, srcAltLanguage []string, destLanguage string, userId string, ttsSpeaker string, vadSlienceTime int64, codec AudioCodec) (int64, error) {
quest := fpnn.NewQuest("voiceStart")
quest.Param("asrResult", asrResult)
quest.Param("asrTempResult", tempResult)
quest.Param("transResult", transResult)
quest.Param("ttsResult", ttsResult)
quest.Param("srcLanguage", srcLanguage)
quest.Param("srcAltLanguage", srcAltLanguage)
quest.Param("destLanguage", destLanguage)
quest.Param("userId", userId)
quest.Param("ttsSpeaker", ttsSpeaker)
Expand Down Expand Up @@ -148,11 +149,11 @@ func (client *RTVTClient) voiceEnd(streamId int64) error {
return nil
}

func (client *RTVTClient) StartTranslate(asrResult bool, tempResult bool, transResult bool, srcLanguage string, destLanguage string, userId string, vadSlienceTime int64, codec AudioCodec) (int64, error) {
func (client *RTVTClient) StartTranslate(asrResult bool, tempResult bool, transResult bool, srcLanguage string, srcAltLanguage []string, destLanguage string, userId string, vadSlienceTime int64, codec AudioCodec) (int64, error) {
if vadSlienceTime > 2000 || (vadSlienceTime < 20 && vadSlienceTime != -1) {
return 0, ErrFooInvalidVadSlienceTime
}
return client.voiceStart(asrResult, tempResult, transResult, false, srcLanguage, destLanguage, userId, "", vadSlienceTime, codec)
return client.voiceStart(asrResult, tempResult, transResult, false, srcLanguage, srcAltLanguage, destLanguage, userId, "", vadSlienceTime, codec)
}

func (client *RTVTClient) SendData(streamId int64, data []byte, seq int64, timestamp int64) error {
Expand Down

0 comments on commit a06f126

Please sign in to comment.