mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 02:42:02 +01:00
audio: Adjust buffer size
This commit is contained in:
parent
19ca74e86b
commit
a540d6b2bb
@ -476,12 +476,14 @@ func (p *Player) readLoop() {
|
|||||||
break
|
break
|
||||||
|
|
||||||
case <-t:
|
case <-t:
|
||||||
if len(p.buf) >= 4096*16 {
|
if len(p.buf) >= p.sampleRate*4 {
|
||||||
t = time.After(10 * time.Millisecond)
|
t = time.After(100 * time.Millisecond)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
buf := make([]byte, 4096)
|
l := p.sampleRate * 4 / 60
|
||||||
|
l &= mask
|
||||||
|
buf := make([]byte, l)
|
||||||
n, err := p.src.Read(buf)
|
n, err := p.src.Read(buf)
|
||||||
|
|
||||||
p.buf = append(p.buf, buf[:n]...)
|
p.buf = append(p.buf, buf[:n]...)
|
||||||
|
Loading…
Reference in New Issue
Block a user