Skip to content

Commit 6eb3c35

Browse files
committed
fix: update piaudio.Time faster
Update piaudio.Time faster to limit audio synchronization issues.
1 parent 434b3d6 commit 6eb3c35

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

piebiten/internal/audio.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,16 +248,12 @@ func (p *player) Read(out []byte) (n int, err error) {
248248
defer p.mutex.Unlock()
249249

250250
n = len(out)
251+
p.time <- p.currentTime + sampleTime*float64(n)
251252

252253
for i := 0; i < n; i += 4 {
253254
p.currentTime += sampleTime
254255
p.runCommands()
255256
p.read(out[i : i+4])
256-
257-
if i%1764 == 0 {
258-
// update time each 10ms
259-
p.time <- p.currentTime
260-
}
261257
}
262258

263259
return

0 commit comments

Comments
 (0)