语音修改
This commit is contained in:
@@ -504,22 +504,20 @@ func replaceContent(content string, printMsg *model.PrintMsg) (result string) {
|
|||||||
int16Sound := strconv.FormatInt(intSound, 16)
|
int16Sound := strconv.FormatInt(intSound, 16)
|
||||||
voice += int16Sound
|
voice += int16Sound
|
||||||
}
|
}
|
||||||
voiceDataGBK, _ := jxutils.Utf8ToGbk([]byte(replaceContentOther(voice)))
|
voiceDataGBK, _ := jxutils.Utf8ToGbk([]byte(voice))
|
||||||
voiceData := hex.EncodeToString(voiceDataGBK)
|
voiceData := hex.EncodeToString(voiceDataGBK)
|
||||||
globals.SugarLogger.Debug("voice============", voiceData)
|
|
||||||
|
|
||||||
|
//[8]sounda14 ->5b385d736f756e64613134
|
||||||
realSound := hexPrefixStr + voiceData
|
realSound := hexPrefixStr + voiceData
|
||||||
allLen := fmt.Sprintf("%x", (len("fd001a0101")+len(realSound))/2)
|
allLen := fmt.Sprintf("%x", (len("fd001a0101")+len(realSound))/2)
|
||||||
if len(allLen) < 2 {
|
if len(allLen) < 2 {
|
||||||
allLen = "0" + allLen
|
allLen = "0" + allLen
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debug("realSound============", realSound)
|
|
||||||
globals.SugarLogger.Debug("allLen============", allLen)
|
|
||||||
|
|
||||||
soundLenH, soundLenX := int2h8l8(int64((len(realSound) + len("0101")) / 2))
|
//soundLenH, soundLenX := int2h8l8(int64((len(realSound) + len("0101")) / 2))
|
||||||
globals.SugarLogger.Debug("result1============", result)
|
//result = strings.ReplaceAll(result, byteSignSound, hexSignSound+allLen+"fd"+soundLenH+soundLenX+"0100"+hexPrefixStr)
|
||||||
result = strings.ReplaceAll(result, byteSignSound, hexSignSound+allLen+"fd"+soundLenH+soundLenX+"0100"+hexPrefixStr)
|
result = strings.ReplaceAll(result, byteSignSound, hexSignSound+allLen+hexPrefixStr)
|
||||||
globals.SugarLogger.Debug("result2============", result)
|
result = strings.ReplaceAll(result, byteSignSoundE, "")
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package event
|
|||||||
import (
|
import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"strconv"
|
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -34,5 +34,11 @@ func TestDC(t *testing.T) {
|
|||||||
|
|
||||||
// 十进制字符串转十六进制
|
// 十进制字符串转十六进制
|
||||||
func Test10Two16(t *testing.T) {
|
func Test10Two16(t *testing.T) {
|
||||||
fmt.Println(strconv.FormatInt(11, 16)) // 2 to 10
|
//fmt.Println(strconv.FormatInt(11, 16)) // 2 to 10
|
||||||
|
//for _, v := range strings.Split("324c", "d") {
|
||||||
|
// fmt.Println(v)
|
||||||
|
//}
|
||||||
|
hexPrefix, _ := jxutils.Utf8ToGbk([]byte("[8]sounda14"))
|
||||||
|
hexPrefixStr := hex.EncodeToString(hexPrefix)
|
||||||
|
fmt.Println(hexPrefixStr)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user