暂时放宽时间精度,降低cpu占有率

This commit is contained in:
flswld
2023-01-05 17:33:53 +08:00
parent ff650d9af7
commit 777d2d2257

View File

@@ -42,8 +42,8 @@ func RunPlayAudio() {
for _, event := range track {
// 单个轨道
delay := uint32(float64(event.Delta) * tickTime)
busyPoolWaitMilliSecond(delay)
// interruptWaitMilliSecond(delay)
// busyPollWaitMilliSecond(delay)
interruptWaitMilliSecond(delay)
totalTick += uint64(delay)
msg := event.Message
@@ -79,7 +79,7 @@ func interruptWaitMilliSecond(delay uint32) {
time.Sleep(time.Millisecond * time.Duration(delay))
}
func busyPoolWaitMilliSecond(delay uint32) {
func busyPollWaitMilliSecond(delay uint32) {
start := time.Now()
end := start.Add(time.Millisecond * time.Duration(delay))
for {