mimium-web 4.0.1 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -73,6 +73,8 @@ mimium can describe digital signal processing algorithm from very low-level, lik
|
|
|
73
73
|
|
|
74
74
|
mimium's VM design is inspired by Lua, that can be easily embedded on Rust application through the plugin system. External functions (closures) defined in Rust can be easily called from mimium.
|
|
75
75
|
|
|
76
|
+
Also, the code itself can be transpiled into Rust code which enables a quick prototyping of the development of native audio application.
|
|
77
|
+
|
|
76
78
|
## Installation
|
|
77
79
|
|
|
78
80
|
The easiest way to start mimium is using [Visual Studio Code Extension](https://github.com/mimium-org/mimium-language). The extention will automatically download CLI tool `mimium-cli` and language server (support for syntactic highlight and error reporting) when installed.
|
package/mimium_web.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ export class Context {
|
|
|
18
18
|
clear_virtual_file_cache(): void;
|
|
19
19
|
compile(src: string): Promise<void>;
|
|
20
20
|
compile_direct(src: string): void;
|
|
21
|
+
emit_rust(src: string): Promise<string>;
|
|
22
|
+
emit_rust_direct(src: string): string;
|
|
21
23
|
export_virtual_file_cache_json(): string;
|
|
22
24
|
get_input_channels(): number;
|
|
23
25
|
get_output_channels(): number;
|
|
@@ -57,6 +59,8 @@ export interface InitOutput {
|
|
|
57
59
|
readonly context_clear_virtual_file_cache: (a: number) => [number, number];
|
|
58
60
|
readonly context_compile: (a: number, b: number, c: number) => any;
|
|
59
61
|
readonly context_compile_direct: (a: number, b: number, c: number) => [number, number];
|
|
62
|
+
readonly context_emit_rust: (a: number, b: number, c: number) => any;
|
|
63
|
+
readonly context_emit_rust_direct: (a: number, b: number, c: number) => [number, number, number, number];
|
|
60
64
|
readonly context_export_virtual_file_cache_json: (a: number) => [number, number, number, number];
|
|
61
65
|
readonly context_get_input_channels: (a: number) => number;
|
|
62
66
|
readonly context_get_output_channels: (a: number) => number;
|
|
@@ -69,9 +73,9 @@ export interface InitOutput {
|
|
|
69
73
|
readonly context_recompile: (a: number, b: number, c: number) => any;
|
|
70
74
|
readonly context_recompile_direct: (a: number, b: number, c: number) => [number, number];
|
|
71
75
|
readonly context_set_module_base_url: (a: number, b: number, c: number) => [number, number];
|
|
72
|
-
readonly
|
|
73
|
-
readonly
|
|
74
|
-
readonly
|
|
76
|
+
readonly wasm_bindgen__closure__destroy__ha96a9ccc7977162c: (a: number, b: number) => void;
|
|
77
|
+
readonly wasm_bindgen__convert__closures_____invoke__hc29654df3a848ae0: (a: number, b: number, c: any) => [number, number];
|
|
78
|
+
readonly wasm_bindgen__convert__closures_____invoke__h21bd0cb4c3be1d74: (a: number, b: number, c: any, d: any) => void;
|
|
75
79
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
76
80
|
readonly __externref_table_alloc: () => number;
|
|
77
81
|
readonly __wbindgen_externrefs: WebAssembly.Table;
|
package/mimium_web.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* @ts-self-types="./mimium_web.d.ts" */
|
|
2
|
-
import { __mimium_test_clear_cache, __mimium_test_put_cache, export_virtual_file_cache_json, get_env, has_network_api, import_virtual_file_cache_json, preload_mimium_lib_cache, preload_user_module_cache, read_file, set_module_base_url } from './snippets/mimium-lang-
|
|
2
|
+
import { __mimium_test_clear_cache, __mimium_test_put_cache, export_virtual_file_cache_json, get_env, has_network_api, import_virtual_file_cache_json, preload_mimium_lib_cache, preload_user_module_cache, read_file, set_module_base_url } from './snippets/mimium-lang-f542d5fedb13efa4/src/utils/fileloader.js';
|
|
3
3
|
|
|
4
4
|
export class Config {
|
|
5
5
|
static __wrap(ptr) {
|
|
@@ -119,6 +119,40 @@ export class Context {
|
|
|
119
119
|
throw takeFromExternrefTable0(ret[0]);
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* @param {string} src
|
|
124
|
+
* @returns {Promise<string>}
|
|
125
|
+
*/
|
|
126
|
+
emit_rust(src) {
|
|
127
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
128
|
+
const len0 = WASM_VECTOR_LEN;
|
|
129
|
+
const ret = wasm.context_emit_rust(this.__wbg_ptr, ptr0, len0);
|
|
130
|
+
return ret;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* @param {string} src
|
|
134
|
+
* @returns {string}
|
|
135
|
+
*/
|
|
136
|
+
emit_rust_direct(src) {
|
|
137
|
+
let deferred3_0;
|
|
138
|
+
let deferred3_1;
|
|
139
|
+
try {
|
|
140
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
141
|
+
const len0 = WASM_VECTOR_LEN;
|
|
142
|
+
const ret = wasm.context_emit_rust_direct(this.__wbg_ptr, ptr0, len0);
|
|
143
|
+
var ptr2 = ret[0];
|
|
144
|
+
var len2 = ret[1];
|
|
145
|
+
if (ret[3]) {
|
|
146
|
+
ptr2 = 0; len2 = 0;
|
|
147
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
148
|
+
}
|
|
149
|
+
deferred3_0 = ptr2;
|
|
150
|
+
deferred3_1 = len2;
|
|
151
|
+
return getStringFromWasm0(ptr2, len2);
|
|
152
|
+
} finally {
|
|
153
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
122
156
|
/**
|
|
123
157
|
* @returns {string}
|
|
124
158
|
*/
|
|
@@ -263,10 +297,10 @@ if (Symbol.dispose) Context.prototype[Symbol.dispose] = Context.prototype.free;
|
|
|
263
297
|
function __wbg_get_imports() {
|
|
264
298
|
const import0 = {
|
|
265
299
|
__proto__: null,
|
|
266
|
-
|
|
300
|
+
__wbg___mimium_test_clear_cache_4d7214f571b2d154: function() { return handleError(function () {
|
|
267
301
|
__mimium_test_clear_cache();
|
|
268
302
|
}, arguments); },
|
|
269
|
-
|
|
303
|
+
__wbg___mimium_test_put_cache_93e377b579f7a8ae: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
270
304
|
__mimium_test_put_cache(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
|
|
271
305
|
}, arguments); },
|
|
272
306
|
__wbg___wbindgen_copy_to_typed_array_d2f20acdab8e0740: function(arg0, arg1, arg2) {
|
|
@@ -308,25 +342,25 @@ function __wbg_get_imports() {
|
|
|
308
342
|
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
309
343
|
}
|
|
310
344
|
},
|
|
311
|
-
|
|
345
|
+
__wbg_export_virtual_file_cache_json_a9372a73058fe29e: function() { return handleError(function (arg0) {
|
|
312
346
|
const ret = export_virtual_file_cache_json();
|
|
313
347
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
314
348
|
const len1 = WASM_VECTOR_LEN;
|
|
315
349
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
316
350
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
317
351
|
}, arguments); },
|
|
318
|
-
|
|
352
|
+
__wbg_get_env_95c2579aff2308c6: function() { return handleError(function (arg0, arg1, arg2) {
|
|
319
353
|
const ret = get_env(getStringFromWasm0(arg1, arg2));
|
|
320
354
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
321
355
|
const len1 = WASM_VECTOR_LEN;
|
|
322
356
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
323
357
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
324
358
|
}, arguments); },
|
|
325
|
-
|
|
359
|
+
__wbg_has_network_api_93e94d307b86400a: function() { return handleError(function () {
|
|
326
360
|
const ret = has_network_api();
|
|
327
361
|
return ret;
|
|
328
362
|
}, arguments); },
|
|
329
|
-
|
|
363
|
+
__wbg_import_virtual_file_cache_json_e37d725fcd2ca2ae: function() { return handleError(function (arg0, arg1) {
|
|
330
364
|
import_virtual_file_cache_json(getStringFromWasm0(arg0, arg1));
|
|
331
365
|
}, arguments); },
|
|
332
366
|
__wbg_new_227d7c05414eb861: function() {
|
|
@@ -340,7 +374,7 @@ function __wbg_get_imports() {
|
|
|
340
374
|
const a = state0.a;
|
|
341
375
|
state0.a = 0;
|
|
342
376
|
try {
|
|
343
|
-
return
|
|
377
|
+
return wasm_bindgen__convert__closures_____invoke__h21bd0cb4c3be1d74(a, state0.b, arg0, arg1);
|
|
344
378
|
} finally {
|
|
345
379
|
state0.a = a;
|
|
346
380
|
}
|
|
@@ -351,11 +385,11 @@ function __wbg_get_imports() {
|
|
|
351
385
|
state0.a = state0.b = 0;
|
|
352
386
|
}
|
|
353
387
|
},
|
|
354
|
-
|
|
388
|
+
__wbg_preload_mimium_lib_cache_69b1e3248fea76ea: function() { return handleError(function (arg0, arg1) {
|
|
355
389
|
const ret = preload_mimium_lib_cache(getStringFromWasm0(arg0, arg1));
|
|
356
390
|
return ret;
|
|
357
391
|
}, arguments); },
|
|
358
|
-
|
|
392
|
+
__wbg_preload_user_module_cache_08fde44d9f8b09b5: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
359
393
|
const ret = preload_user_module_cache(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
|
|
360
394
|
return ret;
|
|
361
395
|
}, arguments); },
|
|
@@ -366,7 +400,7 @@ function __wbg_get_imports() {
|
|
|
366
400
|
__wbg_queueMicrotask_a082d78ce798393e: function(arg0) {
|
|
367
401
|
queueMicrotask(arg0);
|
|
368
402
|
},
|
|
369
|
-
|
|
403
|
+
__wbg_read_file_04f4fad7489c9fc5: function() { return handleError(function (arg0, arg1, arg2) {
|
|
370
404
|
const ret = read_file(getStringFromWasm0(arg1, arg2));
|
|
371
405
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
372
406
|
const len1 = WASM_VECTOR_LEN;
|
|
@@ -377,7 +411,7 @@ function __wbg_get_imports() {
|
|
|
377
411
|
const ret = Promise.resolve(arg0);
|
|
378
412
|
return ret;
|
|
379
413
|
},
|
|
380
|
-
|
|
414
|
+
__wbg_set_module_base_url_e302f48fccf34850: function() { return handleError(function (arg0, arg1) {
|
|
381
415
|
set_module_base_url(getStringFromWasm0(arg0, arg1));
|
|
382
416
|
}, arguments); },
|
|
383
417
|
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
@@ -412,8 +446,8 @@ function __wbg_get_imports() {
|
|
|
412
446
|
return ret;
|
|
413
447
|
},
|
|
414
448
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
415
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
416
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
449
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 625, function: Function { arguments: [Externref], shim_idx: 626, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
450
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__ha96a9ccc7977162c, wasm_bindgen__convert__closures_____invoke__hc29654df3a848ae0);
|
|
417
451
|
return ret;
|
|
418
452
|
},
|
|
419
453
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
@@ -437,15 +471,15 @@ function __wbg_get_imports() {
|
|
|
437
471
|
};
|
|
438
472
|
}
|
|
439
473
|
|
|
440
|
-
function
|
|
441
|
-
const ret = wasm.
|
|
474
|
+
function wasm_bindgen__convert__closures_____invoke__hc29654df3a848ae0(arg0, arg1, arg2) {
|
|
475
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__hc29654df3a848ae0(arg0, arg1, arg2);
|
|
442
476
|
if (ret[1]) {
|
|
443
477
|
throw takeFromExternrefTable0(ret[0]);
|
|
444
478
|
}
|
|
445
479
|
}
|
|
446
480
|
|
|
447
|
-
function
|
|
448
|
-
wasm.
|
|
481
|
+
function wasm_bindgen__convert__closures_____invoke__h21bd0cb4c3be1d74(arg0, arg1, arg2, arg3) {
|
|
482
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h21bd0cb4c3be1d74(arg0, arg1, arg2, arg3);
|
|
449
483
|
}
|
|
450
484
|
|
|
451
485
|
const ConfigFinalization = (typeof FinalizationRegistry === 'undefined')
|
package/mimium_web_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -21,15 +21,24 @@ if (isNode) {
|
|
|
21
21
|
const DEFAULT_GITHUB_LIB_BASE = 'https://raw.githubusercontent.com/mimium-org/mimium-rs/';
|
|
22
22
|
const DEFAULT_GITHUB_TAG = 'dev';
|
|
23
23
|
const LIB_FILES = [
|
|
24
|
+
'composition.mmm',
|
|
24
25
|
'core.mmm',
|
|
25
26
|
'delay.mmm',
|
|
27
|
+
'drive.mmm',
|
|
28
|
+
'dynamics.mmm',
|
|
26
29
|
'env.mmm',
|
|
27
30
|
'filter.mmm',
|
|
28
31
|
'math.mmm',
|
|
32
|
+
'mininotation.mmm',
|
|
33
|
+
'modulation.mmm',
|
|
29
34
|
'noise.mmm',
|
|
30
35
|
'osc.mmm',
|
|
36
|
+
'parser.mmm',
|
|
37
|
+
'pattern.mmm',
|
|
31
38
|
'reactive.mmm',
|
|
32
|
-
'reverb.mmm'
|
|
39
|
+
'reverb.mmm',
|
|
40
|
+
'sequencer.mmm',
|
|
41
|
+
'space.mmm'
|
|
33
42
|
];
|
|
34
43
|
|
|
35
44
|
const memoryCache = new Map();
|
|
@@ -321,7 +330,6 @@ async function preload_mimium_lib_cache(base_url) {
|
|
|
321
330
|
putMemoryAliases(filename, fetched);
|
|
322
331
|
await writeToOpfs(filename, fetched);
|
|
323
332
|
} catch (e) {
|
|
324
|
-
// Keep mutable refs fresh when online, but remain usable offline via OPFS fallback.
|
|
325
333
|
if (fromOpfs !== null) {
|
|
326
334
|
putMemoryAliases(filename, fromOpfs);
|
|
327
335
|
continue;
|
|
@@ -404,4 +412,4 @@ export {
|
|
|
404
412
|
__mimium_test_clear_cache,
|
|
405
413
|
__mimium_test_get_last_preload_base_url,
|
|
406
414
|
__mimium_test_get_last_module_preload_base_url
|
|
407
|
-
};
|
|
415
|
+
};
|