From b0454b874eb648a5bb630578170b17a227d91e04 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Thu, 6 Apr 2017 00:45:28 +0900 Subject: [PATCH] Fix frame counters to int64 (#337) --- audio/audio.go | 6 +++--- internal/loop/run.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/audio/audio.go b/audio/audio.go index dd000b3d1..223424bb2 100644 --- a/audio/audio.go +++ b/audio/audio.go @@ -190,8 +190,8 @@ type Context struct { players *players driver *driver.Player sampleRate int - frames int - writtenBytes int + frames int64 + writtenBytes int64 } var ( @@ -247,7 +247,7 @@ func (c *Context) Update() error { } c.frames++ bytesPerFrame := c.sampleRate * bytesPerSample * channelNum / ebiten.FPS - l := (c.frames * bytesPerFrame) - c.writtenBytes + l := (c.frames * int64(bytesPerFrame)) - c.writtenBytes l &= mask c.writtenBytes += l buf := make([]byte, l) diff --git a/internal/loop/run.go b/internal/loop/run.go index d81cc4df5..ad01bb4ed 100644 --- a/internal/loop/run.go +++ b/internal/loop/run.go @@ -32,7 +32,7 @@ type runContext struct { fps int currentFPS float64 runningSlowly bool - frames int + frames int64 lastUpdated int64 lastFPSUpdated int64 m sync.RWMutex