mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-13 12:32:05 +01:00
audio: Use io.CopyN
This commit is contained in:
parent
a74cf21f21
commit
5679103d71
@ -259,14 +259,8 @@ func (c *Context) loop() {
|
|||||||
c.pingCount--
|
c.pingCount--
|
||||||
c.m.Unlock()
|
c.m.Unlock()
|
||||||
|
|
||||||
buf := make([]byte, 4096)
|
const n = 4096
|
||||||
n, err := c.players.Read(buf)
|
if _, err = io.CopyN(p, c.players, n); err != nil {
|
||||||
if err != nil {
|
|
||||||
audiobinding.SetError(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err = p.Write(buf[:n]); err != nil {
|
|
||||||
audiobinding.SetError(err)
|
audiobinding.SetError(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user