mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-03-01 00:35:36 +08:00
暂时放宽时间精度,降低cpu占有率
This commit is contained in:
@@ -42,8 +42,8 @@ func RunPlayAudio() {
|
|||||||
for _, event := range track {
|
for _, event := range track {
|
||||||
// 单个轨道
|
// 单个轨道
|
||||||
delay := uint32(float64(event.Delta) * tickTime)
|
delay := uint32(float64(event.Delta) * tickTime)
|
||||||
busyPoolWaitMilliSecond(delay)
|
// busyPollWaitMilliSecond(delay)
|
||||||
// interruptWaitMilliSecond(delay)
|
interruptWaitMilliSecond(delay)
|
||||||
totalTick += uint64(delay)
|
totalTick += uint64(delay)
|
||||||
|
|
||||||
msg := event.Message
|
msg := event.Message
|
||||||
@@ -79,7 +79,7 @@ func interruptWaitMilliSecond(delay uint32) {
|
|||||||
time.Sleep(time.Millisecond * time.Duration(delay))
|
time.Sleep(time.Millisecond * time.Duration(delay))
|
||||||
}
|
}
|
||||||
|
|
||||||
func busyPoolWaitMilliSecond(delay uint32) {
|
func busyPollWaitMilliSecond(delay uint32) {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
end := start.Add(time.Millisecond * time.Duration(delay))
|
end := start.Add(time.Millisecond * time.Duration(delay))
|
||||||
for {
|
for {
|
||||||
|
|||||||
Reference in New Issue
Block a user