mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +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.m.Unlock()
|
||||
|
||||
buf := make([]byte, 4096)
|
||||
n, err := c.players.Read(buf)
|
||||
if err != nil {
|
||||
audiobinding.SetError(err)
|
||||
return
|
||||
}
|
||||
|
||||
if _, err = p.Write(buf[:n]); err != nil {
|
||||
const n = 4096
|
||||
if _, err = io.CopyN(p, c.players, n); err != nil {
|
||||
audiobinding.SetError(err)
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user