@m4l-jweb/wrapper 0.2.0 → 0.3.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/package.json +1 -1
- package/src/max.d.ts +41 -2
package/package.json
CHANGED
package/src/max.d.ts
CHANGED
|
@@ -39,6 +39,34 @@ declare class Task {
|
|
|
39
39
|
cancel(): void;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* A named Max dictionary, addressed from [js].
|
|
44
|
+
*
|
|
45
|
+
* The reason this exists here at all is [maxurl]: downloading to a FILE is not
|
|
46
|
+
* expressible as a flat Max message. Per the reference, the file form is a
|
|
47
|
+
* `dictionary <name>` message carrying a dict with a `filename_out` key - so
|
|
48
|
+
* something has to build that dict, and [js] is the only thing in the patcher
|
|
49
|
+
* that can.
|
|
50
|
+
*
|
|
51
|
+
* VERIFIED in Live (doc/SPIKES.md spike 1.3): [js] built a maxurl request dict
|
|
52
|
+
* and read the response dict back. `constructor`, `set`, `clear` and `stringify`
|
|
53
|
+
* all behave as declared. `get`, `parse` and `freepeer` were not exercised.
|
|
54
|
+
*/
|
|
55
|
+
declare class Dict {
|
|
56
|
+
constructor(name?: string);
|
|
57
|
+
name: string;
|
|
58
|
+
set(key: string, value: unknown): void;
|
|
59
|
+
/** UNVERIFIED - the spike only ever wrote, and read back via stringify(). */
|
|
60
|
+
get(key: string): unknown;
|
|
61
|
+
/** The whole dict as JSON - the cheapest way to see what maxurl replied. */
|
|
62
|
+
stringify(): string;
|
|
63
|
+
/** UNVERIFIED. */
|
|
64
|
+
parse(json: string): void;
|
|
65
|
+
clear(): void;
|
|
66
|
+
/** Release the dict's reference. Max dictionaries are refcounted. UNVERIFIED. */
|
|
67
|
+
freepeer(): void;
|
|
68
|
+
}
|
|
69
|
+
|
|
42
70
|
/** Max's file object. Note: `writebytes` truncates silently past ~16 KB. */
|
|
43
71
|
declare class File {
|
|
44
72
|
constructor(path: string, mode?: "read" | "write" | "readwrite");
|
|
@@ -63,8 +91,18 @@ declare class File {
|
|
|
63
91
|
* ASYNCHRONOUS: framecount() right after it still reads the old size. Come back
|
|
64
92
|
* on a Task.
|
|
65
93
|
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
94
|
+
* VERIFIED in Live (doc/SPIKES.md spike 1.2): an empty buffer~ went to 124439
|
|
95
|
+
* frames, 1 channel, midsample -0.0319 after `send("replace", "jongly.aif")`.
|
|
96
|
+
* `send`, `framecount`, `channelcount` and `peek` are all real and behave as
|
|
97
|
+
* declared. `poke` is the one member here still taken on faith from the docs.
|
|
98
|
+
*
|
|
99
|
+
* `replace` on a file buffer~ cannot decode is a SILENT NO-OP: no error, and the
|
|
100
|
+
* buffer keeps whatever it held before. So a frame count on its own never means
|
|
101
|
+
* "the read worked" - it only means something next to what the count was before.
|
|
102
|
+
*
|
|
103
|
+
* `replace` also adopts the FILE's channel count, whatever the buffer~ was
|
|
104
|
+
* declared with (a stereo .wav gave channelcount() === 2 from a buffer~ created
|
|
105
|
+
* with no arguments). Never assume mono. Ask.
|
|
68
106
|
*/
|
|
69
107
|
declare class Buffer {
|
|
70
108
|
constructor(name: string);
|
|
@@ -74,6 +112,7 @@ declare class Buffer {
|
|
|
74
112
|
channelcount(): number;
|
|
75
113
|
/** peek(channel, frameIndex, count) - channels and frames are 1-indexed. */
|
|
76
114
|
peek(channel: number, index: number, count?: number): number;
|
|
115
|
+
/** UNVERIFIED - spike 1.2 exercised everything above this, but not poke. */
|
|
77
116
|
poke(channel: number, index: number, value: number): void;
|
|
78
117
|
}
|
|
79
118
|
|