Debian Codegraph @

wasm/browser/src/modules/instantiation.js

raw
1 /*
2 csound instantiation module from <csound.h>
3 https://csound.com/docs/api/modules.html
4 */
5
6 /**
7 * creates Csound instance
8 * (inferred in @csound/wasm/browser)
9 */
10 export const csoundCreate = (wasm) => () => wasm.exports.csoundCreateWasi();
11
12 csoundCreate.toString = () => "create = async () => undefined;";
13
14 /**
15 * Destroys an instance of Csound and frees memory
16 * @async
17 * @function
18 * @name destroy
19 * @memberof CsoundObj
20 * @return {Promise.<undefined>}
21 */
22 export const csoundDestroy = (wasm) => (csound) => wasm.exports.csoundDestroy(csound);
23
24 csoundDestroy.toString = () => "destroy = async () => undefined;";
25
26 /**
27 * Returns the API version as int
28 * @async
29 * @function
30 * @name getAPIVersion
31 * @memberof CsoundObj
32 * @return {Promise.<number>}
33 */
34 export const csoundGetAPIVersion = (wasm) => () => wasm.exports.csoundGetAPIVersion();
35
36 csoundGetAPIVersion.toString = () => "getAPIVersion = async () => Number;";
37
38 /**
39 * Returns the Csound version as int
40 * @async
41 * @function
42 * @name getVersion
43 * @memberof CsoundObj
44 * @return {Promise.<number>}
45 */
46 export const csoundGetVersion = (wasm) => () => wasm.exports.csoundGetVersion();
47
48 csoundGetVersion.toString = () => "getVersion = async () => Number;";
49
50 /**
51 * Initialise Csound with specific flags.
52 * This function is called internally by csoundCreate(),
53 * so there is generally no need to use it explicitly
54 * unless you need to avoid default initilization that
55 * sets signal handlers and atexit() callbacks.
56 * @async
57 * @function
58 * @name initialize
59 * @memberof CsoundObj
60 * @return {Promise.<number>} - Return value is zero on success,
61 * positive if initialisation was done already, and negative on error.
62 */
63 export const csoundInitialize = (wasm) => (_, flags) => wasm.exports.csoundInitialize(flags);
64
65 csoundInitialize.toString = () => "initialize = async () => Number;";