@carbonenginejs/runtime-resource 0.1.0 → 0.7.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.
Files changed (186) hide show
  1. package/FORMAT-PROVENANCE.md +14 -5
  2. package/README.md +537 -241
  3. package/dist/CjsMotherLode.js +1244 -29
  4. package/dist/CjsMotherLode.js.map +1 -1
  5. package/dist/CjsResMan.js +2537 -272
  6. package/dist/CjsResMan.js.map +1 -1
  7. package/dist/CjsResource.js +218 -18
  8. package/dist/CjsResource.js.map +1 -1
  9. package/dist/format/CjsBlueReader.js +269 -0
  10. package/dist/format/CjsBlueReader.js.map +1 -0
  11. package/dist/format/CjsFormat.js +44 -30
  12. package/dist/format/CjsFormat.js.map +1 -1
  13. package/dist/format/CjsReader.js +18 -0
  14. package/dist/format/CjsReader.js.map +1 -0
  15. package/dist/format/CjsResourceProbe.js +12 -4
  16. package/dist/format/CjsResourceProbe.js.map +1 -1
  17. package/dist/formats/black/CjsBlackFormat.js +12 -6
  18. package/dist/formats/black/CjsBlackFormat.js.map +1 -1
  19. package/dist/formats/black/core/CjsBlackReader.js +27 -148
  20. package/dist/formats/black/core/CjsBlackReader.js.map +1 -1
  21. package/dist/formats/bnk/CjsBnkFormat.js +140 -147
  22. package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
  23. package/dist/formats/bnk/core/graph.js +140 -0
  24. package/dist/formats/bnk/core/graph.js.map +1 -0
  25. package/dist/formats/bnk/core/helpers.js +58 -3
  26. package/dist/formats/bnk/core/helpers.js.map +1 -1
  27. package/dist/formats/bnk/core/musicNodes.js +521 -0
  28. package/dist/formats/bnk/core/musicNodes.js.map +1 -0
  29. package/dist/formats/bnk/index.js +0 -1
  30. package/dist/formats/bnk/index.js.map +1 -1
  31. package/dist/formats/cmf/CjsCmfFormat.js +14 -8
  32. package/dist/formats/cmf/CjsCmfFormat.js.map +1 -1
  33. package/dist/formats/dds/CjsDdsFormat.js +12 -6
  34. package/dist/formats/dds/CjsDdsFormat.js.map +1 -1
  35. package/dist/formats/fbx/CjsFbxFormat.js +12 -6
  36. package/dist/formats/fbx/CjsFbxFormat.js.map +1 -1
  37. package/dist/formats/flac/CjsFlacFormat.js +10 -4
  38. package/dist/formats/flac/CjsFlacFormat.js.map +1 -1
  39. package/dist/formats/gif/CjsGifFormat.js +11 -5
  40. package/dist/formats/gif/CjsGifFormat.js.map +1 -1
  41. package/dist/formats/gltf/CjsGltfFormat.js +12 -6
  42. package/dist/formats/gltf/CjsGltfFormat.js.map +1 -1
  43. package/dist/formats/jpeg/CjsJpegFormat.js +11 -5
  44. package/dist/formats/jpeg/CjsJpegFormat.js.map +1 -1
  45. package/dist/formats/mp3/CjsMp3Format.js +11 -5
  46. package/dist/formats/mp3/CjsMp3Format.js.map +1 -1
  47. package/dist/formats/mp4/CjsMp4Format.js +10 -4
  48. package/dist/formats/mp4/CjsMp4Format.js.map +1 -1
  49. package/dist/formats/obj/CjsObjFormat.js +12 -6
  50. package/dist/formats/obj/CjsObjFormat.js.map +1 -1
  51. package/dist/formats/ogg/CjsOggFormat.js +9 -3
  52. package/dist/formats/ogg/CjsOggFormat.js.map +1 -1
  53. package/dist/formats/png/CjsPngFormat.js +11 -5
  54. package/dist/formats/png/CjsPngFormat.js.map +1 -1
  55. package/dist/formats/red/CjsRedFormat.js +19 -5
  56. package/dist/formats/red/CjsRedFormat.js.map +1 -1
  57. package/dist/formats/red/core/CjsRedReader.js +63 -70
  58. package/dist/formats/red/core/CjsRedReader.js.map +1 -1
  59. package/dist/formats/red/core/helpers.js +3 -0
  60. package/dist/formats/red/core/helpers.js.map +1 -1
  61. package/dist/formats/stl/CjsStlFormat.js +77 -16
  62. package/dist/formats/stl/CjsStlFormat.js.map +1 -1
  63. package/dist/formats/stl/core/helpers.js +4 -0
  64. package/dist/formats/stl/core/helpers.js.map +1 -1
  65. package/dist/formats/stl/core/stl.js +100 -15
  66. package/dist/formats/stl/core/stl.js.map +1 -1
  67. package/dist/formats/tga/CjsTgaFormat.js +11 -5
  68. package/dist/formats/tga/CjsTgaFormat.js.map +1 -1
  69. package/dist/formats/wav/CjsWavFormat.js +11 -5
  70. package/dist/formats/wav/CjsWavFormat.js.map +1 -1
  71. package/dist/formats/webm/CjsWebmFormat.js +10 -4
  72. package/dist/formats/webm/CjsWebmFormat.js.map +1 -1
  73. package/dist/formats/webp/CjsWebpFormat.js +9 -3
  74. package/dist/formats/webp/CjsWebpFormat.js.map +1 -1
  75. package/dist/formats/wem/CjsWemFormat.js +50 -6
  76. package/dist/formats/wem/CjsWemFormat.js.map +1 -1
  77. package/dist/formats/wem/core/helpers.js +84 -3
  78. package/dist/formats/wem/core/helpers.js.map +1 -1
  79. package/dist/formats/wem/core/ptadpcm.js +77 -0
  80. package/dist/formats/wem/core/ptadpcm.js.map +1 -0
  81. package/dist/formats/wem/core/resolve.js +121 -0
  82. package/dist/formats/wem/core/resolve.js.map +1 -0
  83. package/dist/formats/yaml/CjsYamlFormat.js +11 -5
  84. package/dist/formats/yaml/CjsYamlFormat.js.map +1 -1
  85. package/dist/formats/yaml/core/CjsYamlReader.js +3 -2
  86. package/dist/formats/yaml/core/CjsYamlReader.js.map +1 -1
  87. package/dist/index.js +28 -32
  88. package/dist/index.js.map +1 -1
  89. package/dist/{generated/resources → resources}/AudioGeometryResData.js +2 -2
  90. package/dist/resources/AudioGeometryResData.js.map +1 -0
  91. package/dist/{generated/resources → resources}/GStateBindingCallbackData.js +2 -2
  92. package/dist/resources/GStateBindingCallbackData.js.map +1 -0
  93. package/dist/{generated/resources → resources}/MeshDecalData.js +2 -2
  94. package/dist/resources/MeshDecalData.js.map +1 -0
  95. package/dist/{generated/resources → resources}/MeshDecalLodData.js +2 -2
  96. package/dist/resources/MeshDecalLodData.js.map +1 -0
  97. package/dist/resources/Tr2GrannyIntersectionResult.js +60 -0
  98. package/dist/resources/Tr2GrannyIntersectionResult.js.map +1 -0
  99. package/dist/{generated/resources → resources}/Tr2MaterialArea.js +2 -2
  100. package/dist/resources/Tr2MaterialArea.js.map +1 -0
  101. package/dist/{generated/resources → resources}/Tr2MaterialMesh.js +2 -2
  102. package/dist/resources/Tr2MaterialMesh.js.map +1 -0
  103. package/dist/{generated/resources → resources}/Tr2MaterialRes.js +2 -2
  104. package/dist/resources/Tr2MaterialRes.js.map +1 -0
  105. package/dist/{generated/resources → resources}/Tr2ShaderPermutation.js +2 -2
  106. package/dist/resources/Tr2ShaderPermutation.js.map +1 -0
  107. package/dist/{generated/resources → resources}/Tr2TextureLodManager.js +50 -10
  108. package/dist/resources/Tr2TextureLodManager.js.map +1 -0
  109. package/dist/{generated/resources → resources}/Tr2TextureLodUpdateRequest.js +2 -2
  110. package/dist/resources/Tr2TextureLodUpdateRequest.js.map +1 -0
  111. package/dist/{generated/resources → resources}/Tr2TexturePackChannel.js +2 -2
  112. package/dist/resources/Tr2TexturePackChannel.js.map +1 -0
  113. package/dist/resources/Tr2TexturePipeline.js +68 -0
  114. package/dist/resources/Tr2TexturePipeline.js.map +1 -0
  115. package/dist/{generated/resources → resources}/Tr2TexturePipelineParams.js +2 -2
  116. package/dist/resources/Tr2TexturePipelineParams.js.map +1 -0
  117. package/dist/{generated/resources → resources}/Tr2TexturePipelineStepCompress.js +3 -3
  118. package/dist/resources/Tr2TexturePipelineStepCompress.js.map +1 -0
  119. package/dist/{generated/resources → resources}/Tr2TexturePipelineStepLimitSize.js +2 -2
  120. package/dist/resources/Tr2TexturePipelineStepLimitSize.js.map +1 -0
  121. package/dist/{generated/resources → resources}/Tr2TexturePipelineStepLoad.js +2 -2
  122. package/dist/resources/Tr2TexturePipelineStepLoad.js.map +1 -0
  123. package/dist/{generated/resources → resources}/Tr2TexturePipelineStepPack.js +3 -3
  124. package/dist/resources/Tr2TexturePipelineStepPack.js.map +1 -0
  125. package/dist/{generated/resources → resources}/TriGeometryResAreaData.js +2 -2
  126. package/dist/resources/TriGeometryResAreaData.js.map +1 -0
  127. package/dist/{generated/resources → resources}/TriGeometryResJointData.js +2 -2
  128. package/dist/resources/TriGeometryResJointData.js.map +1 -0
  129. package/dist/{generated/resources → resources}/TriGeometryResLodData.js +2 -2
  130. package/dist/resources/TriGeometryResLodData.js.map +1 -0
  131. package/dist/{generated/resources → resources}/TriGeometryResMeshData.js +2 -2
  132. package/dist/resources/TriGeometryResMeshData.js.map +1 -0
  133. package/dist/{generated/resources → resources}/TriGeometryResSkeletonData.js +2 -2
  134. package/dist/resources/TriGeometryResSkeletonData.js.map +1 -0
  135. package/dist/{generated/resources → resources}/TriJointBinding.js +2 -2
  136. package/dist/resources/TriJointBinding.js.map +1 -0
  137. package/dist/{generated/resources → resources}/TriMorphTargetGeometryConstants.js +2 -2
  138. package/dist/resources/TriMorphTargetGeometryConstants.js.map +1 -0
  139. package/dist/{generated/resources → resources}/TriRtGeometryConstants.js +2 -2
  140. package/dist/resources/TriRtGeometryConstants.js.map +1 -0
  141. package/dist/resources/enums.js.map +1 -0
  142. package/dist/resources/texturePipelineBehavior.js +320 -0
  143. package/dist/resources/texturePipelineBehavior.js.map +1 -0
  144. package/format-notices/bnk/NOTICE +7 -4
  145. package/package.json +51 -51
  146. package/resource-lifecycle.md +262 -70
  147. package/dist/generated/resources/AudioGeometryResData.js.map +0 -1
  148. package/dist/generated/resources/CmfVertexReader.js +0 -46
  149. package/dist/generated/resources/CmfVertexReader.js.map +0 -1
  150. package/dist/generated/resources/GStateBindingCallbackData.js.map +0 -1
  151. package/dist/generated/resources/MeshDecalData.js.map +0 -1
  152. package/dist/generated/resources/MeshDecalLodData.js.map +0 -1
  153. package/dist/generated/resources/Tr2AsyncSave.js +0 -46
  154. package/dist/generated/resources/Tr2AsyncSave.js.map +0 -1
  155. package/dist/generated/resources/Tr2CmfContents.js +0 -37
  156. package/dist/generated/resources/Tr2CmfContents.js.map +0 -1
  157. package/dist/generated/resources/Tr2GrannyIntersectionResult.js +0 -58
  158. package/dist/generated/resources/Tr2GrannyIntersectionResult.js.map +0 -1
  159. package/dist/generated/resources/Tr2LoadPrepareFence.js +0 -37
  160. package/dist/generated/resources/Tr2LoadPrepareFence.js.map +0 -1
  161. package/dist/generated/resources/Tr2MaterialArea.js.map +0 -1
  162. package/dist/generated/resources/Tr2MaterialMesh.js.map +0 -1
  163. package/dist/generated/resources/Tr2MaterialRes.js.map +0 -1
  164. package/dist/generated/resources/Tr2ShaderPermutation.js.map +0 -1
  165. package/dist/generated/resources/Tr2TextureLodManager.js.map +0 -1
  166. package/dist/generated/resources/Tr2TextureLodUpdateRequest.js.map +0 -1
  167. package/dist/generated/resources/Tr2TexturePackChannel.js.map +0 -1
  168. package/dist/generated/resources/Tr2TexturePipeline.js +0 -44
  169. package/dist/generated/resources/Tr2TexturePipeline.js.map +0 -1
  170. package/dist/generated/resources/Tr2TexturePipelineParams.js.map +0 -1
  171. package/dist/generated/resources/Tr2TexturePipelineStepCompress.js.map +0 -1
  172. package/dist/generated/resources/Tr2TexturePipelineStepLimitSize.js.map +0 -1
  173. package/dist/generated/resources/Tr2TexturePipelineStepLoad.js.map +0 -1
  174. package/dist/generated/resources/Tr2TexturePipelineStepPack.js.map +0 -1
  175. package/dist/generated/resources/TriGeometryResAreaData.js.map +0 -1
  176. package/dist/generated/resources/TriGeometryResJointData.js.map +0 -1
  177. package/dist/generated/resources/TriGeometryResLodData.js.map +0 -1
  178. package/dist/generated/resources/TriGeometryResMeshData.js.map +0 -1
  179. package/dist/generated/resources/TriGeometryResSkeletonData.js.map +0 -1
  180. package/dist/generated/resources/TriJointBinding.js.map +0 -1
  181. package/dist/generated/resources/TriMorphTargetGeometryConstants.js.map +0 -1
  182. package/dist/generated/resources/TriRtGeometryConstants.js.map +0 -1
  183. package/dist/generated/resources/enums.js.map +0 -1
  184. package/dist/generated/resources/index.js +0 -32
  185. package/dist/generated/resources/index.js.map +0 -1
  186. /package/dist/{generated/resources → resources}/enums.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"CjsTgaFormat.js","sources":["../../../../src/formats/tga/CjsTgaFormat.js"],"sourcesContent":["import {\n DEFAULT_VALUES,\n OUTPUT_IMAGE,\n OUTPUT_JSON,\n OUTPUT_RAW,\n OUTPUT_RGBA,\n inspectWithValues,\n isSupportedWithValues,\n isTGA,\n normalizeValues,\n readWithValues,\n toBytes,\n toJsonValue\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsTgaFormat\";\n\nexport class CjsTgaFormat\n{\n #values = DEFAULT_VALUES;\n\n /**\n * Create a reusable TGA format profile.\n *\n * @param {object} [options] Default read/inspect options.\n */\n constructor(options = {})\n {\n this.SetValues(options);\n }\n\n /**\n * Merge options into this profile.\n *\n * @param {object} [options] Values to merge.\n * @returns {CjsTgaFormat} This format profile.\n */\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, { inputType: \"tga\", ...options }, FORMAT_NAME);\n return this;\n }\n\n /**\n * Get normalized profile values with optional per-call overrides.\n *\n * @param {object} [options] Per-call values.\n * @returns {object} Normalized read values.\n */\n GetValues(options = {})\n {\n return normalizeValues(this.#values, { inputType: \"tga\", ...options }, FORMAT_NAME);\n }\n\n /**\n * Read TGA bytes with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} GPU-free raw/debug/RGBA payload for the selected emit target.\n */\n Read(input, options = {})\n {\n return readWithValues(input, this.GetValues(options), \"tga\");\n }\n\n /**\n * Read TGA bytes asynchronously with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Per-call values.\n * @returns {Promise<object>} GPU-free raw/debug/RGBA payload for the selected emit target.\n */\n async ReadAsync(input, options = {})\n {\n return this.Read(input, options);\n }\n\n /**\n * Inspect TGA bytes without decoding full image data.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} TGA header metadata.\n */\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options), \"tga\");\n }\n\n /**\n * Report whether TGA input and requested output variants are supported.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} Support/probe report.\n */\n IsSupported(input, options = {})\n {\n return isSupportedWithValues(input, this.GetValues(options), \"tga\");\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n ToJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * One-shot TGA read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Read options.\n * @returns {object} GPU-free raw/debug/RGBA payload for the selected emit target.\n */\n static read(input, options = {})\n {\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"tga\", ...options }, FORMAT_NAME), \"tga\");\n }\n\n /**\n * One-shot asynchronous TGA read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Read options.\n * @returns {Promise<object>} GPU-free raw/debug/RGBA payload for the selected emit target.\n */\n static async readAsync(input, options = {})\n {\n return CjsTgaFormat.read(input, options);\n }\n\n /**\n * One-shot TGA inspection.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Inspect options.\n * @returns {object} TGA header metadata.\n */\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"tga\", ...options }, FORMAT_NAME), \"tga\");\n }\n\n /**\n * One-shot TGA support probe.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Probe options.\n * @returns {object} Support/probe report.\n */\n static isSupported(input, options = {})\n {\n return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"tga\", ...options }, FORMAT_NAME), \"tga\");\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n static toJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * Test whether bytes look like a TGA file.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Candidate TGA bytes.\n * @returns {boolean} True when the TGA header looks valid.\n */\n static isTGA(input)\n {\n try\n {\n return isTGA(toBytes(input));\n }\n catch\n {\n return false;\n }\n }\n\n static OUTPUT_IMAGE = OUTPUT_IMAGE;\n static OUTPUT_RGBA = OUTPUT_RGBA;\n static OUTPUT_RAW = OUTPUT_RAW;\n static OUTPUT_JSON = OUTPUT_JSON;\n static OUTPUT_TGA_JSON = \"tgaJson\";\n static type = Object.freeze([ \"image\" ]);\n static mediaTypes = Object.freeze([ \"image\" ]);\n static inputTypes = Object.freeze([ \"tga\" ]);\n static outputTypes = Object.freeze([ OUTPUT_IMAGE, OUTPUT_RGBA ]);\n static debugOutputTypes = Object.freeze([ \"tgaJson\", OUTPUT_RAW ]);\n}\n\nexport default CjsTgaFormat;\n"],"names":["FORMAT_NAME","CjsTgaFormat","DEFAULT_VALUES","constructor","options","SetValues","normalizeValues","inputType","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","IsSupported","isSupportedWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","isSupported","toJSON","isTGA","toBytes","OUTPUT_IMAGE","OUTPUT_RGBA","OUTPUT_RAW","OUTPUT_JSON","OUTPUT_TGA_JSON","type","Object","freeze","mediaTypes","inputTypes","outputTypes","debugOutputTypes"],"mappings":";;AAeA,MAAMA,WAAW,GAAG,cAAc;AAE3B,MAAMC,YAAY,CACzB;EACI,OAAO,GAAGC,cAAc;;AAExB;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;IACI,IAAI,CAAC,OAAO,GAAGE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE;AAAEC,MAAAA,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,EAClB;IACI,IACA;AACI,MAAA,OAAOe,KAAK,CAACC,OAAO,CAAChB,KAAK,CAAC,CAAC;AAChC,IAAA,CAAC,CACD,MACA;AACI,MAAA,OAAO,KAAK;AAChB,IAAA;AACJ,EAAA;EAEA,OAAOiB,YAAY,GAAGA,YAAY;EAClC,OAAOC,WAAW,GAAGA,WAAW;EAChC,OAAOC,UAAU,GAAGA,UAAU;EAC9B,OAAOC,WAAW,GAAGA,WAAW;EAChC,OAAOC,eAAe,GAAG,SAAS;EAClC,OAAOC,IAAI,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EACxC,OAAOC,UAAU,GAAGF,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EAC9C,OAAOE,UAAU,GAAGH,MAAM,CAACC,MAAM,CAAC,CAAE,KAAK,CAAE,CAAC;EAC5C,OAAOG,WAAW,GAAGJ,MAAM,CAACC,MAAM,CAAC,CAAEP,YAAY,EAAEC,WAAW,CAAE,CAAC;EACjE,OAAOU,gBAAgB,GAAGL,MAAM,CAACC,MAAM,CAAC,CAAE,SAAS,EAAEL,UAAU,CAAE,CAAC;AACtE;;;;"}
