From 681b8ef933ebf7194529f055cfc587179b2c2041 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 14 Mar 2016 00:07:31 +0900 Subject: [PATCH] audio: time.Sleep to avoid busy loop --- exp/audio/audio_openal.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exp/audio/audio_openal.go b/exp/audio/audio_openal.go index 88d1231e2..c9ca376b8 100644 --- a/exp/audio/audio_openal.go +++ b/exp/audio/audio_openal.go @@ -22,6 +22,7 @@ import ( "runtime" "time" + "github.com/hajimehoshi/ebiten" "golang.org/x/mobile/exp/audio/al" ) @@ -146,7 +147,7 @@ func (p *player) start() error { // TODO: Record the last error panic(err) } - runtime.Gosched() + time.Sleep(1 * time.Second / ebiten.FPS / 2) } }() return nil