mimium-web 2.2.3

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 ADDED
@@ -0,0 +1,118 @@
1
+ # mimium
2
+
3
+ main: [![Test(main)](https://github.com/tomoyanonymous/mimium-rs/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/tomoyanonymous/mimium-rs/actions/workflows/ci.yaml) dev: [![Test(dev)](https://github.com/tomoyanonymous/mimium-rs/actions/workflows/ci.yaml/badge.svg?branch=dev)](https://github.com/tomoyanonymous/mimium-rs/actions/workflows/ci.yaml)
4
+
5
+ A programming language as an infrastructure for sound and music.
6
+
7
+ <p align="center" style="display:flex; justify-content:center;">
8
+ <img src = "mimium_logo_slant.svg" width="300" alt="An icon of the mimium. The word “mimium” is written in small caps, white letters at an angle on a gray diamond-shaped background with a gradient. The vertical bars of the letters are evenly spaced, making it look like a pedestrian crossing." />
9
+ </p>
10
+
11
+ https://mimium.org (A documentation for v2 is under preparation!)
12
+
13
+ ---
14
+
15
+ mimium(*MInimal-Musical-medIUM*) is a programming language for sound and music.
16
+
17
+ mimium is made to be an infrastructure for distributing music in a form of a source code, not only a tool for musicians and programmers.
18
+
19
+ Its semantics are inspired from several modern programming languages for sound such as *[Faust](https://faust.grame.fr)*, *[Kronos](https://kronoslang.io/)* and *[Extempore](https://extemporelang.github.io/)*.
20
+
21
+ A minimal example below generates a sinewave of 440Hz.
22
+
23
+ ```rust
24
+ // minimal.mmm
25
+ let twopi = 3.141595*2.0
26
+ fn dsp(){
27
+ sin(now * 440.0 * twopi / samplerate)
28
+ }
29
+ ```
30
+
31
+ A special keyword `self` can be used in function, which is a last return value of the function.
32
+ This enables an easy and clean expression of feedback connection of signal chain.
33
+
34
+ ```rust
35
+ fn lpf(input,fb){
36
+ (1.0-fb)*input + fb*self
37
+ }
38
+ ```
39
+
40
+ Also, the language design is based on the call by value lambda calculus, so the higher-order functions are supported to express generative signal graph like replicatiing multiple oscillators.
41
+
42
+ ```rust
43
+ fn replicate(n,gen){
44
+ if (n>0.0){
45
+ let c = replicate(n - 1.0,gen)
46
+ let g = gen()
47
+ |x,rate| g(x,rate) + c(x+100.0,rate+0.1)
48
+ }else{
49
+ |x,rate| 0
50
+ }
51
+ }
52
+ ```
53
+
54
+ mimium is a statically typed language but the most of type annotations can be omitted by the type inference system. If you are interested in the theoritical background of mimium, see [the paper about mimium](https://matsuuratomoya.com/en/research/lambdammm-ifc-2024/).
55
+
56
+ This repository is for a mimium *version 2*, all the code base is rewritten in Rust while the original was in C++, and semantics of the language was re-designed. The codes are still very under development.
57
+
58
+ ## Installation
59
+
60
+ An easy way to start mimium is using [Visual Studio Code Extension](https://github.com/mimium-org/mimium-language). You can run opening `.mmm` file from the command palette.
61
+
62
+ Also you can download the latest CLI tool [mimium-cli](https://github.com/tomoyanonymous/mimium-rs/releases) from GitHub Release.
63
+
64
+ ## Development
65
+
66
+ See [Development](./Development) section.
67
+
68
+ ## Contributing
69
+
70
+ There's no concrete way for contributing to the mimium project for now but any type of contribution (bugfix, code refactoring, documentation, showing the usecases, etc).
71
+
72
+ (However, because the mimium is still early stage of the development and there's much things to do, the proposal or request for new feature without Pull Request will not be accepted.)
73
+
74
+ Take a look at [Code of Conduct](./CODE_OF_CONDUCT) before you make contribution.
75
+
76
+ ## [License](LICENSE)
77
+
78
+ ©️ the mimium development community.
79
+
80
+ The source code is licensed under the [Mozilla Puclic License 2.0 (MPL2.0)](LICENSE).
81
+
82
+ ## Original Author
83
+
84
+ Tomoya Matsuura/松浦知也 <https://matsuuratomoya.com/en>
85
+
86
+ ## Acknowledgements
87
+
88
+ This project is supported grants and scholarships as follows.
89
+
90
+ - 2019 Exploratory IT Human Resources Project ([The MITOU Program](https://www.ipa.go.jp/jinzai/mitou/portal_index.html)) by IPA: INFORMATION-TECHNOLOGY PROMOTION AGENCY, Japan.
91
+ - Kakehashi Foundation (2022)
92
+ - JSPS Kakenhi 23K12059 "Civil Engineering of Music, as a Practice and Critics between Music and Engineering"(2023-2025)
93
+
94
+ ### Contributers
95
+
96
+ This list contains the contributers from v1 development, documentation and financial sponsors(via github sponsor).
97
+
98
+ #### Source Code Contributions
99
+
100
+ - [Hiroaki Yutani](https://github.com/yutannihilation)
101
+ - [Shinichi Tanaka(t-sin)](https://github.com/t-sin)
102
+ - [kyo](https://github.com/syougikakugenn)
103
+ - [Inqb8tr-jp](https://github.com/Inqb8tr-jp)
104
+ - [zakuro9715](https://github.com/zakuro9715)
105
+
106
+ #### Other forms of Contributions
107
+
108
+ - [Baku Hashimoto](https://baku89.com)
109
+ - [Yuichi Yogo](https://github.com/yuichkun)
110
+ - [Ayumu Nagamatsu](http://ayumu-nagamatsu.com/)
111
+ - [zigen](https://horol.org/)
112
+
113
+
114
+ ## Known Bugs
115
+
116
+ See [GitHub Issues with "bug" tag](https://github.com/tomoyanonymous/mimium-rs/issues?q=is%3Aissue+is%3Aopen+label%3Abug).
117
+
118
+ ## [Roadmap](./Roadmap.md)
@@ -0,0 +1,75 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export class Config {
4
+ free(): void;
5
+ constructor();
6
+ sample_rate: number;
7
+ input_channels: number;
8
+ output_channels: number;
9
+ buffer_size: number;
10
+ }
11
+ export class Context {
12
+ free(): void;
13
+ constructor(config: Config);
14
+ compile(src: string): void;
15
+ /**
16
+ * .
17
+ *
18
+ * # Safety
19
+ * Array size of input and output must be equal to `input_channels * buffer_size` and `output_channels * buffer_size` respectively.
20
+ * .
21
+ */
22
+ process(input: Float32Array, output: Float32Array): bigint;
23
+ }
24
+
25
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
26
+
27
+ export interface InitOutput {
28
+ readonly memory: WebAssembly.Memory;
29
+ readonly __wbg_config_free: (a: number, b: number) => void;
30
+ readonly __wbg_get_config_sample_rate: (a: number) => number;
31
+ readonly __wbg_set_config_sample_rate: (a: number, b: number) => void;
32
+ readonly __wbg_get_config_input_channels: (a: number) => number;
33
+ readonly __wbg_set_config_input_channels: (a: number, b: number) => void;
34
+ readonly __wbg_get_config_output_channels: (a: number) => number;
35
+ readonly __wbg_set_config_output_channels: (a: number, b: number) => void;
36
+ readonly __wbg_get_config_buffer_size: (a: number) => number;
37
+ readonly __wbg_set_config_buffer_size: (a: number, b: number) => void;
38
+ readonly config_new: () => number;
39
+ readonly __wbg_context_free: (a: number, b: number) => void;
40
+ readonly context_new: (a: number) => number;
41
+ readonly context_compile: (a: number, b: number, c: number) => void;
42
+ readonly context_process: (a: number, b: number, c: number, d: number, e: number, f: any) => bigint;
43
+ readonly __wbindgen_exn_store: (a: number) => void;
44
+ readonly __externref_table_alloc: () => number;
45
+ readonly __wbindgen_export_2: WebAssembly.Table;
46
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
47
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
48
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
49
+ readonly __wbindgen_export_6: WebAssembly.Table;
50
+ readonly closure39_externref_shim: (a: number, b: number, c: any) => void;
51
+ readonly closure68_externref_shim: (a: number, b: number, c: any) => void;
52
+ readonly closure84_externref_shim: (a: number, b: number, c: any, d: any) => void;
53
+ readonly __wbindgen_start: () => void;
54
+ }
55
+
56
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
57
+ /**
58
+ * Instantiates the given `module`, which can either be bytes or
59
+ * a precompiled `WebAssembly.Module`.
60
+ *
61
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
62
+ *
63
+ * @returns {InitOutput}
64
+ */
65
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
66
+
67
+ /**
68
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
69
+ * for everything else, calls `WebAssembly.instantiate` directly.
70
+ *
71
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
72
+ *
73
+ * @returns {Promise<InitOutput>}
74
+ */
75
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
package/mimium_web.js ADDED
@@ -0,0 +1,679 @@
1
+ let wasm;
2
+
3
+ function addToExternrefTable0(obj) {
4
+ const idx = wasm.__externref_table_alloc();
5
+ wasm.__wbindgen_export_2.set(idx, obj);
6
+ return idx;
7
+ }
8
+
9
+ function handleError(f, args) {
10
+ try {
11
+ return f.apply(this, args);
12
+ } catch (e) {
13
+ const idx = addToExternrefTable0(e);
14
+ wasm.__wbindgen_exn_store(idx);
15
+ }
16
+ }
17
+
18
+ let cachedUint8ArrayMemory0 = null;
19
+
20
+ function getUint8ArrayMemory0() {
21
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
22
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
23
+ }
24
+ return cachedUint8ArrayMemory0;
25
+ }
26
+
27
+ let WASM_VECTOR_LEN = 0;
28
+
29
+ function passArray8ToWasm0(arg, malloc) {
30
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
31
+ getUint8ArrayMemory0().set(arg, ptr / 1);
32
+ WASM_VECTOR_LEN = arg.length;
33
+ return ptr;
34
+ }
35
+
36
+ let cachedDataViewMemory0 = null;
37
+
38
+ function getDataViewMemory0() {
39
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
40
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
41
+ }
42
+ return cachedDataViewMemory0;
43
+ }
44
+
45
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
46
+
47
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
48
+
49
+ function getStringFromWasm0(ptr, len) {
50
+ ptr = ptr >>> 0;
51
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
52
+ }
53
+
54
+ const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
55
+
56
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
57
+ ? function (arg, view) {
58
+ return cachedTextEncoder.encodeInto(arg, view);
59
+ }
60
+ : function (arg, view) {
61
+ const buf = cachedTextEncoder.encode(arg);
62
+ view.set(buf);
63
+ return {
64
+ read: arg.length,
65
+ written: buf.length
66
+ };
67
+ });
68
+
69
+ function passStringToWasm0(arg, malloc, realloc) {
70
+
71
+ if (realloc === undefined) {
72
+ const buf = cachedTextEncoder.encode(arg);
73
+ const ptr = malloc(buf.length, 1) >>> 0;
74
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
75
+ WASM_VECTOR_LEN = buf.length;
76
+ return ptr;
77
+ }
78
+
79
+ let len = arg.length;
80
+ let ptr = malloc(len, 1) >>> 0;
81
+
82
+ const mem = getUint8ArrayMemory0();
83
+
84
+ let offset = 0;
85
+
86
+ for (; offset < len; offset++) {
87
+ const code = arg.charCodeAt(offset);
88
+ if (code > 0x7F) break;
89
+ mem[ptr + offset] = code;
90
+ }
91
+
92
+ if (offset !== len) {
93
+ if (offset !== 0) {
94
+ arg = arg.slice(offset);
95
+ }
96
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
97
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
98
+ const ret = encodeString(arg, view);
99
+
100
+ offset += ret.written;
101
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
102
+ }
103
+
104
+ WASM_VECTOR_LEN = offset;
105
+ return ptr;
106
+ }
107
+
108
+ function isLikeNone(x) {
109
+ return x === undefined || x === null;
110
+ }
111
+
112
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
113
+ ? { register: () => {}, unregister: () => {} }
114
+ : new FinalizationRegistry(state => {
115
+ wasm.__wbindgen_export_6.get(state.dtor)(state.a, state.b)
116
+ });
117
+
118
+ function makeMutClosure(arg0, arg1, dtor, f) {
119
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
120
+ const real = (...args) => {
121
+ // First up with a closure we increment the internal reference
122
+ // count. This ensures that the Rust closure environment won't
123
+ // be deallocated while we're invoking it.
124
+ state.cnt++;
125
+ const a = state.a;
126
+ state.a = 0;
127
+ try {
128
+ return f(a, state.b, ...args);
129
+ } finally {
130
+ if (--state.cnt === 0) {
131
+ wasm.__wbindgen_export_6.get(state.dtor)(a, state.b);
132
+ CLOSURE_DTORS.unregister(state);
133
+ } else {
134
+ state.a = a;
135
+ }
136
+ }
137
+ };
138
+ real.original = state;
139
+ CLOSURE_DTORS.register(real, state, state);
140
+ return real;
141
+ }
142
+
143
+ function getArrayU8FromWasm0(ptr, len) {
144
+ ptr = ptr >>> 0;
145
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
146
+ }
147
+
148
+ function debugString(val) {
149
+ // primitive types
150
+ const type = typeof val;
151
+ if (type == 'number' || type == 'boolean' || val == null) {
152
+ return `${val}`;
153
+ }
154
+ if (type == 'string') {
155
+ return `"${val}"`;
156
+ }
157
+ if (type == 'symbol') {
158
+ const description = val.description;
159
+ if (description == null) {
160
+ return 'Symbol';
161
+ } else {
162
+ return `Symbol(${description})`;
163
+ }
164
+ }
165
+ if (type == 'function') {
166
+ const name = val.name;
167
+ if (typeof name == 'string' && name.length > 0) {
168
+ return `Function(${name})`;
169
+ } else {
170
+ return 'Function';
171
+ }
172
+ }
173
+ // objects
174
+ if (Array.isArray(val)) {
175
+ const length = val.length;
176
+ let debug = '[';
177
+ if (length > 0) {
178
+ debug += debugString(val[0]);
179
+ }
180
+ for(let i = 1; i < length; i++) {
181
+ debug += ', ' + debugString(val[i]);
182
+ }
183
+ debug += ']';
184
+ return debug;
185
+ }
186
+ // Test for built-in
187
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
188
+ let className;
189
+ if (builtInMatches && builtInMatches.length > 1) {
190
+ className = builtInMatches[1];
191
+ } else {
192
+ // Failed to match the standard '[object ClassName]'
193
+ return toString.call(val);
194
+ }
195
+ if (className == 'Object') {
196
+ // we're a user defined class or Object
197
+ // JSON.stringify avoids problems with cycles, and is generally much
198
+ // easier than looping through ownProperties of `val`.
199
+ try {
200
+ return 'Object(' + JSON.stringify(val) + ')';
201
+ } catch (_) {
202
+ return 'Object';
203
+ }
204
+ }
205
+ // errors
206
+ if (val instanceof Error) {
207
+ return `${val.name}: ${val.message}\n${val.stack}`;
208
+ }
209
+ // TODO we could test for more things here, like `Set`s and `Map`s.
210
+ return className;
211
+ }
212
+
213
+ function _assertClass(instance, klass) {
214
+ if (!(instance instanceof klass)) {
215
+ throw new Error(`expected instance of ${klass.name}`);
216
+ }
217
+ }
218
+
219
+ let cachedFloat32ArrayMemory0 = null;
220
+
221
+ function getFloat32ArrayMemory0() {
222
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
223
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
224
+ }
225
+ return cachedFloat32ArrayMemory0;
226
+ }
227
+
228
+ function passArrayF32ToWasm0(arg, malloc) {
229
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
230
+ getFloat32ArrayMemory0().set(arg, ptr / 4);
231
+ WASM_VECTOR_LEN = arg.length;
232
+ return ptr;
233
+ }
234
+ function __wbg_adapter_18(arg0, arg1, arg2) {
235
+ wasm.closure39_externref_shim(arg0, arg1, arg2);
236
+ }
237
+
238
+ function __wbg_adapter_21(arg0, arg1, arg2) {
239
+ wasm.closure68_externref_shim(arg0, arg1, arg2);
240
+ }
241
+
242
+ function __wbg_adapter_70(arg0, arg1, arg2, arg3) {
243
+ wasm.closure84_externref_shim(arg0, arg1, arg2, arg3);
244
+ }
245
+
246
+ const ConfigFinalization = (typeof FinalizationRegistry === 'undefined')
247
+ ? { register: () => {}, unregister: () => {} }
248
+ : new FinalizationRegistry(ptr => wasm.__wbg_config_free(ptr >>> 0, 1));
249
+
250
+ export class Config {
251
+
252
+ __destroy_into_raw() {
253
+ const ptr = this.__wbg_ptr;
254
+ this.__wbg_ptr = 0;
255
+ ConfigFinalization.unregister(this);
256
+ return ptr;
257
+ }
258
+
259
+ free() {
260
+ const ptr = this.__destroy_into_raw();
261
+ wasm.__wbg_config_free(ptr, 0);
262
+ }
263
+ /**
264
+ * @returns {number}
265
+ */
266
+ get sample_rate() {
267
+ const ret = wasm.__wbg_get_config_sample_rate(this.__wbg_ptr);
268
+ return ret;
269
+ }
270
+ /**
271
+ * @param {number} arg0
272
+ */
273
+ set sample_rate(arg0) {
274
+ wasm.__wbg_set_config_sample_rate(this.__wbg_ptr, arg0);
275
+ }
276
+ /**
277
+ * @returns {number}
278
+ */
279
+ get input_channels() {
280
+ const ret = wasm.__wbg_get_config_input_channels(this.__wbg_ptr);
281
+ return ret >>> 0;
282
+ }
283
+ /**
284
+ * @param {number} arg0
285
+ */
286
+ set input_channels(arg0) {
287
+ wasm.__wbg_set_config_input_channels(this.__wbg_ptr, arg0);
288
+ }
289
+ /**
290
+ * @returns {number}
291
+ */
292
+ get output_channels() {
293
+ const ret = wasm.__wbg_get_config_output_channels(this.__wbg_ptr);
294
+ return ret >>> 0;
295
+ }
296
+ /**
297
+ * @param {number} arg0
298
+ */
299
+ set output_channels(arg0) {
300
+ wasm.__wbg_set_config_output_channels(this.__wbg_ptr, arg0);
301
+ }
302
+ /**
303
+ * @returns {number}
304
+ */
305
+ get buffer_size() {
306
+ const ret = wasm.__wbg_get_config_buffer_size(this.__wbg_ptr);
307
+ return ret >>> 0;
308
+ }
309
+ /**
310
+ * @param {number} arg0
311
+ */
312
+ set buffer_size(arg0) {
313
+ wasm.__wbg_set_config_buffer_size(this.__wbg_ptr, arg0);
314
+ }
315
+ constructor() {
316
+ const ret = wasm.config_new();
317
+ this.__wbg_ptr = ret >>> 0;
318
+ ConfigFinalization.register(this, this.__wbg_ptr, this);
319
+ return this;
320
+ }
321
+ }
322
+
323
+ const ContextFinalization = (typeof FinalizationRegistry === 'undefined')
324
+ ? { register: () => {}, unregister: () => {} }
325
+ : new FinalizationRegistry(ptr => wasm.__wbg_context_free(ptr >>> 0, 1));
326
+
327
+ export class Context {
328
+
329
+ __destroy_into_raw() {
330
+ const ptr = this.__wbg_ptr;
331
+ this.__wbg_ptr = 0;
332
+ ContextFinalization.unregister(this);
333
+ return ptr;
334
+ }
335
+
336
+ free() {
337
+ const ptr = this.__destroy_into_raw();
338
+ wasm.__wbg_context_free(ptr, 0);
339
+ }
340
+ /**
341
+ * @param {Config} config
342
+ */
343
+ constructor(config) {
344
+ _assertClass(config, Config);
345
+ var ptr0 = config.__destroy_into_raw();
346
+ const ret = wasm.context_new(ptr0);
347
+ this.__wbg_ptr = ret >>> 0;
348
+ ContextFinalization.register(this, this.__wbg_ptr, this);
349
+ return this;
350
+ }
351
+ /**
352
+ * @param {string} src
353
+ */
354
+ compile(src) {
355
+ const ptr0 = passStringToWasm0(src, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
356
+ const len0 = WASM_VECTOR_LEN;
357
+ wasm.context_compile(this.__wbg_ptr, ptr0, len0);
358
+ }
359
+ /**
360
+ * .
361
+ *
362
+ * # Safety
363
+ * Array size of input and output must be equal to `input_channels * buffer_size` and `output_channels * buffer_size` respectively.
364
+ * .
365
+ * @param {Float32Array} input
366
+ * @param {Float32Array} output
367
+ * @returns {bigint}
368
+ */
369
+ process(input, output) {
370
+ const ptr0 = passArrayF32ToWasm0(input, wasm.__wbindgen_malloc);
371
+ const len0 = WASM_VECTOR_LEN;
372
+ var ptr1 = passArrayF32ToWasm0(output, wasm.__wbindgen_malloc);
373
+ var len1 = WASM_VECTOR_LEN;
374
+ const ret = wasm.context_process(this.__wbg_ptr, ptr0, len0, ptr1, len1, output);
375
+ return BigInt.asUintN(64, ret);
376
+ }
377
+ }
378
+
379
+ async function __wbg_load(module, imports) {
380
+ if (typeof Response === 'function' && module instanceof Response) {
381
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
382
+ try {
383
+ return await WebAssembly.instantiateStreaming(module, imports);
384
+
385
+ } catch (e) {
386
+ if (module.headers.get('Content-Type') != 'application/wasm') {
387
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
388
+
389
+ } else {
390
+ throw e;
391
+ }
392
+ }
393
+ }
394
+
395
+ const bytes = await module.arrayBuffer();
396
+ return await WebAssembly.instantiate(bytes, imports);
397
+
398
+ } else {
399
+ const instance = await WebAssembly.instantiate(module, imports);
400
+
401
+ if (instance instanceof WebAssembly.Instance) {
402
+ return { instance, module };
403
+
404
+ } else {
405
+ return instance;
406
+ }
407
+ }
408
+ }
409
+
410
+ function __wbg_get_imports() {
411
+ const imports = {};
412
+ imports.wbg = {};
413
+ imports.wbg.__wbg_call_b0d8e36992d9900d = function() { return handleError(function (arg0, arg1) {
414
+ const ret = arg0.call(arg1);
415
+ return ret;
416
+ }, arguments) };
417
+ imports.wbg.__wbg_data_d2ef8a36fe06fc0a = function() { return handleError(function (arg0, arg1) {
418
+ const ret = arg1.data;
419
+ const ptr1 = passArray8ToWasm0(ret, wasm.__wbindgen_malloc);
420
+ const len1 = WASM_VECTOR_LEN;
421
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
422
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
423
+ }, arguments) };
424
+ imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
425
+ let deferred0_0;
426
+ let deferred0_1;
427
+ try {
428
+ deferred0_0 = arg0;
429
+ deferred0_1 = arg1;
430
+ console.error(getStringFromWasm0(arg0, arg1));
431
+ } finally {
432
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
433
+ }
434
+ };
435
+ imports.wbg.__wbg_forEach_960fd897546c2cc7 = function(arg0, arg1, arg2) {
436
+ try {
437
+ var state0 = {a: arg1, b: arg2};
438
+ var cb0 = (arg0, arg1) => {
439
+ const a = state0.a;
440
+ state0.a = 0;
441
+ try {
442
+ return __wbg_adapter_70(a, state0.b, arg0, arg1);
443
+ } finally {
444
+ state0.a = a;
445
+ }
446
+ };
447
+ arg0.forEach(cb0);
448
+ } finally {
449
+ state0.a = state0.b = 0;
450
+ }
451
+ };
452
+ imports.wbg.__wbg_id_342672fabcb69265 = function(arg0, arg1) {
453
+ const ret = arg1.id;
454
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
455
+ const len1 = WASM_VECTOR_LEN;
456
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
457
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
458
+ };
459
+ imports.wbg.__wbg_inputs_b38a2701063a9f19 = function(arg0) {
460
+ const ret = arg0.inputs;
461
+ return ret;
462
+ };
463
+ imports.wbg.__wbg_instanceof_MidiAccess_0a300b3304ef3202 = function(arg0) {
464
+ let result;
465
+ try {
466
+ result = arg0 instanceof MIDIAccess;
467
+ } catch (_) {
468
+ result = false;
469
+ }
470
+ const ret = result;
471
+ return ret;
472
+ };
473
+ imports.wbg.__wbg_instanceof_MidiInput_8847af17a1bd9e0a = function(arg0) {
474
+ let result;
475
+ try {
476
+ result = arg0 instanceof MIDIInput;
477
+ } catch (_) {
478
+ result = false;
479
+ }
480
+ const ret = result;
481
+ return ret;
482
+ };
483
+ imports.wbg.__wbg_instanceof_Window_d2514c6a7ee7ba60 = function(arg0) {
484
+ let result;
485
+ try {
486
+ result = arg0 instanceof Window;
487
+ } catch (_) {
488
+ result = false;
489
+ }
490
+ const ret = result;
491
+ return ret;
492
+ };
493
+ imports.wbg.__wbg_name_476a3f59d488a92a = function(arg0, arg1) {
494
+ const ret = arg1.name;
495
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
496
+ var len1 = WASM_VECTOR_LEN;
497
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
498
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
499
+ };
500
+ imports.wbg.__wbg_navigator_0fe968937104eaa7 = function(arg0) {
501
+ const ret = arg0.navigator;
502
+ return ret;
503
+ };
504
+ imports.wbg.__wbg_new_688846f374351c92 = function() {
505
+ const ret = new Object();
506
+ return ret;
507
+ };
508
+ imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
509
+ const ret = new Error();
510
+ return ret;
511
+ };
512
+ imports.wbg.__wbg_newnoargs_fd9e4bf8be2bc16d = function(arg0, arg1) {
513
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
514
+ return ret;
515
+ };
516
+ imports.wbg.__wbg_open_bad7415c7076f4d4 = function(arg0) {
517
+ const ret = arg0.open();
518
+ return ret;
519
+ };
520
+ imports.wbg.__wbg_requestMIDIAccess_e5de2909f77fdf72 = function() { return handleError(function (arg0, arg1) {
521
+ const ret = arg0.requestMIDIAccess(arg1);
522
+ return ret;
523
+ }, arguments) };
524
+ imports.wbg.__wbg_setonmidimessage_cc963fd52d629fb2 = function(arg0, arg1) {
525
+ arg0.onmidimessage = arg1;
526
+ };
527
+ imports.wbg.__wbg_setsysex_634999d73a9f19a9 = function(arg0, arg1) {
528
+ arg0.sysex = arg1 !== 0;
529
+ };
530
+ imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
531
+ const ret = arg1.stack;
532
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
533
+ const len1 = WASM_VECTOR_LEN;
534
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
535
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
536
+ };
537
+ imports.wbg.__wbg_static_accessor_GLOBAL_0be7472e492ad3e3 = function() {
538
+ const ret = typeof global === 'undefined' ? null : global;
539
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
540
+ };
541
+ imports.wbg.__wbg_static_accessor_GLOBAL_THIS_1a6eb482d12c9bfb = function() {
542
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
543
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
544
+ };
545
+ imports.wbg.__wbg_static_accessor_SELF_1dc398a895c82351 = function() {
546
+ const ret = typeof self === 'undefined' ? null : self;
547
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
548
+ };
549
+ imports.wbg.__wbg_static_accessor_WINDOW_ae1c80c7eea8d64a = function() {
550
+ const ret = typeof window === 'undefined' ? null : window;
551
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
552
+ };
553
+ imports.wbg.__wbg_then_0ffafeddf0e182a4 = function(arg0, arg1, arg2) {
554
+ const ret = arg0.then(arg1, arg2);
555
+ return ret;
556
+ };
557
+ imports.wbg.__wbg_timeStamp_0aab179f39f96348 = function(arg0) {
558
+ const ret = arg0.timeStamp;
559
+ return ret;
560
+ };
561
+ imports.wbg.__wbindgen_cb_drop = function(arg0) {
562
+ const obj = arg0.original;
563
+ if (obj.cnt-- == 1) {
564
+ obj.a = 0;
565
+ return true;
566
+ }
567
+ const ret = false;
568
+ return ret;
569
+ };
570
+ imports.wbg.__wbindgen_closure_wrapper132 = function(arg0, arg1, arg2) {
571
+ const ret = makeMutClosure(arg0, arg1, 40, __wbg_adapter_18);
572
+ return ret;
573
+ };
574
+ imports.wbg.__wbindgen_closure_wrapper193 = function(arg0, arg1, arg2) {
575
+ const ret = makeMutClosure(arg0, arg1, 69, __wbg_adapter_21);
576
+ return ret;
577
+ };
578
+ imports.wbg.__wbindgen_copy_to_typed_array = function(arg0, arg1, arg2) {
579
+ new Uint8Array(arg2.buffer, arg2.byteOffset, arg2.byteLength).set(getArrayU8FromWasm0(arg0, arg1));
580
+ };
581
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
582
+ const ret = debugString(arg1);
583
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
584
+ const len1 = WASM_VECTOR_LEN;
585
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
586
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
587
+ };
588
+ imports.wbg.__wbindgen_init_externref_table = function() {
589
+ const table = wasm.__wbindgen_export_2;
590
+ const offset = table.grow(4);
591
+ table.set(0, undefined);
592
+ table.set(offset + 0, undefined);
593
+ table.set(offset + 1, null);
594
+ table.set(offset + 2, true);
595
+ table.set(offset + 3, false);
596
+ ;
597
+ };
598
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
599
+ const ret = arg0 === undefined;
600
+ return ret;
601
+ };
602
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
603
+ throw new Error(getStringFromWasm0(arg0, arg1));
604
+ };
605
+
606
+ return imports;
607
+ }
608
+
609
+ function __wbg_init_memory(imports, memory) {
610
+
611
+ }
612
+
613
+ function __wbg_finalize_init(instance, module) {
614
+ wasm = instance.exports;
615
+ __wbg_init.__wbindgen_wasm_module = module;
616
+ cachedDataViewMemory0 = null;
617
+ cachedFloat32ArrayMemory0 = null;
618
+ cachedUint8ArrayMemory0 = null;
619
+
620
+
621
+ wasm.__wbindgen_start();
622
+ return wasm;
623
+ }
624
+
625
+ function initSync(module) {
626
+ if (wasm !== undefined) return wasm;
627
+
628
+
629
+ if (typeof module !== 'undefined') {
630
+ if (Object.getPrototypeOf(module) === Object.prototype) {
631
+ ({module} = module)
632
+ } else {
633
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
634
+ }
635
+ }
636
+
637
+ const imports = __wbg_get_imports();
638
+
639
+ __wbg_init_memory(imports);
640
+
641
+ if (!(module instanceof WebAssembly.Module)) {
642
+ module = new WebAssembly.Module(module);
643
+ }
644
+
645
+ const instance = new WebAssembly.Instance(module, imports);
646
+
647
+ return __wbg_finalize_init(instance, module);
648
+ }
649
+
650
+ async function __wbg_init(module_or_path) {
651
+ if (wasm !== undefined) return wasm;
652
+
653
+
654
+ if (typeof module_or_path !== 'undefined') {
655
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
656
+ ({module_or_path} = module_or_path)
657
+ } else {
658
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
659
+ }
660
+ }
661
+
662
+ if (typeof module_or_path === 'undefined') {
663
+ module_or_path = new URL('mimium_web_bg.wasm', import.meta.url);
664
+ }
665
+ const imports = __wbg_get_imports();
666
+
667
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
668
+ module_or_path = fetch(module_or_path);
669
+ }
670
+
671
+ __wbg_init_memory(imports);
672
+
673
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
674
+
675
+ return __wbg_finalize_init(instance, module);
676
+ }
677
+
678
+ export { initSync };
679
+ export default __wbg_init;
Binary file
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "mimium-web",
3
+ "type": "module",
4
+ "collaborators": [
5
+ "Tomoya Matsuura <me@matsuuratomoya.com>"
6
+ ],
7
+ "version": "2.2.3",
8
+ "license": "MPL-2.0",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/tomoyanonymous/mimium-rs/"
12
+ },
13
+ "files": [
14
+ "mimium_web_bg.wasm",
15
+ "mimium_web.js",
16
+ "mimium_web.d.ts"
17
+ ],
18
+ "main": "mimium_web.js",
19
+ "types": "mimium_web.d.ts",
20
+ "sideEffects": [
21
+ "./snippets/*"
22
+ ]
23
+ }