test sound

This commit is contained in:
suyl
2021-07-09 15:11:04 +08:00
parent 7076f09626
commit 4dfe19a9fb

View File

@@ -477,6 +477,9 @@ func replaceContent(content string, printMsg *model.PrintMsg) (result string) {
soundPerfix := "[" + utils.Int2Str(printer.Volume*2) + "]" + printer.Sound + ","
realSound := soundPerfix + sound
allLen := fmt.Sprintf("%x", (len("fd001a0101")+len(realSound))/2)
if len(allLen) < 2 {
allLen = "0" + allLen
}
soundLenH, soundLenX := int2h8l8(int64(len(realSound) / 2))
hexPrefix, _ := jxutils.Utf8ToGbk([]byte(soundPerfix))
result = strings.ReplaceAll(result, byteSignSound, hexSignSound+allLen+"fd"+soundLenH+soundLenX+"0101"+hex.EncodeToString(hexPrefix))