mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +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) {
|
if c < p.position-bufferSize*0.5/float64(p.sampleRate) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if p.position < c {
|
||||||
|
p.position = c
|
||||||
|
}
|
||||||
b := make([]byte, bufferSize)
|
b := make([]byte, bufferSize)
|
||||||
n, err := p.src.Read(b)
|
n, err := p.src.Read(b)
|
||||||
if 0 < n {
|
if 0 < n {
|
||||||
@ -104,9 +107,6 @@ func (p *player) proceed() error {
|
|||||||
p.bufferSource.Call("connect", p.context.Get("destination"))
|
p.bufferSource.Call("connect", p.context.Get("destination"))
|
||||||
p.bufferSource.Call("start", maxF(p.position, c))
|
p.bufferSource.Call("start", maxF(p.position, c))
|
||||||
p.position += buf.Get("duration").Float()
|
p.position += buf.Get("duration").Float()
|
||||||
if p.position < c {
|
|
||||||
p.position = c
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user