From 701de9f82bde2fdbf652c49b8f8d82cc360f2772 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 25 Jan 2015 23:38:26 +0900 Subject: [PATCH] audio: Bug fix: half volume of any sound on GopherJS --- internal/audio/audio_js.go | 2 +- internal/audio/audio_openal.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/audio/audio_js.go b/internal/audio/audio_js.go index 0dd9d7aaf..3ba89dcf3 100644 --- a/internal/audio/audio_js.go +++ b/internal/audio/audio_js.go @@ -38,7 +38,7 @@ func initialize() { r := e.Get("outputBuffer").Call("getChannelData", 1) inputL, inputR := loadChannelBuffers() nextInsertionPosition -= min(bufferSize, nextInsertionPosition) - const max = 1 << 16 + const max = 1 << 15 for i := 0; i < bufferSize; i++ { // TODO: Use copyFromChannel? if len(inputL) <= i { diff --git a/internal/audio/audio_openal.go b/internal/audio/audio_openal.go index a673f41c2..1ddf4bc92 100644 --- a/internal/audio/audio_openal.go +++ b/internal/audio/audio_openal.go @@ -31,7 +31,7 @@ func toBytes(l, r []int16) []byte { panic("len(l) must equal to len(r)") } b := &bytes.Buffer{} - for i, _ := range l { + for i := 0; i < len(l); i++ { if err := binary.Write(b, binary.LittleEndian, []int16{l[i], r[i]}); err != nil { panic(err) }