@onda-lang/processor-abi 0.8.38 → 0.8.39
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 +2 -2
- package/api.md +9 -2
- package/package.json +1 -1
- package/src/index.d.ts +12 -1
- package/src/index.js +13 -0
package/README.md
CHANGED
|
@@ -119,7 +119,7 @@ if (overflowCount) reportOverflow(overflowCount);
|
|
|
119
119
|
|
|
120
120
|
Allocate the descriptor and storage before realtime execution and consume records before the next
|
|
121
121
|
call reuses them. Reset the execution output immediately before every generated entry call. See the
|
|
122
|
-
|
|
122
|
+
[host output guide](../../docs/host-output.md#delegates)
|
|
123
123
|
for the complete lifecycle, capacity guidance, and APIs for other hosts.
|
|
124
124
|
|
|
125
125
|
## Print batches
|
|
@@ -129,7 +129,7 @@ Print delivery uses an independent caller-owned batch with the same physical des
|
|
|
129
129
|
scalar types; `formatPrintBatch()` and `formatPrintRecords()` produce canonical newline-terminated
|
|
130
130
|
text with exact `i64` and width-correct floating-point formatting. Use `writeExecutionOutput()` to
|
|
131
131
|
pass independently nullable delegate and print batch addresses to init, process, or event exports.
|
|
132
|
-
See the
|
|
132
|
+
See the [host output guide](../../docs/host-output.md#prints) for the complete
|
|
133
133
|
lifecycle and metadata contract.
|
|
134
134
|
|
|
135
135
|
The current descriptor represents every bindable buffer-array slot as a physical
|
package/api.md
CHANGED
|
@@ -70,7 +70,7 @@ The returned instance provides:
|
|
|
70
70
|
- `compileSource(source, options?)` and `inspectSourceConstants(source, options?)`.
|
|
71
71
|
- `compileWorkspace(workspace, options?)` and `inspectWorkspaceConstants(workspace, options?)`.
|
|
72
72
|
- `compileProjectImage(bytes, options?)` and `inspectProjectImageConstants(bytes, options?)`.
|
|
73
|
-
- `createProjectImage(sourceGraph, buffers?)`, `inspectProjectImage(bytes)`,
|
|
73
|
+
- `createProjectImage(sourceGraph, buffers?, constants?)`, `inspectProjectImage(bytes)`,
|
|
74
74
|
`loadProjectFiles(files, projectFilePath?)`, and `materializeProjectImage(bytes, names?)`.
|
|
75
75
|
- `encodeBufferAsset(binding)`, `decodeBufferAsset(bytes)`, and `decodeBufferFile(bytes, path?)`.
|
|
76
76
|
- `projectCapabilities()` for supported image, buffer, and standard-library versions.
|
|
@@ -78,6 +78,9 @@ The returned instance provides:
|
|
|
78
78
|
- `dispose()`, an idempotent terminal release of compiler and worker resources.
|
|
79
79
|
|
|
80
80
|
Compile options accept `sampleRate`, `blockSize`, typed compile-constant overrides, and `codegen`.
|
|
81
|
+
Workspaces may carry `constants` in project-manifest form (numbers, booleans, decimal strings for
|
|
82
|
+
`i64`, and primitive arrays). These are project defaults; explicit `options.constants` take
|
|
83
|
+
precedence. Pass the same defaults to `createProjectImage` when exporting an edited workspace.
|
|
81
84
|
The sample rate defaults to 48000 Hz and the block size to 512 frames.
|
|
82
85
|
Code generation can select optimization level `0..4`, shrink level `0..2`, strict or fast math,
|
|
83
86
|
SIMD, loop-containing inlining, and optional WAT emission. A successful compilation returns an
|
|
@@ -136,6 +139,9 @@ endpoints, apply linear, logarithmic, or curved scale, and clamp and snap to the
|
|
|
136
139
|
|
|
137
140
|
### Delegates and print output
|
|
138
141
|
|
|
142
|
+
See the [host output guide](https://onda-lang.org/docs/host-output/#javascript-and-web-audio)
|
|
143
|
+
for batch sizing, decoding, formatting, and Web Audio listener examples.
|
|
144
|
+
|
|
139
145
|
Complete wasm32 processor exports receive an optional execution-output descriptor containing
|
|
140
146
|
independently nullable delegate and print batches. Allocate all descriptors and storage before
|
|
141
147
|
real-time execution. Their linear-memory regions must be mutually disjoint and must not overlap any
|
|
@@ -156,7 +162,7 @@ chronological output stream.
|
|
|
156
162
|
|
|
157
163
|
Batch capacity is host policy. `overflowCount` reports whole records that did not fit; it is not a
|
|
158
164
|
byte count. Consume the returned storage before reusing it for another init, process, or event call.
|
|
159
|
-
See the [language guide](https://onda-lang.org/docs/language/#delegates) for authored semantics and
|
|
165
|
+
See the [language guide](https://onda-lang.org/docs/language/#delegates-and-when) for authored semantics and
|
|
160
166
|
the [processor API](https://onda-lang.org/docs/processor-api/#call-scoped-execution-output) for
|
|
161
167
|
physical record layout.
|
|
162
168
|
|
|
@@ -425,6 +431,7 @@ OndaProcessorInitMode
|
|
|
425
431
|
OndaProcessorMetadata
|
|
426
432
|
OndaProjectBufferInfo
|
|
427
433
|
OndaProjectCapabilities
|
|
434
|
+
OndaProjectConstant
|
|
428
435
|
OndaProjectImageInfo
|
|
429
436
|
OndaProjectMaterialization
|
|
430
437
|
OndaResolvedCompileConstValue
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -280,10 +280,21 @@ export interface OndaProcessorMetadata {
|
|
|
280
280
|
target: OndaTargetInfo;
|
|
281
281
|
integration: {
|
|
282
282
|
required_symbols: string[];
|
|
283
|
+
/** Native link dependencies, for example ["m", "mvec"]. */
|
|
284
|
+
link_libraries?: string[];
|
|
283
285
|
one_processor_per_artifact: true;
|
|
284
286
|
profile: OndaIntegrationProfile;
|
|
285
287
|
};
|
|
286
|
-
compile: {
|
|
288
|
+
compile: {
|
|
289
|
+
sample_rate: number;
|
|
290
|
+
block_size: number;
|
|
291
|
+
fast_math: boolean;
|
|
292
|
+
floating_point?: {
|
|
293
|
+
reassociate: boolean;
|
|
294
|
+
contract: boolean;
|
|
295
|
+
no_signed_zeros: boolean;
|
|
296
|
+
};
|
|
297
|
+
};
|
|
287
298
|
exports: {
|
|
288
299
|
memory?: string;
|
|
289
300
|
heap_base?: string;
|
package/src/index.js
CHANGED
|
@@ -100,6 +100,19 @@ export function validateProcessorMetadata(metadata, expectedKind = null) {
|
|
|
100
100
|
requirePositiveFinite(metadata.compile?.sample_rate, "compile.sample_rate");
|
|
101
101
|
requireInteger(metadata.compile?.block_size, "compile.block_size", 1);
|
|
102
102
|
requireBoolean(metadata.compile?.fast_math, "compile.fast_math");
|
|
103
|
+
if (metadata.compile.floating_point !== undefined) {
|
|
104
|
+
for (const permission of ["reassociate", "contract", "no_signed_zeros"]) {
|
|
105
|
+
requireBoolean(metadata.compile.floating_point?.[permission], `compile.floating_point.${permission}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (metadata.integration?.link_libraries !== undefined) {
|
|
109
|
+
if (!Array.isArray(metadata.integration.link_libraries)) {
|
|
110
|
+
throw new OndaArtifactError("integration.link_libraries must be an array");
|
|
111
|
+
}
|
|
112
|
+
for (const library of metadata.integration.link_libraries) {
|
|
113
|
+
requireString(library, "integration.link_libraries[]");
|
|
114
|
+
}
|
|
115
|
+
}
|
|
103
116
|
requireInteger(metadata.runtime?.state_size_bytes, "runtime.state_size_bytes", 0);
|
|
104
117
|
requireInteger(metadata.runtime?.state_align_bytes, "runtime.state_align_bytes", 1);
|
|
105
118
|
requireInteger(metadata.runtime?.param_size_bytes, "runtime.param_size_bytes", 0);
|