1
+ {"version":3,"file":"CjsTgaFormat.js","sources":["../../../../src/formats/tga/CjsTgaFormat.js"],"sourcesContent":["import {\n DEFAULT_VALUES,\n OUTPUT_IMAGE,\n OUTPUT_JSON,\n OUTPUT_RAW,\n OUTPUT_RGBA,\n inspectWithValues,\n isSupportedWithValues,\n isTGA,\n normalizeValues,\n readWithValues,\n toBytes,\n toJsonValue\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsTgaFormat\";\n\nexport class CjsTgaFormat\n{\n #values = DEFAULT_VALUES;\n\n /**\n * Create a reusable TGA format profile.\n *\n * @param {object} [options] Default read/inspect options.\n */\n constructor(options = {})\n {\n this.SetValues(options);\n }\n\n /**\n * Merge options into this profile.\n *\n * @param {object} [options] Values to merge.\n * @returns {CjsTgaFormat} This format profile.\n */\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, { inputType: \"tga\", ...options }, FORMAT_NAME);\n return this;\n }\n\n /**\n * Get normalized profile values with optional per-call overrides.\n *\n * @param {object} [options] Per-call values.\n * @returns {object} Normalized read values.\n */\n GetValues(options = {})\n {\n return normalizeValues(this.#values, { inputType: \"tga\", ...options }, FORMAT_NAME);\n }\n\n /**\n * Read TGA bytes with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} GPU-free raw/debug/RGBA payload for the selected emit target.\n */\n Read(input, options = {})\n {\n return readWithValues(input, this.GetValues(options), \"tga\");\n }\n\n /**\n * Read TGA bytes asynchronously with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Per-call values.\n * @returns {Promise<object>} GPU-free raw/debug/RGBA payload for the selected emit target.\n */\n async ReadAsync(input, options = {})\n {\n return this.Read(input, options);\n }\n\n /**\n * Inspect TGA bytes without decoding full image data.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} TGA header metadata.\n */\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options), \"tga\");\n }\n\n /**\n * Report whether TGA input and requested output variants are supported.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} Support/probe report.\n */\n IsSupported(input, options = {})\n {\n return isSupportedWithValues(input, this.GetValues(options), \"tga\");\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n ToJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * One-shot TGA read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Read options.\n * @returns {object} GPU-free raw/debug/RGBA payload for the selected emit target.\n */\n static read(input, options = {})\n {\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"tga\", ...options }, FORMAT_NAME), \"tga\");\n }\n\n /**\n * One-shot asynchronous TGA read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Read options.\n * @returns {Promise<object>} GPU-free raw/debug/RGBA payload for the selected emit target.\n */\n static async readAsync(input, options = {})\n {\n return CjsTgaFormat.read(input, options);\n }\n\n /**\n * One-shot TGA inspection.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Inspect options.\n * @returns {object} TGA header metadata.\n */\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"tga\", ...options }, FORMAT_NAME), \"tga\");\n }\n\n /**\n * One-shot TGA support probe.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input TGA bytes.\n * @param {object} [options] Probe options.\n * @returns {object} Support/probe report.\n */\n static isSupported(input, options = {})\n {\n return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"tga\", ...options }, FORMAT_NAME), \"tga\");\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n static toJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * Test whether bytes look like a TGA file.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Candidate TGA bytes.\n * @returns {boolean} True when the TGA header looks valid.\n */\n static isTGA(input)\n {\n try\n {\n return isTGA(toBytes(input));\n }\n catch\n {\n return false;\n }\n }\n\n /**\n * Emit targets for this format (canonical frozen enum).\n */\n static Output = Object.freeze({\n IMAGE: OUTPUT_IMAGE,\n RGBA: OUTPUT_RGBA,\n RAW: OUTPUT_RAW,\n JSON: OUTPUT_JSON\n });\n\n static OUTPUT_TGA_JSON = \"tgaJson\";\n\n static type = Object.freeze([ \"image\" ]);\n\n static mediaTypes = Object.freeze([ \"image\" ]);\n\n static inputTypes = Object.freeze([ \"tga\" ]);\n\n static outputTypes = Object.freeze([ OUTPUT_IMAGE, OUTPUT_RGBA ]);\n\n static debugOutputTypes = Object.freeze([ \"tgaJson\", OUTPUT_RAW ]);\n}\n\nexport default CjsTgaFormat;\n"],"names":["FORMAT_NAME","CjsTgaFormat","DEFAULT_VALUES","constructor","options","SetValues","normalizeValues","inputType","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","IsSupported","isSupportedWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","isSupported","toJSON","isTGA","toBytes","Output","Object","freeze","IMAGE","OUTPUT_IMAGE","RGBA","OUTPUT_RGBA","RAW","OUTPUT_RAW","JSON","OUTPUT_JSON","OUTPUT_TGA_JSON","type","mediaTypes","inputTypes","outputTypes","debugOutputTypes"],"mappings":";;AAeA,MAAMA,WAAW,GAAG,cAAc;AAE3B,MAAMC,YAAY,CACzB;EACI,OAAO,GAAGC,cAAc;;AAExB;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;IACI,IAAI,CAAC,OAAO,GAAGE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE;AAAEC,MAAAA,SAAS,EAAE,KAAK;MAAE,GAAGH;KAAS,EAAEJ,WAAW,CAAC;AAC3F,IAAA,OAAO,IAAI;AACf,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIQ,EAAAA,SAASA,CAACJ,OAAO,GAAG,EAAE,EACtB;AACI,IAAA,OAAOE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE;AAAEC,MAAAA,SAAS,EAAE,KAAK;MAAE,GAAGH;KAAS,EAAEJ,WAAW,CAAC;AACvF,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACA;AACI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ACV,GAAC,CAAC;EAEF,OAAOC,eAAe,GAAG,SAAS;EAElC,OAAOC,IAAI,GAAGX,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EAExC,OAAOW,UAAU,GAAGZ,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EAE9C,OAAOY,UAAU,GAAGb,MAAM,CAACC,MAAM,CAAC,CAAE,KAAK,CAAE,CAAC;EAE5C,OAAOa,WAAW,GAAGd,MAAM,CAACC,MAAM,CAAC,CAAEE,YAAY,EAAEE,WAAW,CAAE,CAAC;EAEjE,OAAOU,gBAAgB,GAAGf,MAAM,CAACC,MAAM,CAAC,CAAE,SAAS,EAAEM,UAAU,CAAE,CAAC;AACtE;;;;"}
@@ -1,4 +1,4 @@
1
- import { DEFAULT_VALUES, normalizeValues, readWithValues, inspectWithValues, isSupportedWithValues, toJsonValue, isWAV, toBytes, OUTPUT_AUDIO, OUTPUT_PCM, OUTPUT_RAW, OUTPUT_JSON } from './core/helpers.js';
1
+ import { DEFAULT_VALUES, normalizeValues, readWithValues, inspectWithValues, isSupportedWithValues, toJsonValue, isWAV, toBytes, OUTPUT_JSON, OUTPUT_RAW, OUTPUT_PCM, OUTPUT_AUDIO } from './core/helpers.js';
2
2
 
3
3
  const FORMAT_NAME = "CjsWavFormat";
4
4
  class CjsWavFormat {
@@ -170,10 +170,16 @@ class CjsWavFormat {
170
170
  return false;
171
171
  }
172
172
  }
173
- static OUTPUT_AUDIO = OUTPUT_AUDIO;
174
- static OUTPUT_PCM = OUTPUT_PCM;
175
- static OUTPUT_RAW = OUTPUT_RAW;
176
- static OUTPUT_JSON = OUTPUT_JSON;
173
+
174
+ /**
175
+ * Emit targets for this format (canonical frozen enum).
176
+ */
177
+ static Output = Object.freeze({
178
+ AUDIO: OUTPUT_AUDIO,
179
+ PCM: OUTPUT_PCM,
180
+ RAW: OUTPUT_RAW,
181
+ JSON: OUTPUT_JSON
182
+ });
177
183
  static OUTPUT_WAV_JSON = "wavJson";
178
184
  static type = Object.freeze(["audio"]);
179
185
  static mediaTypes = Object.freeze(["audio"]);
@@ -1 +1 @@
1
- {"version":3,"file":"CjsWavFormat.js","sources":["../../../../src/formats/wav/CjsWavFormat.js"],"sourcesContent":["import {\n DEFAULT_VALUES,\n OUTPUT_AUDIO,\n OUTPUT_JSON,\n OUTPUT_PCM,\n OUTPUT_RAW,\n inspectWithValues,\n isSupportedWithValues,\n isWAV,\n normalizeValues,\n readWithValues,\n toBytes,\n toJsonValue\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsWavFormat\";\n\nexport class CjsWavFormat\n{\n #values = DEFAULT_VALUES;\n\n /**\n * Create a reusable WAV format profile.\n *\n * @param {object} [options] Default read/inspect options.\n */\n constructor(options = {})\n {\n this.SetValues(options);\n }\n\n /**\n * Merge options into this profile.\n *\n * @param {object} [options] Values to merge.\n * @returns {CjsWavFormat} This format profile.\n */\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, { inputType: \"wav\", ...options }, FORMAT_NAME);\n return this;\n }\n\n /**\n * Get normalized profile values with optional per-call overrides.\n *\n * @param {object} [options] Per-call values.\n * @returns {object} Normalized read values.\n */\n GetValues(options = {})\n {\n return normalizeValues(this.#values, { inputType: \"wav\", ...options }, FORMAT_NAME);\n }\n\n /**\n * Read WAV bytes with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} GPU-free raw/debug/PCM payload for the selected emit target.\n */\n Read(input, options = {})\n {\n return readWithValues(input, this.GetValues(options), \"wav\");\n }\n\n /**\n * Read WAV bytes asynchronously with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Per-call values.\n * @returns {Promise<object>} GPU-free raw/debug/PCM payload for the selected emit target.\n */\n async ReadAsync(input, options = {})\n {\n return this.Read(input, options);\n }\n\n /**\n * Inspect WAV bytes without decoding sample data.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} RIFF/WAVE metadata.\n */\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options), \"wav\");\n }\n\n /**\n * Report whether WAV input and requested output variants are supported.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} Support/probe report.\n */\n IsSupported(input, options = {})\n {\n return isSupportedWithValues(input, this.GetValues(options), \"wav\");\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n ToJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * One-shot WAV read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Read options.\n * @returns {object} GPU-free raw/debug/PCM payload for the selected emit target.\n */\n static read(input, options = {})\n {\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"wav\", ...options }, FORMAT_NAME), \"wav\");\n }\n\n /**\n * One-shot asynchronous WAV read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Read options.\n * @returns {Promise<object>} GPU-free raw/debug/PCM payload for the selected emit target.\n */\n static async readAsync(input, options = {})\n {\n return CjsWavFormat.read(input, options);\n }\n\n /**\n * One-shot WAV inspection.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Inspect options.\n * @returns {object} RIFF/WAVE metadata.\n */\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"wav\", ...options }, FORMAT_NAME), \"wav\");\n }\n\n /**\n * One-shot WAV support probe.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Probe options.\n * @returns {object} Support/probe report.\n */\n static isSupported(input, options = {})\n {\n return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"wav\", ...options }, FORMAT_NAME), \"wav\");\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n static toJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * Test whether bytes look like a WAV file.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Candidate WAV bytes.\n * @returns {boolean} True when RIFF/WAVE signatures are present.\n */\n static isWAV(input)\n {\n try\n {\n return isWAV(toBytes(input));\n }\n catch\n {\n return false;\n }\n }\n\n static OUTPUT_AUDIO = OUTPUT_AUDIO;\n static OUTPUT_PCM = OUTPUT_PCM;\n static OUTPUT_RAW = OUTPUT_RAW;\n static OUTPUT_JSON = OUTPUT_JSON;\n static OUTPUT_WAV_JSON = \"wavJson\";\n static type = Object.freeze([ \"audio\" ]);\n static mediaTypes = Object.freeze([ \"audio\" ]);\n static inputTypes = Object.freeze([ \"wav\" ]);\n static outputTypes = Object.freeze([ OUTPUT_AUDIO, OUTPUT_PCM ]);\n static debugOutputTypes = Object.freeze([ \"wavJson\", OUTPUT_RAW ]);\n}\n\nexport default CjsWavFormat;\n"],"names":["FORMAT_NAME","CjsWavFormat","DEFAULT_VALUES","constructor","options","SetValues","normalizeValues","inputType","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","IsSupported","isSupportedWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","isSupported","toJSON","isWAV","toBytes","OUTPUT_AUDIO","OUTPUT_PCM","OUTPUT_RAW","OUTPUT_JSON","OUTPUT_WAV_JSON","type","Object","freeze","mediaTypes","inputTypes","outputTypes","debugOutputTypes"],"mappings":";;AAeA,MAAMA,WAAW,GAAG,cAAc;AAE3B,MAAMC,YAAY,CACzB;EACI,OAAO,GAAGC,cAAc;;AAExB;AACJ;AACA;AACA;AACA;AACIC,EAAAA,WAAWA,CAACC,OAAO,GAAG,EAAE,EACxB;AACI,IAAA,IAAI,CAACC,SAAS,CAACD,OAAO,CAAC;AAC3B,E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A;AACA;AACA;AACA;EACI,OAAOwB,MAAMA,CAACN,KAAK,EACnB;IACI,OAAOC,WAAW,CAACD,KAAK,CAAC;AAC7B,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;EACI,OAAOO,KAAKA,CAACf,KAAK,EAClB;IACI,IACA;AACI,MAAA,OAAOe,KAAK,CAACC,OAAO,CAAChB,KAAK,CAAC,CAAC;AAChC,IAAA,CAAC,CACD,MACA;AACI,MAAA,OAAO,KAAK;AAChB,IAAA;AACJ,EAAA;EAEA,OAAOiB,YAAY,GAAGA,YAAY;EAClC,OAAOC,UAAU,GAAGA,UAAU;EAC9B,OAAOC,UAAU,GAAGA,UAAU;EAC9B,OAAOC,WAAW,GAAGA,WAAW;EAChC,OAAOC,eAAe,GAAG,SAAS;EAClC,OAAOC,IAAI,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EACxC,OAAOC,UAAU,GAAGF,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EAC9C,OAAOE,UAAU,GAAGH,MAAM,CAACC,MAAM,CAAC,CAAE,KAAK,CAAE,CAAC;EAC5C,OAAOG,WAAW,GAAGJ,MAAM,CAACC,MAAM,CAAC,CAAEP,YAAY,EAAEC,UAAU,CAAE,CAAC;EAChE,OAAOU,gBAAgB,GAAGL,MAAM,CAACC,MAAM,CAAC,CAAE,SAAS,EAAEL,UAAU,CAAE,CAAC;AACtE;;;;"}
1
+ {"version":3,"file":"CjsWavFormat.js","sources":["../../../../src/formats/wav/CjsWavFormat.js"],"sourcesContent":["import {\n DEFAULT_VALUES,\n OUTPUT_AUDIO,\n OUTPUT_JSON,\n OUTPUT_PCM,\n OUTPUT_RAW,\n inspectWithValues,\n isSupportedWithValues,\n isWAV,\n normalizeValues,\n readWithValues,\n toBytes,\n toJsonValue\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsWavFormat\";\n\nexport class CjsWavFormat\n{\n #values = DEFAULT_VALUES;\n\n /**\n * Create a reusable WAV format profile.\n *\n * @param {object} [options] Default read/inspect options.\n */\n constructor(options = {})\n {\n this.SetValues(options);\n }\n\n /**\n * Merge options into this profile.\n *\n * @param {object} [options] Values to merge.\n * @returns {CjsWavFormat} This format profile.\n */\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, { inputType: \"wav\", ...options }, FORMAT_NAME);\n return this;\n }\n\n /**\n * Get normalized profile values with optional per-call overrides.\n *\n * @param {object} [options] Per-call values.\n * @returns {object} Normalized read values.\n */\n GetValues(options = {})\n {\n return normalizeValues(this.#values, { inputType: \"wav\", ...options }, FORMAT_NAME);\n }\n\n /**\n * Read WAV bytes with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} GPU-free raw/debug/PCM payload for the selected emit target.\n */\n Read(input, options = {})\n {\n return readWithValues(input, this.GetValues(options), \"wav\");\n }\n\n /**\n * Read WAV bytes asynchronously with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Per-call values.\n * @returns {Promise<object>} GPU-free raw/debug/PCM payload for the selected emit target.\n */\n async ReadAsync(input, options = {})\n {\n return this.Read(input, options);\n }\n\n /**\n * Inspect WAV bytes without decoding sample data.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} RIFF/WAVE metadata.\n */\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options), \"wav\");\n }\n\n /**\n * Report whether WAV input and requested output variants are supported.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} Support/probe report.\n */\n IsSupported(input, options = {})\n {\n return isSupportedWithValues(input, this.GetValues(options), \"wav\");\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n ToJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * One-shot WAV read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Read options.\n * @returns {object} GPU-free raw/debug/PCM payload for the selected emit target.\n */\n static read(input, options = {})\n {\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"wav\", ...options }, FORMAT_NAME), \"wav\");\n }\n\n /**\n * One-shot asynchronous WAV read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Read options.\n * @returns {Promise<object>} GPU-free raw/debug/PCM payload for the selected emit target.\n */\n static async readAsync(input, options = {})\n {\n return CjsWavFormat.read(input, options);\n }\n\n /**\n * One-shot WAV inspection.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Inspect options.\n * @returns {object} RIFF/WAVE metadata.\n */\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"wav\", ...options }, FORMAT_NAME), \"wav\");\n }\n\n /**\n * One-shot WAV support probe.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WAV bytes.\n * @param {object} [options] Probe options.\n * @returns {object} Support/probe report.\n */\n static isSupported(input, options = {})\n {\n return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"wav\", ...options }, FORMAT_NAME), \"wav\");\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n static toJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * Test whether bytes look like a WAV file.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Candidate WAV bytes.\n * @returns {boolean} True when RIFF/WAVE signatures are present.\n */\n static isWAV(input)\n {\n try\n {\n return isWAV(toBytes(input));\n }\n catch\n {\n return false;\n }\n }\n\n /**\n * Emit targets for this format (canonical frozen enum).\n */\n static Output = Object.freeze({\n AUDIO: OUTPUT_AUDIO,\n PCM: OUTPUT_PCM,\n RAW: OUTPUT_RAW,\n JSON: OUTPUT_JSON\n });\n static OUTPUT_WAV_JSON = \"wavJson\";\n static type = Object.freeze([ \"audio\" ]);\n static mediaTypes = Object.freeze([ \"audio\" ]);\n static inputTypes = Object.freeze([ \"wav\" ]);\n static outputTypes = Object.freeze([ OUTPUT_AUDIO, OUTPUT_PCM ]);\n static debugOutputTypes = Object.freeze([ \"wavJson\", OUTPUT_RAW ]);\n}\n\nexport default CjsWavFormat;\n"],"names":["FORMAT_NAME","CjsWavFormat","DEFAULT_VALUES","constructor","options","SetValues","normalizeValues","inputType","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","IsSupported","isSupportedWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","isSupported","toJSON","isWAV","toBytes","Output","Object","freeze","AUDIO","OUTPUT_AUDIO","PCM","OUTPUT_PCM","RAW","OUTPUT_RAW","JSON","OUTPUT_JSON","OUTPUT_WAV_JSON","type","mediaTypes","inputTypes","outputTypes","debugOutputTypes"],"mappings":";;AAeA,MAAMA,WAAW,GAAG,cAAc;AAE3B,MAAMC,YAAY,CACzB;EACI,OAAO,GAAGC,cAAc;;AAExB;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;IACI,IAAI,CAAC,OAAO,GAAGE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE;AAAEC,MAAAA,SAAS,EAAE,KAAK;MAAE,GAAGH;KAAS,EAAEJ,WAAW,CAAC;AAC3F,IAAA,OAAO,IAAI;AACf,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIQ,EAAAA,SAASA,CAACJ,OAAO,GAAG,EAAE,EACtB;AACI,IAAA,OAAOE,eAAe,CAAC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M,CAACC,MAAM,CAAC;AAC1BC,IAAAA,KAAK,EAAEC,YAAY;AACnBC,IAAAA,GAAG,EAAEC,UAAU;AACfC,IAAAA,GAAG,EAAEC,UAAU;AACfC,IAAAA,IAAI,EAAEC;AACV,GAAC,CAAC;EACF,OAAOC,eAAe,GAAG,SAAS;EAClC,OAAOC,IAAI,GAAGX,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EACxC,OAAOW,UAAU,GAAGZ,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EAC9C,OAAOY,UAAU,GAAGb,MAAM,CAACC,MAAM,CAAC,CAAE,KAAK,CAAE,CAAC;EAC5C,OAAOa,WAAW,GAAGd,MAAM,CAACC,MAAM,CAAC,CAAEE,YAAY,EAAEE,UAAU,CAAE,CAAC;EAChE,OAAOU,gBAAgB,GAAGf,MAAM,CAACC,MAAM,CAAC,CAAE,SAAS,EAAEM,UAAU,CAAE,CAAC;AACtE;;;;"}
@@ -1,4 +1,4 @@
1
- import { DEFAULT_VALUES, normalizeValues, readWithValues, inspectWithValues, isSupportedWithValues, toJsonValue, isWebM, toBytes, OUTPUT_VIDEO, OUTPUT_RAW, OUTPUT_JSON } from './core/helpers.js';
1
+ import { DEFAULT_VALUES, normalizeValues, readWithValues, inspectWithValues, isSupportedWithValues, toJsonValue, isWebM, toBytes, OUTPUT_JSON, OUTPUT_RAW, OUTPUT_VIDEO } from './core/helpers.js';
2
2
 
