From e69b44e327abaaf40d64d2166991f1a5d3ddb237 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 5 Mar 2016 23:01:13 +0900 Subject: [PATCH] audio: Refactoring --- exp/audio/audio_js.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exp/audio/audio_js.go b/exp/audio/audio_js.go index 23d9d74a3..297da875c 100644 --- a/exp/audio/audio_js.go +++ b/exp/audio/audio_js.go @@ -85,6 +85,9 @@ func (p *player) proceed() error { if c < p.position-bufferSize*0.5/float64(p.sampleRate) { return nil } + if p.position < c { + p.position = c + } b := make([]byte, bufferSize) n, err := p.src.Read(b) if 0 < n { @@ -104,9 +107,6 @@ func (p *player) proceed() error { p.bufferSource.Call("connect", p.context.Get("destination")) p.bufferSource.Call("start", maxF(p.position, c)) p.position += buf.Get("duration").Float() - if p.position < c { - p.position = c - } } return err }