mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 12:08:58 +01:00
clock: Make ProceedAudioTimer take a number of frames
This commit is contained in:
parent
d12a3d4073
commit
d5d5ebb0b3
@ -260,10 +260,7 @@ func (c *Context) loop() {
|
|||||||
|
|
||||||
written += int64(n)
|
written += int64(n)
|
||||||
fs := written/int64(bytesPerFrame) - prevWritten/int64(bytesPerFrame)
|
fs := written/int64(bytesPerFrame) - prevWritten/int64(bytesPerFrame)
|
||||||
for fs > 0 {
|
clock.ProceedAudioTimer(fs)
|
||||||
clock.ProceedAudioTimer()
|
|
||||||
fs--
|
|
||||||
}
|
|
||||||
prevWritten = written
|
prevWritten = written
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,10 +66,10 @@ func RegisterPing(pingFunc func()) {
|
|||||||
m.Unlock()
|
m.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProceedAudioTimer increments the audio time by a frame.
|
// ProceedAudioTimer increments the audio time by the given number of frames.
|
||||||
func ProceedAudioTimer() {
|
func ProceedAudioTimer(num int64) {
|
||||||
m.Lock()
|
m.Lock()
|
||||||
audioTimeInFrames++
|
audioTimeInFrames += num
|
||||||
m.Unlock()
|
m.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user