MCPcopy Create free account
hub / github.com/csound/csound / string2ptr

Function string2ptr

wasm/browser/src/utils/string-pointers.js:19–31  ·  view source on GitHub ↗
(wasm, string)

Source from the content-addressed store, hash-verified

17};
18
19export const string2ptr = (wasm, string) => {
20 if (typeof string !== "string") {
21 console.error("Expected string but got", typeof string);
22 return;
23 }
24
25 const stringBuf = encoder.encode(string);
26 const offset = wasm.exports.allocStringMem(stringBuf.length);
27 const { buffer } = wasm.wasi.memory;
28 const outBuf = new Uint8Array(buffer, offset, stringBuf.length + 1);
29 outBuf.set(stringBuf);
30 return offset;
31};

Callers 13

csoundAppendEnvFunction · 0.90
csoundCompileOrcFunction · 0.90
csoundEvalCodeFunction · 0.90
csoundCompileCsdFunction · 0.90
csoundCompileCsdTextFunction · 0.90
csoundSetOptionFunction · 0.90
csoundReadScoreFunction · 0.90
csoundInputMessageFunction · 0.90
csoundInputMessageAsyncFunction · 0.90
csoundGetControlChannelFunction · 0.90
csoundSetControlChannelFunction · 0.90
csoundGetStringChannelFunction · 0.90

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected