@carbonenginejs/runtime-resource 0.1.0 → 0.8.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/FORMAT-PROVENANCE.md +155 -135
- package/LICENSE +21 -21
- package/NOTICE +29 -29
- package/README.md +548 -241
- package/dist/CjsMotherLode.js +1271 -56
- package/dist/CjsMotherLode.js.map +1 -1
- package/dist/CjsResMan.js +3005 -740
- package/dist/CjsResMan.js.map +1 -1
- package/dist/CjsResManQueue.js +214 -214
- package/dist/CjsResource.js +566 -366
- package/dist/CjsResource.js.map +1 -1
- package/dist/CjsResourceSource.js +59 -59
- package/dist/_virtual/_rollupPluginBabelHelpers.js +153 -153
- package/dist/format/CjsBlueReader.js +269 -0
- package/dist/format/CjsBlueReader.js.map +1 -0
- package/dist/format/CjsFormat.js +192 -178
- package/dist/format/CjsFormat.js.map +1 -1
- package/dist/format/CjsReader.js +18 -0
- package/dist/format/CjsReader.js.map +1 -0
- package/dist/format/CjsResourceProbe.js +277 -269
- package/dist/format/CjsResourceProbe.js.map +1 -1
- package/dist/format/payloadContract.js +173 -173
- package/dist/formats/black/CjsBlackFormat.js +278 -272
- package/dist/formats/black/CjsBlackFormat.js.map +1 -1
- package/dist/formats/black/core/CjsBlackBinaryReader.js +153 -153
- package/dist/formats/black/core/CjsBlackPropertyReaders.js +382 -382
- package/dist/formats/black/core/CjsBlackReader.js +639 -760
- package/dist/formats/black/core/CjsBlackReader.js.map +1 -1
- package/dist/formats/black/core/CjsBlackSchemaRegistry.js +433 -433
- package/dist/formats/black/core/black-schema-v1-2026-07-11.json.js +4 -4
- package/dist/formats/black/core/blackConstants.js +7 -7
- package/dist/formats/black/core/blackDefinitions.js +10 -10
- package/dist/formats/black/core/blackEnums.js +6 -6
- package/dist/formats/black/core/blackSchema.js +3 -3
- package/dist/formats/black/core/blackVersion.js +22 -22
- package/dist/formats/black/core/helpers.js +182 -182
- package/dist/formats/black/core/schema.js +4 -4
- package/dist/formats/black/index.js +2 -2
- package/dist/formats/bnk/CjsBnkFormat.js +238 -245
- package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
- package/dist/formats/bnk/core/graph.js +140 -0
- package/dist/formats/bnk/core/graph.js.map +1 -0
- package/dist/formats/bnk/core/helpers.js +409 -354
- package/dist/formats/bnk/core/helpers.js.map +1 -1
- package/dist/formats/bnk/core/musicNodes.js +521 -0
- package/dist/formats/bnk/core/musicNodes.js.map +1 -0
- package/dist/formats/bnk/core/soundbanksInfo.js +246 -246
- package/dist/formats/bnk/index.js +2 -3
- package/dist/formats/bnk/index.js.map +1 -1
- package/dist/formats/cmf/CjsCmfFormat.js +497 -491
- package/dist/formats/cmf/CjsCmfFormat.js.map +1 -1
- package/dist/formats/cmf/core/binary.js +118 -118
- package/dist/formats/cmf/core/buffers.js +233 -233
- package/dist/formats/cmf/core/constants.js +47 -47
- package/dist/formats/cmf/core/gr2Anim.js +453 -453
- package/dist/formats/cmf/core/helpers.js +287 -287
- package/dist/formats/cmf/core/pack.js +276 -276
- package/dist/formats/cmf/core/schema.js +364 -364
- package/dist/formats/cmf/core/shared.js +268 -268
- package/dist/formats/cmf/core/writer.js +517 -517
- package/dist/formats/cmf/index.js +2 -2
- package/dist/formats/dds/CjsDdsFormat.js +193 -187
- package/dist/formats/dds/CjsDdsFormat.js.map +1 -1
- package/dist/formats/dds/core/bc6h.js +288 -0
- package/dist/formats/dds/core/bc6h.js.map +1 -0
- package/dist/formats/dds/core/bc7.js +251 -0
- package/dist/formats/dds/core/bc7.js.map +1 -0
- package/dist/formats/dds/core/helpers.js +815 -812
- package/dist/formats/dds/core/helpers.js.map +1 -1
- package/dist/formats/dds/index.js +2 -2
- package/dist/formats/fbx/CjsFbxFormat.js +266 -260
- package/dist/formats/fbx/CjsFbxFormat.js.map +1 -1
- package/dist/formats/fbx/core/helpers.js +3901 -3901
- package/dist/formats/fbx/index.js +2 -2
- package/dist/formats/flac/CjsFlacFormat.js +87 -81
- package/dist/formats/flac/CjsFlacFormat.js.map +1 -1
- package/dist/formats/flac/core/helpers.js +295 -295
- package/dist/formats/flac/index.js +2 -2
- package/dist/formats/gif/CjsGifFormat.js +87 -81
- package/dist/formats/gif/CjsGifFormat.js.map +1 -1
- package/dist/formats/gif/core/helpers.js +360 -360
- package/dist/formats/gif/index.js +2 -2
- package/dist/formats/gltf/CjsGltfFormat.js +290 -284
- package/dist/formats/gltf/CjsGltfFormat.js.map +1 -1
- package/dist/formats/gltf/core/helpers.js +292 -292
- package/dist/formats/gltf/core/json.js +79 -79
- package/dist/formats/gltf/core/parser.js +666 -666
- package/dist/formats/gltf/core/targets.js +163 -163
- package/dist/formats/gltf/index.js +2 -2
- package/dist/formats/index.js +23 -23
- package/dist/formats/jpeg/CjsJpegFormat.js +206 -200
- package/dist/formats/jpeg/CjsJpegFormat.js.map +1 -1
- package/dist/formats/jpeg/core/helpers.js +350 -350
- package/dist/formats/jpeg/core/jpeg.js +377 -377
- package/dist/formats/jpeg/index.js +2 -2
- package/dist/formats/mp3/CjsMp3Format.js +192 -186
- package/dist/formats/mp3/CjsMp3Format.js.map +1 -1
- package/dist/formats/mp3/core/helpers.js +338 -338
- package/dist/formats/mp3/index.js +2 -2
- package/dist/formats/mp4/CjsMp4Format.js +191 -185
- package/dist/formats/mp4/CjsMp4Format.js.map +1 -1
- package/dist/formats/mp4/core/helpers.js +449 -449
- package/dist/formats/mp4/index.js +2 -2
- package/dist/formats/obj/CjsObjFormat.js +253 -247
- package/dist/formats/obj/CjsObjFormat.js.map +1 -1
- package/dist/formats/obj/core/helpers.js +573 -573
- package/dist/formats/obj/core/json.js +64 -64
- package/dist/formats/obj/core/parser.js +321 -321
- package/dist/formats/obj/index.js +2 -2
- package/dist/formats/ogg/CjsOggFormat.js +88 -82
- package/dist/formats/ogg/CjsOggFormat.js.map +1 -1
- package/dist/formats/ogg/core/helpers.js +387 -387
- package/dist/formats/ogg/core/imdct.js +178 -178
- package/dist/formats/ogg/core/vorbis.js +999 -999
- package/dist/formats/ogg/index.js +2 -2
- package/dist/formats/png/CjsPngFormat.js +195 -189
- package/dist/formats/png/CjsPngFormat.js.map +1 -1
- package/dist/formats/png/core/helpers.js +583 -583
- package/dist/formats/png/index.js +2 -2
- package/dist/formats/red/CjsRedFormat.js +261 -247
- package/dist/formats/red/CjsRedFormat.js.map +1 -1
- package/dist/formats/red/core/CjsRedReader.js +194 -201
- package/dist/formats/red/core/CjsRedReader.js.map +1 -1
- package/dist/formats/red/core/blackDefinitions.js +3 -3
- package/dist/formats/red/core/helpers.js +139 -136
- package/dist/formats/red/core/helpers.js.map +1 -1
- package/dist/formats/red/core/redGraph.js +68 -68
- package/dist/formats/red/core/schema.js +4 -4
- package/dist/formats/red/index.js +2 -2
- package/dist/formats/stl/CjsStlFormat.js +365 -304
- package/dist/formats/stl/CjsStlFormat.js.map +1 -1
- package/dist/formats/stl/core/helpers.js +261 -257
- package/dist/formats/stl/core/helpers.js.map +1 -1
- package/dist/formats/stl/core/json.js +51 -51
- package/dist/formats/stl/core/stl.js +629 -544
- package/dist/formats/stl/core/stl.js.map +1 -1
- package/dist/formats/stl/core/targets.js +163 -163
- package/dist/formats/stl/index.js +2 -2
- package/dist/formats/tga/CjsTgaFormat.js +192 -186
- package/dist/formats/tga/CjsTgaFormat.js.map +1 -1
- package/dist/formats/tga/core/helpers.js +446 -446
- package/dist/formats/tga/index.js +2 -2
- package/dist/formats/wav/CjsWavFormat.js +192 -186
- package/dist/formats/wav/CjsWavFormat.js.map +1 -1
- package/dist/formats/wav/core/helpers.js +328 -328
- package/dist/formats/wav/index.js +2 -2
- package/dist/formats/webm/CjsWebmFormat.js +191 -185
- package/dist/formats/webm/CjsWebmFormat.js.map +1 -1
- package/dist/formats/webm/core/helpers.js +537 -537
- package/dist/formats/webm/index.js +2 -2
- package/dist/formats/webp/CjsWebpFormat.js +86 -80
- package/dist/formats/webp/CjsWebpFormat.js.map +1 -1
- package/dist/formats/webp/core/helpers.js +214 -214
- package/dist/formats/webp/index.js +2 -2
- package/dist/formats/wem/CjsWemFormat.js +241 -197
- package/dist/formats/wem/CjsWemFormat.js.map +1 -1
- package/dist/formats/wem/core/bitStream.js +259 -259
- package/dist/formats/wem/core/codebookLibrary.js +164 -164
- package/dist/formats/wem/core/helpers.js +417 -336
- package/dist/formats/wem/core/helpers.js.map +1 -1
- package/dist/formats/wem/core/packedCodebooksAotuv603.js +30 -30
- package/dist/formats/wem/core/ptadpcm.js +77 -0
- package/dist/formats/wem/core/ptadpcm.js.map +1 -0
- package/dist/formats/wem/core/resolve.js +121 -0
- package/dist/formats/wem/core/resolve.js.map +1 -0
- package/dist/formats/wem/core/wemToOgg.js +485 -485
- package/dist/formats/wem/index.js +2 -2
- package/dist/formats/yaml/CjsYamlFormat.js +83 -77
- package/dist/formats/yaml/CjsYamlFormat.js.map +1 -1
- package/dist/formats/yaml/core/CjsYamlReader.js +305 -304
- package/dist/formats/yaml/core/CjsYamlReader.js.map +1 -1
- package/dist/formats/yaml/core/helpers.js +160 -160
- package/dist/formats/yaml/index.js +2 -2
- package/dist/index.js +48 -52
- package/dist/index.js.map +1 -1
- package/dist/resourcePath.js +18 -18
- package/dist/resourceStates.js +9 -9
- package/dist/{generated/resources → resources}/AudioGeometryResData.js +47 -47
- package/dist/resources/AudioGeometryResData.js.map +1 -0
- package/dist/{generated/resources → resources}/GStateBindingCallbackData.js +31 -31
- package/dist/resources/GStateBindingCallbackData.js.map +1 -0
- package/dist/{generated/resources → resources}/MeshDecalData.js +37 -37
- package/dist/resources/MeshDecalData.js.map +1 -0
- package/dist/{generated/resources → resources}/MeshDecalLodData.js +34 -34
- package/dist/resources/MeshDecalLodData.js.map +1 -0
- package/dist/resources/Tr2EffectRes.js +71 -71
- package/dist/resources/Tr2GrannyIntersectionResult.js +60 -0
- package/dist/resources/Tr2GrannyIntersectionResult.js.map +1 -0
- package/dist/resources/Tr2GrannyStateRes.js +44 -44
- package/dist/resources/Tr2ImageRes.js +114 -114
- package/dist/resources/Tr2LightProfileRes.js +40 -40
- package/dist/{generated/resources → resources}/Tr2MaterialArea.js +34 -34
- package/dist/resources/Tr2MaterialArea.js.map +1 -0
- package/dist/{generated/resources → resources}/Tr2MaterialMesh.js +31 -31
- package/dist/resources/Tr2MaterialMesh.js.map +1 -0
- package/dist/{generated/resources → resources}/Tr2MaterialRes.js +34 -34
- package/dist/resources/Tr2MaterialRes.js.map +1 -0
- package/dist/{generated/resources → resources}/Tr2ShaderPermutation.js +43 -43
- package/dist/resources/Tr2ShaderPermutation.js.map +1 -0
- package/dist/{generated/resources → resources}/Tr2TextureLodManager.js +100 -60
- package/dist/resources/Tr2TextureLodManager.js.map +1 -0
- package/dist/{generated/resources → resources}/Tr2TextureLodUpdateRequest.js +37 -37
- package/dist/resources/Tr2TextureLodUpdateRequest.js.map +1 -0
- package/dist/{generated/resources → resources}/Tr2TexturePackChannel.js +37 -37
- package/dist/resources/Tr2TexturePackChannel.js.map +1 -0
- package/dist/resources/Tr2TexturePipeline.js +68 -0
- package/dist/resources/Tr2TexturePipeline.js.map +1 -0
- package/dist/{generated/resources → resources}/Tr2TexturePipelineParams.js +34 -34
- package/dist/resources/Tr2TexturePipelineParams.js.map +1 -0
- package/dist/{generated/resources → resources}/Tr2TexturePipelineStepCompress.js +40 -40
- package/dist/resources/Tr2TexturePipelineStepCompress.js.map +1 -0
- package/dist/{generated/resources → resources}/Tr2TexturePipelineStepLimitSize.js +34 -34
- package/dist/resources/Tr2TexturePipelineStepLimitSize.js.map +1 -0
- package/dist/{generated/resources → resources}/Tr2TexturePipelineStepLoad.js +31 -31
- package/dist/resources/Tr2TexturePipelineStepLoad.js.map +1 -0
- package/dist/{generated/resources → resources}/Tr2TexturePipelineStepPack.js +43 -43
- package/dist/resources/Tr2TexturePipelineStepPack.js.map +1 -0
- package/dist/resources/TriGeometryRes.js +239 -216
- package/dist/resources/TriGeometryRes.js.map +1 -1
- package/dist/{generated/resources → resources}/TriGeometryResAreaData.js +59 -59
- package/dist/resources/TriGeometryResAreaData.js.map +1 -0
- package/dist/{generated/resources → resources}/TriGeometryResJointData.js +38 -38
- package/dist/resources/TriGeometryResJointData.js.map +1 -0
- package/dist/{generated/resources → resources}/TriGeometryResLodData.js +88 -88
- package/dist/resources/TriGeometryResLodData.js.map +1 -0
- package/dist/{generated/resources → resources}/TriGeometryResMeshData.js +63 -63
- package/dist/resources/TriGeometryResMeshData.js.map +1 -0
- package/dist/{generated/resources → resources}/TriGeometryResSkeletonData.js +34 -34
- package/dist/resources/TriGeometryResSkeletonData.js.map +1 -0
- package/dist/resources/TriGrannyRes.js +43 -43
- package/dist/{generated/resources → resources}/TriJointBinding.js +38 -38
- package/dist/resources/TriJointBinding.js.map +1 -0
- package/dist/{generated/resources → resources}/TriMorphTargetGeometryConstants.js +46 -46
- package/dist/resources/TriMorphTargetGeometryConstants.js.map +1 -0
- package/dist/{generated/resources → resources}/TriRtGeometryConstants.js +88 -88
- package/dist/resources/TriRtGeometryConstants.js.map +1 -0
- package/dist/resources/TriTextureRes.js +304 -304
- package/dist/{generated/resources → resources}/enums.js +18 -18
- package/dist/resources/enums.js.map +1 -0
- package/dist/resources/resourceBoundary.js +47 -47
- package/dist/resources/texturePipelineBehavior.js +320 -0
- package/dist/resources/texturePipelineBehavior.js.map +1 -0
- package/dist/texture/CjsTextureArrayRes.js +406 -406
- package/dist/texture/CjsTextureParameterProxy.js +133 -133
- package/format-notices/black/LICENSE +21 -21
- package/format-notices/black/NOTICE +47 -47
- package/format-notices/bnk/LICENSE +21 -21
- package/format-notices/bnk/NOTICE +20 -17
- package/format-notices/cmf/LICENSE +21 -21
- package/format-notices/cmf/NOTICE +36 -36
- package/format-notices/dds/LICENSE +21 -21
- package/format-notices/dds/NOTICE +14 -14
- package/format-notices/fbx/LICENSE +21 -21
- package/format-notices/fbx/NOTICE +14 -14
- package/format-notices/flac/LICENSE +21 -21
- package/format-notices/flac/NOTICE +14 -14
- package/format-notices/gif/LICENSE +21 -21
- package/format-notices/gif/NOTICE +14 -14
- package/format-notices/gltf/LICENSE +21 -21
- package/format-notices/gltf/NOTICE +27 -27
- package/format-notices/jpeg/LICENSE +21 -21
- package/format-notices/jpeg/NOTICE +14 -14
- package/format-notices/mp3/LICENSE +21 -21
- package/format-notices/mp3/NOTICE +14 -14
- package/format-notices/mp4/LICENSE +21 -21
- package/format-notices/mp4/NOTICE +14 -14
- package/format-notices/obj/LICENSE +21 -21
- package/format-notices/obj/NOTICE +26 -26
- package/format-notices/ogg/LICENSE +21 -21
- package/format-notices/ogg/NOTICE +28 -28
- package/format-notices/png/LICENSE +21 -21
- package/format-notices/png/NOTICE +14 -14
- package/format-notices/red/LICENSE +21 -21
- package/format-notices/red/NOTICE +31 -31
- package/format-notices/stl/LICENSE +21 -21
- package/format-notices/stl/NOTICE +21 -21
- package/format-notices/tga/LICENSE +21 -21
- package/format-notices/tga/NOTICE +14 -14
- package/format-notices/wav/LICENSE +21 -21
- package/format-notices/wav/NOTICE +14 -14
- package/format-notices/webm/LICENSE +21 -21
- package/format-notices/webm/NOTICE +14 -14
- package/format-notices/webp/LICENSE +21 -21
- package/format-notices/webp/NOTICE +14 -14
- package/format-notices/wem/LICENSE +57 -57
- package/format-notices/wem/NOTICE +33 -33
- package/format-notices/yaml/LICENSE +21 -21
- package/format-notices/yaml/NOTICE +44 -44
- package/package.json +51 -51
- package/resource-lifecycle.md +679 -487
- package/dist/generated/resources/AudioGeometryResData.js.map +0 -1
- package/dist/generated/resources/CmfVertexReader.js +0 -46
- package/dist/generated/resources/CmfVertexReader.js.map +0 -1
- package/dist/generated/resources/GStateBindingCallbackData.js.map +0 -1
- package/dist/generated/resources/MeshDecalData.js.map +0 -1
- package/dist/generated/resources/MeshDecalLodData.js.map +0 -1
- package/dist/generated/resources/Tr2AsyncSave.js +0 -46
- package/dist/generated/resources/Tr2AsyncSave.js.map +0 -1
- package/dist/generated/resources/Tr2CmfContents.js +0 -37
- package/dist/generated/resources/Tr2CmfContents.js.map +0 -1
- package/dist/generated/resources/Tr2GrannyIntersectionResult.js +0 -58
- package/dist/generated/resources/Tr2GrannyIntersectionResult.js.map +0 -1
- package/dist/generated/resources/Tr2LoadPrepareFence.js +0 -37
- package/dist/generated/resources/Tr2LoadPrepareFence.js.map +0 -1
- package/dist/generated/resources/Tr2MaterialArea.js.map +0 -1
- package/dist/generated/resources/Tr2MaterialMesh.js.map +0 -1
- package/dist/generated/resources/Tr2MaterialRes.js.map +0 -1
- package/dist/generated/resources/Tr2ShaderPermutation.js.map +0 -1
- package/dist/generated/resources/Tr2TextureLodManager.js.map +0 -1
- package/dist/generated/resources/Tr2TextureLodUpdateRequest.js.map +0 -1
- package/dist/generated/resources/Tr2TexturePackChannel.js.map +0 -1
- package/dist/generated/resources/Tr2TexturePipeline.js +0 -44
- package/dist/generated/resources/Tr2TexturePipeline.js.map +0 -1
- package/dist/generated/resources/Tr2TexturePipelineParams.js.map +0 -1
- package/dist/generated/resources/Tr2TexturePipelineStepCompress.js.map +0 -1
- package/dist/generated/resources/Tr2TexturePipelineStepLimitSize.js.map +0 -1
- package/dist/generated/resources/Tr2TexturePipelineStepLoad.js.map +0 -1
- package/dist/generated/resources/Tr2TexturePipelineStepPack.js.map +0 -1
- package/dist/generated/resources/TriGeometryResAreaData.js.map +0 -1
- package/dist/generated/resources/TriGeometryResJointData.js.map +0 -1
- package/dist/generated/resources/TriGeometryResLodData.js.map +0 -1
- package/dist/generated/resources/TriGeometryResMeshData.js.map +0 -1
- package/dist/generated/resources/TriGeometryResSkeletonData.js.map +0 -1
- package/dist/generated/resources/TriJointBinding.js.map +0 -1
- package/dist/generated/resources/TriMorphTargetGeometryConstants.js.map +0 -1
- package/dist/generated/resources/TriRtGeometryConstants.js.map +0 -1
- package/dist/generated/resources/enums.js.map +0 -1
- package/dist/generated/resources/index.js +0 -32
- package/dist/generated/resources/index.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"musicNodes.js","sources":["../../../../../src/formats/bnk/core/musicNodes.js"],"sourcesContent":["// Wwise interactive-music node decoding: typed payloads for music-segment\r\n// (10), music-track (11), music-switch-container (12), and\r\n// music-playlist-container (13) HIRC entries. Exposed through\r\n// `CjsBnkFormat.wwise` next to the event graph walk - interpretation over\r\n// `inspect()` results, never part of the format read path.\r\n//\r\n// Verified against EVE soundbanks (bank generator version 150 / Wwise\r\n// 2022.1): 2,484 tracks, 1,326 segments, 214 playlists, and 54 switch\r\n// containers across music.bnk + music_essential.bnk all decode with the\r\n// exact-end validation below (2026-07-19 corpus run).\r\n//\r\n// Approach: consumers of these nodes (music schedulers) only need the fields\r\n// AFTER the variable-length NodeBaseParams block - children, meter, stingers,\r\n// and each type's tail - so segment/playlist/switch payloads are parsed from\r\n// a children+meter ANCHOR (a u32 child count and child ids that exist in the\r\n// bank, followed by a plausible AkMeterInfo) and the parse is accepted only\r\n// when it consumes the payload EXACTLY to its end. Track clips live at the\r\n// head (before NodeBaseParams) and the track's type block is tail-validated\r\n// the same way.\r\n\r\nclass MusicCursor\r\n{\r\n constructor(bytes, offset = 0)\r\n {\r\n this.view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\r\n this.bytes = bytes;\r\n this.at = offset;\r\n }\r\n\r\n get remaining()\r\n {\r\n return this.bytes.byteLength - this.at;\r\n }\r\n\r\n u8()\r\n {\r\n return this.view.getUint8(this.at++);\r\n }\r\n\r\n u16()\r\n {\r\n const value = this.view.getUint16(this.at, true);\r\n this.at += 2;\r\n return value;\r\n }\r\n\r\n s16()\r\n {\r\n const value = this.view.getInt16(this.at, true);\r\n this.at += 2;\r\n return value;\r\n }\r\n\r\n u32()\r\n {\r\n const value = this.view.getUint32(this.at, true);\r\n this.at += 4;\r\n return value;\r\n }\r\n\r\n s32()\r\n {\r\n const value = this.view.getInt32(this.at, true);\r\n this.at += 4;\r\n return value;\r\n }\r\n\r\n f32()\r\n {\r\n const value = this.view.getFloat32(this.at, true);\r\n this.at += 4;\r\n return value;\r\n }\r\n\r\n f64()\r\n {\r\n const value = this.view.getFloat64(this.at, true);\r\n this.at += 8;\r\n return value;\r\n }\r\n\r\n stringZ()\r\n {\r\n let end = this.at;\r\n while (end < this.bytes.byteLength && this.bytes[end] !== 0) end++;\r\n let value = \"\";\r\n for (let i = this.at; i < end; i++) value += String.fromCharCode(this.bytes[i]);\r\n this.at = end + 1;\r\n return value;\r\n }\r\n}\r\n\r\nfunction plausibleMeter(view, at, byteLength)\r\n{\r\n if (at + 22 > byteLength) return false;\r\n const grid = view.getFloat64(at, true);\r\n const offset = view.getFloat64(at + 8, true);\r\n const tempo = view.getFloat32(at + 16, true);\r\n const beats = view.getUint8(at + 20);\r\n const beatValue = view.getUint8(at + 21);\r\n return Number.isFinite(grid) && grid >= 0 && grid < 600000\r\n && Number.isFinite(offset) && offset >= 0 && offset < 600000\r\n && Number.isFinite(tempo) && tempo > 0 && tempo < 1000\r\n && beats >= 1 && beats <= 64\r\n && [ 1, 2, 4, 8, 16, 32 ].includes(beatValue);\r\n}\r\n\r\nfunction findAnchors(bytes, knownIds)\r\n{\r\n const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\r\n const anchors = [];\r\n for (let at = 1; at + 4 <= bytes.byteLength; at++)\r\n {\r\n const count = view.getUint32(at, true);\r\n if (count > 256 || at + 4 + count * 4 + 22 > bytes.byteLength) continue;\r\n let valid = true;\r\n for (let i = 0; i < count; i++)\r\n {\r\n if (!knownIds.has(view.getUint32(at + 4 + i * 4, true)))\r\n {\r\n valid = false;\r\n break;\r\n }\r\n }\r\n if (valid && plausibleMeter(view, at + 4 + count * 4, bytes.byteLength))\r\n {\r\n anchors.push(at);\r\n }\r\n }\r\n return anchors;\r\n}\r\n\r\nfunction readMusicNodeTail(cursor)\r\n{\r\n const childCount = cursor.u32();\r\n const children = [];\r\n for (let i = 0; i < childCount; i++) children.push(cursor.u32());\r\n const meter = {\r\n gridPeriod: cursor.f64(),\r\n gridOffset: cursor.f64(),\r\n tempo: cursor.f32(),\r\n beatsPerBar: cursor.u8(),\r\n beatValue: cursor.u8()\r\n };\r\n const meterOverride = cursor.u8() !== 0;\r\n const stingerCount = cursor.u32();\r\n const stingers = [];\r\n for (let i = 0; i < stingerCount; i++)\r\n {\r\n stingers.push({\r\n triggerId: cursor.u32(),\r\n segmentId: cursor.u32(),\r\n syncPlayAt: cursor.u32(),\r\n cueFilterHash: cursor.u32(),\r\n dontRepeatTime: cursor.s32(),\r\n numSegmentLookAhead: cursor.u32()\r\n });\r\n }\r\n return { children, meter, meterOverride, stingers };\r\n}\r\n\r\n/** AkMusicTransNodeParams: transition rules shared by playlist + switch containers. */\r\nfunction readTransRules(cursor)\r\n{\r\n const ruleCount = cursor.u32();\r\n if (ruleCount > 4096) throw new RangeError(\"rule count\");\r\n const rules = [];\r\n for (let i = 0; i < ruleCount; i++)\r\n {\r\n const srcCount = cursor.u32();\r\n if (srcCount > 1024) throw new RangeError(\"src count\");\r\n const srcIds = [];\r\n for (let j = 0; j < srcCount; j++) srcIds.push(cursor.s32());\r\n const dstCount = cursor.u32();\r\n if (dstCount > 1024) throw new RangeError(\"dst count\");\r\n const dstIds = [];\r\n for (let j = 0; j < dstCount; j++) dstIds.push(cursor.s32());\r\n const src = {\r\n transitionTime: cursor.s32(), fadeCurve: cursor.u32(), fadeOffset: cursor.s32(),\r\n syncType: cursor.u32(), cueFilterHash: cursor.u32(), playPostExit: cursor.u8() !== 0\r\n };\r\n const dst = {\r\n transitionTime: cursor.s32(), fadeCurve: cursor.u32(), fadeOffset: cursor.s32(),\r\n cueFilterHash: cursor.u32(), jumpToId: cursor.u32(), jumpToType: cursor.u16(),\r\n entryType: cursor.u16(), playPreEntry: cursor.u8() !== 0,\r\n matchSourceCueName: cursor.u8() !== 0\r\n };\r\n let transitionSegment = null;\r\n if (cursor.u8() !== 0)\r\n {\r\n transitionSegment = {\r\n segmentId: cursor.u32(),\r\n fadeIn: { transitionTime: cursor.s32(), fadeCurve: cursor.u32(), fadeOffset: cursor.s32() },\r\n fadeOut: { transitionTime: cursor.s32(), fadeCurve: cursor.u32(), fadeOffset: cursor.s32() },\r\n playPreEntry: cursor.u8() !== 0,\r\n playPostExit: cursor.u8() !== 0\r\n };\r\n }\r\n rules.push({ srcIds, dstIds, src, dst, transitionSegment });\r\n }\r\n return rules;\r\n}\r\n\r\n/**\r\n * Decode a music-segment (HIRC 10) payload: children, meter, stingers,\r\n * duration, and entry/exit markers.\r\n *\r\n * @param {Uint8Array} bytes Entry payload view from `inspect()`.\r\n * @param {Set<number>} knownIds Every HIRC object id in the same bank.\r\n * @returns {object|null} Decoded segment, or null when no anchored parse consumes the payload exactly.\r\n */\r\nexport function parseMusicSegment(bytes, knownIds)\r\n{\r\n for (const anchor of findAnchors(bytes, knownIds))\r\n {\r\n try\r\n {\r\n const cursor = new MusicCursor(bytes, anchor);\r\n const node = readMusicNodeTail(cursor);\r\n const duration = cursor.f64();\r\n if (!Number.isFinite(duration) || duration < 0 || duration > 36000000) continue;\r\n const markerCount = cursor.u32();\r\n if (markerCount > 1024) continue;\r\n const markers = [];\r\n for (let i = 0; i < markerCount; i++)\r\n {\r\n markers.push({ id: cursor.u32(), position: cursor.f64(), name: cursor.stringZ() });\r\n }\r\n if (cursor.at !== bytes.byteLength) continue;\r\n if (markers.some(marker => !Number.isFinite(marker.position) || marker.position < 0)) continue;\r\n return { ...node, duration, markers };\r\n }\r\n catch\r\n {\r\n continue;\r\n }\r\n }\r\n return null;\r\n}\r\n\r\n/**\r\n * Decode a music-track (HIRC 11) payload: sources, clips (play position and\r\n * trims per subtrack), track type, and switch parameters for switch tracks.\r\n *\r\n * @param {Uint8Array} bytes Entry payload view from `inspect()`.\r\n * @returns {object|null} Decoded track, or null when neither tail layout validates.\r\n */\r\nexport function parseMusicTrack(bytes)\r\n{\r\n const cursor = new MusicCursor(bytes, 0);\r\n cursor.u8(); // uFlags (midi/override bits)\r\n const sourceCount = cursor.u32();\r\n if (sourceCount > 512) return null;\r\n const sources = [];\r\n for (let i = 0; i < sourceCount; i++)\r\n {\r\n const pluginId = cursor.u32();\r\n const streamType = cursor.u8();\r\n const sourceId = cursor.u32();\r\n const inMemoryMediaSize = cursor.u32();\r\n const sourceBits = cursor.u8();\r\n if ((pluginId & 0x0f) === 0x02)\r\n {\r\n const size = cursor.u32();\r\n cursor.at += size;\r\n }\r\n sources.push({ pluginId, streamType, sourceId, inMemoryMediaSize, sourceBits });\r\n }\r\n const clipCount = cursor.u32();\r\n if (clipCount > 4096) return null;\r\n const clips = [];\r\n for (let i = 0; i < clipCount; i++)\r\n {\r\n clips.push({\r\n trackId: cursor.u32(),\r\n sourceId: cursor.u32(),\r\n eventId: cursor.u32(),\r\n playAt: cursor.f64(),\r\n beginTrimOffset: cursor.f64(),\r\n endTrimOffset: cursor.f64(),\r\n srcDuration: cursor.f64()\r\n });\r\n }\r\n const subTrackCount = clipCount > 0 ? cursor.u32() : 0;\r\n const autoCount = cursor.u32();\r\n if (autoCount > 4096) return null;\r\n for (let i = 0; i < autoCount; i++)\r\n {\r\n cursor.u32(); // clip index\r\n cursor.u32(); // automation type\r\n const points = cursor.u32();\r\n if (points > 65536) return null;\r\n cursor.at += points * 12;\r\n }\r\n const headEnd = cursor.at;\r\n\r\n // Tail: [NodeBaseParams...] u8 trackType, [switch+trans params when the\r\n // type is 3], f32 lookAheadTime. The switch layout is tried FIRST because\r\n // it validates every field to the exact payload end - the simple layout\r\n // only checks one byte, and a switch tail ending in zero bytes would\r\n // satisfy it falsely.\r\n const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\r\n const end = bytes.byteLength;\r\n for (let typeAt = headEnd; typeAt <= end - 5; typeAt++)\r\n {\r\n if (view.getUint8(typeAt) !== 3) continue;\r\n const tail = new MusicCursor(bytes, typeAt + 1);\r\n try\r\n {\r\n const groupType = tail.u8();\r\n if (groupType > 1) continue;\r\n const groupId = tail.u32();\r\n const defaultSwitch = tail.u32();\r\n const assocCount = tail.u32();\r\n if (assocCount > 1024) continue;\r\n const assoc = [];\r\n for (let i = 0; i < assocCount; i++) assoc.push(tail.u32());\r\n const trans = {\r\n srcTransitionTime: tail.s32(), srcFadeCurve: tail.u32(), srcFadeOffset: tail.s32(),\r\n syncType: tail.u32(), cueFilterHash: tail.u32(),\r\n dstTransitionTime: tail.s32(), dstFadeCurve: tail.u32(), dstFadeOffset: tail.s32()\r\n };\r\n const lookAheadTime = tail.f32();\r\n if (tail.at !== end) continue;\r\n return {\r\n sources, clips, subTrackCount,\r\n trackType: 3,\r\n lookAheadTime,\r\n switchParams: { groupType, groupId, defaultSwitch, assoc, trans }\r\n };\r\n }\r\n catch\r\n {\r\n continue;\r\n }\r\n }\r\n const simpleAt = end - 5;\r\n if (simpleAt >= headEnd)\r\n {\r\n const type = view.getUint8(simpleAt);\r\n if (type <= 2)\r\n {\r\n return {\r\n sources, clips, subTrackCount,\r\n trackType: type,\r\n lookAheadTime: view.getFloat32(end - 4, true),\r\n switchParams: null\r\n };\r\n }\r\n }\r\n return null;\r\n}\r\n\r\n/**\r\n * Decode a music-playlist-container (HIRC 13) payload: children, meter,\r\n * stingers, transition rules, and the flat pre-order playlist tree.\r\n *\r\n * @param {Uint8Array} bytes Entry payload view from `inspect()`.\r\n * @param {Set<number>} knownIds Every HIRC object id in the same bank.\r\n * @returns {object|null} Decoded playlist container, or null when no anchored parse validates.\r\n */\r\nexport function parseMusicPlaylist(bytes, knownIds)\r\n{\r\n for (const anchor of findAnchors(bytes, knownIds))\r\n {\r\n try\r\n {\r\n const cursor = new MusicCursor(bytes, anchor);\r\n const node = readMusicNodeTail(cursor);\r\n const rules = readTransRules(cursor);\r\n const itemCount = cursor.u32();\r\n if (itemCount > 8192) continue;\r\n if (cursor.remaining !== itemCount * 30) continue;\r\n const items = [];\r\n for (let i = 0; i < itemCount; i++)\r\n {\r\n items.push({\r\n segmentId: cursor.u32(),\r\n playlistItemId: cursor.u32(),\r\n childCount: cursor.u32(),\r\n rsType: cursor.s32(),\r\n loop: cursor.s16(),\r\n loopMin: cursor.s16(),\r\n loopMax: cursor.s16(),\r\n weight: cursor.u32(),\r\n avoidRepeatCount: cursor.u16(),\r\n usingWeight: cursor.u8() !== 0,\r\n shuffle: cursor.u8() !== 0\r\n });\r\n }\r\n if (cursor.at !== bytes.byteLength) continue;\r\n return { ...node, rules, playlist: items };\r\n }\r\n catch\r\n {\r\n continue;\r\n }\r\n }\r\n return null;\r\n}\r\n\r\n/**\r\n * Decode a music-switch-container (HIRC 12) payload: children, meter,\r\n * stingers, transition rules, argument groups, and the decision tree.\r\n *\r\n * @param {Uint8Array} bytes Entry payload view from `inspect()`.\r\n * @param {Set<number>} knownIds Every HIRC object id in the same bank.\r\n * @returns {object|null} Decoded switch container, or null when no anchored parse validates.\r\n */\r\nexport function parseMusicSwitch(bytes, knownIds)\r\n{\r\n for (const anchor of findAnchors(bytes, knownIds))\r\n {\r\n try\r\n {\r\n const cursor = new MusicCursor(bytes, anchor);\r\n const node = readMusicNodeTail(cursor);\r\n const rules = readTransRules(cursor);\r\n const continuePlayback = cursor.u8() !== 0;\r\n const treeDepth = cursor.u32();\r\n if (treeDepth > 16) continue;\r\n const argumentGroups = [];\r\n for (let i = 0; i < treeDepth; i++) argumentGroups.push({ groupId: cursor.u32() });\r\n for (let i = 0; i < treeDepth; i++) argumentGroups[i].groupType = cursor.u8();\r\n const treeDataSize = cursor.u32();\r\n const mode = cursor.u8();\r\n if (cursor.remaining !== treeDataSize) continue;\r\n if (treeDataSize % 12 !== 0) continue;\r\n const treeNodes = [];\r\n const nodeCount = treeDataSize / 12;\r\n for (let i = 0; i < nodeCount; i++)\r\n {\r\n const key = cursor.u32();\r\n // 4-byte union: leaf = audioNodeId, internal = childrenIdx + count.\r\n const audioNodeId = cursor.view.getUint32(cursor.at, true);\r\n const childrenIdx = cursor.u16();\r\n const childrenCount = cursor.u16();\r\n const weight = cursor.u16();\r\n const probability = cursor.u16();\r\n treeNodes.push({ key, audioNodeId, childrenIdx, childrenCount, weight, probability });\r\n }\r\n if (cursor.at !== bytes.byteLength) continue;\r\n return { ...node, rules, continuePlayback, argumentGroups, mode, treeNodes };\r\n }\r\n catch\r\n {\r\n continue;\r\n }\r\n }\r\n return null;\r\n}\r\n\r\nconst MUSIC_PARSERS = Object.freeze({\r\n 10: (payload, knownIds) => parseMusicSegment(payload, knownIds),\r\n 11: payload => parseMusicTrack(payload),\r\n 12: (payload, knownIds) => parseMusicSwitch(payload, knownIds),\r\n 13: (payload, knownIds) => parseMusicPlaylist(payload, knownIds)\r\n});\r\n\r\nconst MUSIC_TYPE_NAMES = Object.freeze({\r\n 10: \"music-segment\",\r\n 11: \"music-track\",\r\n 12: \"music-switch-container\",\r\n 13: \"music-playlist-container\"\r\n});\r\n\r\n/**\r\n * Decode every interactive-music node across one or more inspected banks.\r\n *\r\n * @param {Array<object>} inspections `CjsBnkFormat.inspect()` results for every related music bank.\r\n * @returns {{nodes: Map<number, object>, diagnostics: {parsed: number, failed: Array<{bank: string, type: string, id: number}>}}} Decoded nodes keyed by object id plus per-entry failures.\r\n */\r\nexport function musicNodesFromBanks(inspections)\r\n{\r\n const banks = Array.isArray(inspections) ? inspections : [ inspections ];\r\n const nodes = new Map();\r\n const failed = [];\r\n let parsed = 0;\r\n for (const inspection of banks)\r\n {\r\n const knownIds = new Set();\r\n for (const entry of inspection.hirc ?? []) knownIds.add(entry.id);\r\n for (const entry of inspection.hirc ?? [])\r\n {\r\n const parser = MUSIC_PARSERS[entry.type];\r\n if (!parser) continue;\r\n const payload = entry.payload instanceof Uint8Array ? entry.payload : null;\r\n const decoded = payload ? parser(payload, knownIds) : null;\r\n if (!decoded)\r\n {\r\n failed.push({ bank: inspection.source || \"\", type: MUSIC_TYPE_NAMES[entry.type], id: entry.id });\r\n continue;\r\n }\r\n parsed++;\r\n nodes.set(entry.id, { id: entry.id, type: MUSIC_TYPE_NAMES[entry.type], bank: inspection.source || \"\", ...decoded });\r\n }\r\n }\r\n return { nodes, diagnostics: { parsed, failed } };\r\n}\r\n"],"names":["MusicCursor","constructor","bytes","offset","view","DataView","buffer","byteOffset","byteLength","at","remaining","u8","getUint8","u16","value","getUint16","s16","getInt16","u32","getUint32","s32","getInt32","f32","getFloat32","f64","getFloat64","stringZ","end","i","String","fromCharCode","plausibleMeter","grid","tempo","beats","beatValue","Number","isFinite","includes","findAnchors","knownIds","anchors","count","valid","has","push","readMusicNodeTail","cursor","childCount","children","meter","gridPeriod","gridOffset","beatsPerBar","meterOverride","stingerCount","stingers","triggerId","segmentId","syncPlayAt","cueFilterHash","dontRepeatTime","numSegmentLookAhead","readTransRules","ruleCount","RangeError","rules","srcCount","srcIds","j","dstCount","dstIds","src","transitionTime","fadeCurve","fadeOffset","syncType","playPostExit","dst","jumpToId","jumpToType","entryType","playPreEntry","matchSourceCueName","transitionSegment","fadeIn","fadeOut","parseMusicSegment","anchor","node","duration","markerCount","markers","id","position","name","some","marker","parseMusicTrack","sourceCount","sources","pluginId","streamType","sourceId","inMemoryMediaSize","sourceBits","size","clipCount","clips","trackId","eventId","playAt","beginTrimOffset","endTrimOffset","srcDuration","subTrackCount","autoCount","points","headEnd","typeAt","tail","groupType","groupId","defaultSwitch","assocCount","assoc","trans","srcTransitionTime","srcFadeCurve","srcFadeOffset","dstTransitionTime","dstFadeCurve","dstFadeOffset","lookAheadTime","trackType","switchParams","simpleAt","type","parseMusicPlaylist","itemCount","items","playlistItemId","rsType","loop","loopMin","loopMax","weight","avoidRepeatCount","usingWeight","shuffle","playlist","parseMusicSwitch","continuePlayback","treeDepth","argumentGroups","treeDataSize","mode","treeNodes","nodeCount","key","audioNodeId","childrenIdx","childrenCount","probability","MUSIC_PARSERS","Object","freeze","payload","MUSIC_TYPE_NAMES","musicNodesFromBanks","inspections","banks","Array","isArray","nodes","Map","failed","parsed","inspection","Set","entry","hirc","add","parser","Uint8Array","decoded","bank","source","set","diagnostics"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,WAAW,CACjB;AACIC,EAAAA,WAAWA,CAACC,KAA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AACb,OAAO,YAAYiB,UAAU,GAAGJ,KAAK,CAACb,OAAO,GAAG,IAAI;MAC1E,MAAMkB,OAAO,GAAGlB,OAAO,GAAGgB,MAAM,CAAChB,OAAO,EAAE/H,QAAQ,CAAC,GAAG,IAAI;MAC1D,IAAI,CAACiJ,OAAO,EACZ;QACIT,MAAM,CAACnI,IAAI,CAAC;AAAE6I,UAAAA,IAAI,EAAER,UAAU,CAACS,MAAM,IAAI,EAAE;AAAElD,UAAAA,IAAI,EAAE+B,gBAAgB,CAACY,KAAK,CAAC3C,IAAI,CAAC;UAAE5C,EAAE,EAAEuF,KAAK,CAACvF;AAAG,SAAC,CAAC;AAChG,QAAA;AACJ,MAAA;AACAoF,MAAAA,MAAM,EAAE;AACRH,MAAAA,KAAK,CAACc,GAAG,CAACR,KAAK,CAACvF,EAAE,EAAE;QAAEA,EAAE,EAAEuF,KAAK,CAACvF,EAAE;AAAE4C,QAAAA,IAAI,EAAE+B,gBAAgB,CAACY,KAAK,CAAC3C,IAAI,CAAC;AAAEiD,QAAAA,IAAI,EAAER,UAAU,CAACS,MAAM,IAAI,EAAE;QAAE,GAAGF;AAAQ,OAAC,CAAC;AACxH,IAAA;AACJ,EAAA;EACA,OAAO;IAAEX,KAAK;AAAEe,IAAAA,WAAW,EAAE;MAAEZ,MAAM;AAAED,MAAAA;AAAO;GAAG;AACrD;;;;"}
|
|
@@ -1,246 +1,246 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Readers for Wwise SoundbanksInfo metadata (the `soundbanksinfo.json` file
|
|
3
|
-
* generated next to soundbanks).
|
|
4
|
-
*
|
|
5
|
-
* SoundbanksInfo is the authoring-name authority for soundbank content: it
|
|
6
|
-
* maps media ids to original source paths and lists per-bank events, switch
|
|
7
|
-
* groups, state groups, and game parameters. These helpers normalize that
|
|
8
|
-
* document and join it against `CjsBnkFormat` inspection output; they never
|
|
9
|
-
* touch audio bytes.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Compute the Wwise 32-bit id for a name.
|
|
14
|
-
*
|
|
15
|
-
* Wwise derives bank, event, and language ids as the FNV-1 32-bit hash of the
|
|
16
|
-
* lowercased name (verified against EVE build 3421648 bank and language ids).
|
|
17
|
-
*
|
|
18
|
-
* @param {string} name Bank, event, switch, or language name.
|
|
19
|
-
* @returns {number} Unsigned 32-bit Wwise id.
|
|
20
|
-
*/
|
|
21
|
-
function wwiseIdFromName(name) {
|
|
22
|
-
let hash = 2166136261 >>> 0;
|
|
23
|
-
const text = String(name).toLowerCase();
|
|
24
|
-
for (let i = 0; i < text.length; i++) {
|
|
25
|
-
hash = Math.imul(hash, 16777619) >>> 0;
|
|
26
|
-
hash = (hash ^ text.charCodeAt(i)) >>> 0;
|
|
27
|
-
}
|
|
28
|
-
return hash;
|
|
29
|
-
}
|
|
30
|
-
function toSoundbanksInfoDocument(input) {
|
|
31
|
-
let value = input;
|
|
32
|
-
if (value instanceof ArrayBuffer) value = new Uint8Array(value);
|
|
33
|
-
if (ArrayBuffer.isView(value)) value = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
34
|
-
if (value instanceof Uint8Array) value = utf8String(value);
|
|
35
|
-
if (typeof value === "string") {
|
|
36
|
-
try {
|
|
37
|
-
value = JSON.parse(value);
|
|
38
|
-
} catch (error) {
|
|
39
|
-
throw new TypeError(`CjsBnkFormat: SoundbanksInfo input is not valid JSON (${error.message})`);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
43
|
-
throw new TypeError("CjsBnkFormat: SoundbanksInfo input must be JSON bytes, text, or an object");
|
|
44
|
-
}
|
|
45
|
-
const document = value.SoundBanksInfo || value;
|
|
46
|
-
if (!document || typeof document !== "object" || !Array.isArray(document.SoundBanks)) {
|
|
47
|
-
throw new TypeError("CjsBnkFormat: input has no SoundBanksInfo.SoundBanks document");
|
|
48
|
-
}
|
|
49
|
-
return document;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Test whether input looks like a Wwise SoundbanksInfo document.
|
|
54
|
-
*
|
|
55
|
-
* @param {Uint8Array|ArrayBuffer|DataView|string|object} input Candidate document.
|
|
56
|
-
* @returns {boolean} True when a SoundBanksInfo bank list is present.
|
|
57
|
-
*/
|
|
58
|
-
function isSoundbanksInfo(input) {
|
|
59
|
-
try {
|
|
60
|
-
toSoundbanksInfoDocument(input);
|
|
61
|
-
return true;
|
|
62
|
-
} catch {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Parse SoundbanksInfo into a normalized camelCase summary.
|
|
69
|
-
*
|
|
70
|
-
* @param {Uint8Array|ArrayBuffer|DataView|string|object} input SoundbanksInfo JSON bytes, text, or object.
|
|
71
|
-
* @returns {object} Normalized document summary with per-bank details.
|
|
72
|
-
*/
|
|
73
|
-
function parseSoundbanksInfo(input) {
|
|
74
|
-
const document = toSoundbanksInfoDocument(input);
|
|
75
|
-
const banks = document.SoundBanks.map(normalizeBank);
|
|
76
|
-
const summary = {
|
|
77
|
-
platform: document.Platform || "",
|
|
78
|
-
basePlatform: document.BasePlatform || "",
|
|
79
|
-
schemaVersion: document.SchemaVersion || "",
|
|
80
|
-
soundBankVersion: document.SoundBankVersion || "",
|
|
81
|
-
bankCount: banks.length,
|
|
82
|
-
mediaCount: 0,
|
|
83
|
-
streamingMediaCount: 0,
|
|
84
|
-
eventCount: 0,
|
|
85
|
-
languages: [],
|
|
86
|
-
banks
|
|
87
|
-
};
|
|
88
|
-
const languages = new Set();
|
|
89
|
-
for (const bank of banks) {
|
|
90
|
-
summary.mediaCount += bank.media.length;
|
|
91
|
-
summary.streamingMediaCount += bank.media.filter(entry => entry.streaming).length;
|
|
92
|
-
summary.eventCount += bank.events.length;
|
|
93
|
-
if (bank.language) languages.add(bank.language);
|
|
94
|
-
}
|
|
95
|
-
summary.languages = [...languages].sort();
|
|
96
|
-
return summary;
|
|
97
|
-
}
|
|
98
|
-
function normalizeBank(bank) {
|
|
99
|
-
return {
|
|
100
|
-
id: String(bank.Id ?? ""),
|
|
101
|
-
type: bank.Type || "",
|
|
102
|
-
language: bank.Language || "",
|
|
103
|
-
shortName: bank.ShortName || "",
|
|
104
|
-
path: bank.Path || "",
|
|
105
|
-
media: (bank.Media || []).map(entry => ({
|
|
106
|
-
id: String(entry.Id ?? ""),
|
|
107
|
-
shortName: entry.ShortName || "",
|
|
108
|
-
cachePath: entry.CachePath || "",
|
|
109
|
-
language: entry.Language || "",
|
|
110
|
-
streaming: entry.Streaming === "true",
|
|
111
|
-
location: entry.Location || ""
|
|
112
|
-
})),
|
|
113
|
-
events: (bank.Events || []).map(entry => ({
|
|
114
|
-
id: String(entry.Id ?? ""),
|
|
115
|
-
name: entry.Name || ""
|
|
116
|
-
})),
|
|
117
|
-
switchGroups: (bank.SwitchGroups || []).map(group => ({
|
|
118
|
-
id: String(group.Id ?? ""),
|
|
119
|
-
name: group.Name || "",
|
|
120
|
-
switches: (group.Switches || []).map(entry => ({
|
|
121
|
-
id: String(entry.Id ?? ""),
|
|
122
|
-
name: entry.Name || ""
|
|
123
|
-
}))
|
|
124
|
-
})),
|
|
125
|
-
stateGroups: (bank.StateGroups || []).map(group => ({
|
|
126
|
-
id: String(group.Id ?? ""),
|
|
127
|
-
name: group.Name || "",
|
|
128
|
-
states: (group.States || []).map(entry => ({
|
|
129
|
-
id: String(entry.Id ?? ""),
|
|
130
|
-
name: entry.Name || ""
|
|
131
|
-
}))
|
|
132
|
-
})),
|
|
133
|
-
gameParameters: (bank.GameParameters || []).map(entry => ({
|
|
134
|
-
id: String(entry.Id ?? ""),
|
|
135
|
-
name: entry.Name || ""
|
|
136
|
-
}))
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Build id-keyed lookup tables from SoundbanksInfo.
|
|
142
|
-
*
|
|
143
|
-
* Media ids repeat across language variants of the same bank, so
|
|
144
|
-
* `mediaById[id]` is an array of entries; event ids are unique.
|
|
145
|
-
*
|
|
146
|
-
* @param {Uint8Array|ArrayBuffer|DataView|string|object} input SoundbanksInfo JSON bytes, text, or object.
|
|
147
|
-
* @returns {object} Catalog with banksById, mediaById, eventsById, and eventsByName.
|
|
148
|
-
*/
|
|
149
|
-
function buildSoundbanksCatalog(input) {
|
|
150
|
-
const parsed = parseSoundbanksInfo(input);
|
|
151
|
-
const catalog = {
|
|
152
|
-
platform: parsed.platform,
|
|
153
|
-
soundBankVersion: parsed.soundBankVersion,
|
|
154
|
-
bankCount: parsed.bankCount,
|
|
155
|
-
mediaCount: parsed.mediaCount,
|
|
156
|
-
eventCount: parsed.eventCount,
|
|
157
|
-
languages: parsed.languages,
|
|
158
|
-
banksById: {},
|
|
159
|
-
bankVariantsById: {},
|
|
160
|
-
mediaById: {},
|
|
161
|
-
eventsById: {},
|
|
162
|
-
eventsByName: {}
|
|
163
|
-
};
|
|
164
|
-
for (const bank of parsed.banks) {
|
|
165
|
-
if (!catalog.banksById[bank.id]) catalog.banksById[bank.id] = bank;
|
|
166
|
-
if (!catalog.bankVariantsById[bank.id]) catalog.bankVariantsById[bank.id] = [];
|
|
167
|
-
catalog.bankVariantsById[bank.id].push(bank);
|
|
168
|
-
for (const entry of bank.media) {
|
|
169
|
-
const reference = {
|
|
170
|
-
...entry,
|
|
171
|
-
bankId: bank.id,
|
|
172
|
-
bankName: bank.shortName
|
|
173
|
-
};
|
|
174
|
-
if (!catalog.mediaById[entry.id]) catalog.mediaById[entry.id] = [];
|
|
175
|
-
catalog.mediaById[entry.id].push(reference);
|
|
176
|
-
}
|
|
177
|
-
for (const entry of bank.events) {
|
|
178
|
-
const reference = {
|
|
179
|
-
...entry,
|
|
180
|
-
bankId: bank.id,
|
|
181
|
-
bankName: bank.shortName
|
|
182
|
-
};
|
|
183
|
-
catalog.eventsById[entry.id] = reference;
|
|
184
|
-
catalog.eventsByName[entry.name] = reference;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
return catalog;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Join a `CjsBnkFormat` inspection result with a SoundbanksInfo catalog.
|
|
192
|
-
*
|
|
193
|
-
* Annotates the bank's embedded media and HIRC event listing with authoring
|
|
194
|
-
* names. Entries with no catalog match keep `null` name fields rather than
|
|
195
|
-
* being dropped, so counts stay aligned with the inspected bank. Language
|
|
196
|
-
* variants of a bank share one bank id; the inspected BKHD `languageId`
|
|
197
|
-
* (an FNV-1 hash of the language name) selects the exact variant.
|
|
198
|
-
*
|
|
199
|
-
* @param {object} bankInfo `CjsBnkFormat` inspect output.
|
|
200
|
-
* @param {object} catalog `buildSoundbanksCatalog` output.
|
|
201
|
-
* @returns {object} Bank/media/event annotations for the inspected bank.
|
|
202
|
-
*/
|
|
203
|
-
function joinSoundbanksInfo(bankInfo, catalog) {
|
|
204
|
-
const bankId = String(bankInfo.bankId ?? "");
|
|
205
|
-
const variants = catalog.bankVariantsById[bankId] || [];
|
|
206
|
-
const bank = variants.find(variant => wwiseIdFromName(variant.language) === bankInfo.languageId) || catalog.banksById[bankId] || null;
|
|
207
|
-
const bankLanguage = bank ? bank.language : "";
|
|
208
|
-
const media = (bankInfo.media || []).map(entry => {
|
|
209
|
-
const references = catalog.mediaById[String(entry.id)] || [];
|
|
210
|
-
const match = references.find(reference => reference.bankId === bankId && reference.language === bankLanguage) || references.find(reference => reference.bankId === bankId) || references[0] || null;
|
|
211
|
-
return {
|
|
212
|
-
id: entry.id,
|
|
213
|
-
length: entry.length,
|
|
214
|
-
available: entry.available,
|
|
215
|
-
shortName: match ? match.shortName : null,
|
|
216
|
-
cachePath: match ? match.cachePath : null,
|
|
217
|
-
language: match ? match.language : null,
|
|
218
|
-
streaming: match ? match.streaming : null
|
|
219
|
-
};
|
|
220
|
-
});
|
|
221
|
-
const events = (bankInfo.hirc || []).filter(entry => entry.typeName === "event").map(entry => {
|
|
222
|
-
const match = catalog.eventsById[String(entry.id)] || null;
|
|
223
|
-
return {
|
|
224
|
-
id: entry.id,
|
|
225
|
-
name: match ? match.name : null,
|
|
226
|
-
bankName: match ? match.bankName : null
|
|
227
|
-
};
|
|
228
|
-
});
|
|
229
|
-
return {
|
|
230
|
-
bankId,
|
|
231
|
-
bank,
|
|
232
|
-
media,
|
|
233
|
-
namedMediaCount: media.filter(entry => entry.shortName !== null).length,
|
|
234
|
-
events,
|
|
235
|
-
namedEventCount: events.filter(entry => entry.name !== null).length
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
function utf8String(bytes) {
|
|
239
|
-
if (typeof TextDecoder !== "undefined") return new TextDecoder("utf-8").decode(bytes);
|
|
240
|
-
let value = "";
|
|
241
|
-
for (let i = 0; i < bytes.length; i++) value += String.fromCharCode(bytes[i]);
|
|
242
|
-
return value;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
export { buildSoundbanksCatalog, isSoundbanksInfo, joinSoundbanksInfo, parseSoundbanksInfo, toSoundbanksInfoDocument, wwiseIdFromName };
|
|
246
|
-
//# sourceMappingURL=soundbanksInfo.js.map
|
|
1
|
+
/**
|
|
2
|
+
* Readers for Wwise SoundbanksInfo metadata (the `soundbanksinfo.json` file
|
|
3
|
+
* generated next to soundbanks).
|
|
4
|
+
*
|
|
5
|
+
* SoundbanksInfo is the authoring-name authority for soundbank content: it
|
|
6
|
+
* maps media ids to original source paths and lists per-bank events, switch
|
|
7
|
+
* groups, state groups, and game parameters. These helpers normalize that
|
|
8
|
+
* document and join it against `CjsBnkFormat` inspection output; they never
|
|
9
|
+
* touch audio bytes.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Compute the Wwise 32-bit id for a name.
|
|
14
|
+
*
|
|
15
|
+
* Wwise derives bank, event, and language ids as the FNV-1 32-bit hash of the
|
|
16
|
+
* lowercased name (verified against EVE build 3421648 bank and language ids).
|
|
17
|
+
*
|
|
18
|
+
* @param {string} name Bank, event, switch, or language name.
|
|
19
|
+
* @returns {number} Unsigned 32-bit Wwise id.
|
|
20
|
+
*/
|
|
21
|
+
function wwiseIdFromName(name) {
|
|
22
|
+
let hash = 2166136261 >>> 0;
|
|
23
|
+
const text = String(name).toLowerCase();
|
|
24
|
+
for (let i = 0; i < text.length; i++) {
|
|
25
|
+
hash = Math.imul(hash, 16777619) >>> 0;
|
|
26
|
+
hash = (hash ^ text.charCodeAt(i)) >>> 0;
|
|
27
|
+
}
|
|
28
|
+
return hash;
|
|
29
|
+
}
|
|
30
|
+
function toSoundbanksInfoDocument(input) {
|
|
31
|
+
let value = input;
|
|
32
|
+
if (value instanceof ArrayBuffer) value = new Uint8Array(value);
|
|
33
|
+
if (ArrayBuffer.isView(value)) value = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
34
|
+
if (value instanceof Uint8Array) value = utf8String(value);
|
|
35
|
+
if (typeof value === "string") {
|
|
36
|
+
try {
|
|
37
|
+
value = JSON.parse(value);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
throw new TypeError(`CjsBnkFormat: SoundbanksInfo input is not valid JSON (${error.message})`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
43
|
+
throw new TypeError("CjsBnkFormat: SoundbanksInfo input must be JSON bytes, text, or an object");
|
|
44
|
+
}
|
|
45
|
+
const document = value.SoundBanksInfo || value;
|
|
46
|
+
if (!document || typeof document !== "object" || !Array.isArray(document.SoundBanks)) {
|
|
47
|
+
throw new TypeError("CjsBnkFormat: input has no SoundBanksInfo.SoundBanks document");
|
|
48
|
+
}
|
|
49
|
+
return document;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Test whether input looks like a Wwise SoundbanksInfo document.
|
|
54
|
+
*
|
|
55
|
+
* @param {Uint8Array|ArrayBuffer|DataView|string|object} input Candidate document.
|
|
56
|
+
* @returns {boolean} True when a SoundBanksInfo bank list is present.
|
|
57
|
+
*/
|
|
58
|
+
function isSoundbanksInfo(input) {
|
|
59
|
+
try {
|
|
60
|
+
toSoundbanksInfoDocument(input);
|
|
61
|
+
return true;
|
|
62
|
+
} catch {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Parse SoundbanksInfo into a normalized camelCase summary.
|
|
69
|
+
*
|
|
70
|
+
* @param {Uint8Array|ArrayBuffer|DataView|string|object} input SoundbanksInfo JSON bytes, text, or object.
|
|
71
|
+
* @returns {object} Normalized document summary with per-bank details.
|
|
72
|
+
*/
|
|
73
|
+
function parseSoundbanksInfo(input) {
|
|
74
|
+
const document = toSoundbanksInfoDocument(input);
|
|
75
|
+
const banks = document.SoundBanks.map(normalizeBank);
|
|
76
|
+
const summary = {
|
|
77
|
+
platform: document.Platform || "",
|
|
78
|
+
basePlatform: document.BasePlatform || "",
|
|
79
|
+
schemaVersion: document.SchemaVersion || "",
|
|
80
|
+
soundBankVersion: document.SoundBankVersion || "",
|
|
81
|
+
bankCount: banks.length,
|
|
82
|
+
mediaCount: 0,
|
|
83
|
+
streamingMediaCount: 0,
|
|
84
|
+
eventCount: 0,
|
|
85
|
+
languages: [],
|
|
86
|
+
banks
|
|
87
|
+
};
|
|
88
|
+
const languages = new Set();
|
|
89
|
+
for (const bank of banks) {
|
|
90
|
+
summary.mediaCount += bank.media.length;
|
|
91
|
+
summary.streamingMediaCount += bank.media.filter(entry => entry.streaming).length;
|
|
92
|
+
summary.eventCount += bank.events.length;
|
|
93
|
+
if (bank.language) languages.add(bank.language);
|
|
94
|
+
}
|
|
95
|
+
summary.languages = [...languages].sort();
|
|
96
|
+
return summary;
|
|
97
|
+
}
|
|
98
|
+
function normalizeBank(bank) {
|
|
99
|
+
return {
|
|
100
|
+
id: String(bank.Id ?? ""),
|
|
101
|
+
type: bank.Type || "",
|
|
102
|
+
language: bank.Language || "",
|
|
103
|
+
shortName: bank.ShortName || "",
|
|
104
|
+
path: bank.Path || "",
|
|
105
|
+
media: (bank.Media || []).map(entry => ({
|
|
106
|
+
id: String(entry.Id ?? ""),
|
|
107
|
+
shortName: entry.ShortName || "",
|
|
108
|
+
cachePath: entry.CachePath || "",
|
|
109
|
+
language: entry.Language || "",
|
|
110
|
+
streaming: entry.Streaming === "true",
|
|
111
|
+
location: entry.Location || ""
|
|
112
|
+
})),
|
|
113
|
+
events: (bank.Events || []).map(entry => ({
|
|
114
|
+
id: String(entry.Id ?? ""),
|
|
115
|
+
name: entry.Name || ""
|
|
116
|
+
})),
|
|
117
|
+
switchGroups: (bank.SwitchGroups || []).map(group => ({
|
|
118
|
+
id: String(group.Id ?? ""),
|
|
119
|
+
name: group.Name || "",
|
|
120
|
+
switches: (group.Switches || []).map(entry => ({
|
|
121
|
+
id: String(entry.Id ?? ""),
|
|
122
|
+
name: entry.Name || ""
|
|
123
|
+
}))
|
|
124
|
+
})),
|
|
125
|
+
stateGroups: (bank.StateGroups || []).map(group => ({
|
|
126
|
+
id: String(group.Id ?? ""),
|
|
127
|
+
name: group.Name || "",
|
|
128
|
+
states: (group.States || []).map(entry => ({
|
|
129
|
+
id: String(entry.Id ?? ""),
|
|
130
|
+
name: entry.Name || ""
|
|
131
|
+
}))
|
|
132
|
+
})),
|
|
133
|
+
gameParameters: (bank.GameParameters || []).map(entry => ({
|
|
134
|
+
id: String(entry.Id ?? ""),
|
|
135
|
+
name: entry.Name || ""
|
|
136
|
+
}))
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Build id-keyed lookup tables from SoundbanksInfo.
|
|
142
|
+
*
|
|
143
|
+
* Media ids repeat across language variants of the same bank, so
|
|
144
|
+
* `mediaById[id]` is an array of entries; event ids are unique.
|
|
145
|
+
*
|
|
146
|
+
* @param {Uint8Array|ArrayBuffer|DataView|string|object} input SoundbanksInfo JSON bytes, text, or object.
|
|
147
|
+
* @returns {object} Catalog with banksById, mediaById, eventsById, and eventsByName.
|
|
148
|
+
*/
|
|
149
|
+
function buildSoundbanksCatalog(input) {
|
|
150
|
+
const parsed = parseSoundbanksInfo(input);
|
|
151
|
+
const catalog = {
|
|
152
|
+
platform: parsed.platform,
|
|
153
|
+
soundBankVersion: parsed.soundBankVersion,
|
|
154
|
+
bankCount: parsed.bankCount,
|
|
155
|
+
mediaCount: parsed.mediaCount,
|
|
156
|
+
eventCount: parsed.eventCount,
|
|
157
|
+
languages: parsed.languages,
|
|
158
|
+
banksById: {},
|
|
159
|
+
bankVariantsById: {},
|
|
160
|
+
mediaById: {},
|
|
161
|
+
eventsById: {},
|
|
162
|
+
eventsByName: {}
|
|
163
|
+
};
|
|
164
|
+
for (const bank of parsed.banks) {
|
|
165
|
+
if (!catalog.banksById[bank.id]) catalog.banksById[bank.id] = bank;
|
|
166
|
+
if (!catalog.bankVariantsById[bank.id]) catalog.bankVariantsById[bank.id] = [];
|
|
167
|
+
catalog.bankVariantsById[bank.id].push(bank);
|
|
168
|
+
for (const entry of bank.media) {
|
|
169
|
+
const reference = {
|
|
170
|
+
...entry,
|
|
171
|
+
bankId: bank.id,
|
|
172
|
+
bankName: bank.shortName
|
|
173
|
+
};
|
|
174
|
+
if (!catalog.mediaById[entry.id]) catalog.mediaById[entry.id] = [];
|
|
175
|
+
catalog.mediaById[entry.id].push(reference);
|
|
176
|
+
}
|
|
177
|
+
for (const entry of bank.events) {
|
|
178
|
+
const reference = {
|
|
179
|
+
...entry,
|
|
180
|
+
bankId: bank.id,
|
|
181
|
+
bankName: bank.shortName
|
|
182
|
+
};
|
|
183
|
+
catalog.eventsById[entry.id] = reference;
|
|
184
|
+
catalog.eventsByName[entry.name] = reference;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return catalog;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Join a `CjsBnkFormat` inspection result with a SoundbanksInfo catalog.
|
|
192
|
+
*
|
|
193
|
+
* Annotates the bank's embedded media and HIRC event listing with authoring
|
|
194
|
+
* names. Entries with no catalog match keep `null` name fields rather than
|
|
195
|
+
* being dropped, so counts stay aligned with the inspected bank. Language
|
|
196
|
+
* variants of a bank share one bank id; the inspected BKHD `languageId`
|
|
197
|
+
* (an FNV-1 hash of the language name) selects the exact variant.
|
|
198
|
+
*
|
|
199
|
+
* @param {object} bankInfo `CjsBnkFormat` inspect output.
|
|
200
|
+
* @param {object} catalog `buildSoundbanksCatalog` output.
|
|
201
|
+
* @returns {object} Bank/media/event annotations for the inspected bank.
|
|
202
|
+
*/
|
|
203
|
+
function joinSoundbanksInfo(bankInfo, catalog) {
|
|
204
|
+
const bankId = String(bankInfo.bankId ?? "");
|
|
205
|
+
const variants = catalog.bankVariantsById[bankId] || [];
|
|
206
|
+
const bank = variants.find(variant => wwiseIdFromName(variant.language) === bankInfo.languageId) || catalog.banksById[bankId] || null;
|
|
207
|
+
const bankLanguage = bank ? bank.language : "";
|
|
208
|
+
const media = (bankInfo.media || []).map(entry => {
|
|
209
|
+
const references = catalog.mediaById[String(entry.id)] || [];
|
|
210
|
+
const match = references.find(reference => reference.bankId === bankId && reference.language === bankLanguage) || references.find(reference => reference.bankId === bankId) || references[0] || null;
|
|
211
|
+
return {
|
|
212
|
+
id: entry.id,
|
|
213
|
+
length: entry.length,
|
|
214
|
+
available: entry.available,
|
|
215
|
+
shortName: match ? match.shortName : null,
|
|
216
|
+
cachePath: match ? match.cachePath : null,
|
|
217
|
+
language: match ? match.language : null,
|
|
218
|
+
streaming: match ? match.streaming : null
|
|
219
|
+
};
|
|
220
|
+
});
|
|
221
|
+
const events = (bankInfo.hirc || []).filter(entry => entry.typeName === "event").map(entry => {
|
|
222
|
+
const match = catalog.eventsById[String(entry.id)] || null;
|
|
223
|
+
return {
|
|
224
|
+
id: entry.id,
|
|
225
|
+
name: match ? match.name : null,
|
|
226
|
+
bankName: match ? match.bankName : null
|
|
227
|
+
};
|
|
228
|
+
});
|
|
229
|
+
return {
|
|
230
|
+
bankId,
|
|
231
|
+
bank,
|
|
232
|
+
media,
|
|
233
|
+
namedMediaCount: media.filter(entry => entry.shortName !== null).length,
|
|
234
|
+
events,
|
|
235
|
+
namedEventCount: events.filter(entry => entry.name !== null).length
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function utf8String(bytes) {
|
|
239
|
+
if (typeof TextDecoder !== "undefined") return new TextDecoder("utf-8").decode(bytes);
|
|
240
|
+
let value = "";
|
|
241
|
+
for (let i = 0; i < bytes.length; i++) value += String.fromCharCode(bytes[i]);
|
|
242
|
+
return value;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export { buildSoundbanksCatalog, isSoundbanksInfo, joinSoundbanksInfo, parseSoundbanksInfo, toSoundbanksInfoDocument, wwiseIdFromName };
|
|
246
|
+
//# sourceMappingURL=soundbanksInfo.js.map
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export { CjsBnkFormat, CjsBnkFormat as default } from './CjsBnkFormat.js';
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { CjsBnkFormat, CjsBnkFormat as default } from './CjsBnkFormat.js';
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|