3
3
  const FORMAT_NAME = "CjsWebmFormat";
4
4
  class CjsWebmFormat {
@@ -170,9 +170,15 @@ class CjsWebmFormat {
170
170
  return false;
171
171
  }
172
172
  }
173
- static OUTPUT_VIDEO = OUTPUT_VIDEO;
174
- static OUTPUT_RAW = OUTPUT_RAW;
175
- static OUTPUT_JSON = OUTPUT_JSON;
173
+
174
+ /**
175
+ * Emit targets for this format (canonical frozen enum).
176
+ */
177
+ static Output = Object.freeze({
178
+ VIDEO: OUTPUT_VIDEO,
179
+ RAW: OUTPUT_RAW,
180
+ JSON: OUTPUT_JSON
181
+ });
176
182
  static OUTPUT_WEBM_JSON = "webmJson";
177
183
  static type = Object.freeze(["video"]);
178
184
  static mediaTypes = Object.freeze(["video"]);
@@ -1 +1 @@
1
- {"version":3,"file":"CjsWebmFormat.js","sources":["../../../../src/formats/webm/CjsWebmFormat.js"],"sourcesContent":["import {\n DEFAULT_VALUES,\n OUTPUT_JSON,\n OUTPUT_RAW,\n OUTPUT_VIDEO,\n inspectWithValues,\n isSupportedWithValues,\n isWebM,\n normalizeValues,\n readWithValues,\n toBytes,\n toJsonValue\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsWebmFormat\";\n\nexport class CjsWebmFormat\n{\n #values = DEFAULT_VALUES;\n\n /**\n * Create a reusable WebM format profile.\n *\n * @param {object} [options] Default read/inspect options.\n */\n constructor(options = {})\n {\n this.SetValues(options);\n }\n\n /**\n * Merge options into this profile.\n *\n * @param {object} [options] Values to merge.\n * @returns {CjsWebmFormat} This format profile.\n */\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, { inputType: \"webm\", ...options }, FORMAT_NAME);\n return this;\n }\n\n /**\n * Get normalized profile values with optional per-call overrides.\n *\n * @param {object} [options] Per-call values.\n * @returns {object} Normalized read values.\n */\n GetValues(options = {})\n {\n return normalizeValues(this.#values, { inputType: \"webm\", ...options }, FORMAT_NAME);\n }\n\n /**\n * Read WebM bytes with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WebM bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} GPU-free raw/debug payload for the selected emit target.\n */\n Read(input, options = {})\n {\n return readWithValues(input, this.GetValues(options), \"webm\");\n }\n\n /**\n * Read WebM bytes asynchronously with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WebM bytes.\n * @param {object} [options] Per-call values.\n * @returns {Promise<object>} GPU-free raw/debug payload for the selected emit target.\n */\n async ReadAsync(input, options = {})\n {\n return this.Read(input, options);\n }\n\n /**\n * Inspect WebM bytes without decoding media samples.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WebM bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} WebM container metadata.\n */\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options), \"webm\");\n }\n\n /**\n * Report whether WebM input and requested output variants are supported.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WebM bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} Support/probe report.\n */\n IsSupported(input, options = {})\n {\n return isSupportedWithValues(input, this.GetValues(options), \"webm\");\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n ToJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * One-shot WebM read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WebM bytes.\n * @param {object} [options] Read options.\n * @returns {object} GPU-free raw/debug payload for the selected emit target.\n */\n static read(input, options = {})\n {\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"webm\", ...options }, FORMAT_NAME), \"webm\");\n }\n\n /**\n * One-shot asynchronous WebM read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WebM bytes.\n * @param {object} [options] Read options.\n * @returns {Promise<object>} GPU-free raw/debug payload for the selected emit target.\n */\n static async readAsync(input, options = {})\n {\n return CjsWebmFormat.read(input, options);\n }\n\n /**\n * One-shot WebM inspection.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WebM bytes.\n * @param {object} [options] Inspect options.\n * @returns {object} WebM container metadata.\n */\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"webm\", ...options }, FORMAT_NAME), \"webm\");\n }\n\n /**\n * One-shot WebM support probe.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WebM bytes.\n * @param {object} [options] Probe options.\n * @returns {object} Support/probe report.\n */\n static isSupported(input, options = {})\n {\n return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"webm\", ...options }, FORMAT_NAME), \"webm\");\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n static toJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * Test whether bytes look like a WebM file.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Candidate WebM bytes.\n * @returns {boolean} True when the EBML signature is present.\n */\n static isWebM(input)\n {\n try\n {\n return isWebM(toBytes(input));\n }\n catch\n {\n return false;\n }\n }\n\n static OUTPUT_VIDEO = OUTPUT_VIDEO;\n static OUTPUT_RAW = OUTPUT_RAW;\n static OUTPUT_JSON = OUTPUT_JSON;\n static OUTPUT_WEBM_JSON = \"webmJson\";\n static type = Object.freeze([ \"video\" ]);\n static mediaTypes = Object.freeze([ \"video\" ]);\n static inputTypes = Object.freeze([ \"webm\" ]);\n static outputTypes = Object.freeze([ OUTPUT_VIDEO ]);\n static debugOutputTypes = Object.freeze([ \"webmJson\", OUTPUT_RAW ]);\n}\n\nexport default CjsWebmFormat;\n"],"names":["FORMAT_NAME","CjsWebmFormat","DEFAULT_VALUES","constructor","options","SetValues","normalizeValues","inputType","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","IsSupported","isSupportedWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","isSupported","toJSON","isWebM","toBytes","OUTPUT_VIDEO","OUTPUT_RAW","OUTPUT_JSON","OUTPUT_WEBM_JSON","type","Object","freeze","mediaTypes","inputTypes","outputTypes","debugOutputTypes"],"mappings":";;AAcA,MAAMA,WAAW,GAAG,eAAe;AAE5B,MAAMC,aAAa,CAC1B;EACI,OAAO,GAAGC,cAAc;;AAExB;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;A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A,CAACN,KAAK,EACnB;IACI,OAAOC,WAAW,CAACD,KAAK,CAAC;AAC7B,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;EACI,OAAOO,MAAMA,CAACf,KAAK,EACnB;IACI,IACA;AACI,MAAA,OAAOe,MAAM,CAACC,OAAO,CAAChB,KAAK,CAAC,CAAC;AACjC,IAAA,CAAC,CACD,MACA;AACI,MAAA,OAAO,KAAK;AAChB,IAAA;AACJ,EAAA;EAEA,OAAOiB,YAAY,GAAGA,YAAY;EAClC,OAAOC,UAAU,GAAGA,UAAU;EAC9B,OAAOC,WAAW,GAAGA,WAAW;EAChC,OAAOC,gBAAgB,GAAG,UAAU;EACpC,OAAOC,IAAI,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EACxC,OAAOC,UAAU,GAAGF,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EAC9C,OAAOE,UAAU,GAAGH,MAAM,CAACC,MAAM,CAAC,CAAE,MAAM,CAAE,CAAC;EAC7C,OAAOG,WAAW,GAAGJ,MAAM,CAACC,MAAM,CAAC,CAAEN,YAAY,CAAE,CAAC;EACpD,OAAOU,gBAAgB,GAAGL,MAAM,CAACC,MAAM,CAAC,CAAE,UAAU,EAAEL,UAAU,CAAE,CAAC;AACvE;;;;"}
1
+ {"version":3,"file":"CjsWebmFormat.js","sources":["../../../../src/formats/webm/CjsWebmFormat.js"],"sourcesContent":["import {\n DEFAULT_VALUES,\n OUTPUT_JSON,\n OUTPUT_RAW,\n OUTPUT_VIDEO,\n inspectWithValues,\n isSupportedWithValues,\n isWebM,\n normalizeValues,\n readWithValues,\n toBytes,\n toJsonValue\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsWebmFormat\";\n\nexport class CjsWebmFormat\n{\n #values = DEFAULT_VALUES;\n\n /**\n * Create a reusable WebM format profile.\n *\n * @param {object} [options] Default read/inspect options.\n */\n constructor(options = {})\n {\n this.SetValues(options);\n }\n\n /**\n * Merge options into this profile.\n *\n * @param {object} [options] Values to merge.\n * @returns {CjsWebmFormat} This format profile.\n */\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, { inputType: \"webm\", ...options }, FORMAT_NAME);\n return this;\n }\n\n /**\n * Get normalized profile values with optional per-call overrides.\n *\n * @param {object} [options] Per-call values.\n * @returns {object} Normalized read values.\n */\n GetValues(options = {})\n {\n return normalizeValues(this.#values, { inputType: \"webm\", ...options }, FORMAT_NAME);\n }\n\n /**\n * Read WebM bytes with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WebM bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} GPU-free raw/debug payload for the selected emit target.\n */\n Read(input, options = {})\n {\n return readWithValues(input, this.GetValues(options), \"webm\");\n }\n\n /**\n * Read WebM bytes asynchronously with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WebM bytes.\n * @param {object} [options] Per-call values.\n * @returns {Promise<object>} GPU-free raw/debug payload for the selected emit target.\n */\n async ReadAsync(input, options = {})\n {\n return this.Read(input, options);\n }\n\n /**\n * Inspect WebM bytes without decoding media samples.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WebM bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} WebM container metadata.\n */\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options), \"webm\");\n }\n\n /**\n * Report whether WebM input and requested output variants are supported.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WebM bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} Support/probe report.\n */\n IsSupported(input, options = {})\n {\n return isSupportedWithValues(input, this.GetValues(options), \"webm\");\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n ToJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * One-shot WebM read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WebM bytes.\n * @param {object} [options] Read options.\n * @returns {object} GPU-free raw/debug payload for the selected emit target.\n */\n static read(input, options = {})\n {\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"webm\", ...options }, FORMAT_NAME), \"webm\");\n }\n\n /**\n * One-shot asynchronous WebM read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WebM bytes.\n * @param {object} [options] Read options.\n * @returns {Promise<object>} GPU-free raw/debug payload for the selected emit target.\n */\n static async readAsync(input, options = {})\n {\n return CjsWebmFormat.read(input, options);\n }\n\n /**\n * One-shot WebM inspection.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WebM bytes.\n * @param {object} [options] Inspect options.\n * @returns {object} WebM container metadata.\n */\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"webm\", ...options }, FORMAT_NAME), \"webm\");\n }\n\n /**\n * One-shot WebM support probe.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input WebM bytes.\n * @param {object} [options] Probe options.\n * @returns {object} Support/probe report.\n */\n static isSupported(input, options = {})\n {\n return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"webm\", ...options }, FORMAT_NAME), \"webm\");\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n static toJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * Test whether bytes look like a WebM file.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Candidate WebM bytes.\n * @returns {boolean} True when the EBML signature is present.\n */\n static isWebM(input)\n {\n try\n {\n return isWebM(toBytes(input));\n }\n catch\n {\n return false;\n }\n }\n\n /**\n * Emit targets for this format (canonical frozen enum).\n */\n static Output = Object.freeze({\n VIDEO: OUTPUT_VIDEO,\n RAW: OUTPUT_RAW,\n JSON: OUTPUT_JSON\n });\n\n static OUTPUT_WEBM_JSON = \"webmJson\";\n\n static type = Object.freeze([ \"video\" ]);\n\n static mediaTypes = Object.freeze([ \"video\" ]);\n\n static inputTypes = Object.freeze([ \"webm\" ]);\n\n static outputTypes = Object.freeze([ OUTPUT_VIDEO ]);\n\n static debugOutputTypes = Object.freeze([ \"webmJson\", OUTPUT_RAW ]);\n}\n\nexport default CjsWebmFormat;\n"],"names":["FORMAT_NAME","CjsWebmFormat","DEFAULT_VALUES","constructor","options","SetValues","normalizeValues","inputType","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","IsSupported","isSupportedWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","isSupported","toJSON","isWebM","toBytes","Output","Object","freeze","VIDEO","OUTPUT_VIDEO","RAW","OUTPUT_RAW","JSON","OUTPUT_JSON","OUTPUT_WEBM_JSON","type","mediaTypes","inputTypes","outputTypes","debugOutputTypes"],"mappings":";;AAcA,MAAMA,WAAW,GAAG,eAAe;AAE5B,MAAMC,aAAa,CAC1B;EACI,OAAO,GAAGC,cAAc;;AAExB;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;IACI,IAAI,CAAC,OAAO,GAAGE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE;AAAEC,MAAAA,SAAS,EAAE,MAAM;MAAE,GAAGH;KAAS,EAAEJ,WAAW,CAAC;AAC5F,IAAA,OAAO,IAAI;AACf,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIQ,EAAAA,SAASA,CAACJ,OAAO,GAAG,EAAE,EACtB;AACI,IAAA,OAAOE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE;AAAEC,MAAAA,SAAS,EAAE,MAAM;MAAE,GAAGH;KAAS,EAAEJ,WAAW,CAAC;AACxF,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACA;AACIS,EAAAA,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AAU;EAEpC,OAAOC,IAAI,GAAGT,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EAExC,OAAOS,UAAU,GAAGV,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EAE9C,OAAOU,UAAU,GAAGX,MAAM,CAACC,MAAM,CAAC,CAAE,MAAM,CAAE,CAAC;EAE7C,OAAOW,WAAW,GAAGZ,MAAM,CAACC,MAAM,CAAC,CAAEE,YAAY,CAAE,CAAC;EAEpD,OAAOU,gBAAgB,GAAGb,MAAM,CAACC,MAAM,CAAC,CAAE,UAAU,EAAEI,UAAU,CAAE,CAAC;AACvE;;;;"}
@@ -1,4 +1,4 @@
1
- import { DEFAULT_VALUES, normalizeValues, readWithValues, inspectWithValues, isSupportedWithValues, toJsonValue, isWebP, toBytes, OUTPUT_RAW, OUTPUT_JSON } from './core/helpers.js';
1
+ import { DEFAULT_VALUES, normalizeValues, readWithValues, inspectWithValues, isSupportedWithValues, toJsonValue, isWebP, toBytes, OUTPUT_JSON, OUTPUT_RAW } from './core/helpers.js';
2
2
 
