audio: Bug fix: half volume of any sound on GopherJS

This commit is contained in:
Hajime Hoshi 2015-01-25 23:38:26 +09:00
parent d455233e32
commit 701de9f82b
2 changed files with 2 additions and 2 deletions

View File

@ -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 {

View File

@ -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)
}