mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
audio: Bug fix: half volume of any sound on GopherJS
This commit is contained in:
parent
d455233e32
commit
701de9f82b
@ -38,7 +38,7 @@ func initialize() {
|
|||||||
r := e.Get("outputBuffer").Call("getChannelData", 1)
|
r := e.Get("outputBuffer").Call("getChannelData", 1)
|
||||||
inputL, inputR := loadChannelBuffers()
|
inputL, inputR := loadChannelBuffers()
|
||||||
nextInsertionPosition -= min(bufferSize, nextInsertionPosition)
|
nextInsertionPosition -= min(bufferSize, nextInsertionPosition)
|
||||||
const max = 1 << 16
|
const max = 1 << 15
|
||||||
for i := 0; i < bufferSize; i++ {
|
for i := 0; i < bufferSize; i++ {
|
||||||
// TODO: Use copyFromChannel?
|
// TODO: Use copyFromChannel?
|
||||||
if len(inputL) <= i {
|
if len(inputL) <= i {
|
||||||
|
@ -31,7 +31,7 @@ func toBytes(l, r []int16) []byte {
|
|||||||
panic("len(l) must equal to len(r)")
|
panic("len(l) must equal to len(r)")
|
||||||
}
|
}
|
||||||
b := &bytes.Buffer{}
|
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 {
|
if err := binary.Write(b, binary.LittleEndian, []int16{l[i], r[i]}); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user