mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 20:18:59 +01:00
audio/mp3: Bug fix: ArrayBuffer in the backend can be different from Uint8Array range
This commit is contained in:
parent
4c70ad382d
commit
baee2ba4c9
@ -186,7 +186,10 @@ func decode(context *audio.Context, buf []byte, try int) (*Stream, error) {
|
||||
|
||||
// TODO: 1 is a correct second argument?
|
||||
oc := offlineAudioContextClass.New(2, 1, context.SampleRate())
|
||||
a := js.ValueOf(buf).Get("buffer").Call("slice", 0, len(buf))
|
||||
|
||||
u8 := js.ValueOf(buf)
|
||||
a := u8.Get("buffer").Call("slice", u8.Get("byteOffset"), u8.Get("byteOffset").Int()+len(buf))
|
||||
|
||||
oc.Call("decodeAudioData", a, js.NewCallback(func(args []js.Value) {
|
||||
buf := args[0]
|
||||
s.leftData = float32ArrayToSlice(buf.Call("getChannelData", 0))
|
||||
|
Loading…
Reference in New Issue
Block a user