@carbonenginejs/runtime-resource 0.11.1 → 0.12.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/dist/formats/bnk/CjsBnkFormat.js +12 -2
- package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
- package/dist/formats/bnk/core/graph.js +3 -6
- package/dist/formats/bnk/core/graph.js.map +1 -1
- package/dist/formats/bnk/core/helpers.js +53 -11
- package/dist/formats/bnk/core/helpers.js.map +1 -1
- package/dist/formats/bnk/core/sfxNodes.js +532 -0
- package/dist/formats/bnk/core/sfxNodes.js.map +1 -0
- package/dist/formats/bnk/core/soundbanksInfo.js +59 -51
- package/dist/formats/bnk/core/soundbanksInfo.js.map +1 -1
- package/dist/formats/gr2/CjsGr2Format.js +256 -13
- package/dist/formats/gr2/CjsGr2Format.js.map +1 -1
- package/dist/formats/gr2/core/helpers.js +15 -15
- package/dist/formats/gr2/core/helpers.js.map +1 -1
- package/dist/formats/gr2/core/json.js +1 -1
- package/dist/formats/gr2/core/json.js.map +1 -1
- package/dist/formats/gr2/core/targets.js +1 -1
- package/dist/formats/gr2/core/targets.js.map +1 -1
- package/dist/formats/gr2/index.js +0 -1
- package/dist/formats/gr2/index.js.map +1 -1
- package/dist/formats/hlsl/core/analysis.js +1 -1
- package/dist/formats/hlsl/index.js +1 -0
- package/dist/formats/hlsl/index.js.map +1 -1
- package/dist/formats/index.js +3 -6
- package/dist/formats/index.js.map +1 -1
- package/dist/formats/webgl/core/cewg/binary.js +3 -3
- package/dist/formats/webgl/core/cewg/binary.js.map +1 -1
- package/dist/formats/webgl/core/effectPackage.js +4 -1
- package/dist/formats/webgl/core/effectPackage.js.map +1 -1
- package/dist/formats/webgl/core/errors.js +3 -3
- package/dist/formats/webgl/core/errors.js.map +1 -1
- package/docs/formats/dxbc/README.md +68 -0
- package/docs/formats/dxbc/architecture.md +80 -0
- package/docs/formats/dxbc/reference/api.md +77 -0
- package/docs/formats/dxbc/reference/classes/README.md +76 -0
- package/docs/formats/dxbc/reference/decoded-output.md +122 -0
- package/docs/formats/gr2.md +3 -4
- package/docs/formats/hlsl/README.md +54 -0
- package/docs/formats/hlsl/architecture.md +67 -0
- package/docs/formats/hlsl/guides/hydrating-json-output.md +62 -0
- package/docs/formats/hlsl/guides/reading-effects.md +64 -0
- package/docs/formats/hlsl/reference/advanced-analysis.md +66 -0
- package/docs/formats/hlsl/reference/api.md +97 -0
- package/docs/formats/hlsl/reference/classes/README.md +16 -0
- package/docs/formats/hlsl/reference/classes/carbon-compatibility.md +66 -0
- package/docs/formats/hlsl/reference/classes/public-api.md +26 -0
- package/docs/formats/hlsl/reference/classes/tr2-effect-model.md +150 -0
- package/docs/formats/hlsl/reference/json-graph.md +100 -0
- package/docs/formats/hlsl/reference/portable-reflection.md +141 -0
- package/docs/formats/provenance.md +9 -4
- package/docs/formats/webgl/README.md +57 -0
- package/docs/formats/webgl/architecture.md +70 -0
- package/docs/formats/webgl/carbon-constant-layouts.md +326 -0
- package/docs/formats/webgl/decl-io.md +1234 -0
- package/docs/formats/webgl/effect-reflection.md +127 -0
- package/docs/formats/webgl/memory-structured.md +871 -0
- package/docs/formats/webgl/reference/classes/README.md +96 -0
- package/docs/formats/webgl/texture-sample.md +964 -0
- package/docs/formats/webgpu/README.md +81 -0
- package/docs/formats/webgpu/architecture.md +93 -0
- package/docs/formats/webgpu/formats/cewgpu.md +479 -0
- package/docs/formats/webgpu/guides/effect-packaging.md +199 -0
- package/docs/formats/webgpu/reference/api.md +197 -0
- package/docs/formats/webgpu/reference/classes/README.md +66 -0
- package/docs/formats/webgpu/reference/wgsl-compatibility.md +1442 -0
- package/docs/formats/wwise.md +16 -1
- package/docs/reference/classes/formats.md +10 -10
- package/format-notices/bnk/NOTICE +5 -4
- package/format-notices/webgl/NOTICE +1 -1
- package/package.json +1 -1
- package/dist/formats/gr2/core/CjsFormatGr2.js +0 -273
- package/dist/formats/gr2/core/CjsFormatGr2.js.map +0 -1
|
@@ -0,0 +1,532 @@
|
|
|
1
|
+
import { readWwiseVar } from './helpers.js';
|
|
2
|
+
|
|
3
|
+
// Wwise v150 authored-SFX node decoding. Like musicNodes.js, this interprets
|
|
4
|
+
// inspect() payload views outside the BNK read path and accepts a suffix only
|
|
5
|
+
// when one anchored candidate consumes the payload exactly.
|
|
6
|
+
|
|
7
|
+
const SUPPORTED_VERSION = 150;
|
|
8
|
+
const SFX_CHILD_TYPES = new Set([2, 5, 6, 7, 9]);
|
|
9
|
+
const TYPE_NAMES = Object.freeze({
|
|
10
|
+
2: "sound",
|
|
11
|
+
5: "random-sequence-container",
|
|
12
|
+
6: "switch-container",
|
|
13
|
+
9: "blend-container"
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Bounds-aware little-endian cursor used for exact-end Wwise SFX-tail
|
|
18
|
+
* validation.
|
|
19
|
+
*/
|
|
20
|
+
class SfxCursor {
|
|
21
|
+
/** Creates a cursor over one HIRC payload at a candidate tail offset. */
|
|
22
|
+
constructor(bytes, offset = 0) {
|
|
23
|
+
this.bytes = bytes;
|
|
24
|
+
this.view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
25
|
+
this.at = offset;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Returns the number of unread payload bytes. */
|
|
29
|
+
get remaining() {
|
|
30
|
+
return this.bytes.byteLength - this.at;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Verifies that a primitive read remains inside the HIRC payload. */
|
|
34
|
+
ensure(size) {
|
|
35
|
+
if (this.at + size > this.bytes.byteLength) {
|
|
36
|
+
throw new RangeError("truncated SFX node");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Reads an unsigned 8-bit integer. */
|
|
41
|
+
u8() {
|
|
42
|
+
this.ensure(1);
|
|
43
|
+
return this.view.getUint8(this.at++);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Reads an unsigned little-endian 16-bit integer. */
|
|
47
|
+
u16() {
|
|
48
|
+
this.ensure(2);
|
|
49
|
+
const value = this.view.getUint16(this.at, true);
|
|
50
|
+
this.at += 2;
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Reads an unsigned little-endian 32-bit integer. */
|
|
55
|
+
u32() {
|
|
56
|
+
this.ensure(4);
|
|
57
|
+
const value = this.view.getUint32(this.at, true);
|
|
58
|
+
this.at += 4;
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Reads a signed little-endian 32-bit integer. */
|
|
63
|
+
s32() {
|
|
64
|
+
this.ensure(4);
|
|
65
|
+
const value = this.view.getInt32(this.at, true);
|
|
66
|
+
this.at += 4;
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Reads a little-endian 32-bit float. */
|
|
71
|
+
f32() {
|
|
72
|
+
this.ensure(4);
|
|
73
|
+
const value = this.view.getFloat32(this.at, true);
|
|
74
|
+
this.at += 4;
|
|
75
|
+
return value;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Reads one MSB-first Wwise variable-length unsigned integer. */
|
|
79
|
+
variable() {
|
|
80
|
+
const result = readWwiseVar(this.bytes, this.at);
|
|
81
|
+
if (!result) {
|
|
82
|
+
throw new RangeError("invalid Wwise variable integer");
|
|
83
|
+
}
|
|
84
|
+
this.at = result.nextOffset;
|
|
85
|
+
return result.value;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Decodes one v150 HIRC 5 Random/Sequence payload.
|
|
91
|
+
*
|
|
92
|
+
* @returns {object|null} Typed node, or null when no unique exact-end anchor
|
|
93
|
+
* validates.
|
|
94
|
+
*/
|
|
95
|
+
function parseSfxRandomSequence(payload, knownObjects, {
|
|
96
|
+
bankVersion = SUPPORTED_VERSION
|
|
97
|
+
} = {}) {
|
|
98
|
+
return FindRandomSequence(payload, NormalizeKnownObjects(knownObjects), bankVersion).node;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Decodes one v150 HIRC 6 Switch payload.
|
|
103
|
+
*
|
|
104
|
+
* @returns {object|null} Typed node, or null when no unique exact-end anchor
|
|
105
|
+
* validates.
|
|
106
|
+
*/
|
|
107
|
+
function parseSfxSwitch(payload, knownObjects, {
|
|
108
|
+
bankVersion = SUPPORTED_VERSION
|
|
109
|
+
} = {}) {
|
|
110
|
+
return FindSwitch(payload, NormalizeKnownObjects(knownObjects), bankVersion).node;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Decodes one v150 HIRC 9 Layer payload without lowering curve semantics.
|
|
115
|
+
*
|
|
116
|
+
* @returns {object|null} Typed node, or null when no unique exact-end anchor
|
|
117
|
+
* validates.
|
|
118
|
+
*/
|
|
119
|
+
function parseSfxLayer(payload, knownObjects, {
|
|
120
|
+
bankVersion = SUPPORTED_VERSION
|
|
121
|
+
} = {}) {
|
|
122
|
+
return FindLayer(payload, NormalizeKnownObjects(knownObjects), bankVersion).node;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Decodes typed SFX nodes, events, and actions across inspected v150 banks.
|
|
127
|
+
*
|
|
128
|
+
* Raw Wwise identities and semantics are preserved. Runtime schema lowering
|
|
129
|
+
* and optional authoring-name enrichment belong to runtime-audio's builder.
|
|
130
|
+
*/
|
|
131
|
+
function sfxNodesFromBanks(inspections) {
|
|
132
|
+
const banks = Array.isArray(inspections) ? inspections : [inspections];
|
|
133
|
+
const knownObjects = new Map();
|
|
134
|
+
const duplicates = [];
|
|
135
|
+
for (const inspection of banks) {
|
|
136
|
+
for (const entry of inspection?.hirc ?? []) {
|
|
137
|
+
if (knownObjects.has(entry.id)) {
|
|
138
|
+
duplicates.push({
|
|
139
|
+
id: entry.id,
|
|
140
|
+
previousBank: knownObjects.get(entry.id).bank,
|
|
141
|
+
bank: inspection.source || ""
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
knownObjects.set(entry.id, {
|
|
145
|
+
...entry,
|
|
146
|
+
bank: inspection.source || ""
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
const nodes = new Map();
|
|
151
|
+
const events = new Map();
|
|
152
|
+
const actions = new Map();
|
|
153
|
+
const failed = [];
|
|
154
|
+
const ambiguous = [];
|
|
155
|
+
const unsupportedVersions = [];
|
|
156
|
+
const parsedByType = {};
|
|
157
|
+
let parsed = 0;
|
|
158
|
+
for (const inspection of banks) {
|
|
159
|
+
const version = Number(inspection?.bankVersion) >>> 0;
|
|
160
|
+
const bank = inspection?.source || "";
|
|
161
|
+
if (version !== SUPPORTED_VERSION) {
|
|
162
|
+
unsupportedVersions.push({
|
|
163
|
+
bank,
|
|
164
|
+
version
|
|
165
|
+
});
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
for (const entry of inspection?.hirc ?? []) {
|
|
169
|
+
if (entry.type === 4) {
|
|
170
|
+
events.set(entry.id, {
|
|
171
|
+
id: entry.id,
|
|
172
|
+
type: "event",
|
|
173
|
+
bank,
|
|
174
|
+
actionIds: [...(entry.actionIds ?? [])]
|
|
175
|
+
});
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
if (entry.type === 3) {
|
|
179
|
+
actions.set(entry.id, {
|
|
180
|
+
id: entry.id,
|
|
181
|
+
type: "event-action",
|
|
182
|
+
bank,
|
|
183
|
+
actionType: entry.actionType,
|
|
184
|
+
targetId: entry.targetId,
|
|
185
|
+
payload: entry.payload
|
|
186
|
+
});
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
let result = null;
|
|
190
|
+
if (entry.type === 2) {
|
|
191
|
+
if (entry.pluginId === undefined || entry.sourceId === undefined) {
|
|
192
|
+
result = {
|
|
193
|
+
node: null,
|
|
194
|
+
reason: "missing typed sound fields"
|
|
195
|
+
};
|
|
196
|
+
} else {
|
|
197
|
+
result = {
|
|
198
|
+
node: {
|
|
199
|
+
type: "sound",
|
|
200
|
+
pluginId: entry.pluginId,
|
|
201
|
+
pluginType: entry.pluginType ?? entry.pluginId & 0x0f,
|
|
202
|
+
streamType: entry.streamType,
|
|
203
|
+
sourceId: entry.sourceId,
|
|
204
|
+
inMemoryMediaSize: entry.inMemoryMediaSize
|
|
205
|
+
},
|
|
206
|
+
reason: ""
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
} else if (entry.type === 5) {
|
|
210
|
+
result = FindRandomSequence(entry.payload, knownObjects, version);
|
|
211
|
+
} else if (entry.type === 6) {
|
|
212
|
+
result = FindSwitch(entry.payload, knownObjects, version);
|
|
213
|
+
} else if (entry.type === 9) {
|
|
214
|
+
result = FindLayer(entry.payload, knownObjects, version);
|
|
215
|
+
} else {
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
if (!result.node) {
|
|
219
|
+
const failure = {
|
|
220
|
+
bank,
|
|
221
|
+
version,
|
|
222
|
+
type: TYPE_NAMES[entry.type],
|
|
223
|
+
id: entry.id,
|
|
224
|
+
reason: result.reason
|
|
225
|
+
};
|
|
226
|
+
failed.push(failure);
|
|
227
|
+
if (result.reason === "ambiguous anchors") {
|
|
228
|
+
ambiguous.push(failure);
|
|
229
|
+
}
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
parsed++;
|
|
233
|
+
parsedByType[result.node.type] = (parsedByType[result.node.type] ?? 0) + 1;
|
|
234
|
+
nodes.set(entry.id, {
|
|
235
|
+
id: entry.id,
|
|
236
|
+
bank,
|
|
237
|
+
...result.node
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return {
|
|
242
|
+
nodes,
|
|
243
|
+
events,
|
|
244
|
+
actions,
|
|
245
|
+
diagnostics: {
|
|
246
|
+
parsed,
|
|
247
|
+
parsedByType,
|
|
248
|
+
failed,
|
|
249
|
+
ambiguous,
|
|
250
|
+
unsupportedVersions,
|
|
251
|
+
duplicates
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
function FindRandomSequence(payload, knownObjects, bankVersion) {
|
|
256
|
+
return FindUnique(payload, bankVersion, cursor => {
|
|
257
|
+
const loopCount = cursor.u16();
|
|
258
|
+
const loopModMin = cursor.u16();
|
|
259
|
+
const loopModMax = cursor.u16();
|
|
260
|
+
const transitionTime = Finite(cursor.f32());
|
|
261
|
+
const transitionTimeModMin = Finite(cursor.f32());
|
|
262
|
+
const transitionTimeModMax = Finite(cursor.f32());
|
|
263
|
+
const avoidRepeatCount = cursor.u16();
|
|
264
|
+
const transitionMode = cursor.u8();
|
|
265
|
+
const randomMode = cursor.u8();
|
|
266
|
+
const containerMode = cursor.u8();
|
|
267
|
+
const flags = cursor.u8();
|
|
268
|
+
if (transitionMode > 5 || randomMode > 1 || containerMode > 1 || flags & ~0x1f) {
|
|
269
|
+
throw new RangeError("invalid Random/Sequence enum");
|
|
270
|
+
}
|
|
271
|
+
const children = ReadChildren(cursor, knownObjects);
|
|
272
|
+
const playlistCount = BoundedCount(cursor.u16(), cursor.remaining, 8, 8192);
|
|
273
|
+
const childSet = new Set(children);
|
|
274
|
+
const playlist = [];
|
|
275
|
+
for (let index = 0; index < playlistCount; index++) {
|
|
276
|
+
const playId = cursor.u32();
|
|
277
|
+
const weight = cursor.s32();
|
|
278
|
+
if (!childSet.has(playId) || weight < 0) {
|
|
279
|
+
throw new RangeError("invalid Random/Sequence playlist");
|
|
280
|
+
}
|
|
281
|
+
playlist.push({
|
|
282
|
+
playId,
|
|
283
|
+
weight
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
return {
|
|
287
|
+
type: containerMode === 0 ? "random" : "sequence",
|
|
288
|
+
loopCount,
|
|
289
|
+
loopModMin,
|
|
290
|
+
loopModMax,
|
|
291
|
+
transitionTime,
|
|
292
|
+
transitionTimeModMin,
|
|
293
|
+
transitionTimeModMax,
|
|
294
|
+
avoidRepeatCount,
|
|
295
|
+
transitionMode,
|
|
296
|
+
randomMode,
|
|
297
|
+
usingWeight: Boolean(flags & 0x01),
|
|
298
|
+
resetPlaylistEachPlay: Boolean(flags & 0x02),
|
|
299
|
+
restartBackward: Boolean(flags & 0x04),
|
|
300
|
+
continuous: Boolean(flags & 0x08),
|
|
301
|
+
global: Boolean(flags & 0x10),
|
|
302
|
+
children,
|
|
303
|
+
playlist
|
|
304
|
+
};
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
function FindSwitch(payload, knownObjects, bankVersion) {
|
|
308
|
+
return FindUnique(payload, bankVersion, cursor => {
|
|
309
|
+
const groupType = cursor.u8();
|
|
310
|
+
const groupId = cursor.u32();
|
|
311
|
+
const defaultValueId = cursor.u32();
|
|
312
|
+
const continuousValidation = cursor.u8();
|
|
313
|
+
if (groupType > 1 || continuousValidation > 1) {
|
|
314
|
+
throw new RangeError("invalid Switch enum");
|
|
315
|
+
}
|
|
316
|
+
const children = ReadChildren(cursor, knownObjects);
|
|
317
|
+
const childSet = new Set(children);
|
|
318
|
+
const assignmentCount = BoundedCount(cursor.u32(), cursor.remaining, 8, 8192);
|
|
319
|
+
const assignments = [];
|
|
320
|
+
for (let index = 0; index < assignmentCount; index++) {
|
|
321
|
+
const valueId = cursor.u32();
|
|
322
|
+
const itemCount = BoundedCount(cursor.u32(), cursor.remaining, 4, 8192);
|
|
323
|
+
const childIds = [];
|
|
324
|
+
for (let item = 0; item < itemCount; item++) {
|
|
325
|
+
const childId = cursor.u32();
|
|
326
|
+
if (!childSet.has(childId)) {
|
|
327
|
+
throw new RangeError("invalid Switch assignment child");
|
|
328
|
+
}
|
|
329
|
+
childIds.push(childId);
|
|
330
|
+
}
|
|
331
|
+
assignments.push({
|
|
332
|
+
valueId,
|
|
333
|
+
childIds
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
const parameterCount = BoundedCount(cursor.u32(), cursor.remaining, 14, 8192);
|
|
337
|
+
const parameters = [];
|
|
338
|
+
for (let index = 0; index < parameterCount; index++) {
|
|
339
|
+
const childId = cursor.u32();
|
|
340
|
+
const flags1 = cursor.u8();
|
|
341
|
+
const flags2 = cursor.u8();
|
|
342
|
+
const onSwitchMode = flags2 & 0x07;
|
|
343
|
+
if (!childSet.has(childId) || flags1 & ~0x03 || flags2 & ~0x07 || onSwitchMode > 1) {
|
|
344
|
+
throw new RangeError("invalid Switch parameter");
|
|
345
|
+
}
|
|
346
|
+
parameters.push({
|
|
347
|
+
childId,
|
|
348
|
+
firstOnly: Boolean(flags1 & 0x01),
|
|
349
|
+
continuePlayback: Boolean(flags1 & 0x02),
|
|
350
|
+
onSwitchMode,
|
|
351
|
+
fadeOutMs: cursor.s32(),
|
|
352
|
+
fadeInMs: cursor.s32()
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
return {
|
|
356
|
+
type: "switch",
|
|
357
|
+
groupType,
|
|
358
|
+
groupId,
|
|
359
|
+
defaultValueId,
|
|
360
|
+
continuousValidation: Boolean(continuousValidation),
|
|
361
|
+
children,
|
|
362
|
+
assignments,
|
|
363
|
+
parameters
|
|
364
|
+
};
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
function FindLayer(payload, knownObjects, bankVersion) {
|
|
368
|
+
return FindUnique(payload, bankVersion, cursor => {
|
|
369
|
+
const children = ReadChildren(cursor, knownObjects);
|
|
370
|
+
const childSet = new Set(children);
|
|
371
|
+
const layerCount = BoundedCount(cursor.u32(), cursor.remaining, 15, 1024);
|
|
372
|
+
const layers = [];
|
|
373
|
+
for (let index = 0; index < layerCount; index++) {
|
|
374
|
+
const layerId = cursor.u32();
|
|
375
|
+
const initialRtpcCount = BoundedCount(cursor.u16(), cursor.remaining, 14, 4096);
|
|
376
|
+
const initialRtpcs = [];
|
|
377
|
+
for (let rtpc = 0; rtpc < initialRtpcCount; rtpc++) {
|
|
378
|
+
initialRtpcs.push(ReadInitialRTPC(cursor));
|
|
379
|
+
}
|
|
380
|
+
const controlId = cursor.u32();
|
|
381
|
+
const controlType = cursor.u8();
|
|
382
|
+
const associationCount = BoundedCount(cursor.u32(), cursor.remaining, 8, 8192);
|
|
383
|
+
const associations = [];
|
|
384
|
+
if (controlType > 4) {
|
|
385
|
+
throw new RangeError("invalid Layer control type");
|
|
386
|
+
}
|
|
387
|
+
for (let association = 0; association < associationCount; association++) {
|
|
388
|
+
const childId = cursor.u32();
|
|
389
|
+
const pointCount = BoundedCount(cursor.u32(), cursor.remaining, 12, 65535);
|
|
390
|
+
if (!childSet.has(childId)) {
|
|
391
|
+
throw new RangeError("invalid Layer association child");
|
|
392
|
+
}
|
|
393
|
+
associations.push({
|
|
394
|
+
childId,
|
|
395
|
+
points: ReadPoints(cursor, pointCount)
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
layers.push({
|
|
399
|
+
layerId,
|
|
400
|
+
initialRtpcs,
|
|
401
|
+
controlId,
|
|
402
|
+
controlType,
|
|
403
|
+
associations
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
const continuousValidation = cursor.u8();
|
|
407
|
+
if (continuousValidation > 1) {
|
|
408
|
+
throw new RangeError("invalid Layer validation mode");
|
|
409
|
+
}
|
|
410
|
+
return {
|
|
411
|
+
type: "layer",
|
|
412
|
+
children,
|
|
413
|
+
layers,
|
|
414
|
+
continuousValidation: Boolean(continuousValidation)
|
|
415
|
+
};
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
function ReadInitialRTPC(cursor) {
|
|
419
|
+
const controlId = cursor.u32();
|
|
420
|
+
const controlType = cursor.u8();
|
|
421
|
+
const accumulation = cursor.u8();
|
|
422
|
+
const parameterId = cursor.variable();
|
|
423
|
+
const curveId = cursor.u32();
|
|
424
|
+
const scaling = cursor.u8();
|
|
425
|
+
const pointCount = BoundedCount(cursor.u16(), cursor.remaining, 12, 65535);
|
|
426
|
+
if (controlType > 4 || accumulation > 6 || scaling > 5) {
|
|
427
|
+
throw new RangeError("invalid initial RTPC enum");
|
|
428
|
+
}
|
|
429
|
+
return {
|
|
430
|
+
controlId,
|
|
431
|
+
controlType,
|
|
432
|
+
accumulation,
|
|
433
|
+
parameterId,
|
|
434
|
+
curveId,
|
|
435
|
+
scaling,
|
|
436
|
+
points: ReadPoints(cursor, pointCount)
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
function ReadPoints(cursor, count) {
|
|
440
|
+
const points = [];
|
|
441
|
+
for (let index = 0; index < count; index++) {
|
|
442
|
+
const from = Finite(cursor.f32());
|
|
443
|
+
const to = Finite(cursor.f32());
|
|
444
|
+
const interpolation = cursor.u32();
|
|
445
|
+
if (interpolation > 9) {
|
|
446
|
+
throw new RangeError("invalid curve interpolation");
|
|
447
|
+
}
|
|
448
|
+
points.push({
|
|
449
|
+
from,
|
|
450
|
+
to,
|
|
451
|
+
interpolation
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
return points;
|
|
455
|
+
}
|
|
456
|
+
function ReadChildren(cursor, knownObjects) {
|
|
457
|
+
const count = BoundedCount(cursor.u32(), cursor.remaining, 4, 8192);
|
|
458
|
+
const children = [];
|
|
459
|
+
for (let index = 0; index < count; index++) {
|
|
460
|
+
const id = cursor.u32();
|
|
461
|
+
const type = KnownType(knownObjects.get(id));
|
|
462
|
+
if (!SFX_CHILD_TYPES.has(type)) {
|
|
463
|
+
throw new RangeError("invalid SFX child identity");
|
|
464
|
+
}
|
|
465
|
+
children.push(id);
|
|
466
|
+
}
|
|
467
|
+
return children;
|
|
468
|
+
}
|
|
469
|
+
function FindUnique(payload, bankVersion, parse) {
|
|
470
|
+
if (!(payload instanceof Uint8Array) || Number(bankVersion) !== SUPPORTED_VERSION) {
|
|
471
|
+
return {
|
|
472
|
+
node: null,
|
|
473
|
+
reason: "unsupported bank version"
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
const candidates = [];
|
|
477
|
+
for (let anchor = 0; anchor < payload.byteLength; anchor++) {
|
|
478
|
+
try {
|
|
479
|
+
const cursor = new SfxCursor(payload, anchor);
|
|
480
|
+
const node = parse(cursor);
|
|
481
|
+
if (cursor.at === payload.byteLength) {
|
|
482
|
+
candidates.push(node);
|
|
483
|
+
}
|
|
484
|
+
} catch {
|
|
485
|
+
// This byte was not the exact type-tail anchor.
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
if (candidates.length === 1) {
|
|
489
|
+
return {
|
|
490
|
+
node: candidates[0],
|
|
491
|
+
reason: ""
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
return {
|
|
495
|
+
node: null,
|
|
496
|
+
reason: candidates.length ? "ambiguous anchors" : "no exact anchor"
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
function NormalizeKnownObjects(value) {
|
|
500
|
+
if (value instanceof Map) {
|
|
501
|
+
return value;
|
|
502
|
+
}
|
|
503
|
+
const map = new Map();
|
|
504
|
+
for (const entry of value ?? []) {
|
|
505
|
+
if (typeof entry === "number") {
|
|
506
|
+
map.set(entry, {
|
|
507
|
+
type: 2
|
|
508
|
+
});
|
|
509
|
+
} else if (entry?.id !== undefined) {
|
|
510
|
+
map.set(Number(entry.id) >>> 0, entry);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
return map;
|
|
514
|
+
}
|
|
515
|
+
function KnownType(value) {
|
|
516
|
+
return typeof value === "number" ? value : value?.type;
|
|
517
|
+
}
|
|
518
|
+
function BoundedCount(value, remaining, stride, maximum) {
|
|
519
|
+
if (!Number.isSafeInteger(value) || value < 0 || value > maximum || value * stride > remaining) {
|
|
520
|
+
throw new RangeError("invalid SFX node count");
|
|
521
|
+
}
|
|
522
|
+
return value;
|
|
523
|
+
}
|
|
524
|
+
function Finite(value) {
|
|
525
|
+
if (!Number.isFinite(value)) {
|
|
526
|
+
throw new RangeError("non-finite SFX node value");
|
|
527
|
+
}
|
|
528
|
+
return value;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
export { parseSfxLayer, parseSfxRandomSequence, parseSfxSwitch, sfxNodesFromBanks };
|
|
532
|
+
//# sourceMappingURL=sfxNodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sfxNodes.js","sources":["../../../../../src/formats/bnk/core/sfxNodes.js"],"sourcesContent":["// Wwise v150 authored-SFX node decoding. Like musicNodes.js, this interprets\n// inspect() payload views outside the BNK read path and accepts a suffix only\n// when one anchored candidate consumes the payload exactly.\n\nimport { readWwiseVar } from \"./helpers.js\";\n\nconst SUPPORTED_VERSION = 150;\nconst SFX_CHILD_TYPES = new Set([ 2, 5, 6, 7, 9 ]);\nconst TYPE_NAMES = Object.freeze({\n 2: \"sound\",\n 5: \"random-sequence-container\",\n 6: \"switch-container\",\n 9: \"blend-container\",\n});\n\n/**\n * Bounds-aware little-endian cursor used for exact-end Wwise SFX-tail\n * validation.\n */\nclass SfxCursor\n{\n /** Creates a cursor over one HIRC payload at a candidate tail offset. */\n constructor(bytes, offset = 0)\n {\n this.bytes = bytes;\n this.view = new DataView(\n bytes.buffer,\n bytes.byteOffset,\n bytes.byteLength,\n );\n this.at = offset;\n }\n\n /** Returns the number of unread payload bytes. */\n get remaining()\n {\n return this.bytes.byteLength - this.at;\n }\n\n /** Verifies that a primitive read remains inside the HIRC payload. */\n ensure(size)\n {\n if (this.at + size > this.bytes.byteLength)\n {\n throw new RangeError(\"truncated SFX node\");\n }\n }\n\n /** Reads an unsigned 8-bit integer. */\n u8()\n {\n this.ensure(1);\n return this.view.getUint8(this.at++);\n }\n\n /** Reads an unsigned little-endian 16-bit integer. */\n u16()\n {\n this.ensure(2);\n const value = this.view.getUint16(this.at, true);\n\n this.at += 2;\n return value;\n }\n\n /** Reads an unsigned little-endian 32-bit integer. */\n u32()\n {\n this.ensure(4);\n const value = this.view.getUint32(this.at, true);\n\n this.at += 4;\n return value;\n }\n\n /** Reads a signed little-endian 32-bit integer. */\n s32()\n {\n this.ensure(4);\n const value = this.view.getInt32(this.at, true);\n\n this.at += 4;\n return value;\n }\n\n /** Reads a little-endian 32-bit float. */\n f32()\n {\n this.ensure(4);\n const value = this.view.getFloat32(this.at, true);\n\n this.at += 4;\n return value;\n }\n\n /** Reads one MSB-first Wwise variable-length unsigned integer. */\n variable()\n {\n const result = readWwiseVar(this.bytes, this.at);\n\n if (!result)\n {\n throw new RangeError(\"invalid Wwise variable integer\");\n }\n this.at = result.nextOffset;\n return result.value;\n }\n}\n\n/**\n * Decodes one v150 HIRC 5 Random/Sequence payload.\n *\n * @returns {object|null} Typed node, or null when no unique exact-end anchor\n * validates.\n */\nexport function parseSfxRandomSequence(\n payload,\n knownObjects,\n { bankVersion = SUPPORTED_VERSION } = {},\n)\n{\n return FindRandomSequence(\n payload,\n NormalizeKnownObjects(knownObjects),\n bankVersion,\n ).node;\n}\n\n/**\n * Decodes one v150 HIRC 6 Switch payload.\n *\n * @returns {object|null} Typed node, or null when no unique exact-end anchor\n * validates.\n */\nexport function parseSfxSwitch(\n payload,\n knownObjects,\n { bankVersion = SUPPORTED_VERSION } = {},\n)\n{\n return FindSwitch(\n payload,\n NormalizeKnownObjects(knownObjects),\n bankVersion,\n ).node;\n}\n\n/**\n * Decodes one v150 HIRC 9 Layer payload without lowering curve semantics.\n *\n * @returns {object|null} Typed node, or null when no unique exact-end anchor\n * validates.\n */\nexport function parseSfxLayer(\n payload,\n knownObjects,\n { bankVersion = SUPPORTED_VERSION } = {},\n)\n{\n return FindLayer(\n payload,\n NormalizeKnownObjects(knownObjects),\n bankVersion,\n ).node;\n}\n\n/**\n * Decodes typed SFX nodes, events, and actions across inspected v150 banks.\n *\n * Raw Wwise identities and semantics are preserved. Runtime schema lowering\n * and optional authoring-name enrichment belong to runtime-audio's builder.\n */\nexport function sfxNodesFromBanks(inspections)\n{\n const banks = Array.isArray(inspections)\n ? inspections\n : [ inspections ];\n const knownObjects = new Map();\n const duplicates = [];\n\n for (const inspection of banks)\n {\n for (const entry of inspection?.hirc ?? [])\n {\n if (knownObjects.has(entry.id))\n {\n duplicates.push({\n id: entry.id,\n previousBank: knownObjects.get(entry.id).bank,\n bank: inspection.source || \"\",\n });\n }\n knownObjects.set(entry.id, {\n ...entry,\n bank: inspection.source || \"\",\n });\n }\n }\n\n const nodes = new Map();\n const events = new Map();\n const actions = new Map();\n const failed = [];\n const ambiguous = [];\n const unsupportedVersions = [];\n const parsedByType = {};\n let parsed = 0;\n\n for (const inspection of banks)\n {\n const version = Number(inspection?.bankVersion) >>> 0;\n const bank = inspection?.source || \"\";\n\n if (version !== SUPPORTED_VERSION)\n {\n unsupportedVersions.push({ bank, version });\n continue;\n }\n\n for (const entry of inspection?.hirc ?? [])\n {\n if (entry.type === 4)\n {\n events.set(entry.id, {\n id: entry.id,\n type: \"event\",\n bank,\n actionIds: [ ...(entry.actionIds ?? []) ],\n });\n continue;\n }\n if (entry.type === 3)\n {\n actions.set(entry.id, {\n id: entry.id,\n type: \"event-action\",\n bank,\n actionType: entry.actionType,\n targetId: entry.targetId,\n payload: entry.payload,\n });\n continue;\n }\n\n let result = null;\n\n if (entry.type === 2)\n {\n if (entry.pluginId === undefined\n || entry.sourceId === undefined)\n {\n result = { node: null, reason: \"missing typed sound fields\" };\n }\n else\n {\n result = {\n node: {\n type: \"sound\",\n pluginId: entry.pluginId,\n pluginType: entry.pluginType\n ?? (entry.pluginId & 0x0f),\n streamType: entry.streamType,\n sourceId: entry.sourceId,\n inMemoryMediaSize: entry.inMemoryMediaSize,\n },\n reason: \"\",\n };\n }\n }\n else if (entry.type === 5)\n {\n result = FindRandomSequence(\n entry.payload,\n knownObjects,\n version,\n );\n }\n else if (entry.type === 6)\n {\n result = FindSwitch(\n entry.payload,\n knownObjects,\n version,\n );\n }\n else if (entry.type === 9)\n {\n result = FindLayer(\n entry.payload,\n knownObjects,\n version,\n );\n }\n else\n {\n continue;\n }\n\n if (!result.node)\n {\n const failure = {\n bank,\n version,\n type: TYPE_NAMES[entry.type],\n id: entry.id,\n reason: result.reason,\n };\n\n failed.push(failure);\n if (result.reason === \"ambiguous anchors\")\n {\n ambiguous.push(failure);\n }\n continue;\n }\n\n parsed++;\n parsedByType[result.node.type] = (\n parsedByType[result.node.type] ?? 0\n ) + 1;\n nodes.set(entry.id, {\n id: entry.id,\n bank,\n ...result.node,\n });\n }\n }\n\n return {\n nodes,\n events,\n actions,\n diagnostics: {\n parsed,\n parsedByType,\n failed,\n ambiguous,\n unsupportedVersions,\n duplicates,\n },\n };\n}\n\nfunction FindRandomSequence(payload, knownObjects, bankVersion)\n{\n return FindUnique(payload, bankVersion, (cursor) =>\n {\n const loopCount = cursor.u16();\n const loopModMin = cursor.u16();\n const loopModMax = cursor.u16();\n const transitionTime = Finite(cursor.f32());\n const transitionTimeModMin = Finite(cursor.f32());\n const transitionTimeModMax = Finite(cursor.f32());\n const avoidRepeatCount = cursor.u16();\n const transitionMode = cursor.u8();\n const randomMode = cursor.u8();\n const containerMode = cursor.u8();\n const flags = cursor.u8();\n\n if (transitionMode > 5\n || randomMode > 1\n || containerMode > 1\n || (flags & ~0x1f))\n {\n throw new RangeError(\"invalid Random/Sequence enum\");\n }\n\n const children = ReadChildren(cursor, knownObjects);\n const playlistCount = BoundedCount(\n cursor.u16(),\n cursor.remaining,\n 8,\n 8192,\n );\n const childSet = new Set(children);\n const playlist = [];\n\n for (let index = 0; index < playlistCount; index++)\n {\n const playId = cursor.u32();\n const weight = cursor.s32();\n\n if (!childSet.has(playId) || weight < 0)\n {\n throw new RangeError(\"invalid Random/Sequence playlist\");\n }\n playlist.push({ playId, weight });\n }\n\n return {\n type: containerMode === 0 ? \"random\" : \"sequence\",\n loopCount,\n loopModMin,\n loopModMax,\n transitionTime,\n transitionTimeModMin,\n transitionTimeModMax,\n avoidRepeatCount,\n transitionMode,\n randomMode,\n usingWeight: Boolean(flags & 0x01),\n resetPlaylistEachPlay: Boolean(flags & 0x02),\n restartBackward: Boolean(flags & 0x04),\n continuous: Boolean(flags & 0x08),\n global: Boolean(flags & 0x10),\n children,\n playlist,\n };\n });\n}\n\nfunction FindSwitch(payload, knownObjects, bankVersion)\n{\n return FindUnique(payload, bankVersion, (cursor) =>\n {\n const groupType = cursor.u8();\n const groupId = cursor.u32();\n const defaultValueId = cursor.u32();\n const continuousValidation = cursor.u8();\n\n if (groupType > 1 || continuousValidation > 1)\n {\n throw new RangeError(\"invalid Switch enum\");\n }\n\n const children = ReadChildren(cursor, knownObjects);\n const childSet = new Set(children);\n const assignmentCount = BoundedCount(\n cursor.u32(),\n cursor.remaining,\n 8,\n 8192,\n );\n const assignments = [];\n\n for (let index = 0; index < assignmentCount; index++)\n {\n const valueId = cursor.u32();\n const itemCount = BoundedCount(\n cursor.u32(),\n cursor.remaining,\n 4,\n 8192,\n );\n const childIds = [];\n\n for (let item = 0; item < itemCount; item++)\n {\n const childId = cursor.u32();\n\n if (!childSet.has(childId))\n {\n throw new RangeError(\"invalid Switch assignment child\");\n }\n childIds.push(childId);\n }\n assignments.push({ valueId, childIds });\n }\n\n const parameterCount = BoundedCount(\n cursor.u32(),\n cursor.remaining,\n 14,\n 8192,\n );\n const parameters = [];\n\n for (let index = 0; index < parameterCount; index++)\n {\n const childId = cursor.u32();\n const flags1 = cursor.u8();\n const flags2 = cursor.u8();\n const onSwitchMode = flags2 & 0x07;\n\n if (!childSet.has(childId)\n || (flags1 & ~0x03)\n || (flags2 & ~0x07)\n || onSwitchMode > 1)\n {\n throw new RangeError(\"invalid Switch parameter\");\n }\n parameters.push({\n childId,\n firstOnly: Boolean(flags1 & 0x01),\n continuePlayback: Boolean(flags1 & 0x02),\n onSwitchMode,\n fadeOutMs: cursor.s32(),\n fadeInMs: cursor.s32(),\n });\n }\n\n return {\n type: \"switch\",\n groupType,\n groupId,\n defaultValueId,\n continuousValidation: Boolean(continuousValidation),\n children,\n assignments,\n parameters,\n };\n });\n}\n\nfunction FindLayer(payload, knownObjects, bankVersion)\n{\n return FindUnique(payload, bankVersion, (cursor) =>\n {\n const children = ReadChildren(cursor, knownObjects);\n const childSet = new Set(children);\n const layerCount = BoundedCount(\n cursor.u32(),\n cursor.remaining,\n 15,\n 1024,\n );\n const layers = [];\n\n for (let index = 0; index < layerCount; index++)\n {\n const layerId = cursor.u32();\n const initialRtpcCount = BoundedCount(\n cursor.u16(),\n cursor.remaining,\n 14,\n 4096,\n );\n const initialRtpcs = [];\n\n for (let rtpc = 0; rtpc < initialRtpcCount; rtpc++)\n {\n initialRtpcs.push(ReadInitialRTPC(cursor));\n }\n\n const controlId = cursor.u32();\n const controlType = cursor.u8();\n const associationCount = BoundedCount(\n cursor.u32(),\n cursor.remaining,\n 8,\n 8192,\n );\n const associations = [];\n\n if (controlType > 4)\n {\n throw new RangeError(\"invalid Layer control type\");\n }\n\n for (let association = 0;\n association < associationCount;\n association++)\n {\n const childId = cursor.u32();\n const pointCount = BoundedCount(\n cursor.u32(),\n cursor.remaining,\n 12,\n 65535,\n );\n\n if (!childSet.has(childId))\n {\n throw new RangeError(\"invalid Layer association child\");\n }\n associations.push({\n childId,\n points: ReadPoints(cursor, pointCount),\n });\n }\n\n layers.push({\n layerId,\n initialRtpcs,\n controlId,\n controlType,\n associations,\n });\n }\n\n const continuousValidation = cursor.u8();\n\n if (continuousValidation > 1)\n {\n throw new RangeError(\"invalid Layer validation mode\");\n }\n\n return {\n type: \"layer\",\n children,\n layers,\n continuousValidation: Boolean(continuousValidation),\n };\n });\n}\n\nfunction ReadInitialRTPC(cursor)\n{\n const controlId = cursor.u32();\n const controlType = cursor.u8();\n const accumulation = cursor.u8();\n const parameterId = cursor.variable();\n const curveId = cursor.u32();\n const scaling = cursor.u8();\n const pointCount = BoundedCount(\n cursor.u16(),\n cursor.remaining,\n 12,\n 65535,\n );\n\n if (controlType > 4 || accumulation > 6 || scaling > 5)\n {\n throw new RangeError(\"invalid initial RTPC enum\");\n }\n\n return {\n controlId,\n controlType,\n accumulation,\n parameterId,\n curveId,\n scaling,\n points: ReadPoints(cursor, pointCount),\n };\n}\n\nfunction ReadPoints(cursor, count)\n{\n const points = [];\n\n for (let index = 0; index < count; index++)\n {\n const from = Finite(cursor.f32());\n const to = Finite(cursor.f32());\n const interpolation = cursor.u32();\n\n if (interpolation > 9)\n {\n throw new RangeError(\"invalid curve interpolation\");\n }\n points.push({ from, to, interpolation });\n }\n return points;\n}\n\nfunction ReadChildren(cursor, knownObjects)\n{\n const count = BoundedCount(\n cursor.u32(),\n cursor.remaining,\n 4,\n 8192,\n );\n const children = [];\n\n for (let index = 0; index < count; index++)\n {\n const id = cursor.u32();\n const type = KnownType(knownObjects.get(id));\n\n if (!SFX_CHILD_TYPES.has(type))\n {\n throw new RangeError(\"invalid SFX child identity\");\n }\n children.push(id);\n }\n return children;\n}\n\nfunction FindUnique(payload, bankVersion, parse)\n{\n if (!(payload instanceof Uint8Array)\n || Number(bankVersion) !== SUPPORTED_VERSION)\n {\n return { node: null, reason: \"unsupported bank version\" };\n }\n\n const candidates = [];\n\n for (let anchor = 0; anchor < payload.byteLength; anchor++)\n {\n try\n {\n const cursor = new SfxCursor(payload, anchor);\n const node = parse(cursor);\n\n if (cursor.at === payload.byteLength)\n {\n candidates.push(node);\n }\n }\n catch\n {\n // This byte was not the exact type-tail anchor.\n }\n }\n\n if (candidates.length === 1)\n {\n return { node: candidates[0], reason: \"\" };\n }\n return {\n node: null,\n reason: candidates.length ? \"ambiguous anchors\" : \"no exact anchor\",\n };\n}\n\nfunction NormalizeKnownObjects(value)\n{\n if (value instanceof Map)\n {\n return value;\n }\n\n const map = new Map();\n\n for (const entry of value ?? [])\n {\n if (typeof entry === \"number\")\n {\n map.set(entry, { type: 2 });\n }\n else if (entry?.id !== undefined)\n {\n map.set(Number(entry.id) >>> 0, entry);\n }\n }\n return map;\n}\n\nfunction KnownType(value)\n{\n return typeof value === \"number\" ? value : value?.type;\n}\n\nfunction BoundedCount(value, remaining, stride, maximum)\n{\n if (!Number.isSafeInteger(value)\n || value < 0\n || value > maximum\n || value * stride > remaining)\n {\n throw new RangeError(\"invalid SFX node count\");\n }\n return value;\n}\n\nfunction Finite(value)\n{\n if (!Number.isFinite(value))\n {\n throw new RangeError(\"non-finite SFX node value\");\n }\n return value;\n}\n"],"names":["SUPPORTED_VERSION","SFX_CHILD_TYPES","Set","TYPE_NAMES","Object","freeze","SfxCursor","constructor","bytes","offset","view","DataView","buffer","byteOffset","byteLength","at","remaining","ensure","size","RangeError","u8","getUint8","u16","value","getUint16","u32","getUint32","s32","getInt32","f32","getFloat32","variable","result","readWwiseVar","nextOffset","parseSfxRandomSequence","payload","knownObjects","bankVersion","FindRandomSequence","NormalizeKnownObjects","node","parseSfxSwitch","FindSwitch","parseSfxLayer","FindLayer","sfxNodesFromBanks","inspections","banks","Array","isArray","Map","duplicates","inspection","entry","hirc","has","id","push","previousBank","get","bank","source","set","nodes","events","actions","failed","ambiguous","unsupportedVersions","parsedByType","parsed","version","Number","type","actionIds","actionType","targetId","pluginId","undefined","sourceId","reason","pluginType","streamType","inMemoryMediaSize","failure","diagnostics","FindUnique","cursor","loopCount","loopModMin","loopModMax","transitionTime","Finite","transitionTimeModMin","transitionTimeModMax","avoidRepeatCount","transitionMode","randomMode","containerMode","flags","children","ReadChildren","playlistCount","BoundedCount","childSet","playlist","index","playId","weight","usingWeight","Boolean","resetPlaylistEachPlay","restartBackward","continuous","global","groupType","groupId","defaultValueId","continuousValidation","assignmentCount","assignments","valueId","itemCount","childIds","item","childId","parameterCount","parameters","flags1","flags2","onSwitchMode","firstOnly","continuePlayback","fadeOutMs","fadeInMs","layerCount","layers","layerId","initialRtpcCount","initialRtpcs","rtpc","ReadInitialRTPC","controlId","controlType","associationCount","associations","association","pointCount","points","ReadPoints","accumulation","parameterId","curveId","scaling","count","from","to","interpolation","KnownType","parse","Uint8Array","candidates","anchor","length","map","stride","maximum","isSafeInteger","isFinite"],"mappings":";;AAAA;AACA;AACA;;AAIA,MAAMA,iBAAiB,GAAG,GAAG;AAC7B,MAAMC,eAAe,GAAG,IAAIC,GAAG,CAAC,CAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAE,CAAC;AAClD,MAAMC,UAAU,GAAGC,MAAM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