mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-24 18:02: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
|
||||
|
||||
case <-t:
|
||||
if len(p.buf) >= 4096*16 {
|
||||
t = time.After(10 * time.Millisecond)
|
||||
if len(p.buf) >= p.sampleRate*4 {
|
||||
t = time.After(100 * time.Millisecond)
|
||||
break
|
||||
}
|
||||
|
||||
buf := make([]byte, 4096)
|
||||
l := p.sampleRate * 4 / 60
|
||||
l &= mask
|
||||
buf := make([]byte, l)
|
||||
n, err := p.src.Read(buf)
|
||||
|
||||
p.buf = append(p.buf, buf[:n]...)
|
||||
|
Loading…
Reference in New Issue
Block a user