mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
audio: Refactoring: Remove unneeded for loop
This commit is contained in:
parent
7aaa599f6b
commit
1313644611
@ -81,7 +81,6 @@ func (p *player) proceed() error {
|
||||
p.positionInSamples = c
|
||||
}
|
||||
b := make([]byte, bufferSize)
|
||||
for 0 < len(b) {
|
||||
n, err := p.src.Read(b)
|
||||
if 0 < n {
|
||||
const channelNum = 2
|
||||
@ -98,17 +97,11 @@ func (p *player) proceed() error {
|
||||
p.bufferSource = p.context.Call("createBufferSource")
|
||||
p.bufferSource.Set("buffer", buf)
|
||||
p.bufferSource.Call("connect", p.context.Get("destination"))
|
||||
p.bufferSource.Call("start", float64(max64(p.positionInSamples, c))/float64(p.sampleRate))
|
||||
p.bufferSource.Call("start", float64(p.positionInSamples)/float64(p.sampleRate))
|
||||
p.positionInSamples += int64(len(il))
|
||||
b = b[n:]
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
runtime.Gosched()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *player) start() error {
|
||||
// TODO: What if play is already called?
|
||||
|
Loading…
Reference in New Issue
Block a user