mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
audio: Make sure to fill 4096 bytes
This commit is contained in:
parent
e69b44e327
commit
c090805021
@ -89,6 +89,8 @@ func (p *player) proceed() error {
|
||||
p.position = c
|
||||
}
|
||||
b := make([]byte, bufferSize)
|
||||
for 0 < len(b) {
|
||||
print(len(b))
|
||||
n, err := p.src.Read(b)
|
||||
if 0 < n {
|
||||
const channelNum = 2
|
||||
@ -107,9 +109,14 @@ 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()
|
||||
b = b[n:]
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *player) start() error {
|
||||
// TODO: What if play is already called?
|
||||
|
Loading…
Reference in New Issue
Block a user