@octoseq/visualiser 0.1.0-main.26cefa1 → 0.1.0-main.2975d70
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/pkg/visualiser.d.ts +267 -0
- package/pkg/visualiser.js +516 -10
- package/pkg/visualiser_bg.wasm +0 -0
- package/pkg/visualiser_bg.wasm.d.ts +34 -0
package/package.json
CHANGED
package/pkg/visualiser.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ export class WasmVisualiser {
|
|
|
8
8
|
* Check if a script is currently loaded.
|
|
9
9
|
*/
|
|
10
10
|
has_script(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Check if a signal variable exists in the current script.
|
|
13
|
+
*/
|
|
14
|
+
has_signal(name: string): boolean;
|
|
11
15
|
/**
|
|
12
16
|
* Load a Rhai script for controlling the visualiser.
|
|
13
17
|
* Returns true if the script was loaded successfully.
|
|
@@ -32,7 +36,16 @@ export class WasmVisualiser {
|
|
|
32
36
|
*/
|
|
33
37
|
clear_signals(): void;
|
|
34
38
|
set_sigmoid_k(k: number): void;
|
|
39
|
+
/**
|
|
40
|
+
* Isolate a single entity for rendering (useful for debugging).
|
|
41
|
+
* Only this entity will be rendered.
|
|
42
|
+
*/
|
|
43
|
+
isolate_entity(entity_id: bigint): void;
|
|
35
44
|
push_zoom_data(samples: Float32Array, sample_rate: number): void;
|
|
45
|
+
/**
|
|
46
|
+
* Clear entity isolation, resume normal rendering.
|
|
47
|
+
*/
|
|
48
|
+
clear_isolation(): void;
|
|
36
49
|
/**
|
|
37
50
|
* Get current state values for debugging.
|
|
38
51
|
* Returns [time, scene_entity_count, mesh_count, line_count]
|
|
@@ -47,18 +60,192 @@ export class WasmVisualiser {
|
|
|
47
60
|
* Returns a JSON array of signal names.
|
|
48
61
|
*/
|
|
49
62
|
get_signal_names(): string;
|
|
63
|
+
/**
|
|
64
|
+
* Get a list of all registered mesh asset IDs.
|
|
65
|
+
* Returns a JSON array of asset IDs.
|
|
66
|
+
*/
|
|
67
|
+
list_mesh_assets(): string;
|
|
68
|
+
/**
|
|
69
|
+
* Push pre-extracted events for a band.
|
|
70
|
+
*
|
|
71
|
+
* Events are extracted by the TypeScript layer using the existing peak picker,
|
|
72
|
+
* then pushed here for script access via `inputs.bands[id].events`.
|
|
73
|
+
*
|
|
74
|
+
* The JSON format should be an array of event objects with:
|
|
75
|
+
* - time: f32
|
|
76
|
+
* - weight: f32
|
|
77
|
+
* - beat_position: Option<f32>
|
|
78
|
+
* - beat_phase: Option<f32>
|
|
79
|
+
* - cluster_id: Option<u32>
|
|
80
|
+
*
|
|
81
|
+
* Returns true if successful, false if parsing failed.
|
|
82
|
+
*/
|
|
83
|
+
push_band_events(band_id: string, events_json: string): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Push a band-scoped signal for use in scripts.
|
|
86
|
+
* The signal will be available as `inputs.bands[band_id].{feature}` in Rhai scripts.
|
|
87
|
+
* Stores under both band_id and band_label for dual-access support.
|
|
88
|
+
*
|
|
89
|
+
* - `band_id`: The unique ID of the frequency band.
|
|
90
|
+
* - `band_label`: The user-visible label of the band.
|
|
91
|
+
* - `feature`: Signal type ("energy", "onset", "flux").
|
|
92
|
+
* - `samples`: Signal data.
|
|
93
|
+
* - `sample_rate`: Sample rate of the signal.
|
|
94
|
+
*/
|
|
95
|
+
push_band_signal(band_id: string, band_label: string, feature: string, samples: Float32Array, sample_rate: number): void;
|
|
96
|
+
/**
|
|
97
|
+
* Push a stem-scoped signal for use in scripts.
|
|
98
|
+
* The signal will be available as `inputs.stems[stem_id].{feature}` in Rhai scripts.
|
|
99
|
+
* Stores under both stem_id and stem_label for dual-access support.
|
|
100
|
+
*
|
|
101
|
+
* - `stem_id`: The unique ID of the stem.
|
|
102
|
+
* - `stem_label`: The user-visible label of the stem.
|
|
103
|
+
* - `feature`: Signal type ("energy", "onset", "flux").
|
|
104
|
+
* - `samples`: Signal data.
|
|
105
|
+
* - `sample_rate`: Sample rate of the signal.
|
|
106
|
+
*/
|
|
107
|
+
push_stem_signal(stem_id: string, stem_label: string, feature: string, samples: Float32Array, sample_rate: number): void;
|
|
50
108
|
/**
|
|
51
109
|
* Set the musical time structure for beat-aware signal processing.
|
|
52
110
|
* The JSON format matches the TypeScript MusicalTimeStructure type.
|
|
53
111
|
* Returns true if successful, false if parsing failed.
|
|
54
112
|
*/
|
|
55
113
|
set_musical_time(json: string): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Clear all band event streams.
|
|
116
|
+
*/
|
|
117
|
+
clear_band_events(): void;
|
|
118
|
+
/**
|
|
119
|
+
* Push a named event stream (e.g., "beatCandidates") for script access.
|
|
120
|
+
*
|
|
121
|
+
* The event stream will be available as `inputs.<name>` in Rhai scripts.
|
|
122
|
+
* This is used for MIR-derived events like beat candidates, onset peaks, etc.
|
|
123
|
+
*
|
|
124
|
+
* The JSON format should be an array of event objects with:
|
|
125
|
+
* - time: f32
|
|
126
|
+
* - weight: f32
|
|
127
|
+
* - beat_position: Option<f32>
|
|
128
|
+
* - beat_phase: Option<f32>
|
|
129
|
+
* - cluster_id: Option<u32>
|
|
130
|
+
*
|
|
131
|
+
* Returns true if successful, false if parsing failed.
|
|
132
|
+
*/
|
|
133
|
+
push_event_stream(name: string, events_json: string): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Set debug visualization options.
|
|
136
|
+
*/
|
|
137
|
+
set_debug_options(wireframe: boolean, bounding_boxes: boolean): void;
|
|
138
|
+
/**
|
|
139
|
+
* Clear all band signals.
|
|
140
|
+
*/
|
|
141
|
+
clear_band_signals(): void;
|
|
56
142
|
/**
|
|
57
143
|
* Clear the musical time structure.
|
|
58
144
|
* Beat-aware operations will fall back to 120 BPM default.
|
|
59
145
|
*/
|
|
60
146
|
clear_musical_time(): void;
|
|
147
|
+
/**
|
|
148
|
+
* Clear all stem signals.
|
|
149
|
+
*/
|
|
150
|
+
clear_stem_signals(): void;
|
|
151
|
+
/**
|
|
152
|
+
* Get frequency bounds for all active bands at a given time.
|
|
153
|
+
* Returns a JSON array of { bandId, label, lowHz, highHz, enabled } objects.
|
|
154
|
+
*/
|
|
155
|
+
get_band_bounds_at(time: number): string;
|
|
156
|
+
/**
|
|
157
|
+
* Get all Signal variables from the current script.
|
|
158
|
+
* Returns a JSON array of ScriptSignalInfo objects.
|
|
159
|
+
*/
|
|
160
|
+
get_script_signals(): string;
|
|
61
161
|
push_rotation_data(samples: Float32Array, sample_rate: number): void;
|
|
162
|
+
/**
|
|
163
|
+
* Render with a frame budget timeout.
|
|
164
|
+
*
|
|
165
|
+
* If the frame takes longer than `budget_ms` to process, it will be dropped
|
|
166
|
+
* and a warning logged. This prevents expensive scripts from freezing the browser.
|
|
167
|
+
*
|
|
168
|
+
* Returns true if the frame completed, false if it was dropped due to budget.
|
|
169
|
+
*/
|
|
170
|
+
render_with_budget(dt: number, budget_ms: number): boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Clear all named event streams.
|
|
173
|
+
*/
|
|
174
|
+
clear_event_streams(): void;
|
|
175
|
+
/**
|
|
176
|
+
* Check if frequency bands are currently set.
|
|
177
|
+
*/
|
|
178
|
+
has_frequency_bands(): boolean;
|
|
179
|
+
/**
|
|
180
|
+
* Register a mesh asset from OBJ content.
|
|
181
|
+
* The asset will be available as `mesh.load(asset_id)` in scripts.
|
|
182
|
+
* Returns true if successful, false if parsing failed.
|
|
183
|
+
*/
|
|
184
|
+
register_mesh_asset(asset_id: string, obj_content: string): boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Set available stems for script namespace generation.
|
|
187
|
+
* This registers stem IDs and labels so the script engine can generate
|
|
188
|
+
* `inputs.stems["stem_id"]` and `inputs.stems["label"]` accessors.
|
|
189
|
+
*
|
|
190
|
+
* The JSON format should be an array of [id, label] pairs:
|
|
191
|
+
* `[["stem-abc123", "Drums"], ["stem-def456", "Bass"]]`
|
|
192
|
+
*
|
|
193
|
+
* Returns true if successful, false if parsing failed.
|
|
194
|
+
*/
|
|
195
|
+
set_available_stems(json: string): boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Set the frequency band structure for band-aware processing.
|
|
198
|
+
* The JSON format matches the TypeScript FrequencyBandStructure type.
|
|
199
|
+
* Returns true if successful, false if parsing failed.
|
|
200
|
+
*/
|
|
201
|
+
set_frequency_bands(json: string): boolean;
|
|
202
|
+
/**
|
|
203
|
+
* Analyze a signal chain with localized sampling.
|
|
204
|
+
*
|
|
205
|
+
* Returns JSON with either:
|
|
206
|
+
* - SignalChainAnalysis on success
|
|
207
|
+
* - { "error": "message" } on failure
|
|
208
|
+
*
|
|
209
|
+
* Parameters:
|
|
210
|
+
* - signal_name: Name of the signal variable in the script
|
|
211
|
+
* - center_time: Time to center analysis around (seconds)
|
|
212
|
+
* - window_beats: Number of beats before/after center to sample
|
|
213
|
+
* - sample_count: Number of samples to take
|
|
214
|
+
*/
|
|
215
|
+
analyze_signal_chain(signal_name: string, center_time: number, window_beats: number, sample_count: number): string;
|
|
216
|
+
/**
|
|
217
|
+
* Get the number of events for a specific band.
|
|
218
|
+
* Returns 0 if no events are stored for this band.
|
|
219
|
+
*/
|
|
220
|
+
get_band_event_count(band_id: string): number;
|
|
221
|
+
/**
|
|
222
|
+
* Get list of band keys (IDs and labels) that have signals.
|
|
223
|
+
* Returns a JSON array of strings.
|
|
224
|
+
*/
|
|
225
|
+
get_band_signal_keys(): string;
|
|
226
|
+
/**
|
|
227
|
+
* Get list of stem keys (IDs and labels) that have signals.
|
|
228
|
+
* Returns a JSON array of strings.
|
|
229
|
+
*/
|
|
230
|
+
get_stem_signal_keys(): string;
|
|
231
|
+
/**
|
|
232
|
+
* Clear the frequency band structure.
|
|
233
|
+
*/
|
|
234
|
+
clear_frequency_bands(): void;
|
|
235
|
+
/**
|
|
236
|
+
* Unregister a mesh asset.
|
|
237
|
+
* Returns true if the asset was unregistered, false if it didn't exist.
|
|
238
|
+
*/
|
|
239
|
+
unregister_mesh_asset(asset_id: string): boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Get the number of events in a named event stream.
|
|
242
|
+
* Returns 0 if no events are stored for this name.
|
|
243
|
+
*/
|
|
244
|
+
get_event_stream_count(name: string): number;
|
|
245
|
+
/**
|
|
246
|
+
* Get the number of frequency bands.
|
|
247
|
+
*/
|
|
248
|
+
get_frequency_band_count(): number;
|
|
62
249
|
/**
|
|
63
250
|
* Run script in analysis mode with event extraction support.
|
|
64
251
|
*
|
|
@@ -69,6 +256,43 @@ export class WasmVisualiser {
|
|
|
69
256
|
* Returns a JSON-serialized ExtendedAnalysisResultJson.
|
|
70
257
|
*/
|
|
71
258
|
run_analysis_with_events(script: string, duration: number, time_step: number): string;
|
|
259
|
+
/**
|
|
260
|
+
* Get entity positions as JSON for debugging.
|
|
261
|
+
* Returns a JSON array of objects with id, type, and position fields.
|
|
262
|
+
*/
|
|
263
|
+
get_entity_positions_json(): string;
|
|
264
|
+
/**
|
|
265
|
+
* Push an authored event stream for script access.
|
|
266
|
+
*
|
|
267
|
+
* The event stream will be available as `inputs.authored["name"]` in Rhai scripts.
|
|
268
|
+
* This is used for user-authored events (promoted or manually created).
|
|
269
|
+
*
|
|
270
|
+
* The JSON format should be an array of event objects with:
|
|
271
|
+
* - time: f32
|
|
272
|
+
* - weight: f32
|
|
273
|
+
* - beat_position: Option<f32>
|
|
274
|
+
* - beat_phase: Option<f32>
|
|
275
|
+
* - cluster_id: Option<u32>
|
|
276
|
+
*
|
|
277
|
+
* Returns true if successful, false if parsing failed.
|
|
278
|
+
*/
|
|
279
|
+
push_authored_event_stream(name: string, events_json: string): boolean;
|
|
280
|
+
/**
|
|
281
|
+
* Clear all authored event streams.
|
|
282
|
+
*/
|
|
283
|
+
clear_authored_event_streams(): void;
|
|
284
|
+
/**
|
|
285
|
+
* Drain and return any pending structured script diagnostics as JSON.
|
|
286
|
+
*
|
|
287
|
+
* Intended for UI consumption. Calling this clears the pending diagnostics
|
|
288
|
+
* queue so repeated polling does not duplicate messages.
|
|
289
|
+
*/
|
|
290
|
+
take_script_diagnostics_json(): string;
|
|
291
|
+
/**
|
|
292
|
+
* Get the number of events in an authored event stream.
|
|
293
|
+
* Returns 0 if no events are stored for this name.
|
|
294
|
+
*/
|
|
295
|
+
get_authored_event_stream_count(name: string): number;
|
|
72
296
|
constructor();
|
|
73
297
|
render(dt: number): void;
|
|
74
298
|
resize(width: number, height: number): void;
|
|
@@ -78,6 +302,15 @@ export class WasmVisualiser {
|
|
|
78
302
|
|
|
79
303
|
export function create_visualiser(canvas: HTMLCanvasElement): Promise<WasmVisualiser>;
|
|
80
304
|
|
|
305
|
+
/**
|
|
306
|
+
* Get the host-defined Script API metadata as a JSON string.
|
|
307
|
+
*
|
|
308
|
+
* This is a stable, versioned description of the scripting API surface and is
|
|
309
|
+
* intended to drive editor UX (autocomplete/hover/docs) and future language
|
|
310
|
+
* bindings.
|
|
311
|
+
*/
|
|
312
|
+
export function get_script_api_metadata_json(): string;
|
|
313
|
+
|
|
81
314
|
export function init_panic_hook(): void;
|
|
82
315
|
|
|
83
316
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
@@ -86,24 +319,58 @@ export interface InitOutput {
|
|
|
86
319
|
readonly memory: WebAssembly.Memory;
|
|
87
320
|
readonly __wbg_wasmvisualiser_free: (a: number, b: number) => void;
|
|
88
321
|
readonly create_visualiser: (a: any) => any;
|
|
322
|
+
readonly get_script_api_metadata_json: () => [number, number];
|
|
323
|
+
readonly wasmvisualiser_analyze_signal_chain: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
324
|
+
readonly wasmvisualiser_clear_authored_event_streams: (a: number) => void;
|
|
325
|
+
readonly wasmvisualiser_clear_band_events: (a: number) => void;
|
|
326
|
+
readonly wasmvisualiser_clear_band_signals: (a: number) => void;
|
|
327
|
+
readonly wasmvisualiser_clear_event_streams: (a: number) => void;
|
|
328
|
+
readonly wasmvisualiser_clear_frequency_bands: (a: number) => void;
|
|
329
|
+
readonly wasmvisualiser_clear_isolation: (a: number) => void;
|
|
89
330
|
readonly wasmvisualiser_clear_musical_time: (a: number) => void;
|
|
90
331
|
readonly wasmvisualiser_clear_signals: (a: number) => void;
|
|
332
|
+
readonly wasmvisualiser_clear_stem_signals: (a: number) => void;
|
|
333
|
+
readonly wasmvisualiser_get_authored_event_stream_count: (a: number, b: number, c: number) => number;
|
|
334
|
+
readonly wasmvisualiser_get_band_bounds_at: (a: number, b: number) => [number, number];
|
|
335
|
+
readonly wasmvisualiser_get_band_event_count: (a: number, b: number, c: number) => number;
|
|
336
|
+
readonly wasmvisualiser_get_band_signal_keys: (a: number) => [number, number];
|
|
91
337
|
readonly wasmvisualiser_get_current_vals: (a: number) => [number, number];
|
|
338
|
+
readonly wasmvisualiser_get_entity_positions_json: (a: number) => [number, number];
|
|
339
|
+
readonly wasmvisualiser_get_event_stream_count: (a: number, b: number, c: number) => number;
|
|
340
|
+
readonly wasmvisualiser_get_frequency_band_count: (a: number) => number;
|
|
92
341
|
readonly wasmvisualiser_get_script_error: (a: number) => [number, number];
|
|
342
|
+
readonly wasmvisualiser_get_script_signals: (a: number) => [number, number];
|
|
93
343
|
readonly wasmvisualiser_get_signal_names: (a: number) => [number, number];
|
|
344
|
+
readonly wasmvisualiser_get_stem_signal_keys: (a: number) => [number, number];
|
|
345
|
+
readonly wasmvisualiser_has_frequency_bands: (a: number) => number;
|
|
94
346
|
readonly wasmvisualiser_has_script: (a: number) => number;
|
|
347
|
+
readonly wasmvisualiser_has_signal: (a: number, b: number, c: number) => number;
|
|
348
|
+
readonly wasmvisualiser_isolate_entity: (a: number, b: bigint) => void;
|
|
349
|
+
readonly wasmvisualiser_list_mesh_assets: (a: number) => [number, number];
|
|
95
350
|
readonly wasmvisualiser_load_script: (a: number, b: number, c: number) => number;
|
|
96
351
|
readonly wasmvisualiser_new: () => number;
|
|
352
|
+
readonly wasmvisualiser_push_authored_event_stream: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
353
|
+
readonly wasmvisualiser_push_band_events: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
354
|
+
readonly wasmvisualiser_push_band_signal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
97
355
|
readonly wasmvisualiser_push_data: (a: number, b: number, c: number, d: number) => void;
|
|
356
|
+
readonly wasmvisualiser_push_event_stream: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
98
357
|
readonly wasmvisualiser_push_signal: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
358
|
+
readonly wasmvisualiser_push_stem_signal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
99
359
|
readonly wasmvisualiser_push_zoom_data: (a: number, b: number, c: number, d: number) => void;
|
|
360
|
+
readonly wasmvisualiser_register_mesh_asset: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
100
361
|
readonly wasmvisualiser_render: (a: number, b: number) => void;
|
|
362
|
+
readonly wasmvisualiser_render_with_budget: (a: number, b: number, c: number) => number;
|
|
101
363
|
readonly wasmvisualiser_resize: (a: number, b: number, c: number) => void;
|
|
102
364
|
readonly wasmvisualiser_run_analysis: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
103
365
|
readonly wasmvisualiser_run_analysis_with_events: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
366
|
+
readonly wasmvisualiser_set_available_stems: (a: number, b: number, c: number) => number;
|
|
367
|
+
readonly wasmvisualiser_set_debug_options: (a: number, b: number, c: number) => void;
|
|
368
|
+
readonly wasmvisualiser_set_frequency_bands: (a: number, b: number, c: number) => number;
|
|
104
369
|
readonly wasmvisualiser_set_musical_time: (a: number, b: number, c: number) => number;
|
|
105
370
|
readonly wasmvisualiser_set_sigmoid_k: (a: number, b: number) => void;
|
|
106
371
|
readonly wasmvisualiser_set_time: (a: number, b: number) => void;
|
|
372
|
+
readonly wasmvisualiser_take_script_diagnostics_json: (a: number) => [number, number];
|
|
373
|
+
readonly wasmvisualiser_unregister_mesh_asset: (a: number, b: number, c: number) => number;
|
|
107
374
|
readonly wasmvisualiser_push_rotation_data: (a: number, b: number, c: number, d: number) => void;
|
|
108
375
|
readonly init_panic_hook: () => void;
|
|
109
376
|
readonly wasm_bindgen__convert__closures_____invoke__h9d1c5a23ecfcd5c8: (a: number, b: number, c: any) => void;
|
package/pkg/visualiser.js
CHANGED
|
@@ -293,6 +293,17 @@ export class WasmVisualiser {
|
|
|
293
293
|
const ret = wasm.wasmvisualiser_has_script(this.__wbg_ptr);
|
|
294
294
|
return ret !== 0;
|
|
295
295
|
}
|
|
296
|
+
/**
|
|
297
|
+
* Check if a signal variable exists in the current script.
|
|
298
|
+
* @param {string} name
|
|
299
|
+
* @returns {boolean}
|
|
300
|
+
*/
|
|
301
|
+
has_signal(name) {
|
|
302
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
303
|
+
const len0 = WASM_VECTOR_LEN;
|
|
304
|
+
const ret = wasm.wasmvisualiser_has_signal(this.__wbg_ptr, ptr0, len0);
|
|
305
|
+
return ret !== 0;
|
|
306
|
+
}
|
|
296
307
|
/**
|
|
297
308
|
* Load a Rhai script for controlling the visualiser.
|
|
298
309
|
* Returns true if the script was loaded successfully.
|
|
@@ -357,6 +368,14 @@ export class WasmVisualiser {
|
|
|
357
368
|
set_sigmoid_k(k) {
|
|
358
369
|
wasm.wasmvisualiser_set_sigmoid_k(this.__wbg_ptr, k);
|
|
359
370
|
}
|
|
371
|
+
/**
|
|
372
|
+
* Isolate a single entity for rendering (useful for debugging).
|
|
373
|
+
* Only this entity will be rendered.
|
|
374
|
+
* @param {bigint} entity_id
|
|
375
|
+
*/
|
|
376
|
+
isolate_entity(entity_id) {
|
|
377
|
+
wasm.wasmvisualiser_isolate_entity(this.__wbg_ptr, entity_id);
|
|
378
|
+
}
|
|
360
379
|
/**
|
|
361
380
|
* @param {Float32Array} samples
|
|
362
381
|
* @param {number} sample_rate
|
|
@@ -366,6 +385,12 @@ export class WasmVisualiser {
|
|
|
366
385
|
const len0 = WASM_VECTOR_LEN;
|
|
367
386
|
wasm.wasmvisualiser_push_zoom_data(this.__wbg_ptr, ptr0, len0, sample_rate);
|
|
368
387
|
}
|
|
388
|
+
/**
|
|
389
|
+
* Clear entity isolation, resume normal rendering.
|
|
390
|
+
*/
|
|
391
|
+
clear_isolation() {
|
|
392
|
+
wasm.wasmvisualiser_clear_isolation(this.__wbg_ptr);
|
|
393
|
+
}
|
|
369
394
|
/**
|
|
370
395
|
* Get current state values for debugging.
|
|
371
396
|
* Returns [time, scene_entity_count, mesh_count, line_count]
|
|
@@ -407,6 +432,103 @@ export class WasmVisualiser {
|
|
|
407
432
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
408
433
|
}
|
|
409
434
|
}
|
|
435
|
+
/**
|
|
436
|
+
* Get a list of all registered mesh asset IDs.
|
|
437
|
+
* Returns a JSON array of asset IDs.
|
|
438
|
+
* @returns {string}
|
|
439
|
+
*/
|
|
440
|
+
list_mesh_assets() {
|
|
441
|
+
let deferred1_0;
|
|
442
|
+
let deferred1_1;
|
|
443
|
+
try {
|
|
444
|
+
const ret = wasm.wasmvisualiser_list_mesh_assets(this.__wbg_ptr);
|
|
445
|
+
deferred1_0 = ret[0];
|
|
446
|
+
deferred1_1 = ret[1];
|
|
447
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
448
|
+
} finally {
|
|
449
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Push pre-extracted events for a band.
|
|
454
|
+
*
|
|
455
|
+
* Events are extracted by the TypeScript layer using the existing peak picker,
|
|
456
|
+
* then pushed here for script access via `inputs.bands[id].events`.
|
|
457
|
+
*
|
|
458
|
+
* The JSON format should be an array of event objects with:
|
|
459
|
+
* - time: f32
|
|
460
|
+
* - weight: f32
|
|
461
|
+
* - beat_position: Option<f32>
|
|
462
|
+
* - beat_phase: Option<f32>
|
|
463
|
+
* - cluster_id: Option<u32>
|
|
464
|
+
*
|
|
465
|
+
* Returns true if successful, false if parsing failed.
|
|
466
|
+
* @param {string} band_id
|
|
467
|
+
* @param {string} events_json
|
|
468
|
+
* @returns {boolean}
|
|
469
|
+
*/
|
|
470
|
+
push_band_events(band_id, events_json) {
|
|
471
|
+
const ptr0 = passStringToWasm0(band_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
472
|
+
const len0 = WASM_VECTOR_LEN;
|
|
473
|
+
const ptr1 = passStringToWasm0(events_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
474
|
+
const len1 = WASM_VECTOR_LEN;
|
|
475
|
+
const ret = wasm.wasmvisualiser_push_band_events(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
476
|
+
return ret !== 0;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Push a band-scoped signal for use in scripts.
|
|
480
|
+
* The signal will be available as `inputs.bands[band_id].{feature}` in Rhai scripts.
|
|
481
|
+
* Stores under both band_id and band_label for dual-access support.
|
|
482
|
+
*
|
|
483
|
+
* - `band_id`: The unique ID of the frequency band.
|
|
484
|
+
* - `band_label`: The user-visible label of the band.
|
|
485
|
+
* - `feature`: Signal type ("energy", "onset", "flux").
|
|
486
|
+
* - `samples`: Signal data.
|
|
487
|
+
* - `sample_rate`: Sample rate of the signal.
|
|
488
|
+
* @param {string} band_id
|
|
489
|
+
* @param {string} band_label
|
|
490
|
+
* @param {string} feature
|
|
491
|
+
* @param {Float32Array} samples
|
|
492
|
+
* @param {number} sample_rate
|
|
493
|
+
*/
|
|
494
|
+
push_band_signal(band_id, band_label, feature, samples, sample_rate) {
|
|
495
|
+
const ptr0 = passStringToWasm0(band_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
496
|
+
const len0 = WASM_VECTOR_LEN;
|
|
497
|
+
const ptr1 = passStringToWasm0(band_label, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
498
|
+
const len1 = WASM_VECTOR_LEN;
|
|
499
|
+
const ptr2 = passStringToWasm0(feature, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
500
|
+
const len2 = WASM_VECTOR_LEN;
|
|
501
|
+
const ptr3 = passArrayF32ToWasm0(samples, wasm.__wbindgen_malloc);
|
|
502
|
+
const len3 = WASM_VECTOR_LEN;
|
|
503
|
+
wasm.wasmvisualiser_push_band_signal(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, sample_rate);
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Push a stem-scoped signal for use in scripts.
|
|
507
|
+
* The signal will be available as `inputs.stems[stem_id].{feature}` in Rhai scripts.
|
|
508
|
+
* Stores under both stem_id and stem_label for dual-access support.
|
|
509
|
+
*
|
|
510
|
+
* - `stem_id`: The unique ID of the stem.
|
|
511
|
+
* - `stem_label`: The user-visible label of the stem.
|
|
512
|
+
* - `feature`: Signal type ("energy", "onset", "flux").
|
|
513
|
+
* - `samples`: Signal data.
|
|
514
|
+
* - `sample_rate`: Sample rate of the signal.
|
|
515
|
+
* @param {string} stem_id
|
|
516
|
+
* @param {string} stem_label
|
|
517
|
+
* @param {string} feature
|
|
518
|
+
* @param {Float32Array} samples
|
|
519
|
+
* @param {number} sample_rate
|
|
520
|
+
*/
|
|
521
|
+
push_stem_signal(stem_id, stem_label, feature, samples, sample_rate) {
|
|
522
|
+
const ptr0 = passStringToWasm0(stem_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
523
|
+
const len0 = WASM_VECTOR_LEN;
|
|
524
|
+
const ptr1 = passStringToWasm0(stem_label, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
525
|
+
const len1 = WASM_VECTOR_LEN;
|
|
526
|
+
const ptr2 = passStringToWasm0(feature, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
527
|
+
const len2 = WASM_VECTOR_LEN;
|
|
528
|
+
const ptr3 = passArrayF32ToWasm0(samples, wasm.__wbindgen_malloc);
|
|
529
|
+
const len3 = WASM_VECTOR_LEN;
|
|
530
|
+
wasm.wasmvisualiser_push_stem_signal(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, sample_rate);
|
|
531
|
+
}
|
|
410
532
|
/**
|
|
411
533
|
* Set the musical time structure for beat-aware signal processing.
|
|
412
534
|
* The JSON format matches the TypeScript MusicalTimeStructure type.
|
|
@@ -420,6 +542,52 @@ export class WasmVisualiser {
|
|
|
420
542
|
const ret = wasm.wasmvisualiser_set_musical_time(this.__wbg_ptr, ptr0, len0);
|
|
421
543
|
return ret !== 0;
|
|
422
544
|
}
|
|
545
|
+
/**
|
|
546
|
+
* Clear all band event streams.
|
|
547
|
+
*/
|
|
548
|
+
clear_band_events() {
|
|
549
|
+
wasm.wasmvisualiser_clear_band_events(this.__wbg_ptr);
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Push a named event stream (e.g., "beatCandidates") for script access.
|
|
553
|
+
*
|
|
554
|
+
* The event stream will be available as `inputs.<name>` in Rhai scripts.
|
|
555
|
+
* This is used for MIR-derived events like beat candidates, onset peaks, etc.
|
|
556
|
+
*
|
|
557
|
+
* The JSON format should be an array of event objects with:
|
|
558
|
+
* - time: f32
|
|
559
|
+
* - weight: f32
|
|
560
|
+
* - beat_position: Option<f32>
|
|
561
|
+
* - beat_phase: Option<f32>
|
|
562
|
+
* - cluster_id: Option<u32>
|
|
563
|
+
*
|
|
564
|
+
* Returns true if successful, false if parsing failed.
|
|
565
|
+
* @param {string} name
|
|
566
|
+
* @param {string} events_json
|
|
567
|
+
* @returns {boolean}
|
|
568
|
+
*/
|
|
569
|
+
push_event_stream(name, events_json) {
|
|
570
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
571
|
+
const len0 = WASM_VECTOR_LEN;
|
|
572
|
+
const ptr1 = passStringToWasm0(events_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
573
|
+
const len1 = WASM_VECTOR_LEN;
|
|
574
|
+
const ret = wasm.wasmvisualiser_push_event_stream(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
575
|
+
return ret !== 0;
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Set debug visualization options.
|
|
579
|
+
* @param {boolean} wireframe
|
|
580
|
+
* @param {boolean} bounding_boxes
|
|
581
|
+
*/
|
|
582
|
+
set_debug_options(wireframe, bounding_boxes) {
|
|
583
|
+
wasm.wasmvisualiser_set_debug_options(this.__wbg_ptr, wireframe, bounding_boxes);
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Clear all band signals.
|
|
587
|
+
*/
|
|
588
|
+
clear_band_signals() {
|
|
589
|
+
wasm.wasmvisualiser_clear_band_signals(this.__wbg_ptr);
|
|
590
|
+
}
|
|
423
591
|
/**
|
|
424
592
|
* Clear the musical time structure.
|
|
425
593
|
* Beat-aware operations will fall back to 120 BPM default.
|
|
@@ -427,6 +595,47 @@ export class WasmVisualiser {
|
|
|
427
595
|
clear_musical_time() {
|
|
428
596
|
wasm.wasmvisualiser_clear_musical_time(this.__wbg_ptr);
|
|
429
597
|
}
|
|
598
|
+
/**
|
|
599
|
+
* Clear all stem signals.
|
|
600
|
+
*/
|
|
601
|
+
clear_stem_signals() {
|
|
602
|
+
wasm.wasmvisualiser_clear_stem_signals(this.__wbg_ptr);
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Get frequency bounds for all active bands at a given time.
|
|
606
|
+
* Returns a JSON array of { bandId, label, lowHz, highHz, enabled } objects.
|
|
607
|
+
* @param {number} time
|
|
608
|
+
* @returns {string}
|
|
609
|
+
*/
|
|
610
|
+
get_band_bounds_at(time) {
|
|
611
|
+
let deferred1_0;
|
|
612
|
+
let deferred1_1;
|
|
613
|
+
try {
|
|
614
|
+
const ret = wasm.wasmvisualiser_get_band_bounds_at(this.__wbg_ptr, time);
|
|
615
|
+
deferred1_0 = ret[0];
|
|
616
|
+
deferred1_1 = ret[1];
|
|
617
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
618
|
+
} finally {
|
|
619
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Get all Signal variables from the current script.
|
|
624
|
+
* Returns a JSON array of ScriptSignalInfo objects.
|
|
625
|
+
* @returns {string}
|
|
626
|
+
*/
|
|
627
|
+
get_script_signals() {
|
|
628
|
+
let deferred1_0;
|
|
629
|
+
let deferred1_1;
|
|
630
|
+
try {
|
|
631
|
+
const ret = wasm.wasmvisualiser_get_script_signals(this.__wbg_ptr);
|
|
632
|
+
deferred1_0 = ret[0];
|
|
633
|
+
deferred1_1 = ret[1];
|
|
634
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
635
|
+
} finally {
|
|
636
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
430
639
|
/**
|
|
431
640
|
* @param {Float32Array} samples
|
|
432
641
|
* @param {number} sample_rate
|
|
@@ -436,6 +645,198 @@ export class WasmVisualiser {
|
|
|
436
645
|
const len0 = WASM_VECTOR_LEN;
|
|
437
646
|
wasm.wasmvisualiser_push_data(this.__wbg_ptr, ptr0, len0, sample_rate);
|
|
438
647
|
}
|
|
648
|
+
/**
|
|
649
|
+
* Render with a frame budget timeout.
|
|
650
|
+
*
|
|
651
|
+
* If the frame takes longer than `budget_ms` to process, it will be dropped
|
|
652
|
+
* and a warning logged. This prevents expensive scripts from freezing the browser.
|
|
653
|
+
*
|
|
654
|
+
* Returns true if the frame completed, false if it was dropped due to budget.
|
|
655
|
+
* @param {number} dt
|
|
656
|
+
* @param {number} budget_ms
|
|
657
|
+
* @returns {boolean}
|
|
658
|
+
*/
|
|
659
|
+
render_with_budget(dt, budget_ms) {
|
|
660
|
+
const ret = wasm.wasmvisualiser_render_with_budget(this.__wbg_ptr, dt, budget_ms);
|
|
661
|
+
return ret !== 0;
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Clear all named event streams.
|
|
665
|
+
*/
|
|
666
|
+
clear_event_streams() {
|
|
667
|
+
wasm.wasmvisualiser_clear_event_streams(this.__wbg_ptr);
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Check if frequency bands are currently set.
|
|
671
|
+
* @returns {boolean}
|
|
672
|
+
*/
|
|
673
|
+
has_frequency_bands() {
|
|
674
|
+
const ret = wasm.wasmvisualiser_has_frequency_bands(this.__wbg_ptr);
|
|
675
|
+
return ret !== 0;
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* Register a mesh asset from OBJ content.
|
|
679
|
+
* The asset will be available as `mesh.load(asset_id)` in scripts.
|
|
680
|
+
* Returns true if successful, false if parsing failed.
|
|
681
|
+
* @param {string} asset_id
|
|
682
|
+
* @param {string} obj_content
|
|
683
|
+
* @returns {boolean}
|
|
684
|
+
*/
|
|
685
|
+
register_mesh_asset(asset_id, obj_content) {
|
|
686
|
+
const ptr0 = passStringToWasm0(asset_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
687
|
+
const len0 = WASM_VECTOR_LEN;
|
|
688
|
+
const ptr1 = passStringToWasm0(obj_content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
689
|
+
const len1 = WASM_VECTOR_LEN;
|
|
690
|
+
const ret = wasm.wasmvisualiser_register_mesh_asset(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
691
|
+
return ret !== 0;
|
|
692
|
+
}
|
|
693
|
+
/**
|
|
694
|
+
* Set available stems for script namespace generation.
|
|
695
|
+
* This registers stem IDs and labels so the script engine can generate
|
|
696
|
+
* `inputs.stems["stem_id"]` and `inputs.stems["label"]` accessors.
|
|
697
|
+
*
|
|
698
|
+
* The JSON format should be an array of [id, label] pairs:
|
|
699
|
+
* `[["stem-abc123", "Drums"], ["stem-def456", "Bass"]]`
|
|
700
|
+
*
|
|
701
|
+
* Returns true if successful, false if parsing failed.
|
|
702
|
+
* @param {string} json
|
|
703
|
+
* @returns {boolean}
|
|
704
|
+
*/
|
|
705
|
+
set_available_stems(json) {
|
|
706
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
707
|
+
const len0 = WASM_VECTOR_LEN;
|
|
708
|
+
const ret = wasm.wasmvisualiser_set_available_stems(this.__wbg_ptr, ptr0, len0);
|
|
709
|
+
return ret !== 0;
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* Set the frequency band structure for band-aware processing.
|
|
713
|
+
* The JSON format matches the TypeScript FrequencyBandStructure type.
|
|
714
|
+
* Returns true if successful, false if parsing failed.
|
|
715
|
+
* @param {string} json
|
|
716
|
+
* @returns {boolean}
|
|
717
|
+
*/
|
|
718
|
+
set_frequency_bands(json) {
|
|
719
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
720
|
+
const len0 = WASM_VECTOR_LEN;
|
|
721
|
+
const ret = wasm.wasmvisualiser_set_frequency_bands(this.__wbg_ptr, ptr0, len0);
|
|
722
|
+
return ret !== 0;
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* Analyze a signal chain with localized sampling.
|
|
726
|
+
*
|
|
727
|
+
* Returns JSON with either:
|
|
728
|
+
* - SignalChainAnalysis on success
|
|
729
|
+
* - { "error": "message" } on failure
|
|
730
|
+
*
|
|
731
|
+
* Parameters:
|
|
732
|
+
* - signal_name: Name of the signal variable in the script
|
|
733
|
+
* - center_time: Time to center analysis around (seconds)
|
|
734
|
+
* - window_beats: Number of beats before/after center to sample
|
|
735
|
+
* - sample_count: Number of samples to take
|
|
736
|
+
* @param {string} signal_name
|
|
737
|
+
* @param {number} center_time
|
|
738
|
+
* @param {number} window_beats
|
|
739
|
+
* @param {number} sample_count
|
|
740
|
+
* @returns {string}
|
|
741
|
+
*/
|
|
742
|
+
analyze_signal_chain(signal_name, center_time, window_beats, sample_count) {
|
|
743
|
+
let deferred2_0;
|
|
744
|
+
let deferred2_1;
|
|
745
|
+
try {
|
|
746
|
+
const ptr0 = passStringToWasm0(signal_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
747
|
+
const len0 = WASM_VECTOR_LEN;
|
|
748
|
+
const ret = wasm.wasmvisualiser_analyze_signal_chain(this.__wbg_ptr, ptr0, len0, center_time, window_beats, sample_count);
|
|
749
|
+
deferred2_0 = ret[0];
|
|
750
|
+
deferred2_1 = ret[1];
|
|
751
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
752
|
+
} finally {
|
|
753
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* Get the number of events for a specific band.
|
|
758
|
+
* Returns 0 if no events are stored for this band.
|
|
759
|
+
* @param {string} band_id
|
|
760
|
+
* @returns {number}
|
|
761
|
+
*/
|
|
762
|
+
get_band_event_count(band_id) {
|
|
763
|
+
const ptr0 = passStringToWasm0(band_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
764
|
+
const len0 = WASM_VECTOR_LEN;
|
|
765
|
+
const ret = wasm.wasmvisualiser_get_band_event_count(this.__wbg_ptr, ptr0, len0);
|
|
766
|
+
return ret >>> 0;
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* Get list of band keys (IDs and labels) that have signals.
|
|
770
|
+
* Returns a JSON array of strings.
|
|
771
|
+
* @returns {string}
|
|
772
|
+
*/
|
|
773
|
+
get_band_signal_keys() {
|
|
774
|
+
let deferred1_0;
|
|
775
|
+
let deferred1_1;
|
|
776
|
+
try {
|
|
777
|
+
const ret = wasm.wasmvisualiser_get_band_signal_keys(this.__wbg_ptr);
|
|
778
|
+
deferred1_0 = ret[0];
|
|
779
|
+
deferred1_1 = ret[1];
|
|
780
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
781
|
+
} finally {
|
|
782
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Get list of stem keys (IDs and labels) that have signals.
|
|
787
|
+
* Returns a JSON array of strings.
|
|
788
|
+
* @returns {string}
|
|
789
|
+
*/
|
|
790
|
+
get_stem_signal_keys() {
|
|
791
|
+
let deferred1_0;
|
|
792
|
+
let deferred1_1;
|
|
793
|
+
try {
|
|
794
|
+
const ret = wasm.wasmvisualiser_get_stem_signal_keys(this.__wbg_ptr);
|
|
795
|
+
deferred1_0 = ret[0];
|
|
796
|
+
deferred1_1 = ret[1];
|
|
797
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
798
|
+
} finally {
|
|
799
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* Clear the frequency band structure.
|
|
804
|
+
*/
|
|
805
|
+
clear_frequency_bands() {
|
|
806
|
+
wasm.wasmvisualiser_clear_frequency_bands(this.__wbg_ptr);
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Unregister a mesh asset.
|
|
810
|
+
* Returns true if the asset was unregistered, false if it didn't exist.
|
|
811
|
+
* @param {string} asset_id
|
|
812
|
+
* @returns {boolean}
|
|
813
|
+
*/
|
|
814
|
+
unregister_mesh_asset(asset_id) {
|
|
815
|
+
const ptr0 = passStringToWasm0(asset_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
816
|
+
const len0 = WASM_VECTOR_LEN;
|
|
817
|
+
const ret = wasm.wasmvisualiser_unregister_mesh_asset(this.__wbg_ptr, ptr0, len0);
|
|
818
|
+
return ret !== 0;
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* Get the number of events in a named event stream.
|
|
822
|
+
* Returns 0 if no events are stored for this name.
|
|
823
|
+
* @param {string} name
|
|
824
|
+
* @returns {number}
|
|
825
|
+
*/
|
|
826
|
+
get_event_stream_count(name) {
|
|
827
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
828
|
+
const len0 = WASM_VECTOR_LEN;
|
|
829
|
+
const ret = wasm.wasmvisualiser_get_event_stream_count(this.__wbg_ptr, ptr0, len0);
|
|
830
|
+
return ret >>> 0;
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* Get the number of frequency bands.
|
|
834
|
+
* @returns {number}
|
|
835
|
+
*/
|
|
836
|
+
get_frequency_band_count() {
|
|
837
|
+
const ret = wasm.wasmvisualiser_get_frequency_band_count(this.__wbg_ptr);
|
|
838
|
+
return ret >>> 0;
|
|
839
|
+
}
|
|
439
840
|
/**
|
|
440
841
|
* Run script in analysis mode with event extraction support.
|
|
441
842
|
*
|
|
@@ -463,6 +864,86 @@ export class WasmVisualiser {
|
|
|
463
864
|
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
464
865
|
}
|
|
465
866
|
}
|
|
867
|
+
/**
|
|
868
|
+
* Get entity positions as JSON for debugging.
|
|
869
|
+
* Returns a JSON array of objects with id, type, and position fields.
|
|
870
|
+
* @returns {string}
|
|
871
|
+
*/
|
|
872
|
+
get_entity_positions_json() {
|
|
873
|
+
let deferred1_0;
|
|
874
|
+
let deferred1_1;
|
|
875
|
+
try {
|
|
876
|
+
const ret = wasm.wasmvisualiser_get_entity_positions_json(this.__wbg_ptr);
|
|
877
|
+
deferred1_0 = ret[0];
|
|
878
|
+
deferred1_1 = ret[1];
|
|
879
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
880
|
+
} finally {
|
|
881
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* Push an authored event stream for script access.
|
|
886
|
+
*
|
|
887
|
+
* The event stream will be available as `inputs.authored["name"]` in Rhai scripts.
|
|
888
|
+
* This is used for user-authored events (promoted or manually created).
|
|
889
|
+
*
|
|
890
|
+
* The JSON format should be an array of event objects with:
|
|
891
|
+
* - time: f32
|
|
892
|
+
* - weight: f32
|
|
893
|
+
* - beat_position: Option<f32>
|
|
894
|
+
* - beat_phase: Option<f32>
|
|
895
|
+
* - cluster_id: Option<u32>
|
|
896
|
+
*
|
|
897
|
+
* Returns true if successful, false if parsing failed.
|
|
898
|
+
* @param {string} name
|
|
899
|
+
* @param {string} events_json
|
|
900
|
+
* @returns {boolean}
|
|
901
|
+
*/
|
|
902
|
+
push_authored_event_stream(name, events_json) {
|
|
903
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
904
|
+
const len0 = WASM_VECTOR_LEN;
|
|
905
|
+
const ptr1 = passStringToWasm0(events_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
906
|
+
const len1 = WASM_VECTOR_LEN;
|
|
907
|
+
const ret = wasm.wasmvisualiser_push_authored_event_stream(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
908
|
+
return ret !== 0;
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* Clear all authored event streams.
|
|
912
|
+
*/
|
|
913
|
+
clear_authored_event_streams() {
|
|
914
|
+
wasm.wasmvisualiser_clear_authored_event_streams(this.__wbg_ptr);
|
|
915
|
+
}
|
|
916
|
+
/**
|
|
917
|
+
* Drain and return any pending structured script diagnostics as JSON.
|
|
918
|
+
*
|
|
919
|
+
* Intended for UI consumption. Calling this clears the pending diagnostics
|
|
920
|
+
* queue so repeated polling does not duplicate messages.
|
|
921
|
+
* @returns {string}
|
|
922
|
+
*/
|
|
923
|
+
take_script_diagnostics_json() {
|
|
924
|
+
let deferred1_0;
|
|
925
|
+
let deferred1_1;
|
|
926
|
+
try {
|
|
927
|
+
const ret = wasm.wasmvisualiser_take_script_diagnostics_json(this.__wbg_ptr);
|
|
928
|
+
deferred1_0 = ret[0];
|
|
929
|
+
deferred1_1 = ret[1];
|
|
930
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
931
|
+
} finally {
|
|
932
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
/**
|
|
936
|
+
* Get the number of events in an authored event stream.
|
|
937
|
+
* Returns 0 if no events are stored for this name.
|
|
938
|
+
* @param {string} name
|
|
939
|
+
* @returns {number}
|
|
940
|
+
*/
|
|
941
|
+
get_authored_event_stream_count(name) {
|
|
942
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
943
|
+
const len0 = WASM_VECTOR_LEN;
|
|
944
|
+
const ret = wasm.wasmvisualiser_get_authored_event_stream_count(this.__wbg_ptr, ptr0, len0);
|
|
945
|
+
return ret >>> 0;
|
|
946
|
+
}
|
|
466
947
|
constructor() {
|
|
467
948
|
const ret = wasm.wasmvisualiser_new();
|
|
468
949
|
this.__wbg_ptr = ret >>> 0;
|
|
@@ -509,6 +990,27 @@ export function create_visualiser(canvas) {
|
|
|
509
990
|
return ret;
|
|
510
991
|
}
|
|
511
992
|
|
|
993
|
+
/**
|
|
994
|
+
* Get the host-defined Script API metadata as a JSON string.
|
|
995
|
+
*
|
|
996
|
+
* This is a stable, versioned description of the scripting API surface and is
|
|
997
|
+
* intended to drive editor UX (autocomplete/hover/docs) and future language
|
|
998
|
+
* bindings.
|
|
999
|
+
* @returns {string}
|
|
1000
|
+
*/
|
|
1001
|
+
export function get_script_api_metadata_json() {
|
|
1002
|
+
let deferred1_0;
|
|
1003
|
+
let deferred1_1;
|
|
1004
|
+
try {
|
|
1005
|
+
const ret = wasm.get_script_api_metadata_json();
|
|
1006
|
+
deferred1_0 = ret[0];
|
|
1007
|
+
deferred1_1 = ret[1];
|
|
1008
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1009
|
+
} finally {
|
|
1010
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
|
|
512
1014
|
export function init_panic_hook() {
|
|
513
1015
|
wasm.init_panic_hook();
|
|
514
1016
|
}
|
|
@@ -1160,6 +1662,10 @@ function __wbg_get_imports() {
|
|
|
1160
1662
|
const ret = arg0.offset;
|
|
1161
1663
|
return ret;
|
|
1162
1664
|
};
|
|
1665
|
+
imports.wbg.__wbg_performance_c77a440eff2efd9b = function(arg0) {
|
|
1666
|
+
const ret = arg0.performance;
|
|
1667
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1668
|
+
};
|
|
1163
1669
|
imports.wbg.__wbg_popErrorScope_af0b22f136a861d6 = function(arg0) {
|
|
1164
1670
|
const ret = arg0.popErrorScope();
|
|
1165
1671
|
return ret;
|
|
@@ -1363,26 +1869,26 @@ function __wbg_get_imports() {
|
|
|
1363
1869
|
imports.wbg.__wbg_writeTexture_246118eb2f5a1592 = function(arg0, arg1, arg2, arg3, arg4) {
|
|
1364
1870
|
arg0.writeTexture(arg1, arg2, arg3, arg4);
|
|
1365
1871
|
};
|
|
1872
|
+
imports.wbg.__wbindgen_cast_20a09e3b1a4dd0c5 = function(arg0, arg1) {
|
|
1873
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 3344, function: Function { arguments: [Externref], shim_idx: 3345, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1874
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hf5eaa61ced318e08, wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7);
|
|
1875
|
+
return ret;
|
|
1876
|
+
};
|
|
1366
1877
|
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
1367
1878
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
1368
1879
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
1369
1880
|
return ret;
|
|
1370
1881
|
};
|
|
1371
|
-
imports.wbg.__wbindgen_cast_3ab85374d1bc89a0 = function(arg0, arg1) {
|
|
1372
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 2084, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 2085, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1373
|
-
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__heb49a8f426ac2d2e, wasm_bindgen__convert__closures_____invoke__h9d1c5a23ecfcd5c8);
|
|
1374
|
-
return ret;
|
|
1375
|
-
};
|
|
1376
|
-
imports.wbg.__wbindgen_cast_c8fd0bbc5dfe7a9b = function(arg0, arg1) {
|
|
1377
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 2218, function: Function { arguments: [Externref], shim_idx: 2219, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1378
|
-
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hf5eaa61ced318e08, wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7);
|
|
1379
|
-
return ret;
|
|
1380
|
-
};
|
|
1381
1882
|
imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
|
|
1382
1883
|
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
1383
1884
|
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
1384
1885
|
return ret;
|
|
1385
1886
|
};
|
|
1887
|
+
imports.wbg.__wbindgen_cast_d06b8da61cc8218a = function(arg0, arg1) {
|
|
1888
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 3212, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 3213, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1889
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__heb49a8f426ac2d2e, wasm_bindgen__convert__closures_____invoke__h9d1c5a23ecfcd5c8);
|
|
1890
|
+
return ret;
|
|
1891
|
+
};
|
|
1386
1892
|
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
1387
1893
|
// Cast intrinsic for `F64 -> Externref`.
|
|
1388
1894
|
const ret = arg0;
|
package/pkg/visualiser_bg.wasm
CHANGED
|
Binary file
|
|
@@ -3,24 +3,58 @@
|
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const __wbg_wasmvisualiser_free: (a: number, b: number) => void;
|
|
5
5
|
export const create_visualiser: (a: any) => any;
|
|
6
|
+
export const get_script_api_metadata_json: () => [number, number];
|
|
7
|
+
export const wasmvisualiser_analyze_signal_chain: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
8
|
+
export const wasmvisualiser_clear_authored_event_streams: (a: number) => void;
|
|
9
|
+
export const wasmvisualiser_clear_band_events: (a: number) => void;
|
|
10
|
+
export const wasmvisualiser_clear_band_signals: (a: number) => void;
|
|
11
|
+
export const wasmvisualiser_clear_event_streams: (a: number) => void;
|
|
12
|
+
export const wasmvisualiser_clear_frequency_bands: (a: number) => void;
|
|
13
|
+
export const wasmvisualiser_clear_isolation: (a: number) => void;
|
|
6
14
|
export const wasmvisualiser_clear_musical_time: (a: number) => void;
|
|
7
15
|
export const wasmvisualiser_clear_signals: (a: number) => void;
|
|
16
|
+
export const wasmvisualiser_clear_stem_signals: (a: number) => void;
|
|
17
|
+
export const wasmvisualiser_get_authored_event_stream_count: (a: number, b: number, c: number) => number;
|
|
18
|
+
export const wasmvisualiser_get_band_bounds_at: (a: number, b: number) => [number, number];
|
|
19
|
+
export const wasmvisualiser_get_band_event_count: (a: number, b: number, c: number) => number;
|
|
20
|
+
export const wasmvisualiser_get_band_signal_keys: (a: number) => [number, number];
|
|
8
21
|
export const wasmvisualiser_get_current_vals: (a: number) => [number, number];
|
|
22
|
+
export const wasmvisualiser_get_entity_positions_json: (a: number) => [number, number];
|
|
23
|
+
export const wasmvisualiser_get_event_stream_count: (a: number, b: number, c: number) => number;
|
|
24
|
+
export const wasmvisualiser_get_frequency_band_count: (a: number) => number;
|
|
9
25
|
export const wasmvisualiser_get_script_error: (a: number) => [number, number];
|
|
26
|
+
export const wasmvisualiser_get_script_signals: (a: number) => [number, number];
|
|
10
27
|
export const wasmvisualiser_get_signal_names: (a: number) => [number, number];
|
|
28
|
+
export const wasmvisualiser_get_stem_signal_keys: (a: number) => [number, number];
|
|
29
|
+
export const wasmvisualiser_has_frequency_bands: (a: number) => number;
|
|
11
30
|
export const wasmvisualiser_has_script: (a: number) => number;
|
|
31
|
+
export const wasmvisualiser_has_signal: (a: number, b: number, c: number) => number;
|
|
32
|
+
export const wasmvisualiser_isolate_entity: (a: number, b: bigint) => void;
|
|
33
|
+
export const wasmvisualiser_list_mesh_assets: (a: number) => [number, number];
|
|
12
34
|
export const wasmvisualiser_load_script: (a: number, b: number, c: number) => number;
|
|
13
35
|
export const wasmvisualiser_new: () => number;
|
|
36
|
+
export const wasmvisualiser_push_authored_event_stream: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
37
|
+
export const wasmvisualiser_push_band_events: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
38
|
+
export const wasmvisualiser_push_band_signal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
14
39
|
export const wasmvisualiser_push_data: (a: number, b: number, c: number, d: number) => void;
|
|
40
|
+
export const wasmvisualiser_push_event_stream: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
15
41
|
export const wasmvisualiser_push_signal: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
42
|
+
export const wasmvisualiser_push_stem_signal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
16
43
|
export const wasmvisualiser_push_zoom_data: (a: number, b: number, c: number, d: number) => void;
|
|
44
|
+
export const wasmvisualiser_register_mesh_asset: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
17
45
|
export const wasmvisualiser_render: (a: number, b: number) => void;
|
|
46
|
+
export const wasmvisualiser_render_with_budget: (a: number, b: number, c: number) => number;
|
|
18
47
|
export const wasmvisualiser_resize: (a: number, b: number, c: number) => void;
|
|
19
48
|
export const wasmvisualiser_run_analysis: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
20
49
|
export const wasmvisualiser_run_analysis_with_events: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
50
|
+
export const wasmvisualiser_set_available_stems: (a: number, b: number, c: number) => number;
|
|
51
|
+
export const wasmvisualiser_set_debug_options: (a: number, b: number, c: number) => void;
|
|
52
|
+
export const wasmvisualiser_set_frequency_bands: (a: number, b: number, c: number) => number;
|
|
21
53
|
export const wasmvisualiser_set_musical_time: (a: number, b: number, c: number) => number;
|
|
22
54
|
export const wasmvisualiser_set_sigmoid_k: (a: number, b: number) => void;
|
|
23
55
|
export const wasmvisualiser_set_time: (a: number, b: number) => void;
|
|
56
|
+
export const wasmvisualiser_take_script_diagnostics_json: (a: number) => [number, number];
|
|
57
|
+
export const wasmvisualiser_unregister_mesh_asset: (a: number, b: number, c: number) => number;
|
|
24
58
|
export const wasmvisualiser_push_rotation_data: (a: number, b: number, c: number, d: number) => void;
|
|
25
59
|
export const init_panic_hook: () => void;
|
|
26
60
|
export const wasm_bindgen__convert__closures_____invoke__h9d1c5a23ecfcd5c8: (a: number, b: number, c: any) => void;
|