MCPcopy
hub / github.com/ebitengine/oto / float32SliceToTypedArray

Function float32SliceToTypedArray

driver_js.go:211–218  ·  view source on GitHub ↗
(s []float32)

Source from the content-addressed store, hash-verified

209}
210
211func float32SliceToTypedArray(s []float32) js.Value {
212 bs := unsafe.Slice((*byte)(unsafe.Pointer(&s[0])), len(s)*4)
213 a := js.Global().Get("Uint8Array").New(len(bs))
214 js.CopyBytesToJS(a, bs)
215 runtime.KeepAlive(s)
216 buf := a.Get("buffer")
217 return js.Global().Get("Float32Array").New(buf, a.Get("byteOffset"), a.Get("byteLength").Int()/4)
218}
219
220func newScriptURL(script string) js.Value {
221 blob := js.Global().Get("Blob").New([]any{script}, map[string]any{"type": "text/javascript"})

Callers 1

newContextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…