3
3
  const FORMAT_NAME = "CjsWebpFormat";
4
4
  class CjsWebpFormat {
@@ -65,8 +65,14 @@ class CjsWebpFormat {
65
65
  return false;
66
66
  }
67
67
  }
68
- static OUTPUT_RAW = OUTPUT_RAW;
69
- static OUTPUT_JSON = OUTPUT_JSON;
68
+
69
+ /**
70
+ * Emit targets for this format (canonical frozen enum).
71
+ */
72
+ static Output = Object.freeze({
73
+ RAW: OUTPUT_RAW,
74
+ JSON: OUTPUT_JSON
75
+ });
70
76
  static OUTPUT_WEBP_JSON = "webpJson";
71
77
  static type = Object.freeze(["image"]);
72
78
  static mediaTypes = Object.freeze(["image"]);
@@ -1 +1 @@
1
- {"version":3,"file":"CjsWebpFormat.js","sources":["../../../../src/formats/webp/CjsWebpFormat.js"],"sourcesContent":["import {\n DEFAULT_VALUES,\n OUTPUT_JSON,\n OUTPUT_RAW,\n inspectWithValues,\n isSupportedWithValues,\n isWebP,\n normalizeValues,\n readWithValues,\n toBytes,\n toJsonValue\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsWebpFormat\";\n\nexport class CjsWebpFormat\n{\n #values = DEFAULT_VALUES;\n\n constructor(options = {})\n {\n this.SetValues(options);\n }\n\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, { inputType: \"webp\", ...options }, FORMAT_NAME);\n return this;\n }\n\n GetValues(options = {})\n {\n return normalizeValues(this.#values, { inputType: \"webp\", ...options }, FORMAT_NAME);\n }\n\n Read(input, options = {})\n {\n return readWithValues(input, this.GetValues(options));\n }\n\n async ReadAsync(input, options = {})\n {\n return this.Read(input, options);\n }\n\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options));\n }\n\n IsSupported(input, options = {})\n {\n return isSupportedWithValues(input, this.GetValues(options));\n }\n\n ToJSON(value)\n {\n return toJsonValue(value);\n }\n\n static read(input, options = {})\n {\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"webp\", ...options }, FORMAT_NAME));\n }\n\n static async readAsync(input, options = {})\n {\n return CjsWebpFormat.read(input, options);\n }\n\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"webp\", ...options }, FORMAT_NAME));\n }\n\n static isSupported(input, options = {})\n {\n return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"webp\", ...options }, FORMAT_NAME));\n }\n\n static toJSON(value)\n {\n return toJsonValue(value);\n }\n\n static isWebP(input)\n {\n try\n {\n return isWebP(toBytes(input));\n }\n catch\n {\n return false;\n }\n }\n\n static OUTPUT_RAW = OUTPUT_RAW;\n static OUTPUT_JSON = OUTPUT_JSON;\n static OUTPUT_WEBP_JSON = \"webpJson\";\n static type = Object.freeze([ \"image\" ]);\n static mediaTypes = Object.freeze([ \"image\" ]);\n static inputTypes = Object.freeze([ \"webp\" ]);\n static outputTypes = Object.freeze([]);\n static debugOutputTypes = Object.freeze([ \"webpJson\", OUTPUT_RAW ]);\n static implementationStatus = \"metadata-only\";\n}\n\nexport default CjsWebpFormat;\n"],"names":["FORMAT_NAME","CjsWebpFormat","DEFAULT_VALUES","constructor","options","SetValues","normalizeValues","inputType","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","IsSupported","isSupportedWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","isSupported","toJSON","isWebP","toBytes","OUTPUT_RAW","OUTPUT_JSON","OUTPUT_WEBP_JSON","type","Object","freeze","mediaTypes","inputTypes","outputTypes","debugOutputTypes","implementationStatus"],"mappings":";;AAaA,MAAMA,WAAW,GAAG,eAAe;AAE5B,MAAMC,aAAa,CAC1B;EACI,OAAO,GAAGC,cAAc;AAExBC,EAAAA,WAAWA,CAACC,OAAO,GAAG,EAAE,EACxB;AACI,IAAA,IAAI,CAACC,SAAS,CAACD,OAAO,CAAC;AAC3B,EAAA;AAEAC,EAAAA,SAASA,CAACD,OAAO,GAAG,EAAE,EACtB;IACI,IAAI,CAAC,OAAO,GAAGE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE;AAAEC,MAAAA,SAAS,EAAE,MAAM;MAAE,GAAGH;KAAS,EAAEJ,WAAW,CAAC;AAC5F,IAAA,OAAO,IAAI;AACf,EAAA;AAEAQ,EAAAA,SAASA,CAACJ,OAAO,GAAG,EAAE,EACtB;AACI,IAAA,OAAOE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE;AAAEC,MAAAA,SAAS,EAAE,MAAM;MAAE,GAAGH;KAAS,EAAEJ,WAAW,CAAC;AACxF,EAAA;AAEAS,EAAAA,IAAIA,CAACC,KAAK,EAAEN,OAAO,GAAG,EAAE,EACxB;IACI,OAAOO,cAAc,CAACD,KAAK,EAAE,IAAI,CAACF,SAAS,CAACJ,OAAO,CAAC,CAAC;AACzD,EAAA;EAEA,MAAMQ,SAASA,CAACF,KAAK,EAAEN,OAAO,GAAG,EAAE,EACnC;AACI,IAAA,OAAO,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AAM;MAAE,GAAGH;KAAS,EAAEJ,WAAW,CAAC,CAAC;AACxH,EAAA;EAEA,OAAOwB,MAAMA,CAACN,KAAK,EACnB;IACI,OAAOC,WAAW,CAACD,KAAK,CAAC;AAC7B,EAAA;EAEA,OAAOO,MAAMA,CAACf,KAAK,EACnB;IACI,IACA;AACI,MAAA,OAAOe,MAAM,CAACC,OAAO,CAAChB,KAAK,CAAC,CAAC;AACjC,IAAA,CAAC,CACD,MACA;AACI,MAAA,OAAO,KAAK;AAChB,IAAA;AACJ,EAAA;EAEA,OAAOiB,UAAU,GAAGA,UAAU;EAC9B,OAAOC,WAAW,GAAGA,WAAW;EAChC,OAAOC,gBAAgB,GAAG,UAAU;EACpC,OAAOC,IAAI,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EACxC,OAAOC,UAAU,GAAGF,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EAC9C,OAAOE,UAAU,GAAGH,MAAM,CAACC,MAAM,CAAC,CAAE,MAAM,CAAE,CAAC;AAC7C,EAAA,OAAOG,WAAW,GAAGJ,MAAM,CAACC,MAAM,CAAC,EAAE,CAAC;EACtC,OAAOI,gBAAgB,GAAGL,MAAM,CAACC,MAAM,CAAC,CAAE,UAAU,EAAEL,UAAU,CAAE,CAAC;EACnE,OAAOU,oBAAoB,GAAG,eAAe;AACjD;;;;"}
1
+ {"version":3,"file":"CjsWebpFormat.js","sources":["../../../../src/formats/webp/CjsWebpFormat.js"],"sourcesContent":["import {\n DEFAULT_VALUES,\n OUTPUT_JSON,\n OUTPUT_RAW,\n inspectWithValues,\n isSupportedWithValues,\n isWebP,\n normalizeValues,\n readWithValues,\n toBytes,\n toJsonValue\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsWebpFormat\";\n\nexport class CjsWebpFormat\n{\n #values = DEFAULT_VALUES;\n\n constructor(options = {})\n {\n this.SetValues(options);\n }\n\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, { inputType: \"webp\", ...options }, FORMAT_NAME);\n return this;\n }\n\n GetValues(options = {})\n {\n return normalizeValues(this.#values, { inputType: \"webp\", ...options }, FORMAT_NAME);\n }\n\n Read(input, options = {})\n {\n return readWithValues(input, this.GetValues(options));\n }\n\n async ReadAsync(input, options = {})\n {\n return this.Read(input, options);\n }\n\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options));\n }\n\n IsSupported(input, options = {})\n {\n return isSupportedWithValues(input, this.GetValues(options));\n }\n\n ToJSON(value)\n {\n return toJsonValue(value);\n }\n\n static read(input, options = {})\n {\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"webp\", ...options }, FORMAT_NAME));\n }\n\n static async readAsync(input, options = {})\n {\n return CjsWebpFormat.read(input, options);\n }\n\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"webp\", ...options }, FORMAT_NAME));\n }\n\n static isSupported(input, options = {})\n {\n return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"webp\", ...options }, FORMAT_NAME));\n }\n\n static toJSON(value)\n {\n return toJsonValue(value);\n }\n\n static isWebP(input)\n {\n try\n {\n return isWebP(toBytes(input));\n }\n catch\n {\n return false;\n }\n }\n\n /**\n * Emit targets for this format (canonical frozen enum).\n */\n static Output = Object.freeze({\n RAW: OUTPUT_RAW,\n JSON: OUTPUT_JSON\n });\n\n static OUTPUT_WEBP_JSON = \"webpJson\";\n\n static type = Object.freeze([ \"image\" ]);\n\n static mediaTypes = Object.freeze([ \"image\" ]);\n\n static inputTypes = Object.freeze([ \"webp\" ]);\n\n static outputTypes = Object.freeze([]);\n\n static debugOutputTypes = Object.freeze([ \"webpJson\", OUTPUT_RAW ]);\n\n static implementationStatus = \"metadata-only\";\n}\n\nexport default CjsWebpFormat;\n"],"names":["FORMAT_NAME","CjsWebpFormat","DEFAULT_VALUES","constructor","options","SetValues","normalizeValues","inputType","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","IsSupported","isSupportedWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","isSupported","toJSON","isWebP","toBytes","Output","Object","freeze","RAW","OUTPUT_RAW","JSON","OUTPUT_JSON","OUTPUT_WEBP_JSON","type","mediaTypes","inputTypes","outputTypes","debugOutputTypes","implementationStatus"],"mappings":";;AAaA,MAAMA,WAAW,GAAG,eAAe;AAE5B,MAAMC,aAAa,CAC1B;EACI,OAAO,GAAGC,cAAc;AAExBC,EAAAA,WAAWA,CAACC,OAAO,GAAG,EAAE,EACxB;AACI,IAAA,IAAI,CAACC,SAAS,CAACD,OAAO,CAAC;AAC3B,EAAA;AAEAC,EAAAA,SAASA,CAACD,OAAO,GAAG,EAAE,EACtB;IACI,IAAI,CAAC,OAAO,GAAGE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE;AAAEC,MAAAA,SAAS,EAAE,MAAM;MAAE,GAAGH;KAAS,EAAEJ,WAAW,CAAC;AAC5F,IAAA,OAAO,IAAI;AACf,EAAA;AAEAQ,EAAAA,SAASA,CAACJ,OAAO,GAAG,EAAE,EACtB;AACI,IAAA,OAAOE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE;AAAEC,MAAAA,SAAS,EAAE,MAAM;MAAE,GAAGH;KAAS,EAAEJ,WAAW,CAAC;AACxF,EAAA;AAEAS,EAAAA,IAAIA,CAACC,KAAK,EAAEN,OAAO,GAAG,EAAE,EACxB;IACI,OAAOO,cAAc,CAACD,KAAK,EAAE,IAAI,CAACF,SAAS,CAACJ,OAAO,CAAC,CAAC;AACzD,EAAA;EAEA,MAAMQ,SAASA,CAACF,KAAK,EAAEN,OAAO,GAAG,EAAE,EACnC;AACI,IAAA,OAAO,IAAI,CAACK,IAAI,CAACC,KAAK,EAAEN,OAAO,CAAC;AACpC,EAAA;AAEAS,EAAAA,OAAOA,CAACH,KAAK,EAAEN,OAAO,GAAG,EAAE,EAC3B;IACI,OAAOU,iBAAiB,CAACJ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AEA,OAAOO,MAAMA,CAACf,KAAK,EACnB;IACI,IACA;AACI,MAAA,OAAOe,MAAM,CAACC,OAAO,CAAChB,KAAK,CAAC,CAAC;AACjC,IAAA,CAAC,CACD,MACA;AACI,MAAA,OAAO,KAAK;AAChB,IAAA;AACJ,EAAA;;AAEA;AACJ;AACA;AACI,EAAA,OAAOiB,MAAM,GAAGC,MAAM,CAACC,MAAM,CAAC;AAC1BC,IAAAA,GAAG,EAAEC,UAAU;AACfC,IAAAA,IAAI,EAAEC;AACV,GAAC,CAAC;EAEF,OAAOC,gBAAgB,GAAG,UAAU;EAEpC,OAAOC,IAAI,GAAGP,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EAExC,OAAOO,UAAU,GAAGR,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EAE9C,OAAOQ,UAAU,GAAGT,MAAM,CAACC,MAAM,CAAC,CAAE,MAAM,CAAE,CAAC;AAE7C,EAAA,OAAOS,WAAW,GAAGV,MAAM,CAACC,MAAM,CAAC,EAAE,CAAC;EAEtC,OAAOU,gBAAgB,GAAGX,MAAM,CAACC,MAAM,CAAC,CAAE,UAAU,EAAEE,UAAU,CAAE,CAAC;EAEnE,OAAOS,oBAAoB,GAAG,eAAe;AACjD;;;;"}
@@ -1,4 +1,5 @@
1
- import { DEFAULT_VALUES, normalizeValues, readWithValues, inspectWithValues, isSupportedWithValues, toJsonValue, isWEM, toBytes, OUTPUT_OGG, OUTPUT_RAW, OUTPUT_JSON, OUTPUT_WEM_JSON, WEM_CODEC_NAMES } from './core/helpers.js';
1
+ import { DEFAULT_VALUES, normalizeValues, readWithValues, inspectWithValues, isSupportedWithValues, toJsonValue, isWEM, toBytes, OUTPUT_OGG, OUTPUT_PCM, OUTPUT_WEM_JSON, OUTPUT_JSON, OUTPUT_RAW, WEM_CODEC_NAMES } from './core/helpers.js';
2
+ import { resolveTypeWithValues } from './core/resolve.js';
2
3
 
