@carbonenginejs/runtime-resource 0.12.2 → 0.14.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/README.md +21 -0
- package/dist/CjsResMan.js +393 -29
- package/dist/CjsResMan.js.map +1 -1
- package/dist/format/carbonEffect/CjsCarbonEffectReader.js +165 -118
- package/dist/format/carbonEffect/CjsCarbonEffectReader.js.map +1 -1
- package/dist/format/carbonEffect/buildCarbonEffectContainer.js +182 -0
- package/dist/format/carbonEffect/buildCarbonEffectContainer.js.map +1 -0
- package/dist/format/carbonEffect/carbonEffectBackendBlock.js +7 -113
- package/dist/format/carbonEffect/carbonEffectBackendBlock.js.map +1 -1
- package/dist/format/carbonEffect/carbonEffectRecords.js +258 -66
- package/dist/format/carbonEffect/carbonEffectRecords.js.map +1 -1
- package/dist/format/carbonEffect/carbonEffectResourceTransform.js +197 -0
- package/dist/format/carbonEffect/carbonEffectResourceTransform.js.map +1 -0
- package/dist/format/effect/effectBodyInventory.js +146 -0
- package/dist/format/effect/effectBodyInventory.js.map +1 -0
- package/dist/format/effect/effectPermutationGraph.js +13 -13
- package/dist/format/effect/effectPermutationGraph.js.map +1 -1
- package/dist/format/index.js +4 -4
- package/dist/formats/black/CjsBlackFormat.js +19 -1
- package/dist/formats/black/CjsBlackFormat.js.map +1 -1
- package/dist/formats/bnk/CjsBnkFormat.js +28 -9
- package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
- package/dist/formats/bnk/core/busNodes.js +252 -0
- package/dist/formats/bnk/core/busNodes.js.map +1 -0
- package/dist/formats/bnk/core/effectNodes.js +147 -0
- package/dist/formats/bnk/core/effectNodes.js.map +1 -0
- package/dist/formats/bnk/core/eventAction.js +135 -24
- package/dist/formats/bnk/core/eventAction.js.map +1 -1
- package/dist/formats/bnk/core/globalSettings.js +215 -0
- package/dist/formats/bnk/core/globalSettings.js.map +1 -0
- package/dist/formats/bnk/core/helpers.js +37 -5
- package/dist/formats/bnk/core/helpers.js.map +1 -1
- package/dist/formats/bnk/core/musicNodes.js +43 -19
- package/dist/formats/bnk/core/musicNodes.js.map +1 -1
- package/dist/formats/bnk/core/nodeBase.js +28 -7
- package/dist/formats/bnk/core/nodeBase.js.map +1 -1
- package/dist/formats/dds/core/helpers.js +40 -1
- package/dist/formats/dds/core/helpers.js.map +1 -1
- package/dist/formats/dxbc/CjsDxbcFormat.js +45 -0
- package/dist/formats/dxbc/CjsDxbcFormat.js.map +1 -1
- package/dist/formats/dxbc/core/disassemble.js +240 -0
- package/dist/formats/dxbc/core/disassemble.js.map +1 -0
- package/dist/formats/gltf/CjsGltfFormat.js +1 -39
- package/dist/formats/gltf/CjsGltfFormat.js.map +1 -1
- package/dist/formats/gltf/core/helpers.js +1 -21
- package/dist/formats/gltf/core/helpers.js.map +1 -1
- package/dist/formats/hlsl/CjsHlslFormat.js +0 -21
- package/dist/formats/hlsl/CjsHlslFormat.js.map +1 -1
- package/dist/formats/hlsl/core/carbonDescriptionToRuntime.js +118 -49
- package/dist/formats/hlsl/core/carbonDescriptionToRuntime.js.map +1 -1
- package/dist/formats/hlsl/core/detailMapFamily.js +128 -0
- package/dist/formats/hlsl/core/detailMapFamily.js.map +1 -0
- package/dist/formats/hlsl/core/localLightFamily.js +133 -0
- package/dist/formats/hlsl/core/localLightFamily.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js +79 -73
- package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js.map +1 -1
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectBindingManifest.js +8 -1
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectBindingManifest.js.map +1 -1
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectDescription.js +11 -691
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectDescription.js.map +1 -1
- package/dist/formats/index.js +4 -2
- package/dist/formats/index.js.map +1 -1
- package/dist/formats/obj/CjsObjFormat.js +1 -22
- package/dist/formats/obj/CjsObjFormat.js.map +1 -1
- package/dist/formats/obj/core/helpers.js +1 -21
- package/dist/formats/obj/core/helpers.js.map +1 -1
- package/dist/formats/pickle/CjsPickleFormat.js +214 -0
- package/dist/formats/pickle/CjsPickleFormat.js.map +1 -0
- package/dist/formats/pickle/core/CjsPickleProtocol0Reader.js +551 -0
- package/dist/formats/pickle/core/CjsPickleProtocol0Reader.js.map +1 -0
- package/dist/formats/pickle/index.js +2 -0
- package/dist/formats/pickle/index.js.map +1 -0
- package/dist/formats/red/core/redGraph.js +11 -8
- package/dist/formats/red/core/redGraph.js.map +1 -1
- package/dist/formats/stl/CjsStlFormat.js +1 -46
- package/dist/formats/stl/CjsStlFormat.js.map +1 -1
- package/dist/formats/stl/core/helpers.js +1 -21
- package/dist/formats/stl/core/helpers.js.map +1 -1
- package/dist/formats/webgl/CjsWebglFormat.js +33 -55
- package/dist/formats/webgl/CjsWebglFormat.js.map +1 -1
- package/dist/formats/webgl/core/buildGlslEffectContainer.js +70 -0
- package/dist/formats/webgl/core/buildGlslEffectContainer.js.map +1 -0
- package/dist/formats/webgl/core/effectPackage.js +216 -108
- package/dist/formats/webgl/core/effectPackage.js.map +1 -1
- package/dist/formats/webgl/core/errors.js +1 -1
- package/dist/formats/webgl/core/errors.js.map +1 -1
- package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js +166 -24
- package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
- package/dist/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js +63 -5
- package/dist/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js.map +1 -1
- package/dist/formats/webgl/core/glsl/packedLightFixups.js +98 -0
- package/dist/formats/webgl/core/glsl/packedLightFixups.js.map +1 -0
- package/dist/formats/webgl/core/glslBackendBlock.js +552 -0
- package/dist/formats/webgl/core/glslBackendBlock.js.map +1 -0
- package/dist/formats/webgl/core/glslBackendBodySet.js +243 -0
- package/dist/formats/webgl/core/glslBackendBodySet.js.map +1 -0
- package/dist/formats/webgl/core/{cewgCompleteness.js → glslEffectCompleteness.js} +12 -8
- package/dist/formats/webgl/core/glslEffectCompleteness.js.map +1 -0
- package/dist/formats/webgl/core/helpers.js +33 -172
- package/dist/formats/webgl/core/helpers.js.map +1 -1
- package/dist/formats/webgl/core/inspectGlslEffectContainer.js +122 -0
- package/dist/formats/webgl/core/inspectGlslEffectContainer.js.map +1 -0
- package/dist/formats/webgl/core/readGlslEffectContainer.js +249 -0
- package/dist/formats/webgl/core/readGlslEffectContainer.js.map +1 -0
- package/dist/formats/webgpu/CjsWebgpuFormat.js +15 -15
- package/dist/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
- package/dist/formats/webgpu/core/buildCarbonEffectContainer.js +37 -145
- package/dist/formats/webgpu/core/buildCarbonEffectContainer.js.map +1 -1
- package/dist/formats/webgpu/core/{cewgpu/CewgpuContainer.js → carbonWebgpu/CarbonWebgpuContainer.js} +13 -27
- package/dist/formats/webgpu/core/carbonWebgpu/CarbonWebgpuContainer.js.map +1 -0
- package/dist/formats/webgpu/core/{cewgpu → carbonWebgpu}/containerViews.js +1 -1
- package/dist/formats/webgpu/core/carbonWebgpu/containerViews.js.map +1 -0
- package/dist/formats/webgpu/core/{cewgpu → carbonWebgpu}/validateContainer.js +4 -4
- package/dist/formats/webgpu/core/carbonWebgpu/validateContainer.js.map +1 -0
- package/dist/formats/webgpu/core/effectBackendBodySet.js +18 -18
- package/dist/formats/webgpu/core/effectBackendBodySet.js.map +1 -1
- package/dist/formats/webgpu/core/errors.js +1 -1
- package/dist/formats/webgpu/core/errors.js.map +1 -1
- package/dist/formats/webgpu/core/helpers.js +22 -22
- package/dist/formats/webgpu/core/helpers.js.map +1 -1
- package/dist/formats/webgpu/core/packageEffect.js +11 -15
- package/dist/formats/webgpu/core/packageEffect.js.map +1 -1
- package/dist/formats/webgpu/core/packageEffectSelection.js +1 -1
- package/dist/formats/webgpu/core/packageEffectSelection.js.map +1 -1
- package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js +23 -23
- package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js.map +1 -1
- package/dist/formats/webgpu/core/wgsl/buildWgslSet.js +6 -6
- package/dist/formats/webgpu/core/wgsl/buildWgslSet.js.map +1 -1
- package/dist/formats/yaml/CjsYamlFormat.js +3 -3
- package/dist/formats/yaml/CjsYamlFormat.js.map +1 -1
- package/dist/formats/yaml/core/CjsYamlReader.js +4 -6
- package/dist/formats/yaml/core/CjsYamlReader.js.map +1 -1
- package/dist/formats/yaml/core/helpers.js +27 -1
- package/dist/formats/yaml/core/helpers.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/resource/CjsLoadingObject.js +19 -0
- package/dist/resource/CjsLoadingObject.js.map +1 -0
- package/dist/resource/CjsResource.js +4 -0
- package/dist/resource/CjsResource.js.map +1 -1
- package/dist/resource/ResourceHandlerMode.js +14 -0
- package/dist/resource/ResourceHandlerMode.js.map +1 -0
- package/dist/resource/index.js +2 -0
- package/dist/resource/index.js.map +1 -1
- package/dist/resource/shader/Tr2EffectRes.js +118 -213
- package/dist/resource/shader/Tr2EffectRes.js.map +1 -1
- package/dist/resource/shader/Tr2Shader.js +37 -15
- package/dist/resource/shader/Tr2Shader.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectConstant.js +37 -29
- package/dist/resource/shader/reflection/Tr2EffectConstant.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectDescription.js +39 -34
- package/dist/resource/shader/reflection/Tr2EffectDescription.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js +51 -30
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js +45 -25
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectResource.js +51 -17
- package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js +219 -88
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js +28 -18
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2Pass.js +96 -39
- package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -1
- package/dist/resource/shader/reflection/carbonRecordFields.js +159 -0
- package/dist/resource/shader/reflection/carbonRecordFields.js.map +1 -0
- package/dist/resource/shader/reflection/shaderStage.js +22 -0
- package/dist/resource/shader/reflection/shaderStage.js.map +1 -0
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js +68 -10
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js.map +1 -1
- package/dist/worker/CjsResManMainThreadLoader.js +9 -7
- package/dist/worker/CjsResManMainThreadLoader.js.map +1 -1
- package/dist/worker/CjsResManWorker.js +5 -4
- package/dist/worker/CjsResManWorker.js.map +1 -1
- package/dist/worker/CjsResManWorkerLoader.js +9 -6
- package/dist/worker/CjsResManWorkerLoader.js.map +1 -1
- package/docs/README.md +2 -2
- package/docs/architecture.md +12 -3
- package/docs/concepts/resource-lifecycle.md +9 -8
- package/docs/concepts/shader-resource-model.md +14 -17
- package/docs/concepts/writing-an-engine-adapter.md +1 -1
- package/docs/formats/README.md +4 -2
- package/docs/formats/carbon-effect-container.md +127 -26
- package/docs/formats/dxbc/architecture.md +1 -1
- package/docs/formats/dxbc/reference/api.md +28 -0
- package/docs/formats/hlsl/README.md +3 -3
- package/docs/formats/hlsl/architecture.md +8 -9
- package/docs/formats/hlsl/guides/hydrating-json-output.md +3 -5
- package/docs/formats/hlsl/guides/reading-effects.md +5 -1
- package/docs/formats/hlsl/reference/advanced-analysis.md +20 -25
- package/docs/formats/hlsl/reference/api.md +0 -7
- package/docs/formats/hlsl/reference/json-graph.md +1 -4
- package/docs/formats/pickle.md +82 -0
- package/docs/formats/webgl/README.md +71 -13
- package/docs/formats/webgl/architecture.md +16 -17
- package/docs/formats/webgl/carbon-constant-layouts.md +3 -3
- package/docs/formats/webgl/decl-io.md +3 -3
- package/docs/formats/webgl/memory-structured.md +27 -8
- package/docs/formats/webgl/texture-sample.md +1 -1
- package/docs/formats/webgpu/README.md +3 -3
- package/docs/formats/webgpu/architecture.md +5 -6
- package/docs/formats/webgpu/formats/{cewgpu.md → carbon-webgpu.md} +10 -11
- package/docs/formats/webgpu/guides/effect-packaging.md +6 -8
- package/docs/formats/webgpu/reference/api.md +11 -12
- package/docs/formats/webgpu/reference/wgsl-compatibility.md +11 -8
- package/docs/formats/wwise.md +63 -2
- package/docs/reference/classes/core.md +10 -0
- package/docs/reference/classes/formats.md +40 -48
- package/docs/reference/classes/resources.md +2 -2
- package/docs/reference/queues.md +88 -4
- package/docs/reference/workers.md +7 -0
- package/package.json +61 -61
- package/dist/format/carbonEffect/carbonDescriptionFromPortable.js +0 -372
- package/dist/format/carbonEffect/carbonDescriptionFromPortable.js.map +0 -1
- package/dist/format/effect/effectReflectionPackage.js +0 -636
- package/dist/format/effect/effectReflectionPackage.js.map +0 -1
- package/dist/formats/hlsl/core/HlslReader.js +0 -16
- package/dist/formats/hlsl/core/HlslReader.js.map +0 -1
- package/dist/formats/hlsl/core/portableReflection.js +0 -848
- package/dist/formats/hlsl/core/portableReflection.js.map +0 -1
- package/dist/formats/hlsl/portable.js +0 -2
- package/dist/formats/hlsl/portable.js.map +0 -1
- package/dist/formats/webgl/core/cewg/CewgPackage.js +0 -340
- package/dist/formats/webgl/core/cewg/CewgPackage.js.map +0 -1
- package/dist/formats/webgl/core/cewg/CewgPackageBuilder.js +0 -104
- package/dist/formats/webgl/core/cewg/CewgPackageBuilder.js.map +0 -1
- package/dist/formats/webgl/core/cewg/binary.js +0 -19
- package/dist/formats/webgl/core/cewg/binary.js.map +0 -1
- package/dist/formats/webgl/core/cewgCompleteness.js.map +0 -1
- package/dist/formats/webgl/core/effectPackageValidation.js +0 -331
- package/dist/formats/webgl/core/effectPackageValidation.js.map +0 -1
- package/dist/formats/webgpu/core/cewgpu/CewgpuContainer.js.map +0 -1
- package/dist/formats/webgpu/core/cewgpu/containerViews.js.map +0 -1
- package/dist/formats/webgpu/core/cewgpu/validateContainer.js.map +0 -1
- package/dist/resource/shader/portable.js +0 -33
- package/dist/resource/shader/portable.js.map +0 -1
- package/docs/formats/hlsl/reference/portable-reflection.md +0 -141
- package/docs/formats/webgl/effect-reflection.md +0 -127
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { wwiseIdFromName, joinSoundbanksInfo, buildSoundbanksCatalog, parseSoundbanksInfo, isSoundbanksInfo } from './core/soundbanksInfo.js';
|
|
2
|
-
import { DEFAULT_VALUES, normalizeValues, readWithValues, inspectWithValues, isSupportedWithValues, toJsonValue, toBytes, extractMedia, isBNK, OUTPUT_MEDIA, OUTPUT_BNK_JSON, OUTPUT_JSON, OUTPUT_RAW, HIRC_TYPE_NAMES } from './core/helpers.js';
|
|
2
|
+
import { DEFAULT_VALUES, normalizeValues, readWithValues, inspectWithValues, isSupportedWithValues, toJsonValue, toBytes, extractMedia, isBNK, OUTPUT_MEDIA, OUTPUT_BNK_JSON, OUTPUT_JSON, OUTPUT_RAW, HIRC_TYPE_NAMES, HIRC_V150_TYPE_NAMES } from './core/helpers.js';
|
|
3
3
|
import { eventMediaFromBanks } from './core/graph.js';
|
|
4
4
|
import { parseEventAction } from './core/eventAction.js';
|
|
5
|
+
import { parseGlobalSettings } from './core/globalSettings.js';
|
|
6
|
+
import { parseBusNode, busNodesFromBanks } from './core/busNodes.js';
|
|
7
|
+
import { parseEffectNode, effectNodesFromBanks } from './core/effectNodes.js';
|
|
5
8
|
import { parseMusicSwitch, parseMusicPlaylist, parseMusicTrack, parseMusicSegment, musicNodesFromBanks } from './core/musicNodes.js';
|
|
6
9
|
import { parseSfxLayer, parseSfxSwitch, parseSfxRandomSequence, parseSfxAttenuation, parseSfxActorMixer, sfxNodesFromBanks } from './core/sfxNodes.js';
|
|
7
10
|
|
|
@@ -10,12 +13,13 @@ const FORMAT_NAME = "CjsBnkFormat";
|
|
|
10
13
|
/**
|
|
11
14
|
* Reader for Audiokinetic Wwise soundbank (.bnk) containers.
|
|
12
15
|
*
|
|
13
|
-
* Inspection decodes the bank header, embedded media index,
|
|
14
|
-
* listing (with version-stable typed fields), and
|
|
15
|
-
* without copying payloads. Read can emit the raw bank,
|
|
16
|
-
* embedded media items undecoded. The read path stays a
|
|
17
|
-
* reader; the Wwise-domain toolkit (SoundbanksInfo catalog
|
|
18
|
-
* event -> media graph resolution) is grouped under the
|
|
16
|
+
* Inspection decodes the bank header, embedded media index, exact v150 global
|
|
17
|
+
* settings, object hierarchy listing (with version-stable typed fields), and
|
|
18
|
+
* referenced bank names without copying payloads. Read can emit the raw bank,
|
|
19
|
+
* debug JSON, or the embedded media items undecoded. The read path stays a
|
|
20
|
+
* pure container reader; the Wwise-domain toolkit (SoundbanksInfo catalog
|
|
21
|
+
* helpers, id hash, event -> media graph resolution) is grouped under the
|
|
22
|
+
* `wwise` static.
|
|
19
23
|
*/
|
|
20
24
|
class CjsBnkFormat {
|
|
21
25
|
#values = DEFAULT_VALUES;
|
|
@@ -214,11 +218,20 @@ class CjsBnkFormat {
|
|
|
214
218
|
* core/musicNodes.js for the anchored, exact-end-validated parse.
|
|
215
219
|
*
|
|
216
220
|
* The v150 authored-SFX decoders (`sfxNodesFromBanks` and the per-type
|
|
217
|
-
* Event Action, Random/Sequence, Switch, Layer,
|
|
218
|
-
* Attenuation parsers)
|
|
221
|
+
* Global Settings, Event Action, Random/Sequence, Switch, Layer,
|
|
222
|
+
* Actor-Mixer, and Attenuation parsers)
|
|
219
223
|
* preserve raw Wwise semantics for runtime-audio's optional builder.
|
|
220
224
|
* NodeBase facts, hierarchy-only Actor-Mixers, and attenuation objects
|
|
221
225
|
* remain distinct from playable container behavior.
|
|
226
|
+
*
|
|
227
|
+
* `busNodesFromBanks` and `parseBusNode` expose qualified complete v150
|
|
228
|
+
* Audio Bus and Auxiliary Bus bodies: ancestry, root output device,
|
|
229
|
+
* properties, aux topology, policy, ducking, effect/metadata references,
|
|
230
|
+
* RTPCs, and state values.
|
|
231
|
+
*
|
|
232
|
+
* `effectNodesFromBanks` and `parseEffectNode` expose complete generic
|
|
233
|
+
* v150 Fx ShareSet and Fx Custom bodies while leaving plug-in parameter
|
|
234
|
+
* blocks opaque for separately qualified DSP adapters.
|
|
222
235
|
*/
|
|
223
236
|
static wwise = Object.freeze({
|
|
224
237
|
isSoundbanksInfo,
|
|
@@ -227,12 +240,17 @@ class CjsBnkFormat {
|
|
|
227
240
|
joinSoundbanksInfo,
|
|
228
241
|
wwiseIdFromName,
|
|
229
242
|
eventMediaFromBanks,
|
|
243
|
+
parseGlobalSettings,
|
|
230
244
|
parseEventAction,
|
|
231
245
|
musicNodesFromBanks,
|
|
232
246
|
parseMusicSegment,
|
|
233
247
|
parseMusicTrack,
|
|
234
248
|
parseMusicPlaylist,
|
|
235
249
|
parseMusicSwitch,
|
|
250
|
+
busNodesFromBanks,
|
|
251
|
+
parseBusNode,
|
|
252
|
+
effectNodesFromBanks,
|
|
253
|
+
parseEffectNode,
|
|
236
254
|
sfxNodesFromBanks,
|
|
237
255
|
parseSfxActorMixer,
|
|
238
256
|
parseSfxAttenuation,
|
|
@@ -251,6 +269,7 @@ class CjsBnkFormat {
|
|
|
251
269
|
MEDIA: OUTPUT_MEDIA
|
|
252
270
|
});
|
|
253
271
|
static HIRC_TYPE_NAMES = HIRC_TYPE_NAMES;
|
|
272
|
+
static HIRC_V150_TYPE_NAMES = HIRC_V150_TYPE_NAMES;
|
|
254
273
|
static type = Object.freeze(["audio"]);
|
|
255
274
|
static mediaTypes = Object.freeze(["audio"]);
|
|
256
275
|
static inputTypes = Object.freeze(["bnk"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CjsBnkFormat.js","sources":["../../../../src/formats/bnk/CjsBnkFormat.js"],"sourcesContent":["import {\n buildSoundbanksCatalog,\r\n isSoundbanksInfo,\r\n joinSoundbanksInfo,\r\n parseSoundbanksInfo,\r\n wwiseIdFromName\r\n} from \"./core/soundbanksInfo.js\";\r\nimport {\r\n DEFAULT_VALUES,\r\n HIRC_TYPE_NAMES,\r\n OUTPUT_BNK_JSON,\r\n OUTPUT_JSON,\r\n OUTPUT_MEDIA,\r\n OUTPUT_RAW,\r\n extractMedia,\r\n inspectWithValues,\r\n isBNK,\r\n isSupportedWithValues,\r\n normalizeValues,\r\n readWithValues,\r\n toBytes,\r\n toJsonValue\r\n} from \"./core/helpers.js\";\r\nimport { eventMediaFromBanks } from \"./core/graph.js\";\nimport { parseEventAction } from \"./core/eventAction.js\";\nimport {\r\n musicNodesFromBanks,\r\n parseMusicPlaylist,\r\n parseMusicSegment,\r\n parseMusicSwitch,\r\n parseMusicTrack\r\n} from \"./core/musicNodes.js\";\nimport {\n parseSfxActorMixer,\n parseSfxAttenuation,\n parseSfxLayer,\n parseSfxRandomSequence,\n parseSfxSwitch,\n sfxNodesFromBanks\n} from \"./core/sfxNodes.js\";\n\r\nconst FORMAT_NAME = \"CjsBnkFormat\";\r\n\r\n/**\r\n * Reader for Audiokinetic Wwise soundbank (.bnk) containers.\r\n *\r\n * Inspection decodes the bank header, embedded media index, object hierarchy\r\n * listing (with version-stable typed fields), and referenced bank names\r\n * without copying payloads. Read can emit the raw bank, debug JSON, or the\r\n * embedded media items undecoded. The read path stays a pure container\r\n * reader; the Wwise-domain toolkit (SoundbanksInfo catalog helpers, id hash,\r\n * event -> media graph resolution) is grouped under the `wwise` static.\r\n */\r\nexport class CjsBnkFormat\n{\n #values = DEFAULT_VALUES;\n\n /**\n * Browser-worker module declaration consumed by CjsResManWorkerLoader.\n */\n static worker = Object.freeze({\n module: import.meta.url,\n exportName: \"CjsBnkFormat\"\n });\n\r\n /**\r\n * Create a reusable bnk format profile.\r\n *\r\n * @param {object} [options] Default read/inspect options.\r\n */\r\n constructor(options = {})\r\n {\r\n this.SetValues(options);\r\n }\r\n\r\n /**\r\n * Merge options into this profile.\r\n *\r\n * @param {object} [options] Values to merge.\r\n * @returns {CjsBnkFormat} This format profile.\r\n */\r\n SetValues(options = {})\r\n {\r\n this.#values = normalizeValues(this.#values, options, FORMAT_NAME);\r\n return this;\r\n }\r\n\r\n /**\r\n * Get normalized profile values with optional per-call overrides.\r\n *\r\n * @param {object} [options] Per-call values.\r\n * @returns {object} Normalized read values.\r\n */\r\n GetValues(options = {})\r\n {\r\n return normalizeValues(this.#values, options, FORMAT_NAME);\r\n }\r\n\r\n /**\r\n * Read soundbank bytes with this profile.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Soundbank bytes.\r\n * @param {object} [options] Per-call values.\r\n * @returns {object} GPU-free raw/debug/media payload for the selected emit target.\r\n */\r\n Read(input, options = {})\r\n {\r\n return readWithValues(input, this.GetValues(options));\r\n }\r\n\r\n /**\r\n * Read soundbank bytes asynchronously with this profile.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Soundbank bytes.\r\n * @param {object} [options] Per-call values.\r\n * @returns {Promise<object>} GPU-free raw/debug/media payload for the selected emit target.\r\n */\r\n async ReadAsync(input, options = {})\r\n {\r\n return this.Read(input, options);\r\n }\r\n\r\n /**\r\n * Inspect soundbank bytes without copying media payloads.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Soundbank bytes.\r\n * @param {object} [options] Per-call values.\r\n * @returns {object} Soundbank metadata.\r\n */\r\n Inspect(input, options = {})\r\n {\r\n return inspectWithValues(input, this.GetValues(options));\r\n }\r\n\r\n /**\r\n * Report whether soundbank input and requested output variants are supported.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Soundbank bytes.\r\n * @param {object} [options] Per-call values.\r\n * @returns {object} Support/probe report.\r\n */\r\n IsSupported(input, options = {})\r\n {\r\n return isSupportedWithValues(input, this.GetValues(options));\r\n }\r\n\r\n /**\r\n * Convert format output into JSON-compatible debug data.\r\n *\r\n * @param {any} value Format output.\r\n * @returns {any} JSON-compatible value.\r\n */\r\n ToJSON(value)\r\n {\r\n return toJsonValue(value);\r\n }\r\n\r\n /**\r\n * One-shot soundbank read.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Soundbank bytes.\r\n * @param {object} [options] Read options.\r\n * @returns {object} GPU-free raw/debug/media payload for the selected emit target.\r\n */\r\n static read(input, options = {})\r\n {\r\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\r\n }\r\n\r\n /**\r\n * One-shot asynchronous soundbank read.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Soundbank bytes.\r\n * @param {object} [options] Read options.\r\n * @returns {Promise<object>} GPU-free raw/debug/media payload for the selected emit target.\r\n */\r\n static async readAsync(input, options = {})\r\n {\r\n return CjsBnkFormat.read(input, options);\r\n }\r\n\r\n /**\r\n * One-shot soundbank inspection.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Soundbank bytes.\r\n * @param {object} [options] Inspect options.\r\n * @returns {object} Soundbank metadata.\r\n */\r\n static inspect(input, options = {})\r\n {\r\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\r\n }\r\n\r\n /**\r\n * One-shot soundbank support probe.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Soundbank bytes.\r\n * @param {object} [options] Probe options.\r\n * @returns {object} Support/probe report.\r\n */\r\n static isSupported(input, options = {})\r\n {\r\n return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\r\n }\r\n\r\n /**\r\n * Extract embedded media payloads as views over the soundbank bytes.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Soundbank bytes.\r\n * @param {number} [mediaId] Optional single media id filter.\r\n * @returns {Array<object>} Extracted media items with undecoded bytes.\r\n */\r\n static extractMedia(input, mediaId)\r\n {\r\n const bytes = toBytes(input);\r\n const metadata = inspectWithValues(bytes, DEFAULT_VALUES);\r\n return extractMedia(bytes, metadata, mediaId);\r\n }\r\n\r\n /**\r\n * Convert format output into JSON-compatible debug data.\r\n *\r\n * @param {any} value Format output.\r\n * @returns {any} JSON-compatible value.\r\n */\r\n static toJSON(value)\r\n {\r\n return toJsonValue(value);\r\n }\r\n\r\n /**\r\n * Test whether bytes look like a Wwise soundbank.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Candidate soundbank bytes.\r\n * @returns {boolean} True when the BKHD header chunk is present.\r\n */\r\n static isBNK(input)\r\n {\r\n try\r\n {\r\n return isBNK(toBytes(input));\r\n }\r\n catch\r\n {\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * Wwise-domain toolkit, grouped apart from the container-reading statics -\r\n * the single home for the SoundbanksInfo catalog helpers\r\n * (`isSoundbanksInfo`, `parseSoundbanksInfo`, `buildSoundbanksCatalog`,\r\n * `joinSoundbanksInfo`), the id hash (`wwiseIdFromName`, FNV-1 of the\r\n * lowercased name), and event-graph resolution.\r\n *\r\n * `eventMediaFromBanks(inspections, options)` is graph interpretation over\r\n * `inspect()` results, not a read path: banks may split events from their\r\n * target objects (EVE keeps all events in one bank and their sounds in\r\n * others), so always pass every related bank to one call. Returns\r\n * `{ eventMedia: Map<eventObjectId, Set<wemId>>, diagnostics }`. See\r\n * core/graph.js for the walk policy.\r\n *\r\n * The interactive-music decoders (`musicNodesFromBanks` and the per-type\r\n * `parseMusicSegment/Track/Playlist/Switch`) turn the music-hierarchy\r\n * entries (HIRC 10-13) into typed nodes - children, meter, cue markers,\r\n * clips, playlist trees, decision trees, and transition rules. See\r\n * core/musicNodes.js for the anchored, exact-end-validated parse.\n *\n * The v150 authored-SFX decoders (`sfxNodesFromBanks` and the per-type\n * Event Action, Random/Sequence, Switch, Layer, Actor-Mixer, and\n * Attenuation parsers)\n * preserve raw Wwise semantics for runtime-audio's optional builder.\n * NodeBase facts, hierarchy-only Actor-Mixers, and attenuation objects\n * remain distinct from playable container behavior.\n */\r\n static wwise = Object.freeze({\r\n isSoundbanksInfo,\r\n parseSoundbanksInfo,\r\n buildSoundbanksCatalog,\r\n joinSoundbanksInfo,\r\n wwiseIdFromName,\n eventMediaFromBanks,\n parseEventAction,\n musicNodesFromBanks,\r\n parseMusicSegment,\r\n parseMusicTrack,\n parseMusicPlaylist,\n parseMusicSwitch,\n sfxNodesFromBanks,\n parseSfxActorMixer,\n parseSfxAttenuation,\n parseSfxRandomSequence,\n parseSfxSwitch,\n parseSfxLayer\n });\n\r\n /**\r\n * Emit targets for this format (canonical frozen enum).\r\n */\r\n static Output = Object.freeze({\r\n RAW: OUTPUT_RAW,\r\n JSON: OUTPUT_JSON,\r\n BNK_JSON: OUTPUT_BNK_JSON,\r\n MEDIA: OUTPUT_MEDIA\r\n });\r\n\r\n static HIRC_TYPE_NAMES = HIRC_TYPE_NAMES;\r\n\r\n static type = Object.freeze([ \"audio\" ]);\r\n\r\n static mediaTypes = Object.freeze([ \"audio\" ]);\r\n\r\n static inputTypes = Object.freeze([ \"bnk\" ]);\r\n\r\n static outputTypes = Object.freeze([ OUTPUT_RAW, OUTPUT_MEDIA ]);\r\n\r\n static debugOutputTypes = Object.freeze([ OUTPUT_BNK_JSON, OUTPUT_RAW ]);\r\n}\r\n\r\nexport default CjsBnkFormat;\r\n"],"names":["FORMAT_NAME","CjsBnkFormat","DEFAULT_VALUES","worker","Object","freeze","module","import","meta","url","exportName","constructor","options","SetValues","normalizeValues","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","IsSupported","isSupportedWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","isSupported","extractMedia","mediaId","bytes","toBytes","metadata","toJSON","isBNK","wwise","isSoundbanksInfo","parseSoundbanksInfo","buildSoundbanksCatalog","joinSoundbanksInfo","wwiseIdFromName","eventMediaFromBanks","parseEventAction","musicNodesFromBanks","parseMusicSegment","parseMusicTrack","parseMusicPlaylist","parseMusicSwitch","sfxNodesFromBanks","parseSfxActorMixer","parseSfxAttenuation","parseSfxRandomSequence","parseSfxSwitch","parseSfxLayer","Output","RAW","OUTPUT_RAW","JSON","OUTPUT_JSON","BNK_JSON","OUTPUT_BNK_JSON","MEDIA","OUTPUT_MEDIA","HIRC_TYPE_NAMES","type","mediaTypes","inputTypes","outputTypes","debugOutputTypes"],"mappings":";;;;;;;AAyCA,MAAMA,WAAW,GAAG,cAAc;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,YAAY,CACzB;EACI,OAAO,GAAGC,cAAc;;AAExB;AACJ;AACA;AACI,EAAA,OAAOC,MAAM,GAAGC,MAAM,CAACC,MAAM,CAAC;AAC1BC,IAAAA,MAAM,EAAEC,MAAM,CAACC,IAAI,CAACC,GAAG;AACvBC,IAAAA,UAAU,EAAE;AAChB,GAAC,CAAC;;AAEF;AACJ;AACA;AACA;AACA;AACIC,EAAAA,WAAWA,CAACC,OAAO,GAAG,EAAE,EACxB;AACI,IAAA,IAAI,CAACC,SAAS,CAACD,OAAO,CAAC;AAC3B,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIC,EAAAA,SAASA,CAACD,OAAO,GAAG,EAAE,EACtB;AACI,IAAA,IAAI,CAAC,OAAO,GAAGE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAEF,OAAO,EAAEZ,WAAW,CAAC;AAClE,IAAA,OAAO,IAAI;AACf,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIe,EAAAA,SAASA,CAACH,OAAO,GAAG,EAAE,EACtB;IACI,OAAOE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAEF,OAAO,EAAEZ,WAAW,CAAC;AAC9D,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACA;AACIgB,EAAAA,IAAIA,CAACC,KAAK,EAAEL,OAAO,GAAG,EAAE,EACxB;IACI,OAAOM,cAAc,CAACD,KAAK,EAAE,IAAI,CAACF,SAAS,CAACH,OAAO,CAAC,CAAC;AACzD,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACA;EACI,MAAMO,SAASA,C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,kBAAkB;IAClBC,gBAAgB;IAChBC,iBAAiB;IACjBC,kBAAkB;IAClBC,mBAAmB;IACnBC,sBAAsB;IACtBC,cAAc;AACdC,IAAAA;AACJ,GAAC,CAAC;;AAEF;AACJ;AACA;AACI,EAAA,OAAOC,MAAM,GAAGrD,MAAM,CAACC,MAAM,CAAC;AAC1BqD,IAAAA,GAAG,EAAEC,UAAU;AACfC,IAAAA,IAAI,EAAEC,WAAW;AACjBC,IAAAA,QAAQ,EAAEC,eAAe;AACzBC,IAAAA,KAAK,EAAEC;AACX,GAAC,CAAC;EAEF,OAAOC,eAAe,GAAGA,eAAe;EAExC,OAAOC,IAAI,GAAG/D,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EAExC,OAAO+D,UAAU,GAAGhE,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EAE9C,OAAOgE,UAAU,GAAGjE,MAAM,CAACC,MAAM,CAAC,CAAE,KAAK,CAAE,CAAC;EAE5C,OAAOiE,WAAW,GAAGlE,MAAM,CAACC,MAAM,CAAC,CAAEsD,UAAU,EAAEM,YAAY,CAAE,CAAC;EAEhE,OAAOM,gBAAgB,GAAGnE,MAAM,CAACC,MAAM,CAAC,CAAE0D,eAAe,EAAEJ,UAAU,CAAE,CAAC;AAC5E;;;;"}
|
|
1
|
+
{"version":3,"file":"CjsBnkFormat.js","sources":["../../../../src/formats/bnk/CjsBnkFormat.js"],"sourcesContent":["import {\n buildSoundbanksCatalog,\r\n isSoundbanksInfo,\r\n joinSoundbanksInfo,\r\n parseSoundbanksInfo,\r\n wwiseIdFromName\r\n} from \"./core/soundbanksInfo.js\";\r\nimport {\r\n DEFAULT_VALUES,\n HIRC_TYPE_NAMES,\n HIRC_V150_TYPE_NAMES,\n OUTPUT_BNK_JSON,\r\n OUTPUT_JSON,\r\n OUTPUT_MEDIA,\r\n OUTPUT_RAW,\r\n extractMedia,\r\n inspectWithValues,\r\n isBNK,\r\n isSupportedWithValues,\r\n normalizeValues,\r\n readWithValues,\r\n toBytes,\r\n toJsonValue\r\n} from \"./core/helpers.js\";\r\nimport { eventMediaFromBanks } from \"./core/graph.js\";\nimport { parseEventAction } from \"./core/eventAction.js\";\nimport { parseGlobalSettings } from \"./core/globalSettings.js\";\nimport {\n busNodesFromBanks,\n parseBusNode\n} from \"./core/busNodes.js\";\nimport {\n effectNodesFromBanks,\n parseEffectNode\n} from \"./core/effectNodes.js\";\nimport {\r\n musicNodesFromBanks,\r\n parseMusicPlaylist,\r\n parseMusicSegment,\r\n parseMusicSwitch,\r\n parseMusicTrack\r\n} from \"./core/musicNodes.js\";\nimport {\n parseSfxActorMixer,\n parseSfxAttenuation,\n parseSfxLayer,\n parseSfxRandomSequence,\n parseSfxSwitch,\n sfxNodesFromBanks\n} from \"./core/sfxNodes.js\";\n\r\nconst FORMAT_NAME = \"CjsBnkFormat\";\r\n\r\n/**\r\n * Reader for Audiokinetic Wwise soundbank (.bnk) containers.\r\n *\r\n * Inspection decodes the bank header, embedded media index, exact v150 global\n * settings, object hierarchy listing (with version-stable typed fields), and\n * referenced bank names without copying payloads. Read can emit the raw bank,\n * debug JSON, or the embedded media items undecoded. The read path stays a\n * pure container reader; the Wwise-domain toolkit (SoundbanksInfo catalog\n * helpers, id hash, event -> media graph resolution) is grouped under the\n * `wwise` static.\n */\r\nexport class CjsBnkFormat\n{\n #values = DEFAULT_VALUES;\n\n /**\n * Browser-worker module declaration consumed by CjsResManWorkerLoader.\n */\n static worker = Object.freeze({\n module: import.meta.url,\n exportName: \"CjsBnkFormat\"\n });\n\r\n /**\r\n * Create a reusable bnk format profile.\r\n *\r\n * @param {object} [options] Default read/inspect options.\r\n */\r\n constructor(options = {})\r\n {\r\n this.SetValues(options);\r\n }\r\n\r\n /**\r\n * Merge options into this profile.\r\n *\r\n * @param {object} [options] Values to merge.\r\n * @returns {CjsBnkFormat} This format profile.\r\n */\r\n SetValues(options = {})\r\n {\r\n this.#values = normalizeValues(this.#values, options, FORMAT_NAME);\r\n return this;\r\n }\r\n\r\n /**\r\n * Get normalized profile values with optional per-call overrides.\r\n *\r\n * @param {object} [options] Per-call values.\r\n * @returns {object} Normalized read values.\r\n */\r\n GetValues(options = {})\r\n {\r\n return normalizeValues(this.#values, options, FORMAT_NAME);\r\n }\r\n\r\n /**\r\n * Read soundbank bytes with this profile.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Soundbank bytes.\r\n * @param {object} [options] Per-call values.\r\n * @returns {object} GPU-free raw/debug/media payload for the selected emit target.\r\n */\r\n Read(input, options = {})\r\n {\r\n return readWithValues(input, this.GetValues(options));\r\n }\r\n\r\n /**\r\n * Read soundbank bytes asynchronously with this profile.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Soundbank bytes.\r\n * @param {object} [options] Per-call values.\r\n * @returns {Promise<object>} GPU-free raw/debug/media payload for the selected emit target.\r\n */\r\n async ReadAsync(input, options = {})\r\n {\r\n return this.Read(input, options);\r\n }\r\n\r\n /**\r\n * Inspect soundbank bytes without copying media payloads.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Soundbank bytes.\r\n * @param {object} [options] Per-call values.\r\n * @returns {object} Soundbank metadata.\r\n */\r\n Inspect(input, options = {})\r\n {\r\n return inspectWithValues(input, this.GetValues(options));\r\n }\r\n\r\n /**\r\n * Report whether soundbank input and requested output variants are supported.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Soundbank bytes.\r\n * @param {object} [options] Per-call values.\r\n * @returns {object} Support/probe report.\r\n */\r\n IsSupported(input, options = {})\r\n {\r\n return isSupportedWithValues(input, this.GetValues(options));\r\n }\r\n\r\n /**\r\n * Convert format output into JSON-compatible debug data.\r\n *\r\n * @param {any} value Format output.\r\n * @returns {any} JSON-compatible value.\r\n */\r\n ToJSON(value)\r\n {\r\n return toJsonValue(value);\r\n }\r\n\r\n /**\r\n * One-shot soundbank read.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Soundbank bytes.\r\n * @param {object} [options] Read options.\r\n * @returns {object} GPU-free raw/debug/media payload for the selected emit target.\r\n */\r\n static read(input, options = {})\r\n {\r\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\r\n }\r\n\r\n /**\r\n * One-shot asynchronous soundbank read.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Soundbank bytes.\r\n * @param {object} [options] Read options.\r\n * @returns {Promise<object>} GPU-free raw/debug/media payload for the selected emit target.\r\n */\r\n static async readAsync(input, options = {})\r\n {\r\n return CjsBnkFormat.read(input, options);\r\n }\r\n\r\n /**\r\n * One-shot soundbank inspection.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Soundbank bytes.\r\n * @param {object} [options] Inspect options.\r\n * @returns {object} Soundbank metadata.\r\n */\r\n static inspect(input, options = {})\r\n {\r\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\r\n }\r\n\r\n /**\r\n * One-shot soundbank support probe.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Soundbank bytes.\r\n * @param {object} [options] Probe options.\r\n * @returns {object} Support/probe report.\r\n */\r\n static isSupported(input, options = {})\r\n {\r\n return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\r\n }\r\n\r\n /**\r\n * Extract embedded media payloads as views over the soundbank bytes.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Soundbank bytes.\r\n * @param {number} [mediaId] Optional single media id filter.\r\n * @returns {Array<object>} Extracted media items with undecoded bytes.\r\n */\r\n static extractMedia(input, mediaId)\r\n {\r\n const bytes = toBytes(input);\r\n const metadata = inspectWithValues(bytes, DEFAULT_VALUES);\r\n return extractMedia(bytes, metadata, mediaId);\r\n }\r\n\r\n /**\r\n * Convert format output into JSON-compatible debug data.\r\n *\r\n * @param {any} value Format output.\r\n * @returns {any} JSON-compatible value.\r\n */\r\n static toJSON(value)\r\n {\r\n return toJsonValue(value);\r\n }\r\n\r\n /**\r\n * Test whether bytes look like a Wwise soundbank.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|DataView} input Candidate soundbank bytes.\r\n * @returns {boolean} True when the BKHD header chunk is present.\r\n */\r\n static isBNK(input)\r\n {\r\n try\r\n {\r\n return isBNK(toBytes(input));\r\n }\r\n catch\r\n {\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * Wwise-domain toolkit, grouped apart from the container-reading statics -\r\n * the single home for the SoundbanksInfo catalog helpers\r\n * (`isSoundbanksInfo`, `parseSoundbanksInfo`, `buildSoundbanksCatalog`,\r\n * `joinSoundbanksInfo`), the id hash (`wwiseIdFromName`, FNV-1 of the\r\n * lowercased name), and event-graph resolution.\r\n *\r\n * `eventMediaFromBanks(inspections, options)` is graph interpretation over\r\n * `inspect()` results, not a read path: banks may split events from their\r\n * target objects (EVE keeps all events in one bank and their sounds in\r\n * others), so always pass every related bank to one call. Returns\r\n * `{ eventMedia: Map<eventObjectId, Set<wemId>>, diagnostics }`. See\r\n * core/graph.js for the walk policy.\r\n *\r\n * The interactive-music decoders (`musicNodesFromBanks` and the per-type\r\n * `parseMusicSegment/Track/Playlist/Switch`) turn the music-hierarchy\r\n * entries (HIRC 10-13) into typed nodes - children, meter, cue markers,\r\n * clips, playlist trees, decision trees, and transition rules. See\r\n * core/musicNodes.js for the anchored, exact-end-validated parse.\n *\n * The v150 authored-SFX decoders (`sfxNodesFromBanks` and the per-type\n * Global Settings, Event Action, Random/Sequence, Switch, Layer,\n * Actor-Mixer, and Attenuation parsers)\n * preserve raw Wwise semantics for runtime-audio's optional builder.\n * NodeBase facts, hierarchy-only Actor-Mixers, and attenuation objects\n * remain distinct from playable container behavior.\n *\n * `busNodesFromBanks` and `parseBusNode` expose qualified complete v150\n * Audio Bus and Auxiliary Bus bodies: ancestry, root output device,\n * properties, aux topology, policy, ducking, effect/metadata references,\n * RTPCs, and state values.\n *\n * `effectNodesFromBanks` and `parseEffectNode` expose complete generic\n * v150 Fx ShareSet and Fx Custom bodies while leaving plug-in parameter\n * blocks opaque for separately qualified DSP adapters.\n */\r\n static wwise = Object.freeze({\r\n isSoundbanksInfo,\r\n parseSoundbanksInfo,\r\n buildSoundbanksCatalog,\r\n joinSoundbanksInfo,\r\n wwiseIdFromName,\n eventMediaFromBanks,\n parseGlobalSettings,\n parseEventAction,\n musicNodesFromBanks,\r\n parseMusicSegment,\r\n parseMusicTrack,\n parseMusicPlaylist,\n parseMusicSwitch,\n busNodesFromBanks,\n parseBusNode,\n effectNodesFromBanks,\n parseEffectNode,\n sfxNodesFromBanks,\n parseSfxActorMixer,\n parseSfxAttenuation,\n parseSfxRandomSequence,\n parseSfxSwitch,\n parseSfxLayer\n });\n\r\n /**\r\n * Emit targets for this format (canonical frozen enum).\r\n */\r\n static Output = Object.freeze({\r\n RAW: OUTPUT_RAW,\r\n JSON: OUTPUT_JSON,\r\n BNK_JSON: OUTPUT_BNK_JSON,\r\n MEDIA: OUTPUT_MEDIA\r\n });\r\n\r\n static HIRC_TYPE_NAMES = HIRC_TYPE_NAMES;\n\n static HIRC_V150_TYPE_NAMES = HIRC_V150_TYPE_NAMES;\n\r\n static type = Object.freeze([ \"audio\" ]);\r\n\r\n static mediaTypes = Object.freeze([ \"audio\" ]);\r\n\r\n static inputTypes = Object.freeze([ \"bnk\" ]);\r\n\r\n static outputTypes = Object.freeze([ OUTPUT_RAW, OUTPUT_MEDIA ]);\r\n\r\n static debugOutputTypes = Object.freeze([ OUTPUT_BNK_JSON, OUTPUT_RAW ]);\r\n}\r\n\r\nexport default CjsBnkFormat;\r\n"],"names":["FORMAT_NAME","CjsBnkFormat","DEFAULT_VALUES","worker","Object","freeze","module","import","meta","url","exportName","constructor","options","SetValues","normalizeValues","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","IsSupported","isSupportedWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","isSupported","extractMedia","mediaId","bytes","toBytes","metadata","toJSON","isBNK","wwise","isSoundbanksInfo","parseSoundbanksInfo","buildSoundbanksCatalog","joinSoundbanksInfo","wwiseIdFromName","eventMediaFromBanks","parseGlobalSettings","parseEventAction","musicNodesFromBanks","parseMusicSegment","parseMusicTrack","parseMusicPlaylist","parseMusicSwitch","busNodesFromBanks","parseBusNode","effectNodesFromBanks","parseEffectNode","sfxNodesFromBanks","parseSfxActorMixer","parseSfxAttenuation","parseSfxRandomSequence","parseSfxSwitch","parseSfxLayer","Output","RAW","OUTPUT_RAW","JSON","OUTPUT_JSON","BNK_JSON","OUTPUT_BNK_JSON","MEDIA","OUTPUT_MEDIA","HIRC_TYPE_NAMES","HIRC_V150_TYPE_NAMES","type","mediaTypes","inputTypes","outputTypes","debugOutputTypes"],"mappings":";;;;;;;;;;AAmDA,MAAMA,WAAW,GAAG,cAAc;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,YAAY,CACzB;EACI,OAAO,GAAGC,cAAc;;AAExB;AACJ;AACA;AACI,EAAA,OAAOC,MAAM,GAAGC,MAAM,CAACC,MAAM,CAAC;AAC1BC,IAAAA,MAAM,EAAEC,MAAM,CAACC,IAAI,CAACC,GAAG;AACvBC,IAAAA,UAAU,EAAE;AAChB,GAAC,CAAC;;AAEF;AACJ;AACA;AACA;AACA;AACIC,EAAAA,WAAWA,CAACC,OAAO,GAAG,EAAE,EACxB;AACI,IAAA,IAAI,CAACC,SAAS,CAACD,OAAO,CAAC;AAC3B,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIC,EAAAA,SAASA,CAACD,OAAO,GAAG,EAAE,EACtB;AACI,IAAA,IAAI,CAAC,OAAO,GAAGE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAEF,OAAO,EAAEZ,WAAW,CAAC;AAClE,IAAA,OAAO,IAAI;AACf,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIe,EAAAA,SAASA,CAACH,OAAO,GAAG,EAAE,EACtB;IACI,OAAOE,eAAe,CAAC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C,CAAE+D,eAAe,EAAEJ,UAAU,CAAE,CAAC;AAC5E;;;;"}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { WwiseCursor, boundedCount, readPositioning, readAux, finite, readInitialRtpcs, readStateChunk } from './nodeBase.js';
|
|
2
|
+
|
|
3
|
+
// Exact Wwise v150 Audio Bus and Auxiliary Bus decoding. The HIRC payload
|
|
4
|
+
// supplied by inspect() starts after the object id. Records preserve authored
|
|
5
|
+
// routing, bus policy, ducking, effect references, metadata, RTPCs, and state
|
|
6
|
+
// without assigning runtime mixing or plug-in semantics.
|
|
7
|
+
|
|
8
|
+
const SUPPORTED_VERSION = 150;
|
|
9
|
+
const AUDIO_BUS_TYPE = 8;
|
|
10
|
+
const AUXILIARY_BUS_TYPE = 18;
|
|
11
|
+
const BUS_VOLUME_PROPERTY_ID = 0x04;
|
|
12
|
+
const MAKE_UP_GAIN_PROPERTY_ID = 0x05;
|
|
13
|
+
const OUTPUT_BUS_VOLUME_PROPERTY_ID = 0x0d;
|
|
14
|
+
const FINITE_GAIN_PROPERTY_IDS = new Set([BUS_VOLUME_PROPERTY_ID, MAKE_UP_GAIN_PROPERTY_ID, OUTPUT_BUS_VOLUME_PROPERTY_ID]);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Decodes one complete v150 Audio or Auxiliary Bus body.
|
|
18
|
+
*
|
|
19
|
+
* @param {Uint8Array} payload Entry payload view from `inspect()`.
|
|
20
|
+
* @param {object} [options] Bank-version qualification.
|
|
21
|
+
* @returns {object|null} Typed bus body, or null when it is invalid.
|
|
22
|
+
*/
|
|
23
|
+
function parseBusNode(payload, {
|
|
24
|
+
bankVersion = SUPPORTED_VERSION
|
|
25
|
+
} = {}) {
|
|
26
|
+
if (!(payload instanceof Uint8Array) || Number(bankVersion) !== SUPPORTED_VERSION || payload.byteLength < 5) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
const cursor = new WwiseCursor(payload);
|
|
31
|
+
const overrideBusId = cursor.u32();
|
|
32
|
+
let outputDeviceId = null;
|
|
33
|
+
if (overrideBusId === 0) {
|
|
34
|
+
outputDeviceId = cursor.u32();
|
|
35
|
+
}
|
|
36
|
+
const propertyCount = boundedCount(cursor.u8(), cursor.remaining, 5, 255);
|
|
37
|
+
const ids = [];
|
|
38
|
+
const seen = new Set();
|
|
39
|
+
const properties = [];
|
|
40
|
+
for (let index = 0; index < propertyCount; index++) {
|
|
41
|
+
ids.push(cursor.u8());
|
|
42
|
+
}
|
|
43
|
+
for (const id of ids) {
|
|
44
|
+
if (seen.has(id)) return null;
|
|
45
|
+
seen.add(id);
|
|
46
|
+
const rawValue = cursor.u32();
|
|
47
|
+
const valueBytes = new ArrayBuffer(4);
|
|
48
|
+
const valueView = new DataView(valueBytes);
|
|
49
|
+
valueView.setUint32(0, rawValue, true);
|
|
50
|
+
const floatValue = valueView.getFloat32(0, true);
|
|
51
|
+
if (FINITE_GAIN_PROPERTY_IDS.has(id) && !Number.isFinite(floatValue)) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
properties.push({
|
|
55
|
+
id,
|
|
56
|
+
rawValue,
|
|
57
|
+
floatValue
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const prefixByteLength = cursor.at;
|
|
61
|
+
const positioning = readPositioning(cursor);
|
|
62
|
+
const aux = readAux(cursor);
|
|
63
|
+
const policyFlags = cursor.u8();
|
|
64
|
+
const maxInstances = cursor.u16();
|
|
65
|
+
const channelConfigRaw = cursor.u32();
|
|
66
|
+
const hdrFlags = cursor.u8();
|
|
67
|
+
const recoveryTime = cursor.s32();
|
|
68
|
+
const maxDuckVolume = finite(cursor.f32());
|
|
69
|
+
const ducks = ReadDucks(cursor);
|
|
70
|
+
const fx = ReadEffects(cursor);
|
|
71
|
+
const metadata = ReadMetadata(cursor);
|
|
72
|
+
const rtpcs = readInitialRtpcs(cursor);
|
|
73
|
+
const state = readStateChunk(cursor);
|
|
74
|
+
if (cursor.remaining !== 0) return null;
|
|
75
|
+
const gainValue = id => properties.find(property => property.id === id)?.floatValue ?? null;
|
|
76
|
+
return {
|
|
77
|
+
overrideBusId,
|
|
78
|
+
outputDeviceId,
|
|
79
|
+
properties,
|
|
80
|
+
busVolume: gainValue(BUS_VOLUME_PROPERTY_ID),
|
|
81
|
+
makeUpGain: gainValue(MAKE_UP_GAIN_PROPERTY_ID),
|
|
82
|
+
outputBusVolume: gainValue(OUTPUT_BUS_VOLUME_PROPERTY_ID),
|
|
83
|
+
prefixByteLength,
|
|
84
|
+
positioning,
|
|
85
|
+
aux,
|
|
86
|
+
policy: {
|
|
87
|
+
flags: policyFlags,
|
|
88
|
+
killNewest: Boolean(policyFlags & 0x01),
|
|
89
|
+
useVirtualBehavior: Boolean(policyFlags & 0x02),
|
|
90
|
+
ignoreParentMaxInstances: Boolean(policyFlags & 0x04),
|
|
91
|
+
backgroundMusic: Boolean(policyFlags & 0x08),
|
|
92
|
+
maxInstances
|
|
93
|
+
},
|
|
94
|
+
channelConfig: {
|
|
95
|
+
raw: channelConfigRaw,
|
|
96
|
+
channelCount: channelConfigRaw & 0xff,
|
|
97
|
+
configType: channelConfigRaw >>> 8 & 0x0f,
|
|
98
|
+
channelMask: channelConfigRaw >>> 12
|
|
99
|
+
},
|
|
100
|
+
hdr: {
|
|
101
|
+
flags: hdrFlags,
|
|
102
|
+
enabled: Boolean(hdrFlags & 0x01),
|
|
103
|
+
exponentialRelease: Boolean(hdrFlags & 0x02)
|
|
104
|
+
},
|
|
105
|
+
recoveryTime,
|
|
106
|
+
maxDuckVolume,
|
|
107
|
+
ducks,
|
|
108
|
+
fx,
|
|
109
|
+
metadata,
|
|
110
|
+
rtpcs,
|
|
111
|
+
state,
|
|
112
|
+
byteLength: cursor.at
|
|
113
|
+
};
|
|
114
|
+
} catch {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function ReadDucks(cursor) {
|
|
119
|
+
const count = boundedCount(cursor.u32(), cursor.remaining, 18, 65535);
|
|
120
|
+
const ducks = [];
|
|
121
|
+
for (let index = 0; index < count; index++) {
|
|
122
|
+
const busId = cursor.u32();
|
|
123
|
+
const volume = finite(cursor.f32());
|
|
124
|
+
const fadeOutTime = cursor.s32();
|
|
125
|
+
const fadeInTime = cursor.s32();
|
|
126
|
+
const curve = cursor.u8();
|
|
127
|
+
const targetPropertyId = cursor.u8();
|
|
128
|
+
if (curve > 9) {
|
|
129
|
+
throw new RangeError("invalid v150 Wwise duck curve");
|
|
130
|
+
}
|
|
131
|
+
ducks.push({
|
|
132
|
+
busId,
|
|
133
|
+
volume,
|
|
134
|
+
fadeOutTime,
|
|
135
|
+
fadeInTime,
|
|
136
|
+
curve,
|
|
137
|
+
targetPropertyId
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
return ducks;
|
|
141
|
+
}
|
|
142
|
+
function ReadEffects(cursor) {
|
|
143
|
+
const count = boundedCount(cursor.u8(), cursor.remaining, 6, 255);
|
|
144
|
+
const bypassAllRaw = count ? cursor.u8() : 0;
|
|
145
|
+
const slots = [];
|
|
146
|
+
for (let index = 0; index < count; index++) {
|
|
147
|
+
const slot = cursor.u8();
|
|
148
|
+
const fxId = cursor.u32();
|
|
149
|
+
const flags = cursor.u8();
|
|
150
|
+
slots.push({
|
|
151
|
+
index: slot,
|
|
152
|
+
fxId,
|
|
153
|
+
flags,
|
|
154
|
+
bypass: Boolean(flags & 0x01),
|
|
155
|
+
shareSet: Boolean(flags & 0x02)
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
bypassAllRaw,
|
|
160
|
+
bypassAll: Boolean(bypassAllRaw),
|
|
161
|
+
slots
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function ReadMetadata(cursor) {
|
|
165
|
+
const count = boundedCount(cursor.u8(), cursor.remaining, 6, 255);
|
|
166
|
+
const slots = [];
|
|
167
|
+
for (let index = 0; index < count; index++) {
|
|
168
|
+
const slot = cursor.u8();
|
|
169
|
+
const fxId = cursor.u32();
|
|
170
|
+
const shareSetRaw = cursor.u8();
|
|
171
|
+
slots.push({
|
|
172
|
+
index: slot,
|
|
173
|
+
fxId,
|
|
174
|
+
shareSetRaw,
|
|
175
|
+
shareSet: Boolean(shareSetRaw)
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
slots
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Decodes every v150 Audio and Auxiliary Bus across inspected banks.
|
|
185
|
+
*
|
|
186
|
+
* @param {Array<object>|object} inspections Related `CjsBnkFormat.inspect()` results.
|
|
187
|
+
* @returns {{buses: Map<number, object>, diagnostics: object}} Typed bus catalog and failures.
|
|
188
|
+
*/
|
|
189
|
+
function busNodesFromBanks(inspections) {
|
|
190
|
+
const banks = Array.isArray(inspections) ? inspections : [inspections];
|
|
191
|
+
const buses = new Map();
|
|
192
|
+
const failed = [];
|
|
193
|
+
const duplicates = [];
|
|
194
|
+
const unsupportedVersions = [];
|
|
195
|
+
let parsed = 0;
|
|
196
|
+
for (const inspection of banks) {
|
|
197
|
+
const bank = inspection?.source || "";
|
|
198
|
+
const bankVersion = Number(inspection?.bankVersion) >>> 0;
|
|
199
|
+
if (bankVersion !== SUPPORTED_VERSION) {
|
|
200
|
+
unsupportedVersions.push({
|
|
201
|
+
bank,
|
|
202
|
+
version: bankVersion
|
|
203
|
+
});
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
for (const entry of inspection?.hirc ?? []) {
|
|
207
|
+
if (entry.type !== AUDIO_BUS_TYPE && entry.type !== AUXILIARY_BUS_TYPE) {
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
const decoded = parseBusNode(entry.payload, {
|
|
211
|
+
bankVersion
|
|
212
|
+
});
|
|
213
|
+
const type = entry.type === AUDIO_BUS_TYPE ? "audio-bus" : "auxiliary-bus";
|
|
214
|
+
if (!decoded) {
|
|
215
|
+
failed.push({
|
|
216
|
+
bank,
|
|
217
|
+
version: bankVersion,
|
|
218
|
+
type,
|
|
219
|
+
id: entry.id,
|
|
220
|
+
reason: "invalid v150 bus body"
|
|
221
|
+
});
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
if (buses.has(entry.id)) {
|
|
225
|
+
duplicates.push({
|
|
226
|
+
id: entry.id,
|
|
227
|
+
previousBank: buses.get(entry.id).bank,
|
|
228
|
+
bank
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
parsed++;
|
|
232
|
+
buses.set(entry.id, {
|
|
233
|
+
id: entry.id,
|
|
234
|
+
bank,
|
|
235
|
+
type,
|
|
236
|
+
...decoded
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return {
|
|
241
|
+
buses,
|
|
242
|
+
diagnostics: {
|
|
243
|
+
parsed,
|
|
244
|
+
failed,
|
|
245
|
+
duplicates,
|
|
246
|
+
unsupportedVersions
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export { busNodesFromBanks, parseBusNode };
|
|
252
|
+
//# sourceMappingURL=busNodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"busNodes.js","sources":["../../../../../src/formats/bnk/core/busNodes.js"],"sourcesContent":["// Exact Wwise v150 Audio Bus and Auxiliary Bus decoding. The HIRC payload\n// supplied by inspect() starts after the object id. Records preserve authored\n// routing, bus policy, ducking, effect references, metadata, RTPCs, and state\n// without assigning runtime mixing or plug-in semantics.\n\nimport {\n boundedCount,\n finite,\n readAux,\n readInitialRtpcs,\n readPositioning,\n readStateChunk,\n WwiseCursor,\n} from \"./nodeBase.js\";\n\nconst SUPPORTED_VERSION = 150;\nconst AUDIO_BUS_TYPE = 8;\nconst AUXILIARY_BUS_TYPE = 18;\nconst BUS_VOLUME_PROPERTY_ID = 0x04;\nconst MAKE_UP_GAIN_PROPERTY_ID = 0x05;\nconst OUTPUT_BUS_VOLUME_PROPERTY_ID = 0x0d;\nconst FINITE_GAIN_PROPERTY_IDS = new Set([\n BUS_VOLUME_PROPERTY_ID,\n MAKE_UP_GAIN_PROPERTY_ID,\n OUTPUT_BUS_VOLUME_PROPERTY_ID,\n]);\n\n/**\n * Decodes one complete v150 Audio or Auxiliary Bus body.\n *\n * @param {Uint8Array} payload Entry payload view from `inspect()`.\n * @param {object} [options] Bank-version qualification.\n * @returns {object|null} Typed bus body, or null when it is invalid.\n */\nexport function parseBusNode(\n payload,\n { bankVersion = SUPPORTED_VERSION } = {},\n)\n{\n if (!(payload instanceof Uint8Array)\n || Number(bankVersion) !== SUPPORTED_VERSION\n || payload.byteLength < 5)\n {\n return null;\n }\n\n try\n {\n const cursor = new WwiseCursor(payload);\n const overrideBusId = cursor.u32();\n let outputDeviceId = null;\n\n if (overrideBusId === 0)\n {\n outputDeviceId = cursor.u32();\n }\n\n const propertyCount = boundedCount(\n cursor.u8(),\n cursor.remaining,\n 5,\n 255,\n );\n const ids = [];\n const seen = new Set();\n const properties = [];\n\n for (let index = 0; index < propertyCount; index++)\n {\n ids.push(cursor.u8());\n }\n\n for (const id of ids)\n {\n if (seen.has(id)) return null;\n seen.add(id);\n\n const rawValue = cursor.u32();\n const valueBytes = new ArrayBuffer(4);\n const valueView = new DataView(valueBytes);\n\n valueView.setUint32(0, rawValue, true);\n const floatValue = valueView.getFloat32(0, true);\n\n if (FINITE_GAIN_PROPERTY_IDS.has(id)\n && !Number.isFinite(floatValue))\n {\n return null;\n }\n\n properties.push({ id, rawValue, floatValue });\n }\n\n const prefixByteLength = cursor.at;\n const positioning = readPositioning(cursor);\n const aux = readAux(cursor);\n const policyFlags = cursor.u8();\n const maxInstances = cursor.u16();\n const channelConfigRaw = cursor.u32();\n const hdrFlags = cursor.u8();\n const recoveryTime = cursor.s32();\n const maxDuckVolume = finite(cursor.f32());\n const ducks = ReadDucks(cursor);\n const fx = ReadEffects(cursor);\n const metadata = ReadMetadata(cursor);\n const rtpcs = readInitialRtpcs(cursor);\n const state = readStateChunk(cursor);\n\n if (cursor.remaining !== 0) return null;\n\n const gainValue = id => properties.find(\n property => property.id === id,\n )?.floatValue ?? null;\n\n return {\n overrideBusId,\n outputDeviceId,\n properties,\n busVolume: gainValue(BUS_VOLUME_PROPERTY_ID),\n makeUpGain: gainValue(MAKE_UP_GAIN_PROPERTY_ID),\n outputBusVolume: gainValue(OUTPUT_BUS_VOLUME_PROPERTY_ID),\n prefixByteLength,\n positioning,\n aux,\n policy: {\n flags: policyFlags,\n killNewest: Boolean(policyFlags & 0x01),\n useVirtualBehavior: Boolean(policyFlags & 0x02),\n ignoreParentMaxInstances: Boolean(policyFlags & 0x04),\n backgroundMusic: Boolean(policyFlags & 0x08),\n maxInstances,\n },\n channelConfig: {\n raw: channelConfigRaw,\n channelCount: channelConfigRaw & 0xff,\n configType: (channelConfigRaw >>> 8) & 0x0f,\n channelMask: channelConfigRaw >>> 12,\n },\n hdr: {\n flags: hdrFlags,\n enabled: Boolean(hdrFlags & 0x01),\n exponentialRelease: Boolean(hdrFlags & 0x02),\n },\n recoveryTime,\n maxDuckVolume,\n ducks,\n fx,\n metadata,\n rtpcs,\n state,\n byteLength: cursor.at,\n };\n }\n catch\n {\n return null;\n }\n}\n\nfunction ReadDucks(cursor)\n{\n const count = boundedCount(cursor.u32(), cursor.remaining, 18, 65535);\n const ducks = [];\n\n for (let index = 0; index < count; index++)\n {\n const busId = cursor.u32();\n const volume = finite(cursor.f32());\n const fadeOutTime = cursor.s32();\n const fadeInTime = cursor.s32();\n const curve = cursor.u8();\n const targetPropertyId = cursor.u8();\n\n if (curve > 9)\n {\n throw new RangeError(\"invalid v150 Wwise duck curve\");\n }\n\n ducks.push({\n busId,\n volume,\n fadeOutTime,\n fadeInTime,\n curve,\n targetPropertyId,\n });\n }\n\n return ducks;\n}\n\nfunction ReadEffects(cursor)\n{\n const count = boundedCount(cursor.u8(), cursor.remaining, 6, 255);\n const bypassAllRaw = count ? cursor.u8() : 0;\n const slots = [];\n\n for (let index = 0; index < count; index++)\n {\n const slot = cursor.u8();\n const fxId = cursor.u32();\n const flags = cursor.u8();\n\n slots.push({\n index: slot,\n fxId,\n flags,\n bypass: Boolean(flags & 0x01),\n shareSet: Boolean(flags & 0x02),\n });\n }\n\n return {\n bypassAllRaw,\n bypassAll: Boolean(bypassAllRaw),\n slots,\n };\n}\n\nfunction ReadMetadata(cursor)\n{\n const count = boundedCount(cursor.u8(), cursor.remaining, 6, 255);\n const slots = [];\n\n for (let index = 0; index < count; index++)\n {\n const slot = cursor.u8();\n const fxId = cursor.u32();\n const shareSetRaw = cursor.u8();\n\n slots.push({\n index: slot,\n fxId,\n shareSetRaw,\n shareSet: Boolean(shareSetRaw),\n });\n }\n\n return { slots };\n}\n\n/**\n * Decodes every v150 Audio and Auxiliary Bus across inspected banks.\n *\n * @param {Array<object>|object} inspections Related `CjsBnkFormat.inspect()` results.\n * @returns {{buses: Map<number, object>, diagnostics: object}} Typed bus catalog and failures.\n */\nexport function busNodesFromBanks(inspections)\n{\n const banks = Array.isArray(inspections) ? inspections : [ inspections ];\n const buses = new Map();\n const failed = [];\n const duplicates = [];\n const unsupportedVersions = [];\n let parsed = 0;\n\n for (const inspection of banks)\n {\n const bank = inspection?.source || \"\";\n const bankVersion = Number(inspection?.bankVersion) >>> 0;\n\n if (bankVersion !== SUPPORTED_VERSION)\n {\n unsupportedVersions.push({ bank, version: bankVersion });\n continue;\n }\n\n for (const entry of inspection?.hirc ?? [])\n {\n if (entry.type !== AUDIO_BUS_TYPE\n && entry.type !== AUXILIARY_BUS_TYPE)\n {\n continue;\n }\n\n const decoded = parseBusNode(entry.payload, { bankVersion });\n const type = entry.type === AUDIO_BUS_TYPE\n ? \"audio-bus\"\n : \"auxiliary-bus\";\n\n if (!decoded)\n {\n failed.push({\n bank,\n version: bankVersion,\n type,\n id: entry.id,\n reason: \"invalid v150 bus body\",\n });\n continue;\n }\n if (buses.has(entry.id))\n {\n duplicates.push({\n id: entry.id,\n previousBank: buses.get(entry.id).bank,\n bank,\n });\n }\n\n parsed++;\n buses.set(entry.id, {\n id: entry.id,\n bank,\n type,\n ...decoded,\n });\n }\n }\n\n return {\n buses,\n diagnostics: {\n parsed,\n failed,\n duplicates,\n unsupportedVersions,\n },\n };\n}\n"],"names":["SUPPORTED_VERSION","AUDIO_BUS_TYPE","AUXILIARY_BUS_TYPE","BUS_VOLUME_PROPERTY_ID","MAKE_UP_GAIN_PROPERTY_ID","OUTPUT_BUS_VOLUME_PROPERTY_ID","FINITE_GAIN_PROPERTY_IDS","Set","parseBusNode","payload","bankVersion","Uint8Array","Number","byteLength","cursor","WwiseCursor","overrideBusId","u32","outputDeviceId","propertyCount","boundedCount","u8","remaining","ids","seen","properties","index","push","id","has","add","rawValue","valueBytes","ArrayBuffer","valueView","DataView","setUint32","floatValue","getFloat32","isFinite","prefixByteLength","at","positioning","readPositioning","aux","readAux","policyFlags","maxInstances","u16","channelConfigRaw","hdrFlags","recoveryTime","s32","maxDuckVolume","finite","f32","ducks","ReadDucks","fx","ReadEffects","metadata","ReadMetadata","rtpcs","readInitialRtpcs","state","readStateChunk","gainValue","find","property","busVolume","makeUpGain","outputBusVolume","policy","flags","killNewest","Boolean","useVirtualBehavior","ignoreParentMaxInstances","backgroundMusic","channelConfig","raw","channelCount","configType","channelMask","hdr","enabled","exponentialRelease","count","busId","volume","fadeOutTime","fadeInTime","curve","targetPropertyId","RangeError","bypassAllRaw","slots","slot","fxId","bypass","shareSet","bypassAll","shareSetRaw","busNodesFromBanks","inspections","banks","Array","isArray","buses","Map","failed","duplicates","unsupportedVersions","parsed","inspection","bank","source","version","entry","hirc","type","decoded","reason","previousBank","get","set","diagnostics"],"mappings":";;AAAA;AACA;AACA;AACA;;AAYA,MAAMA,iBAAiB,GAAG,GAAG;AAC7B,MAAMC,cAAc,GAAG,CAAC;AACxB,MAAMC,kBAAkB,GAAG,EAAE;AAC7B,MAAMC,sBAAsB,GAAG,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UAAU;AACVC,MAAAA;AACJ;GACH;AACL;;;;"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { WwiseCursor, boundedCount, readInitialRtpcs, readStateChunk, finite } from './nodeBase.js';
|
|
2
|
+
|
|
3
|
+
// Exact generic Wwise v150 Fx ShareSet and Fx Custom object decoding. Plug-in
|
|
4
|
+
// parameter blocks remain opaque bytes; the resource layer preserves identity,
|
|
5
|
+
// media, RTPC, state, and property records without interpreting DSP behavior.
|
|
6
|
+
|
|
7
|
+
const SUPPORTED_VERSION = 150;
|
|
8
|
+
const FX_SHARE_SET_TYPE = 16;
|
|
9
|
+
const FX_CUSTOM_TYPE = 17;
|
|
10
|
+
const NO_PLUGIN_ID = 0xffffffff;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Decodes one complete v150 Fx ShareSet or Fx Custom body.
|
|
14
|
+
*
|
|
15
|
+
* @param {Uint8Array} payload Entry payload view from `inspect()`.
|
|
16
|
+
* @param {object} [options] Bank-version qualification.
|
|
17
|
+
* @returns {object|null} Typed effect body, or null when it is invalid.
|
|
18
|
+
*/
|
|
19
|
+
function parseEffectNode(payload, {
|
|
20
|
+
bankVersion = SUPPORTED_VERSION
|
|
21
|
+
} = {}) {
|
|
22
|
+
if (!(payload instanceof Uint8Array) || Number(bankVersion) !== SUPPORTED_VERSION || payload.byteLength < 4) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
const cursor = new WwiseCursor(payload);
|
|
27
|
+
const pluginId = cursor.u32();
|
|
28
|
+
let parameterBlock = payload.subarray(cursor.at, cursor.at);
|
|
29
|
+
if (pluginId !== 0 && pluginId !== NO_PLUGIN_ID) {
|
|
30
|
+
const parameterByteLength = cursor.u32();
|
|
31
|
+
cursor.ensure(parameterByteLength);
|
|
32
|
+
parameterBlock = payload.subarray(cursor.at, cursor.at + parameterByteLength);
|
|
33
|
+
cursor.at += parameterByteLength;
|
|
34
|
+
}
|
|
35
|
+
const mediaCount = boundedCount(cursor.u8(), cursor.remaining, 5, 255);
|
|
36
|
+
const media = [];
|
|
37
|
+
for (let index = 0; index < mediaCount; index++) {
|
|
38
|
+
media.push({
|
|
39
|
+
index: cursor.u8(),
|
|
40
|
+
sourceId: cursor.u32()
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
const rtpcs = readInitialRtpcs(cursor);
|
|
44
|
+
const state = readStateChunk(cursor);
|
|
45
|
+
const propertyCount = boundedCount(cursor.u16(), cursor.remaining, 6, 65535);
|
|
46
|
+
const propertyValues = [];
|
|
47
|
+
for (let index = 0; index < propertyCount; index++) {
|
|
48
|
+
const propertyId = cursor.variable();
|
|
49
|
+
const accumulation = cursor.u8();
|
|
50
|
+
const value = finite(cursor.f32());
|
|
51
|
+
if (accumulation > 6) {
|
|
52
|
+
throw new RangeError("invalid v150 effect accumulation");
|
|
53
|
+
}
|
|
54
|
+
propertyValues.push({
|
|
55
|
+
propertyId,
|
|
56
|
+
accumulation,
|
|
57
|
+
value
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
if (cursor.remaining !== 0) return null;
|
|
61
|
+
return {
|
|
62
|
+
pluginId,
|
|
63
|
+
pluginType: pluginId & 0x0f,
|
|
64
|
+
companyId: pluginId >>> 4 & 0x0fff,
|
|
65
|
+
pluginClassId: pluginId >>> 16,
|
|
66
|
+
parameterBlock,
|
|
67
|
+
media,
|
|
68
|
+
rtpcs,
|
|
69
|
+
state,
|
|
70
|
+
propertyValues,
|
|
71
|
+
byteLength: cursor.at
|
|
72
|
+
};
|
|
73
|
+
} catch {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Decodes every v150 Fx ShareSet and Fx Custom across inspected banks.
|
|
80
|
+
*
|
|
81
|
+
* @param {Array<object>|object} inspections Related `CjsBnkFormat.inspect()` results.
|
|
82
|
+
* @returns {{effects: Map<number, object>, diagnostics: object}} Typed effect catalog and failures.
|
|
83
|
+
*/
|
|
84
|
+
function effectNodesFromBanks(inspections) {
|
|
85
|
+
const banks = Array.isArray(inspections) ? inspections : [inspections];
|
|
86
|
+
const effects = new Map();
|
|
87
|
+
const failed = [];
|
|
88
|
+
const duplicates = [];
|
|
89
|
+
const unsupportedVersions = [];
|
|
90
|
+
let parsed = 0;
|
|
91
|
+
for (const inspection of banks) {
|
|
92
|
+
const bank = inspection?.source || "";
|
|
93
|
+
const bankVersion = Number(inspection?.bankVersion) >>> 0;
|
|
94
|
+
if (bankVersion !== SUPPORTED_VERSION) {
|
|
95
|
+
unsupportedVersions.push({
|
|
96
|
+
bank,
|
|
97
|
+
version: bankVersion
|
|
98
|
+
});
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
for (const entry of inspection?.hirc ?? []) {
|
|
102
|
+
if (entry.type !== FX_SHARE_SET_TYPE && entry.type !== FX_CUSTOM_TYPE) {
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
const decoded = parseEffectNode(entry.payload, {
|
|
106
|
+
bankVersion
|
|
107
|
+
});
|
|
108
|
+
const type = entry.type === FX_SHARE_SET_TYPE ? "effect-share-set" : "effect-custom";
|
|
109
|
+
if (!decoded) {
|
|
110
|
+
failed.push({
|
|
111
|
+
bank,
|
|
112
|
+
version: bankVersion,
|
|
113
|
+
type,
|
|
114
|
+
id: entry.id,
|
|
115
|
+
reason: "invalid v150 effect body"
|
|
116
|
+
});
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
if (effects.has(entry.id)) {
|
|
120
|
+
duplicates.push({
|
|
121
|
+
id: entry.id,
|
|
122
|
+
previousBank: effects.get(entry.id).bank,
|
|
123
|
+
bank
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
parsed++;
|
|
127
|
+
effects.set(entry.id, {
|
|
128
|
+
id: entry.id,
|
|
129
|
+
bank,
|
|
130
|
+
type,
|
|
131
|
+
...decoded
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
effects,
|
|
137
|
+
diagnostics: {
|
|
138
|
+
parsed,
|
|
139
|
+
failed,
|
|
140
|
+
duplicates,
|
|
141
|
+
unsupportedVersions
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export { effectNodesFromBanks, parseEffectNode };
|
|
147
|
+
//# sourceMappingURL=effectNodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"effectNodes.js","sources":["../../../../../src/formats/bnk/core/effectNodes.js"],"sourcesContent":["// Exact generic Wwise v150 Fx ShareSet and Fx Custom object decoding. Plug-in\n// parameter blocks remain opaque bytes; the resource layer preserves identity,\n// media, RTPC, state, and property records without interpreting DSP behavior.\n\nimport {\n boundedCount,\n finite,\n readInitialRtpcs,\n readStateChunk,\n WwiseCursor,\n} from \"./nodeBase.js\";\n\nconst SUPPORTED_VERSION = 150;\nconst FX_SHARE_SET_TYPE = 16;\nconst FX_CUSTOM_TYPE = 17;\nconst NO_PLUGIN_ID = 0xffffffff;\n\n/**\n * Decodes one complete v150 Fx ShareSet or Fx Custom body.\n *\n * @param {Uint8Array} payload Entry payload view from `inspect()`.\n * @param {object} [options] Bank-version qualification.\n * @returns {object|null} Typed effect body, or null when it is invalid.\n */\nexport function parseEffectNode(\n payload,\n { bankVersion = SUPPORTED_VERSION } = {},\n)\n{\n if (!(payload instanceof Uint8Array)\n || Number(bankVersion) !== SUPPORTED_VERSION\n || payload.byteLength < 4)\n {\n return null;\n }\n\n try\n {\n const cursor = new WwiseCursor(payload);\n const pluginId = cursor.u32();\n let parameterBlock = payload.subarray(cursor.at, cursor.at);\n\n if (pluginId !== 0 && pluginId !== NO_PLUGIN_ID)\n {\n const parameterByteLength = cursor.u32();\n\n cursor.ensure(parameterByteLength);\n parameterBlock = payload.subarray(\n cursor.at,\n cursor.at + parameterByteLength,\n );\n cursor.at += parameterByteLength;\n }\n\n const mediaCount = boundedCount(\n cursor.u8(),\n cursor.remaining,\n 5,\n 255,\n );\n const media = [];\n\n for (let index = 0; index < mediaCount; index++)\n {\n media.push({\n index: cursor.u8(),\n sourceId: cursor.u32(),\n });\n }\n\n const rtpcs = readInitialRtpcs(cursor);\n const state = readStateChunk(cursor);\n const propertyCount = boundedCount(\n cursor.u16(),\n cursor.remaining,\n 6,\n 65535,\n );\n const propertyValues = [];\n\n for (let index = 0; index < propertyCount; index++)\n {\n const propertyId = cursor.variable();\n const accumulation = cursor.u8();\n const value = finite(cursor.f32());\n\n if (accumulation > 6)\n {\n throw new RangeError(\"invalid v150 effect accumulation\");\n }\n\n propertyValues.push({ propertyId, accumulation, value });\n }\n\n if (cursor.remaining !== 0) return null;\n\n return {\n pluginId,\n pluginType: pluginId & 0x0f,\n companyId: (pluginId >>> 4) & 0x0fff,\n pluginClassId: pluginId >>> 16,\n parameterBlock,\n media,\n rtpcs,\n state,\n propertyValues,\n byteLength: cursor.at,\n };\n }\n catch\n {\n return null;\n }\n}\n\n/**\n * Decodes every v150 Fx ShareSet and Fx Custom across inspected banks.\n *\n * @param {Array<object>|object} inspections Related `CjsBnkFormat.inspect()` results.\n * @returns {{effects: Map<number, object>, diagnostics: object}} Typed effect catalog and failures.\n */\nexport function effectNodesFromBanks(inspections)\n{\n const banks = Array.isArray(inspections) ? inspections : [ inspections ];\n const effects = new Map();\n const failed = [];\n const duplicates = [];\n const unsupportedVersions = [];\n let parsed = 0;\n\n for (const inspection of banks)\n {\n const bank = inspection?.source || \"\";\n const bankVersion = Number(inspection?.bankVersion) >>> 0;\n\n if (bankVersion !== SUPPORTED_VERSION)\n {\n unsupportedVersions.push({ bank, version: bankVersion });\n continue;\n }\n\n for (const entry of inspection?.hirc ?? [])\n {\n if (entry.type !== FX_SHARE_SET_TYPE\n && entry.type !== FX_CUSTOM_TYPE)\n {\n continue;\n }\n\n const decoded = parseEffectNode(entry.payload, { bankVersion });\n const type = entry.type === FX_SHARE_SET_TYPE\n ? \"effect-share-set\"\n : \"effect-custom\";\n\n if (!decoded)\n {\n failed.push({\n bank,\n version: bankVersion,\n type,\n id: entry.id,\n reason: \"invalid v150 effect body\",\n });\n continue;\n }\n if (effects.has(entry.id))\n {\n duplicates.push({\n id: entry.id,\n previousBank: effects.get(entry.id).bank,\n bank,\n });\n }\n\n parsed++;\n effects.set(entry.id, {\n id: entry.id,\n bank,\n type,\n ...decoded,\n });\n }\n }\n\n return {\n effects,\n diagnostics: {\n parsed,\n failed,\n duplicates,\n unsupportedVersions,\n },\n };\n}\n"],"names":["SUPPORTED_VERSION","FX_SHARE_SET_TYPE","FX_CUSTOM_TYPE","NO_PLUGIN_ID","parseEffectNode","payload","bankVersion","Uint8Array","Number","byteLength","cursor","WwiseCursor","pluginId","u32","parameterBlock","subarray","at","parameterByteLength","ensure","mediaCount","boundedCount","u8","remaining","media","index","push","sourceId","rtpcs","readInitialRtpcs","state","readStateChunk","propertyCount","u16","propertyValues","propertyId","variable","accumulation","value","finite","f32","RangeError","pluginType","companyId","pluginClassId","effectNodesFromBanks","inspections","banks","Array","isArray","effects","Map","failed","duplicates","unsupportedVersions","parsed","inspection","bank","source","version","entry","hirc","type","decoded","id","reason","has","previousBank","get","set","diagnostics"],"mappings":";;AAAA;AACA;AACA;;AAUA,MAAMA,iBAAiB,GAAG,GAAG;AAC7B,MAAMC,iBAAiB,GAAG,EAAE;AAC5B,MAAMC,cAAc,GAAG,EAAE;AACzB,MAAMC,YAAY,GAAG,UAAU;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAC3BC,OAAO,EACP;AAAEC,EAAAA,WAAW,GAAGN;AAAkB,CAAC,GAAG,EAAE,EAE5C;AACI,EAAA,IAAI,EAAEK,OAAO,YAAYE,UAAU,CAAC,IAC7BC,MAAM,CAACF,WAAW,CAAC,KAAKN,iBAAiB,IACzCK,OAAO,CAACI,UAAU,GAAG,CAAC,EAC7B;AACI,IAAA,OAAO,IAAI;AACf,EAAA;EAEA,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