aa
This commit is contained in:
@@ -475,14 +475,15 @@ func replaceContent(content string, printMsg *model.PrintMsg) (result string) {
|
|||||||
//001a (声音数据长度高八位低八位)
|
//001a (声音数据长度高八位低八位)
|
||||||
//0101 固定
|
//0101 固定
|
||||||
soundPerfix := "[" + utils.Int2Str(printer.Volume*2) + "]" + printer.Sound + ","
|
soundPerfix := "[" + utils.Int2Str(printer.Volume*2) + "]" + printer.Sound + ","
|
||||||
realSound := soundPerfix + sound
|
hexPrefix, _ := jxutils.Utf8ToGbk([]byte(soundPerfix))
|
||||||
|
hexPrefixStr := hex.EncodeToString(hexPrefix)
|
||||||
|
realSound := hexPrefixStr + sound
|
||||||
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
|
||||||
}
|
}
|
||||||
soundLenH, soundLenX := int2h8l8(int64(len(realSound) / 2))
|
soundLenH, soundLenX := int2h8l8(int64(len(realSound) + len("0101")/2))
|
||||||
hexPrefix, _ := jxutils.Utf8ToGbk([]byte(soundPerfix))
|
result = strings.ReplaceAll(result, byteSignSound, hexSignSound+allLen+"fd"+soundLenH+soundLenX+"0101"+hexPrefixStr)
|
||||||
result = strings.ReplaceAll(result, byteSignSound, hexSignSound+allLen+"fd"+soundLenH+soundLenX+"0101"+hex.EncodeToString(hexPrefix))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user