3
4
  const FORMAT_NAME = "CjsWemFormat";
4
5
 
@@ -140,6 +141,24 @@ class CjsWemFormat {
140
141
  return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));
141
142
  }
142
143
 
144
+ /**
145
+ * Content-verified codec/route resolution (kb §5 resolveType seam).
146
+ *
147
+ * Where `isSupported` trusts the fmt tag, this validates the declared
148
+ * codec against the container's actual structure (Vorbis sidecar,
149
+ * PTADPCM frame layout, PCM size consistency - bounded, no audio
150
+ * decode) and tries the other codecs when the declaration fails.
151
+ * The report carries `verified: true`, `preferred` = `ogg`/`pcm`/`raw`,
152
+ * and declared/resolved/mismatch evidence in `metadata`.
153
+ *
154
+ * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
155
+ * @param {object} [options] Probe options.
156
+ * @returns {Promise<object>} Content-verified probe report.
157
+ */
158
+ static async resolveType(input, options = {}) {
159
+ return resolveTypeWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));
160
+ }
161
+
143
162
  /**
144
163
  * Convert format output into JSON-compatible debug data.
145
164
  *
@@ -181,15 +200,40 @@ class CjsWemFormat {
181
200
  emit: OUTPUT_OGG
182
201
  });
183
202
  }
184
- static OUTPUT_RAW = OUTPUT_RAW;
185
- static OUTPUT_JSON = OUTPUT_JSON;
186
- static OUTPUT_WEM_JSON = OUTPUT_WEM_JSON;
187
- static OUTPUT_OGG = OUTPUT_OGG;
203
+
204
+ /**
205
+ * Decode wem audio data to per-channel float32 PCM (AudioBuffer-ready).
206
+ *
207
+ * Covers Wwise PTADPCM (0x8311) and uncompressed 16-bit PCM. Wwise Vorbis
208
+ * is not decoded here - repack it with `toOgg()` instead. Equivalent to
209
+ * `read(input, { emit: "pcm" })`.
210
+ *
211
+ * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.
212
+ * @param {object} [options] Read options.
213
+ * @returns {object} PCM payload with channelData, sample rate, and timing.
214
+ */
215
+ static toPcm(input, options = {}) {
216
+ return CjsWemFormat.read(input, {
217
+ ...options,
218
+ emit: OUTPUT_PCM
219
+ });
220
+ }
221
+
222
+ /**
223
+ * Emit targets for this format (canonical frozen enum).
224
+ */
225
+ static Output = Object.freeze({
226
+ RAW: OUTPUT_RAW,
227
+ JSON: OUTPUT_JSON,
228
+ WEM_JSON: OUTPUT_WEM_JSON,
229
+ OGG: OUTPUT_OGG,
230
+ PCM: OUTPUT_PCM
231
+ });
188
232
  static CODEC_NAMES = WEM_CODEC_NAMES;
