mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
audio: Refactoring
This commit is contained in:
parent
8631fbc027
commit
e69b44e327
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user