189
233
  static type = Object.freeze(["audio"]);
190
234
  static mediaTypes = Object.freeze(["audio"]);
191
235
  static inputTypes = Object.freeze(["wem"]);
192
- static outputTypes = Object.freeze([OUTPUT_RAW, OUTPUT_OGG]);
236
+ static outputTypes = Object.freeze([OUTPUT_RAW, OUTPUT_OGG, OUTPUT_PCM]);
193
237
  static debugOutputTypes = Object.freeze([OUTPUT_WEM_JSON, OUTPUT_RAW]);
194
238
  }
195
239
 
@@ -1 +1 @@
1
- {"version":3,"file":"CjsWemFormat.js","sources":["../../../../src/formats/wem/CjsWemFormat.js"],"sourcesContent":["import {\n DEFAULT_VALUES,\n OUTPUT_JSON,\n OUTPUT_OGG,\n OUTPUT_RAW,\n OUTPUT_WEM_JSON,\n WEM_CODEC_NAMES,\n inspectWithValues,\n isSupportedWithValues,\n isWEM,\n normalizeValues,\n readWithValues,\n toBytes,\n toJsonValue\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsWemFormat\";\n\n/**\n * Reader for Audiokinetic Wwise media (.wem) containers.\n *\n * Inspection identifies the codec, channel/rate layout, and Vorbis duration\n * without decoding audio data. Read emits the container bytes untouched;\n * decode/transcode targets are deliberately out of scope for this reader.\n */\nexport class CjsWemFormat\n{\n #values = DEFAULT_VALUES;\n\n /**\n * Create a reusable wem format profile.\n *\n * @param {object} [options] Default read/inspect options.\n */\n constructor(options = {})\n {\n this.SetValues(options);\n }\n\n /**\n * Merge options into this profile.\n *\n * @param {object} [options] Values to merge.\n * @returns {CjsWemFormat} This format profile.\n */\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, options, FORMAT_NAME);\n return this;\n }\n\n /**\n * Get normalized profile values with optional per-call overrides.\n *\n * @param {object} [options] Per-call values.\n * @returns {object} Normalized read values.\n */\n GetValues(options = {})\n {\n return normalizeValues(this.#values, options, FORMAT_NAME);\n }\n\n /**\n * Read wem bytes with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} GPU-free raw/debug payload for the selected emit target.\n */\n Read(input, options = {})\n {\n return readWithValues(input, this.GetValues(options));\n }\n\n /**\n * Read wem bytes asynchronously with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Per-call values.\n * @returns {Promise<object>} GPU-free raw/debug payload for the selected emit target.\n */\n async ReadAsync(input, options = {})\n {\n return this.Read(input, options);\n }\n\n /**\n * Inspect wem bytes without decoding audio data.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} Wwise container metadata.\n */\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options));\n }\n\n /**\n * Report whether wem input and requested output variants are supported.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} Support/probe report.\n */\n IsSupported(input, options = {})\n {\n return isSupportedWithValues(input, this.GetValues(options));\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n ToJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * One-shot wem read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Read options.\n * @returns {object} GPU-free raw/debug payload for the selected emit target.\n */\n static read(input, options = {})\n {\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n /**\n * One-shot asynchronous wem read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Read options.\n * @returns {Promise<object>} GPU-free raw/debug payload for the selected emit target.\n */\n static async readAsync(input, options = {})\n {\n return CjsWemFormat.read(input, options);\n }\n\n /**\n * One-shot wem inspection.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Inspect options.\n * @returns {object} Wwise container metadata.\n */\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n /**\n * One-shot wem support probe.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Probe options.\n * @returns {object} Support/probe report.\n */\n static isSupported(input, options = {})\n {\n return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n static toJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * Test whether bytes look like a Wwise media container.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Candidate wem bytes.\n * @returns {boolean} True when RIFF/RIFX WAVE signatures are present.\n */\n static isWEM(input)\n {\n try\n {\n return isWEM(toBytes(input));\n }\n catch\n {\n return false;\n }\n }\n\n /**\n * Repack Wwise Vorbis wem bytes into a standard Ogg Vorbis stream.\n *\n * Lossless container transform (no audio decode/re-encode); output plays\n * natively where Ogg Vorbis is supported. Equivalent to\n * `read(input, { emit: \"ogg\" })`.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Options, including a `codebooks` override.\n * @returns {object} Ogg payload with bytes, timing, and loop metadata.\n */\n static toOgg(input, options = {})\n {\n return CjsWemFormat.read(input, { ...options, emit: OUTPUT_OGG });\n }\n\n static OUTPUT_RAW = OUTPUT_RAW;\n static OUTPUT_JSON = OUTPUT_JSON;\n static OUTPUT_WEM_JSON = OUTPUT_WEM_JSON;\n static OUTPUT_OGG = OUTPUT_OGG;\n static CODEC_NAMES = WEM_CODEC_NAMES;\n static type = Object.freeze([ \"audio\" ]);\n static mediaTypes = Object.freeze([ \"audio\" ]);\n static inputTypes = Object.freeze([ \"wem\" ]);\n static outputTypes = Object.freeze([ OUTPUT_RAW, OUTPUT_OGG ]);\n static debugOutputTypes = Object.freeze([ OUTPUT_WEM_JSON, OUTPUT_RAW ]);\n}\n\nexport default CjsWemFormat;\n"],"names":["FORMAT_NAME","CjsWemFormat","DEFAULT_VALUES","constructor","options","SetValues","normalizeValues","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","IsSupported","isSupportedWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","isSupported","toJSON","isWEM","toBytes","toOgg","emit","OUTPUT_OGG","OUTPUT_RAW","OUTPUT_JSON","OUTPUT_WEM_JSON","CODEC_NAMES","WEM_CODEC_NAMES","type","Object","freeze","mediaTypes","inputTypes","outputTypes","debugOutputTypes"],"mappings":";;AAgBA,MAAMA,WAAW,GAAG,cAAc;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,YAAY,CACzB;EACI,OAAO,GAAGC,cAAc;;AAExB;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,EAAEJ,WAAW,CAAC;AAClE,IAAA,OAAO,IAAI;AACf,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIO,EAAAA,SAASA,CAACH,OAAO,GAAG,EAAE,EACtB;IACI,OAAOE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAEF,OAAO,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AAGA,UAAU;EAC9B,OAAOI,WAAW,GAAGC,eAAe;EACpC,OAAOC,IAAI,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EACxC,OAAOC,UAAU,GAAGF,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EAC9C,OAAOE,UAAU,GAAGH,MAAM,CAACC,MAAM,CAAC,CAAE,KAAK,CAAE,CAAC;EAC5C,OAAOG,WAAW,GAAGJ,MAAM,CAACC,MAAM,CAAC,CAAEP,UAAU,EAAED,UAAU,CAAE,CAAC;EAC9D,OAAOY,gBAAgB,GAAGL,MAAM,CAACC,MAAM,CAAC,CAAEL,eAAe,EAAEF,UAAU,CAAE,CAAC;AAC5E;;;;"}
1
+ {"version":3,"file":"CjsWemFormat.js","sources":["../../../../src/formats/wem/CjsWemFormat.js"],"sourcesContent":["import {\n DEFAULT_VALUES,\n OUTPUT_JSON,\n OUTPUT_OGG,\n OUTPUT_PCM,\n OUTPUT_RAW,\n OUTPUT_WEM_JSON,\n WEM_CODEC_NAMES,\n inspectWithValues,\n isSupportedWithValues,\n isWEM,\n normalizeValues,\n readWithValues,\n toBytes,\n toJsonValue\n} from \"./core/helpers.js\";\nimport { resolveTypeWithValues } from \"./core/resolve.js\";\n\nconst FORMAT_NAME = \"CjsWemFormat\";\n\n/**\n * Reader for Audiokinetic Wwise media (.wem) containers.\n *\n * Inspection identifies the codec, channel/rate layout, and Vorbis duration\n * without decoding audio data. Read emits the container bytes untouched;\n * decode/transcode targets are deliberately out of scope for this reader.\n */\nexport class CjsWemFormat\n{\n #values = DEFAULT_VALUES;\n\n /**\n * Create a reusable wem format profile.\n *\n * @param {object} [options] Default read/inspect options.\n */\n constructor(options = {})\n {\n this.SetValues(options);\n }\n\n /**\n * Merge options into this profile.\n *\n * @param {object} [options] Values to merge.\n * @returns {CjsWemFormat} This format profile.\n */\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, options, FORMAT_NAME);\n return this;\n }\n\n /**\n * Get normalized profile values with optional per-call overrides.\n *\n * @param {object} [options] Per-call values.\n * @returns {object} Normalized read values.\n */\n GetValues(options = {})\n {\n return normalizeValues(this.#values, options, FORMAT_NAME);\n }\n\n /**\n * Read wem bytes with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} GPU-free raw/debug payload for the selected emit target.\n */\n Read(input, options = {})\n {\n return readWithValues(input, this.GetValues(options));\n }\n\n /**\n * Read wem bytes asynchronously with this profile.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Per-call values.\n * @returns {Promise<object>} GPU-free raw/debug payload for the selected emit target.\n */\n async ReadAsync(input, options = {})\n {\n return this.Read(input, options);\n }\n\n /**\n * Inspect wem bytes without decoding audio data.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} Wwise container metadata.\n */\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options));\n }\n\n /**\n * Report whether wem input and requested output variants are supported.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Per-call values.\n * @returns {object} Support/probe report.\n */\n IsSupported(input, options = {})\n {\n return isSupportedWithValues(input, this.GetValues(options));\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n ToJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * One-shot wem read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Read options.\n * @returns {object} GPU-free raw/debug payload for the selected emit target.\n */\n static read(input, options = {})\n {\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n /**\n * One-shot asynchronous wem read.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Read options.\n * @returns {Promise<object>} GPU-free raw/debug payload for the selected emit target.\n */\n static async readAsync(input, options = {})\n {\n return CjsWemFormat.read(input, options);\n }\n\n /**\n * One-shot wem inspection.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Inspect options.\n * @returns {object} Wwise container metadata.\n */\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n /**\n * One-shot wem support probe.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Probe options.\n * @returns {object} Support/probe report.\n */\n static isSupported(input, options = {})\n {\n return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n /**\n * Content-verified codec/route resolution (kb §5 resolveType seam).\n *\n * Where `isSupported` trusts the fmt tag, this validates the declared\n * codec against the container's actual structure (Vorbis sidecar,\n * PTADPCM frame layout, PCM size consistency - bounded, no audio\n * decode) and tries the other codecs when the declaration fails.\n * The report carries `verified: true`, `preferred` = `ogg`/`pcm`/`raw`,\n * and declared/resolved/mismatch evidence in `metadata`.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Probe options.\n * @returns {Promise<object>} Content-verified probe report.\n */\n static async resolveType(input, options = {})\n {\n return resolveTypeWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n /**\n * Convert format output into JSON-compatible debug data.\n *\n * @param {any} value Format output.\n * @returns {any} JSON-compatible value.\n */\n static toJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * Test whether bytes look like a Wwise media container.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Candidate wem bytes.\n * @returns {boolean} True when RIFF/RIFX WAVE signatures are present.\n */\n static isWEM(input)\n {\n try\n {\n return isWEM(toBytes(input));\n }\n catch\n {\n return false;\n }\n }\n\n /**\n * Repack Wwise Vorbis wem bytes into a standard Ogg Vorbis stream.\n *\n * Lossless container transform (no audio decode/re-encode); output plays\n * natively where Ogg Vorbis is supported. Equivalent to\n * `read(input, { emit: \"ogg\" })`.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Options, including a `codebooks` override.\n * @returns {object} Ogg payload with bytes, timing, and loop metadata.\n */\n static toOgg(input, options = {})\n {\n return CjsWemFormat.read(input, { ...options, emit: OUTPUT_OGG });\n }\n\n /**\n * Decode wem audio data to per-channel float32 PCM (AudioBuffer-ready).\n *\n * Covers Wwise PTADPCM (0x8311) and uncompressed 16-bit PCM. Wwise Vorbis\n * is not decoded here - repack it with `toOgg()` instead. Equivalent to\n * `read(input, { emit: \"pcm\" })`.\n *\n * @param {Uint8Array|ArrayBuffer|DataView} input Wem bytes.\n * @param {object} [options] Read options.\n * @returns {object} PCM payload with channelData, sample rate, and timing.\n */\n static toPcm(input, options = {})\n {\n return CjsWemFormat.read(input, { ...options, emit: OUTPUT_PCM });\n }\n\n /**\n * Emit targets for this format (canonical frozen enum).\n */\n static Output = Object.freeze({\n RAW: OUTPUT_RAW,\n JSON: OUTPUT_JSON,\n WEM_JSON: OUTPUT_WEM_JSON,\n OGG: OUTPUT_OGG,\n PCM: OUTPUT_PCM\n });\n static CODEC_NAMES = WEM_CODEC_NAMES;\n static type = Object.freeze([ \"audio\" ]);\n static mediaTypes = Object.freeze([ \"audio\" ]);\n static inputTypes = Object.freeze([ \"wem\" ]);\n static outputTypes = Object.freeze([ OUTPUT_RAW, OUTPUT_OGG, OUTPUT_PCM ]);\n static debugOutputTypes = Object.freeze([ OUTPUT_WEM_JSON, OUTPUT_RAW ]);\n}\n\nexport default CjsWemFormat;\n"],"names":["FORMAT_NAME","CjsWemFormat","DEFAULT_VALUES","constructor","options","SetValues","normalizeValues","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","IsSupported","isSupportedWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","isSupported","resolveType","resolveTypeWithValues","toJSON","isWEM","toBytes","toOgg","emit","OUTPUT_OGG","toPcm","OUTPUT_PCM","Output","Object","freeze","RAW","OUTPUT_RAW","JSON","OUTPUT_JSON","WEM_JSON","OUTPUT_WEM_JSON","OGG","PCM","CODEC_NAMES","WEM_CODEC_NAMES","type","mediaTypes","inputTypes","outputTypes","debugOutputTypes"],"mappings":";;;AAkBA,MAAMA,WAAW,GAAG,cAAc;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,YAAY,CACzB;EACI,OAAO,GAAGC,cAAc;;AAExB;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,EAAEJ,WAAW,CAAC;AAClE,IAAA,OAAO,IAAI;AACf,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIO,EAAAA,SAASA,CAACH,OAAO,GAAG,EAAE,EACtB;IACI,OAAOE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAEF,OAAO,EAAEJ,WAAW,CAAC;AAC9D,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACA;AACIQ,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,CAACF,KAAK,EAAEL,OAAO,GAAG,EAAE,EACnC;AACI,IAAA,OAAO,IAAI,CAACI,IAAI,CAACC,KAAK,EAAEL,OAAO,CAAC;AACpC,EAAA;;AAEA;AACJ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;AACI,EAAA,OAAOC,MAAM,GAAGC,MAAM,CAACC,MAAM,CAAC;AAC1BC,IAAAA,GAAG,EAAEC,UAAU;AACfC,IAAAA,IAAI,EAAEC,WAAW;AACjBC,IAAAA,QAAQ,EAAEC,eAAe;AACzBC,IAAAA,GAAG,EAAEZ,UAAU;AACfa,IAAAA,GAAG,EAAEX;AACT,GAAC,CAAC;EACF,OAAOY,WAAW,GAAGC,eAAe;EACpC,OAAOC,IAAI,GAAGZ,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EACxC,OAAOY,UAAU,GAAGb,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;EAC9C,OAAOa,UAAU,GAAGd,MAAM,CAACC,MAAM,CAAC,CAAE,KAAK,CAAE,CAAC;AAC5C,EAAA,OAAOc,WAAW,GAAGf,MAAM,CAACC,MAAM,CAAC,CAAEE,UAAU,EAAEP,UAAU,EAAEE,UAAU,CAAE,CAAC;EAC1E,OAAOkB,gBAAgB,GAAGhB,MAAM,CAACC,MAAM,CAAC,CAAEM,eAAe,EAAEJ,UAAU,CAAE,CAAC;AAC5E;;;;"}
@@ -1,9 +1,11 @@
1
1
  import { convertWemToOgg } from './wemToOgg.js';
2
+ import { decodePtadpcm } from './ptadpcm.js';
2
3
 
3
4
  const OUTPUT_RAW = "raw";
4
5
  const OUTPUT_JSON = "json";
5
6
  const OUTPUT_WEM_JSON = "wemJson";
6
7
  const OUTPUT_OGG = "ogg";
8
+ const OUTPUT_PCM = "pcm";
7
9
  const DEFAULT_VALUES = Object.freeze({
8
10
  emit: OUTPUT_RAW,
9
11
  inputType: "wem",
@@ -44,7 +46,7 @@ function normalizeValues(base = DEFAULT_VALUES, options = {}, readerName = "CjsW
44
46
  function normalizeEmit(emit, readerName) {
45
47
  if (emit === undefined || emit === null) return OUTPUT_RAW;
46
48
  if (emit === OUTPUT_JSON) return OUTPUT_WEM_JSON;
47
- if ([OUTPUT_RAW, OUTPUT_WEM_JSON, OUTPUT_OGG].includes(emit)) return emit;
49
+ if ([OUTPUT_RAW, OUTPUT_WEM_JSON, OUTPUT_OGG, OUTPUT_PCM].includes(emit)) return emit;
48
50
  throw new TypeError(`${readerName}: unknown emit value ${JSON.stringify(emit)}`);
49
51
  }
50
52
  function toBytes(input) {
@@ -186,12 +188,13 @@ function isSupportedWithValues(input, values = DEFAULT_VALUES) {
186
188
  try {
187
189
  const metadata = inspectWithValues(input, values);
188
190
  const oggSupport = getOggSupport(metadata);
191
+ const pcmSupport = getPcmSupport(metadata);
189
192
  return {
190
193
  format: "wem",
191
194
  source: values.source || "buffer",
192
195
  supported: metadata.codec ? "partial" : "none",
193
196
  confidence: metadata.codec ? 1 : 0.5,
194
- preferred: oggSupport.supported ? OUTPUT_OGG : "raw",
197
+ preferred: oggSupport.supported ? OUTPUT_OGG : pcmSupport.supported ? OUTPUT_PCM : "raw",
195
198
  reason: metadata.codec ? oggSupport.supported ? "Wwise Vorbis recognized; repacks losslessly to Ogg Vorbis." : metadata.codec === "wwise-vorbis" ? oggSupport.reason : "Wwise media container recognized; payloads pass through undecoded." : "RIFF/RIFX container recognized but no fmt chunk was found.",
196
199
  metadata,
197
200
  variants: [{
@@ -212,6 +215,15 @@ function isSupportedWithValues(input, values = DEFAULT_VALUES) {
212
215
  containerOnly: true,
213
216
  isDecoded: false,
214
217
  reason: oggSupport.supported ? "" : oggSupport.reason
218
+ }, {
219
+ kind: OUTPUT_PCM,
220
+ payloadType: OUTPUT_PCM,
221
+ codec: "float32",
222
+ supported: pcmSupport.supported,
223
+ containerOnly: false,
224
+ isDecoded: true,
225
+ pcmDecodeSupported: pcmSupport.supported,
226
+ reason: pcmSupport.supported ? "" : pcmSupport.reason
215
227
  }],
216
228
  warnings: [],
217
229
  errors: []
@@ -231,6 +243,57 @@ function isSupportedWithValues(input, values = DEFAULT_VALUES) {
231
243
  };
232
244
  }
233
245
  }
246
+
247
+ // PCM decode routing by codec: PTADPCM decodes through its own module;
248
+ // uncompressed 16-bit PCM deinterleaves directly. Compressed codecs with
249
+ // their own containers (Vorbis, Opus, XMA) are not decoded here - Vorbis
250
+ // repacks to Ogg instead (OUTPUT_OGG).
251
+ function decodeToPcm(bytes, metadata) {
252
+ if (metadata.codec === "wwise-ptadpcm") {
253
+ return decodePtadpcm(bytes, metadata);
254
+ }
255
+ if ((metadata.codec === "pcm" || metadata.codec === "pcm-extensible") && metadata.bitsPerSample === 16) {
256
+ const channels = Math.max(1, metadata.channels);
257
+ const sampleCount = Math.floor(metadata.dataBytes / (2 * channels));
258
+ const channelData = [];
259
+ for (let channel = 0; channel < channels; channel++) {
260
+ channelData.push(new Float32Array(sampleCount));
261
+ }
262
+ for (let i = 0; i < sampleCount; i++) {
263
+ for (let channel = 0; channel < channels; channel++) {
264
+ const at = metadata.dataOffset + (i * channels + channel) * 2;
265
+ const raw = bytes[at] | bytes[at + 1] << 8;
266
+ channelData[channel][i] = (raw >= 0x8000 ? raw - 0x10000 : raw) / 32768;
267
+ }
268
+ }
269
+ return {
270
+ channelData,
271
+ sampleCount,
272
+ sampleRate: metadata.sampleRate,
273
+ channels
274
+ };
275
+ }
276
+ const error = new Error(`wem: pcm decode is not supported for codec ${metadata.codec || "unknown"}`);
277
+ error.code = "CJS_FORMAT_OUTPUT_NOT_SUPPORTED";
278
+ error.sourceFormat = "wem";
279
+ throw error;
280
+ }
281
+ function getPcmSupport(metadata) {
282
+ if (metadata.codec === "wwise-ptadpcm") return {
283
+ supported: true,
284
+ reason: ""
285
+ };
286
+ if ((metadata.codec === "pcm" || metadata.codec === "pcm-extensible") && metadata.bitsPerSample === 16) {
287
+ return {
288
+ supported: true,
289
+ reason: ""
290
+ };
291
+ }
292
+ return {
293
+ supported: false,
294
+ reason: "PCM decode covers PTADPCM and 16-bit PCM; use the ogg emit for Wwise Vorbis."
295
+ };
296
+ }
234
297
  function getOggSupport(metadata) {
235
298
  if (metadata.codec !== "wwise-vorbis") {
236
299
  return {
@@ -289,6 +352,24 @@ function readWithValues(input, values = DEFAULT_VALUES) {
289
352
  bytes: ogg.bytes
290
353
  };
291
354
  }
355
+ if (values.emit === OUTPUT_PCM) {
356
+ const decoded = decodeToPcm(bytes, metadata);
357
+ return {
358
+ payloadType: OUTPUT_PCM,
359
+ sourceFormat: "wem",
360
+ outputFormat: OUTPUT_PCM,
361
+ codec: "float32",
362
+ sourceCodec: metadata.codec,
363
+ isDecoded: true,
364
+ pcmDecodeSupported: true,
365
+ sampleCount: decoded.sampleCount,
366
+ sampleRate: decoded.sampleRate,
367
+ channels: decoded.channels,
368
+ durationSeconds: decoded.sampleRate ? decoded.sampleCount / decoded.sampleRate : 0,
369
+ channelData: decoded.channelData,
370
+ metadata
371
+ };
372
+ }
292
373
  if (values.emit === OUTPUT_RAW) {
293
374
  return {
294
375
  payloadType: "raw",
@@ -332,5 +413,5 @@ function readU32(bytes, offset, littleEndian) {
332
413
  return littleEndian ? (bytes[offset] | bytes[offset + 1] << 8 | bytes[offset + 2] << 16 | bytes[offset + 3] * 0x1000000) >>> 0 : bytes[offset] * 0x1000000 + (bytes[offset + 1] << 16) + (bytes[offset + 2] << 8) + bytes[offset + 3] >>> 0;
333
414
  }
334
415
 
335
- export { DEFAULT_VALUES, OUTPUT_JSON, OUTPUT_OGG, OUTPUT_RAW, OUTPUT_WEM_JSON, WEM_CODEC_NAMES, inspectWEM, inspectWithValues, isSupportedWithValues, isWEM, normalizeEmit, normalizeValues, readWithValues, toBytes, toJsonValue };
416
+ export { DEFAULT_VALUES, OUTPUT_JSON, OUTPUT_OGG, OUTPUT_PCM, OUTPUT_RAW, OUTPUT_WEM_JSON, WEM_CODEC_NAMES, inspectWEM, inspectWithValues, isSupportedWithValues, isWEM, normalizeEmit, normalizeValues, readWithValues, toBytes, toJsonValue };
336
417
  //# sourceMappingURL=helpers.js.map