@vunk/plus 1.10.1 → 1.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/WebGLRenderer.mjs +1 -1
- package/components/WebGPURenderer.mjs +1 -1
- package/components/agent-chat-provider/index.mjs +1 -1
- package/components/avatar/index.mjs +1 -1
- package/components/broadcasting-markdown/index.mjs +16 -13
- package/components/broadcasting-markdown/src/index.vue.d.ts +1 -75
- package/components/browserAll.mjs +1 -1
- package/components/bubble-list/index.css +0 -22
- package/components/bubble-list/index.mjs +413 -9
- package/components/bubble-templates/index.mjs +1 -1
- package/components/chat-independent/index.mjs +1 -1
- package/components/drawer/index.css +92 -92
- package/components/drawer/index.mjs +2 -2
- package/components/index2.mjs +90 -11
- package/components/index3.mjs +20 -79450
- package/components/lottie-animation/index.mjs +1 -1
- package/components/metahuman-broadcasting/index.d.ts +0 -1
- package/components/metahuman-broadcasting/index.mjs +3092 -68
- package/components/metahuman-broadcasting/src/index.vue.d.ts +75 -191
- package/components/monaco-editor/index.mjs +1 -1
- package/components/monaco-environment/index.mjs +1 -1
- package/components/pixi-frame/index.d.ts +4 -1
- package/components/pixi-frame/index.mjs +2 -2
- package/components/pixi-frame/src/bitmap-generator.vue.d.ts +146 -0
- package/components/recorder-button/index.mjs +1 -1
- package/components/routes-menu-content/index.mjs +3 -3
- package/components/scrollbar/index.mjs +3 -3
- package/components/sender/index.mjs +2 -2
- package/components/speech-button/index.mjs +3 -3
- package/components/table-columns/index.mjs +1 -1
- package/components/tables-v1/index.mjs +1 -1
- package/components/tables-v1-checkbox/index.mjs +1 -1
- package/components/text/index.mjs +1 -1
- package/components/typing-markdown/index.mjs +1 -1
- package/components/vditor/index.mjs +3 -3
- package/components/webworkerAll.mjs +1 -1
- package/components/xgplayer/index.mjs +4 -16359
- package/icons/end/index.mjs +1 -1
- package/icons/keyboard/index.mjs +1 -1
- package/icons/start/index.mjs +1 -1
- package/icons/voice/index.mjs +1 -1
- package/index.css +92 -114
- package/package.json +4 -20
- package/shared/data/blobToAudioBuffer.d.ts +1 -0
- package/shared/data/imgUrlToBitmap.d.ts +1 -0
- package/shared/data/index.d.ts +2 -0
- package/shared/data/index.mjs +25 -0
- package/components/_baseUniq-BXtq6_NW.mjs +0 -239
- package/components/abap-B7h4dtBh.mjs +0 -6
- package/components/actionscript-3-Bmm7RA3Y.mjs +0 -6
- package/components/ada-BZS802Se.mjs +0 -6
- package/components/andromeeda-CrngpmZk.mjs +0 -3
- package/components/apache-D4roVlsU.mjs +0 -6
- package/components/apex-D6mfw0H5.mjs +0 -6
- package/components/apl-DDK-VObo.mjs +0 -18
- package/components/applescript-C43Knf0G.mjs +0 -6
- package/components/ara-DRBH84ND.mjs +0 -6
- package/components/arc-Js_tyW10.mjs +0 -131
- package/components/architecture-O4VJ6CD3-ZoZ2IAk2.mjs +0 -15
- package/components/architectureDiagram-SUXI7LT5-kyYGGrHN.mjs +0 -8678
- package/components/asm-3tg4MVib.mjs +0 -6
- package/components/astro-v4FYbRud.mjs +0 -19
- package/components/aurora-x-wJ4-eM2h.mjs +0 -3
- package/components/awk-ChreaG-G.mjs +0 -6
- package/components/ayu-dark-BEKp3oqs.mjs +0 -3
- package/components/ballerina-B0yt0TYU.mjs +0 -6
- package/components/batch-Ce_EX3Sx.mjs +0 -14
- package/components/beancount-BRIsdQEB.mjs +0 -6
- package/components/berry-Brv4WWdL.mjs +0 -14
- package/components/bibtex-BLeFwAes.mjs +0 -6
- package/components/bicep-BVrgfErX.mjs +0 -6
- package/components/blade-By3Sw_Ex.mjs +0 -22
- package/components/blockDiagram-6J76NXCF-IAr4zDV3.mjs +0 -3610
- package/components/c-C4VtT7JA.mjs +0 -6
- package/components/c4Diagram-6F6E4RAY-Dv27rXcJ.mjs +0 -2492
- package/components/catppuccin-frappe-zLMNRRUx.mjs +0 -3
- package/components/catppuccin-latte-CdF5jC3c.mjs +0 -3
- package/components/catppuccin-macchiato-DyjXeyRt.mjs +0 -3
- package/components/catppuccin-mocha-66IdYxR8.mjs +0 -3
- package/components/cdc-30ktANo3.mjs +0 -14
- package/components/channel-BBZy6zOT.mjs +0 -7
- package/components/chunk-353BL4L5-Dn_Y_Yna.mjs +0 -17
- package/components/chunk-67H74DCK-Br5U8bfD.mjs +0 -102
- package/components/chunk-AACKK3MU-DH_MKxca.mjs +0 -17
- package/components/chunk-BFAMUDN2-DHLCoYMN.mjs +0 -13
- package/components/chunk-E2GYISFI-DQPHyyga.mjs +0 -19
- package/components/chunk-OW32GOEJ-CQOSE6Bn.mjs +0 -1924
- package/components/chunk-SKB7J2MH-BlwHRDiW.mjs +0 -25
- package/components/chunk-SZ463SBG-DEp8buKJ.mjs +0 -1823
- package/components/clarity-6uBl6Vpb.mjs +0 -6
- package/components/classDiagram-M3E45YP4-D0ySDe-v.mjs +0 -32
- package/components/classDiagram-v2-YAWTLIQI-D0ySDe-v.mjs +0 -32
- package/components/clojure-COBRmwo8.mjs +0 -14
- package/components/clone-CEJtuQzg.mjs +0 -8
- package/components/cmake-CDfQILeU.mjs +0 -6
- package/components/cobol-BOOIiISO.mjs +0 -13
- package/components/coffee-DO_RGoZp.mjs +0 -9
- package/components/cpp-DAK8ktHO.mjs +0 -25
- package/components/crystal-CBGbbyVp.mjs +0 -19
- package/components/cs-h3ksD6-P.mjs +0 -14
- package/components/css-BtVcDqlU.mjs +0 -6
- package/components/cue-BFSVLV6N.mjs +0 -6
- package/components/cypher-Dl2CXoXF.mjs +0 -14
- package/components/cytoscape.esm-BojS1z60.mjs +0 -30216
- package/components/d-9qSZPw74.mjs +0 -6
- package/components/dagre-JOIXM2OF-5zx0JY2T.mjs +0 -707
- package/components/dark-plus-DmZ1Dzd4.mjs +0 -3
- package/components/dart-CCSsOg9l.mjs +0 -6
- package/components/dax-CvsmLV-B.mjs +0 -6
- package/components/defaultLocale-DVr69WTU.mjs +0 -202
- package/components/diagram-5UYTHUR4-C19nyAKc.mjs +0 -215
- package/components/diagram-VMROVX33-DkGwo-hj.mjs +0 -861
- package/components/diagram-ZTM2IBQH-CBgHCu9L.mjs +0 -317
- package/components/diff-BEdzuHlE.mjs +0 -6
- package/components/dockerfile-B3DP334t.mjs +0 -14
- package/components/dracula-B8-AVrwI.mjs +0 -3
- package/components/dracula-soft-BHeefow7.mjs +0 -3
- package/components/dream-maker-CNLQpoF-.mjs +0 -6
- package/components/elixir-0rTCSSfp.mjs +0 -11
- package/components/elm-BhwiZPvf.mjs +0 -10
- package/components/erDiagram-3M52JZNH-cttdAJXW.mjs +0 -1169
- package/components/erb-Lra8TlYM.mjs +0 -27
- package/components/erlang-D2NNgvtR.mjs +0 -17
- package/components/everforest-dark-Cg1xdODP.mjs +0 -3
- package/components/everforest-light-BmTD3bxe.mjs +0 -3
- package/components/fish-BU5HSdZy.mjs +0 -6
- package/components/flowDiagram-KYDEHFYC-9HpsqDdB.mjs +0 -2345
- package/components/fs-CdBSddpF.mjs +0 -17
- package/components/ganttDiagram-EK5VF46D-8QB3ofs6.mjs +0 -3497
- package/components/gdresource-CAbkn6H_.mjs +0 -11
- package/components/gdscript-Be_cubqt.mjs +0 -6
- package/components/gdshader-BEzE4j_3.mjs +0 -6
- package/components/gherkin-xCNF9gh8.mjs +0 -6
- package/components/git-commit-PP9xCApN.mjs +0 -9
- package/components/git-rebase-DqdGofLo.mjs +0 -9
- package/components/gitGraph-ZV4HHKMB-BSmtVGRu.mjs +0 -15
- package/components/gitGraphDiagram-GW3U2K7C-DNzc0Vx_.mjs +0 -1227
- package/components/github-dark-O22yVQaY.mjs +0 -3
- package/components/github-dark-default-DB2Hkvqn.mjs +0 -3
- package/components/github-dark-dimmed-CMZ_OfqC.mjs +0 -3
- package/components/github-dark-high-contrast-DmxWVmCU.mjs +0 -3
- package/components/github-light-BTbR9xVK.mjs +0 -3
- package/components/github-light-default-DWEonwFe.mjs +0 -3
- package/components/github-light-high-contrast-WJ_cPDts.mjs +0 -3
- package/components/glimmer-js-BkPYTyD4.mjs +0 -23
- package/components/glsl-CGsiYPcu.mjs +0 -9
- package/components/gnuplot-tV8vezdE.mjs +0 -6
- package/components/go-CBmVHZBz.mjs +0 -6
- package/components/graph-3zJxsO-i.mjs +0 -425
- package/components/graphql-D4pgneW3.mjs +0 -15
- package/components/groovy-Bn4MhXgW.mjs +0 -6
- package/components/gruvbox-dark-hard-C89wZ4s3.mjs +0 -3
- package/components/gruvbox-dark-medium-swz85q_b.mjs +0 -3
- package/components/gruvbox-dark-soft-BYHBHQJW.mjs +0 -3
- package/components/gruvbox-light-hard-DEF_ZxYZ.mjs +0 -3
- package/components/gruvbox-light-medium-ziUMnHJx.mjs +0 -3
- package/components/gruvbox-light-soft-Cuwp0tsB.mjs +0 -3
- package/components/gts-d3WsqAZM.mjs +0 -23
- package/components/hack-CwaBuF5l.mjs +0 -13
- package/components/haml-gLijj4rW.mjs +0 -11
- package/components/hbs-CFi5SpI3.mjs +0 -23
- package/components/hcl-axoq0Ycu.mjs +0 -6
- package/components/hjson-I7LcauIB.mjs +0 -6
- package/components/hlsl-TRzjajlb.mjs +0 -6
- package/components/houston-CF_ws8Cq.mjs +0 -3
- package/components/hs-DXSGqUFF.mjs +0 -14
- package/components/html-CLq-n30c.mjs +0 -11
- package/components/html-derivative-C8POX8SL.mjs +0 -9
- package/components/http-BYUKZ6kX.mjs +0 -20
- package/components/imba-C4923lSV.mjs +0 -6
- package/components/index4.mjs +0 -78
- package/components/info-63CPKGFF-C8sYWczU.mjs +0 -15
- package/components/infoDiagram-LHK5PUON-C-vFFPTf.mjs +0 -44
- package/components/init-ZxktEp_H.mjs +0 -15
- package/components/java-BfXh-0uJ.mjs +0 -6
- package/components/jinja-html-BmW4v_vu.mjs +0 -11
- package/components/jison-C9kAT_Oj.mjs +0 -9
- package/components/journeyDiagram-EWQZEKCU-BJrw4-AG.mjs +0 -1264
- package/components/js-CN_xSsjU.mjs +0 -14
- package/components/json-TjWBGEk1.mjs +0 -6
- package/components/json5-DCGCKrmX.mjs +0 -6
- package/components/jsonc-DLVLp8id.mjs +0 -6
- package/components/jsonl-B-R_pDGg.mjs +0 -6
- package/components/jsonnet-Cs8BnnC6.mjs +0 -6
- package/components/jssm-D_YBQ_cM.mjs +0 -14
- package/components/jsx-BPmvoin2.mjs +0 -6
- package/components/julia-C-JjBobP.mjs +0 -19
- package/components/kanagawa-dragon-DU8n2NNT.mjs +0 -3
- package/components/kanagawa-lotus-Byd0CDet.mjs +0 -3
- package/components/kanagawa-wave-DExoagcR.mjs +0 -3
- package/components/kanban-definition-ZSS6B67P-BptAnqU-.mjs +0 -1059
- package/components/kotlin-BM2ZNTMh.mjs +0 -6
- package/components/kusto-D9MF7CZf.mjs +0 -14
- package/components/laserwave-DF03wMlf.mjs +0 -3
- package/components/latex-BsqkLZB_.mjs +0 -10
- package/components/layout-sGZIJplX.mjs +0 -2043
- package/components/less-BAzLMJNR.mjs +0 -6
- package/components/light-plus-DS08Xg5J.mjs +0 -3
- package/components/linear-DqgVh5FN.mjs +0 -336
- package/components/liquid-f2VHt0dg.mjs +0 -15
- package/components/lisp-DAq1kaby.mjs +0 -6
- package/components/logo-D9l7oEJ8.mjs +0 -6
- package/components/lua-CH3ttzl_.mjs +0 -9
- package/components/makefile-D2qLe7q0.mjs +0 -14
- package/components/marko-DwRyI_--.mjs +0 -15
- package/components/material-theme-B8B2U48Q.mjs +0 -3
- package/components/material-theme-darker-BV0iY_T3.mjs +0 -3
- package/components/material-theme-lighter-DrzybSTF.mjs +0 -3
- package/components/material-theme-ocean-BRPLVReX.mjs +0 -3
- package/components/material-theme-palenight-DSJwsR_D.mjs +0 -3
- package/components/matlab-7XHduepk.mjs +0 -6
- package/components/md-BIvDPr-W.mjs +0 -14
- package/components/mdc-Rx6hWSHn.mjs +0 -16
- package/components/mdx-D5wExp-O.mjs +0 -6
- package/components/mermaid-CUjtoYEe.mjs +0 -6
- package/components/mermaid-parser.core-CH9ryA1K.mjs +0 -16987
- package/components/mermaid.core-CAqkCmS1.mjs +0 -20977
- package/components/min-BngCxx8g.mjs +0 -109
- package/components/min-dark-BNaN9fWk.mjs +0 -3
- package/components/min-light-CMrjentn.mjs +0 -3
- package/components/mindmap-definition-6CBA2TL7-Cp_EeEsh.mjs +0 -5856
- package/components/mojo-CrbF881p.mjs +0 -6
- package/components/monokai-DelygWXa.mjs +0 -3
- package/components/narrat-DOwkIbBe.mjs +0 -14
- package/components/nf-DHfvJ2gH.mjs +0 -14
- package/components/nginx-B_jWsywZ.mjs +0 -10
- package/components/night-owl-DSS199ra.mjs +0 -3
- package/components/nim-yzbnZKJd.mjs +0 -22
- package/components/nix--3K2gyjg.mjs +0 -6
- package/components/nord-CvDbBq5M.mjs +0 -3
- package/components/objective-c-DkOBZg1J.mjs +0 -14
- package/components/objective-cpp-DEoN9Fe5.mjs +0 -6
- package/components/ocaml-B1kfGk9Y.mjs +0 -6
- package/components/one-dark-pro-CsMf0BoJ.mjs +0 -3
- package/components/one-light-BwwAsfsj.mjs +0 -3
- package/components/ordinal-DSZU4PqD.mjs +0 -76
- package/components/packet-HUATNLJX-bfFWFja0.mjs +0 -15
- package/components/pascal-CU8Kjkr_.mjs +0 -6
- package/components/perl-FH6su6vZ.mjs +0 -18
- package/components/php-Dnl1TfYH.mjs +0 -20
- package/components/pie-WTHONI2E-QPrWs3SR.mjs +0 -15
- package/components/pieDiagram-NIOCPIFQ-C46Y_4C6.mjs +0 -250
- package/components/plastic-BjwMpBc0.mjs +0 -3
- package/components/plsql-B3Na24V4.mjs +0 -6
- package/components/poimandres-ChWyhPrn.mjs +0 -3
- package/components/postcss-kj1IbjVd.mjs +0 -6
- package/components/powerquery-B-e1fO-k.mjs +0 -6
- package/components/prisma-bmxcSDxq.mjs +0 -6
- package/components/prolog-BT9GCzqD.mjs +0 -6
- package/components/properties-D6yKO1eW.mjs +0 -14
- package/components/proto-BIXM0k1a.mjs +0 -6
- package/components/ps1-aFyNx8UH.mjs +0 -18
- package/components/pug-BrOx0bSt.mjs +0 -21
- package/components/puppet-N15G4Usj.mjs +0 -6
- package/components/purescript-DrwsEYNH.mjs +0 -6
- package/components/python-D2s92fRP.mjs +0 -14
- package/components/ql-DTm-NCRo.mjs +0 -14
- package/components/quadrantDiagram-2OG54O6I-Dgf6d6F_.mjs +0 -1349
- package/components/r-oprfD2-9.mjs +0 -6
- package/components/radar-NJJJXTRR-BnUCJhQL.mjs +0 -15
- package/components/raku-xArQd_rF.mjs +0 -14
- package/components/razor-BoXCAbWQ.mjs +0 -13
- package/components/red-DByOl5N0.mjs +0 -3
- package/components/reg-CULnG2WX.mjs +0 -6
- package/components/rel-CHRwzjd4.mjs +0 -6
- package/components/requirementDiagram-QOLK2EJ7-CSF6N7HA.mjs +0 -1173
- package/components/riscv-BNQ9cVpw.mjs +0 -6
- package/components/rose-pine-LL9gXmP2.mjs +0 -3
- package/components/rose-pine-dawn-CH9zdisO.mjs +0 -3
- package/components/rose-pine-moon-B1oKSfEJ.mjs +0 -3
- package/components/rst-bEtD1v7N.mjs +0 -36
- package/components/ruby-BmfBy6EV.mjs +0 -44
- package/components/rust-Bf_fdNdL.mjs +0 -14
- package/components/sankeyDiagram-4UZDY2LN-BAHB7dMS.mjs +0 -1201
- package/components/sas-BLBgC3TA.mjs +0 -9
- package/components/sass-BheygBdF.mjs +0 -6
- package/components/scala-B-_7vFVn.mjs +0 -6
- package/components/scheme-BSHdPinv.mjs +0 -6
- package/components/scss-Dq-LbI_c.mjs +0 -9
- package/components/sequenceDiagram-SKLFT4DO-10gLJ50N.mjs +0 -3424
- package/components/shaderlab-BOQRTiQi.mjs +0 -17
- package/components/shellsession-Cu3c0QAc.mjs +0 -17
- package/components/slack-dark-BEe10hxO.mjs +0 -3
- package/components/slack-ochin-BKmu9pBc.mjs +0 -3
- package/components/smalltalk-qxcGy4fT.mjs +0 -6
- package/components/snazzy-light-Dcvd-ZyI.mjs +0 -3
- package/components/solarized-dark-BBl5y5sR.mjs +0 -3
- package/components/solarized-light-DW9b_AY8.mjs +0 -3
- package/components/solidity-CewKZgp-.mjs +0 -6
- package/components/sparql-DswowMAp.mjs +0 -9
- package/components/splunk-gK6Iw_P9.mjs +0 -14
- package/components/sql-DzUuSofg.mjs +0 -6
- package/components/ssh-config-Bk_I5wDR.mjs +0 -6
- package/components/stata-Dl7wDdBE.mjs +0 -9
- package/components/stateDiagram-MI5ZYTHO-D6p6nCaj.mjs +0 -461
- package/components/stateDiagram-v2-5AN5P6BG-DaN5hC-t.mjs +0 -31
- package/components/stylus-qRNkxrFU.mjs +0 -14
- package/components/svelte-B9qv3vkS.mjs +0 -15
- package/components/swift-BRQRsam8.mjs +0 -6
- package/components/synthwave-84-CoUef9sh.mjs +0 -3
- package/components/system-verilog-BcESSvRn.mjs +0 -6
- package/components/tasl-DfOr2qHi.mjs +0 -6
- package/components/tcl-CTsc4-t7.mjs +0 -6
- package/components/tex-CumJx1zu.mjs +0 -9
- package/components/timeline-definition-MYPXXCX6-gLqnWxDu.mjs +0 -1236
- package/components/tokyo-night-DjtLpAEY.mjs +0 -3
- package/components/toml-vHPzWDj6.mjs +0 -6
- package/components/treemap-75Q7IDZK-B2atdfMH.mjs +0 -15
- package/components/tsx-CmGGo4Hm.mjs +0 -6
- package/components/turtle-BnC7StHY.mjs +0 -6
- package/components/twig-0XKNpXN1.mjs +0 -35
- package/components/typescript-CgxwwAuC.mjs +0 -14
- package/components/v-Bmdjo9cy.mjs +0 -6
- package/components/vb-DuF6ZenW.mjs +0 -14
- package/components/verilog-CCb_iTfF.mjs +0 -6
- package/components/vesper-4Q1cEwPL.mjs +0 -3
- package/components/vhdl-DMqk4T2s.mjs +0 -6
- package/components/vimscript-aKp9YbYm.mjs +0 -18
- package/components/vitesse-black-BqNLki8b.mjs +0 -3
- package/components/vitesse-dark-jJ32WhwH.mjs +0 -3
- package/components/vitesse-light-476zM4e6.mjs +0 -3
- package/components/vue-DVNNTw2l.mjs +0 -40
- package/components/vue-html-Cr5wciIP.mjs +0 -16
- package/components/vyper-DYedWgAE.mjs +0 -14
- package/components/wasm-BBh6f151.mjs +0 -6
- package/components/wasm-DDgzZJey.mjs +0 -7
- package/components/wenyan-BdqozpMZ.mjs +0 -6
- package/components/wgsl-Vo-hHVWH.mjs +0 -6
- package/components/wolfram-CRmjUoI4.mjs +0 -6
- package/components/xml-BMzZeaqs.mjs +0 -9
- package/components/xsl-CAhvzxWv.mjs +0 -10
- package/components/xychartDiagram-H2YORKM3-Whqa4ezL.mjs +0 -1895
- package/components/yml-BhSrWWMS.mjs +0 -14
- package/components/zenscript-DFINJL6j.mjs +0 -6
- package/components/zig-CS4FMAZp.mjs +0 -6
- package/components/zsh-hcK4TBd7.mjs +0 -26
- package/shared/StreamingInferenceService.mjs +0 -204
- package/shared/audioToFrames/index.d.ts +0 -19
- package/shared/audioToFrames/index.mjs +0 -44
- package/shared/audioToFrames/src/assets/mask.d.ts +0 -2
- package/shared/audioToFrames/src/audio/StreamingFeatureExtractorService.d.ts +0 -125
- package/shared/audioToFrames/src/audio/index.d.ts +0 -5
- package/shared/audioToFrames/src/audio/index.mjs +0 -375
- package/shared/audioToFrames/src/config.d.ts +0 -4
- package/shared/audioToFrames/src/core/constants.d.ts +0 -17
- package/shared/audioToFrames/src/core/index.d.ts +0 -6
- package/shared/audioToFrames/src/core/index.mjs +0 -24
- package/shared/audioToFrames/src/core/utils.d.ts +0 -26
- package/shared/audioToFrames/src/inference/StreamingInferenceService.d.ts +0 -189
- package/shared/audioToFrames/src/inference/index.d.ts +0 -5
- package/shared/audioToFrames/src/inference/index.mjs +0 -3
- package/shared/audioToFrames/src/media/DataLoaderService.d.ts +0 -59
- package/shared/audioToFrames/src/media/PredictiveFrameLoader.d.ts +0 -81
- package/shared/audioToFrames/src/media/index.d.ts +0 -6
- package/shared/audioToFrames/src/media/index.mjs +0 -236
- package/shared/config.mjs +0 -5
- package/shared/constants.mjs +0 -7
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file StreamingFeatureExtractorService.ts
|
|
3
|
-
*
|
|
4
|
-
* 流式音频特征提取服务模块。
|
|
5
|
-
* 1. 支持将长音频分割为5秒的chunk进行增量特征提取,显著降低首帧视频延迟。
|
|
6
|
-
* 2. 每个chunk独立提取特征,处理完成后立即通过回调通知上层。
|
|
7
|
-
* 3. 所有chunk处理完成后自动合并特征,输出完整特征序列。
|
|
8
|
-
*
|
|
9
|
-
* @author Zhonghan Li
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* 创建AudioContext的兼容函数,处理Safari的限制。
|
|
13
|
-
* 在Safari中,AudioContext需要在用户交互后才能创建。
|
|
14
|
-
*/
|
|
15
|
-
export declare function createAudioContext(): Promise<AudioContext>;
|
|
16
|
-
/**
|
|
17
|
-
* 特征提取结果接口
|
|
18
|
-
*/
|
|
19
|
-
export interface FeatureExtractionResult {
|
|
20
|
-
features: Float32Array;
|
|
21
|
-
dimensions: number[];
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* 单个chunk的特征提取结果结构体。
|
|
25
|
-
*/
|
|
26
|
-
export interface ChunkFeatureResult {
|
|
27
|
-
/** chunk索引(从0开始) */
|
|
28
|
-
chunkIndex: number;
|
|
29
|
-
/** 特征数据(Float32Array) */
|
|
30
|
-
features: Float32Array;
|
|
31
|
-
/** 特征维度信息 [帧数, 序列长度, mel频带数] */
|
|
32
|
-
dimensions: number[];
|
|
33
|
-
/** chunk起始时间(秒) */
|
|
34
|
-
startTimeSeconds: number;
|
|
35
|
-
/** chunk结束时间(秒) */
|
|
36
|
-
endTimeSeconds: number;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* 流式特征提取回调接口定义。
|
|
40
|
-
*/
|
|
41
|
-
export interface StreamingCallbacks {
|
|
42
|
-
/**
|
|
43
|
-
* 单个chunk处理完成时回调。
|
|
44
|
-
* @param result 当前chunk的特征结果。
|
|
45
|
-
*/
|
|
46
|
-
onChunkComplete?: (result: ChunkFeatureResult) => void;
|
|
47
|
-
/**
|
|
48
|
-
* 进度更新回调。
|
|
49
|
-
* @param completed 已完成的chunk数。
|
|
50
|
-
* @param total 总chunk数。
|
|
51
|
-
*/
|
|
52
|
-
onProgress?: (completed: number, total: number) => void;
|
|
53
|
-
/**
|
|
54
|
-
* 全部chunk处理完成时回调。
|
|
55
|
-
* @param totalDimensions 合并后特征的维度信息。
|
|
56
|
-
*/
|
|
57
|
-
onComplete?: (totalDimensions: number[]) => void;
|
|
58
|
-
/**
|
|
59
|
-
* 处理出错时回调。
|
|
60
|
-
* @param error 错误信息。
|
|
61
|
-
*/
|
|
62
|
-
onError?: (error: string) => void;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* 流式音频特征提取服务类。
|
|
66
|
-
* 支持将长音频分块并行处理,实时回调chunk结果,最终合并输出全部特征。
|
|
67
|
-
*/
|
|
68
|
-
export declare class StreamingFeatureExtractorService {
|
|
69
|
-
private queue;
|
|
70
|
-
/** 回调函数集合 */
|
|
71
|
-
private callbacks;
|
|
72
|
-
/** 存储每个chunk的处理结果,用于最终合并 */
|
|
73
|
-
private chunkResults;
|
|
74
|
-
/** 音频总chunk数 */
|
|
75
|
-
private totalChunks;
|
|
76
|
-
/** 已完成的chunk数 */
|
|
77
|
-
private completedChunks;
|
|
78
|
-
/** 已处理的总帧数累加器 */
|
|
79
|
-
private totalFramesProcessed;
|
|
80
|
-
/** 当前是否有任务在运行 */
|
|
81
|
-
private isRunning;
|
|
82
|
-
/** 当前处理的音频缓冲区 */
|
|
83
|
-
private audioBuffer;
|
|
84
|
-
/** 音频上下文实例,用于创建AudioBuffer */
|
|
85
|
-
private audioContext;
|
|
86
|
-
/** 复用的Worker实例,以提高性能 */
|
|
87
|
-
private worker;
|
|
88
|
-
/**
|
|
89
|
-
* 创建AudioBuffer的兼容方法,处理Safari的限制。
|
|
90
|
-
* @param numberOfChannels 声道数
|
|
91
|
-
* @param length 缓冲区长度
|
|
92
|
-
* @param sampleRate 采样率
|
|
93
|
-
* @returns AudioBuffer实例
|
|
94
|
-
*/
|
|
95
|
-
private createAudioBuffer;
|
|
96
|
-
/**
|
|
97
|
-
* 使用Worker处理AudioBuffer,提取特征
|
|
98
|
-
* @param audioBuffer 输入的AudioBuffer
|
|
99
|
-
* @returns Promise<FeatureExtractionResult>
|
|
100
|
-
*/
|
|
101
|
-
private processWithWorker;
|
|
102
|
-
/**
|
|
103
|
-
* 启动流式音频特征提取。
|
|
104
|
-
* @param audioBuffer 输入的音频缓冲区。
|
|
105
|
-
* @param callbacks 处理过程中的回调函数集合。
|
|
106
|
-
*/
|
|
107
|
-
processStreaming(audioBuffer: AudioBuffer, callbacks: StreamingCallbacks): Promise<void>;
|
|
108
|
-
/**
|
|
109
|
-
* 处理单个音频chunk,提取特征并回调。
|
|
110
|
-
* @param chunkIndex chunk的索引(从0开始)。
|
|
111
|
-
*/
|
|
112
|
-
private processChunk;
|
|
113
|
-
/**
|
|
114
|
-
* 所有chunk处理完成后,合并特征并调用onComplete。
|
|
115
|
-
*/
|
|
116
|
-
private finalize;
|
|
117
|
-
/**
|
|
118
|
-
* 清理内部状态和资源。
|
|
119
|
-
*/
|
|
120
|
-
private cleanup;
|
|
121
|
-
/**
|
|
122
|
-
* 停止当前的流式处理。
|
|
123
|
-
*/
|
|
124
|
-
stop(): void;
|
|
125
|
-
}
|
|
@@ -1,375 +0,0 @@
|
|
|
1
|
-
import { w as workerConfig } from '../../../config.mjs';
|
|
2
|
-
import { C as CHUNK_DURATION_SECONDS, a as NUM_SEQUENCE_FRAMES, N as NUM_MEL_BINS } from '../../../constants.mjs';
|
|
3
|
-
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8
|
-
|
|
9
|
-
// src/lib/_AsyncQueueEntry.ts
|
|
10
|
-
var _AsyncQueueEntry = class _AsyncQueueEntry {
|
|
11
|
-
constructor(queue) {
|
|
12
|
-
__publicField(this, "promise");
|
|
13
|
-
__publicField(this, "resolve");
|
|
14
|
-
__publicField(this, "reject");
|
|
15
|
-
__publicField(this, "queue");
|
|
16
|
-
__publicField(this, "signal", null);
|
|
17
|
-
__publicField(this, "signalListener", null);
|
|
18
|
-
this.queue = queue;
|
|
19
|
-
this.promise = new Promise((resolve, reject) => {
|
|
20
|
-
this.resolve = resolve;
|
|
21
|
-
this.reject = reject;
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
setSignal(signal) {
|
|
25
|
-
if (signal.aborted) return this;
|
|
26
|
-
this.signal = signal;
|
|
27
|
-
this.signalListener = () => {
|
|
28
|
-
const index = this.queue["promises"].indexOf(this);
|
|
29
|
-
if (index !== -1) this.queue["promises"].splice(index, 1);
|
|
30
|
-
this.reject(new Error("Request aborted manually"));
|
|
31
|
-
};
|
|
32
|
-
this.signal.addEventListener("abort", this.signalListener);
|
|
33
|
-
return this;
|
|
34
|
-
}
|
|
35
|
-
use() {
|
|
36
|
-
this.dispose();
|
|
37
|
-
this.resolve();
|
|
38
|
-
return this;
|
|
39
|
-
}
|
|
40
|
-
abort() {
|
|
41
|
-
this.dispose();
|
|
42
|
-
this.reject(new Error("Request aborted manually"));
|
|
43
|
-
return this;
|
|
44
|
-
}
|
|
45
|
-
dispose() {
|
|
46
|
-
if (this.signal) {
|
|
47
|
-
this.signal.removeEventListener("abort", this.signalListener);
|
|
48
|
-
this.signal = null;
|
|
49
|
-
this.signalListener = null;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
__name(_AsyncQueueEntry, "AsyncQueueEntry");
|
|
54
|
-
var AsyncQueueEntry = _AsyncQueueEntry;
|
|
55
|
-
|
|
56
|
-
// src/lib/AsyncQueue.ts
|
|
57
|
-
var _AsyncQueue = class _AsyncQueue {
|
|
58
|
-
constructor() {
|
|
59
|
-
/**
|
|
60
|
-
* The promises array
|
|
61
|
-
*/
|
|
62
|
-
__publicField(this, "promises", []);
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* The amount of entries in the queue, including the head.
|
|
66
|
-
* @seealso {@link queued} for the queued count.
|
|
67
|
-
*/
|
|
68
|
-
get remaining() {
|
|
69
|
-
return this.promises.length;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* The amount of queued entries.
|
|
73
|
-
* @seealso {@link remaining} for the count with the head.
|
|
74
|
-
*/
|
|
75
|
-
get queued() {
|
|
76
|
-
return this.remaining === 0 ? 0 : this.remaining - 1;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Waits for last promise and queues a new one
|
|
80
|
-
* @example
|
|
81
|
-
* ```typescript
|
|
82
|
-
* const queue = new AsyncQueue();
|
|
83
|
-
* async function request(url, options) {
|
|
84
|
-
* await queue.wait({ signal: options.signal });
|
|
85
|
-
* try {
|
|
86
|
-
* const result = await fetch(url, options);
|
|
87
|
-
* // Do some operations with 'result'
|
|
88
|
-
* } finally {
|
|
89
|
-
* // Remove first entry from the queue and resolve for the next entry
|
|
90
|
-
* queue.shift();
|
|
91
|
-
* }
|
|
92
|
-
* }
|
|
93
|
-
*
|
|
94
|
-
* request(someUrl1, someOptions1); // Will call fetch() immediately
|
|
95
|
-
* request(someUrl2, someOptions2); // Will call fetch() after the first finished
|
|
96
|
-
* request(someUrl3, someOptions3); // Will call fetch() after the second finished
|
|
97
|
-
* ```
|
|
98
|
-
*/
|
|
99
|
-
wait(options) {
|
|
100
|
-
const entry = new AsyncQueueEntry(this);
|
|
101
|
-
if (this.promises.length === 0) {
|
|
102
|
-
this.promises.push(entry);
|
|
103
|
-
return Promise.resolve();
|
|
104
|
-
}
|
|
105
|
-
this.promises.push(entry);
|
|
106
|
-
if (options?.signal) entry.setSignal(options.signal);
|
|
107
|
-
return entry.promise;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Unlocks the head lock and transfers the next lock (if any) to the head.
|
|
111
|
-
*/
|
|
112
|
-
shift() {
|
|
113
|
-
if (this.promises.length === 0) return;
|
|
114
|
-
if (this.promises.length === 1) {
|
|
115
|
-
this.promises.shift();
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
this.promises.shift();
|
|
119
|
-
this.promises[0].use();
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Aborts all the pending promises.
|
|
123
|
-
* @note To avoid race conditions, this does **not** unlock the head lock.
|
|
124
|
-
*/
|
|
125
|
-
abortAll() {
|
|
126
|
-
if (this.queued === 0) return;
|
|
127
|
-
for (let i = 1; i < this.promises.length; ++i) {
|
|
128
|
-
this.promises[i].abort();
|
|
129
|
-
}
|
|
130
|
-
this.promises.length = 1;
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
__name(_AsyncQueue, "AsyncQueue");
|
|
134
|
-
var AsyncQueue = _AsyncQueue;
|
|
135
|
-
|
|
136
|
-
async function createAudioContext() {
|
|
137
|
-
const AudioContextClass = window.AudioContext || window.webkitAudioContext;
|
|
138
|
-
if (!AudioContextClass) {
|
|
139
|
-
throw new Error("\u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301Web Audio API");
|
|
140
|
-
}
|
|
141
|
-
const audioContext = new AudioContextClass();
|
|
142
|
-
if (audioContext.state === "suspended") {
|
|
143
|
-
await audioContext.resume();
|
|
144
|
-
}
|
|
145
|
-
return audioContext;
|
|
146
|
-
}
|
|
147
|
-
class StreamingFeatureExtractorService {
|
|
148
|
-
constructor() {
|
|
149
|
-
this.queue = new AsyncQueue();
|
|
150
|
-
/** 回调函数集合 */
|
|
151
|
-
this.callbacks = {};
|
|
152
|
-
/** 存储每个chunk的处理结果,用于最终合并 */
|
|
153
|
-
this.chunkResults = [];
|
|
154
|
-
/** 音频总chunk数 */
|
|
155
|
-
this.totalChunks = 0;
|
|
156
|
-
/** 已完成的chunk数 */
|
|
157
|
-
this.completedChunks = 0;
|
|
158
|
-
/** 已处理的总帧数累加器 */
|
|
159
|
-
this.totalFramesProcessed = 0;
|
|
160
|
-
/** 当前是否有任务在运行 */
|
|
161
|
-
this.isRunning = false;
|
|
162
|
-
/** 当前处理的音频缓冲区 */
|
|
163
|
-
this.audioBuffer = null;
|
|
164
|
-
/** 音频上下文实例,用于创建AudioBuffer */
|
|
165
|
-
this.audioContext = null;
|
|
166
|
-
/** 复用的Worker实例,以提高性能 */
|
|
167
|
-
this.worker = null;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* 创建AudioBuffer的兼容方法,处理Safari的限制。
|
|
171
|
-
* @param numberOfChannels 声道数
|
|
172
|
-
* @param length 缓冲区长度
|
|
173
|
-
* @param sampleRate 采样率
|
|
174
|
-
* @returns AudioBuffer实例
|
|
175
|
-
*/
|
|
176
|
-
async createAudioBuffer(numberOfChannels, length, sampleRate) {
|
|
177
|
-
try {
|
|
178
|
-
return new AudioBuffer({
|
|
179
|
-
numberOfChannels,
|
|
180
|
-
length,
|
|
181
|
-
sampleRate
|
|
182
|
-
});
|
|
183
|
-
} catch {
|
|
184
|
-
if (!this.audioContext) {
|
|
185
|
-
const AudioContextClass = window.AudioContext || window.webkitAudioContext;
|
|
186
|
-
this.audioContext = new AudioContextClass();
|
|
187
|
-
}
|
|
188
|
-
return this.audioContext.createBuffer(
|
|
189
|
-
numberOfChannels,
|
|
190
|
-
length,
|
|
191
|
-
sampleRate
|
|
192
|
-
);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* 使用Worker处理AudioBuffer,提取特征
|
|
197
|
-
* @param audioBuffer 输入的AudioBuffer
|
|
198
|
-
* @returns Promise<FeatureExtractionResult>
|
|
199
|
-
*/
|
|
200
|
-
async processWithWorker(audioBuffer) {
|
|
201
|
-
if (!this.worker) {
|
|
202
|
-
throw new Error("Worker not initialized");
|
|
203
|
-
}
|
|
204
|
-
return new Promise((resolve, reject) => {
|
|
205
|
-
const cleanup = () => {
|
|
206
|
-
if (this.worker) {
|
|
207
|
-
this.worker.removeEventListener("message", handleMessage);
|
|
208
|
-
this.worker.removeEventListener("error", handleError);
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
function handleMessage(event) {
|
|
212
|
-
cleanup();
|
|
213
|
-
if (event.data.status === "success") {
|
|
214
|
-
resolve(event.data.payload);
|
|
215
|
-
} else {
|
|
216
|
-
reject(new Error(event.data.error || "Unknown worker error"));
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
function handleError(error) {
|
|
220
|
-
cleanup();
|
|
221
|
-
reject(error);
|
|
222
|
-
}
|
|
223
|
-
this.worker.addEventListener("message", handleMessage);
|
|
224
|
-
this.worker.addEventListener("error", handleError);
|
|
225
|
-
const leftChannel = audioBuffer.getChannelData(0);
|
|
226
|
-
const rightChannel = audioBuffer.numberOfChannels > 1 ? audioBuffer.getChannelData(1) : void 0;
|
|
227
|
-
const message = {
|
|
228
|
-
leftChannel,
|
|
229
|
-
rightChannel,
|
|
230
|
-
sampleRate: audioBuffer.sampleRate
|
|
231
|
-
};
|
|
232
|
-
const transferList = [leftChannel.buffer, rightChannel?.buffer].filter(Boolean);
|
|
233
|
-
this.worker.postMessage(message, transferList);
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* 启动流式音频特征提取。
|
|
238
|
-
* @param audioBuffer 输入的音频缓冲区。
|
|
239
|
-
* @param callbacks 处理过程中的回调函数集合。
|
|
240
|
-
*/
|
|
241
|
-
async processStreaming(audioBuffer, callbacks) {
|
|
242
|
-
await this.queue.wait();
|
|
243
|
-
if (this.isRunning) {
|
|
244
|
-
throw new Error("\u53E6\u4E00\u4E2A\u97F3\u9891\u6B63\u5728\u5904\u7406\u4E2D\uFF0C\u8BF7\u7A0D\u5019\u3002");
|
|
245
|
-
}
|
|
246
|
-
this.isRunning = true;
|
|
247
|
-
this.audioBuffer = audioBuffer;
|
|
248
|
-
this.callbacks = callbacks;
|
|
249
|
-
this.chunkResults = [];
|
|
250
|
-
this.completedChunks = 0;
|
|
251
|
-
this.totalFramesProcessed = 0;
|
|
252
|
-
if (!this.worker) {
|
|
253
|
-
this.worker = new Worker(
|
|
254
|
-
/* @vite-ignore */
|
|
255
|
-
`${workerConfig.path}/feature.worker.js`,
|
|
256
|
-
{ type: "module" }
|
|
257
|
-
);
|
|
258
|
-
}
|
|
259
|
-
const durationSeconds = audioBuffer.duration;
|
|
260
|
-
this.totalChunks = Math.ceil(durationSeconds / CHUNK_DURATION_SECONDS);
|
|
261
|
-
try {
|
|
262
|
-
for (let chunkIndex = 0; chunkIndex < this.totalChunks; chunkIndex++) {
|
|
263
|
-
if (!this.isRunning)
|
|
264
|
-
break;
|
|
265
|
-
await this.processChunk(chunkIndex);
|
|
266
|
-
}
|
|
267
|
-
if (this.isRunning) {
|
|
268
|
-
await this.finalize();
|
|
269
|
-
}
|
|
270
|
-
} catch (error) {
|
|
271
|
-
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
272
|
-
this.callbacks.onError?.(errorMessage);
|
|
273
|
-
} finally {
|
|
274
|
-
await this.queue.shift();
|
|
275
|
-
this.cleanup();
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* 处理单个音频chunk,提取特征并回调。
|
|
280
|
-
* @param chunkIndex chunk的索引(从0开始)。
|
|
281
|
-
*/
|
|
282
|
-
async processChunk(chunkIndex) {
|
|
283
|
-
if (!this.audioBuffer || !this.worker)
|
|
284
|
-
return;
|
|
285
|
-
const startTimeSeconds = chunkIndex * CHUNK_DURATION_SECONDS;
|
|
286
|
-
const endTimeSeconds = Math.min(
|
|
287
|
-
(chunkIndex + 1) * CHUNK_DURATION_SECONDS,
|
|
288
|
-
this.audioBuffer.duration
|
|
289
|
-
);
|
|
290
|
-
const startSample = Math.floor(
|
|
291
|
-
startTimeSeconds * this.audioBuffer.sampleRate
|
|
292
|
-
);
|
|
293
|
-
const endSample = Math.floor(endTimeSeconds * this.audioBuffer.sampleRate);
|
|
294
|
-
const chunkLength = endSample - startSample;
|
|
295
|
-
const chunkBuffer = await this.createAudioBuffer(
|
|
296
|
-
this.audioBuffer.numberOfChannels,
|
|
297
|
-
chunkLength,
|
|
298
|
-
this.audioBuffer.sampleRate
|
|
299
|
-
);
|
|
300
|
-
for (let channel = 0; channel < this.audioBuffer.numberOfChannels; channel++) {
|
|
301
|
-
const sourceData = this.audioBuffer.getChannelData(channel);
|
|
302
|
-
const chunkData = chunkBuffer.getChannelData(channel);
|
|
303
|
-
chunkData.set(sourceData.subarray(startSample, endSample));
|
|
304
|
-
}
|
|
305
|
-
const result = await this.processWithWorker(chunkBuffer);
|
|
306
|
-
const chunkResult = {
|
|
307
|
-
chunkIndex,
|
|
308
|
-
features: result.features,
|
|
309
|
-
dimensions: result.dimensions,
|
|
310
|
-
startTimeSeconds,
|
|
311
|
-
endTimeSeconds
|
|
312
|
-
};
|
|
313
|
-
this.totalFramesProcessed += chunkResult.dimensions[0];
|
|
314
|
-
this.chunkResults[chunkIndex] = chunkResult;
|
|
315
|
-
this.completedChunks++;
|
|
316
|
-
this.callbacks.onChunkComplete?.(chunkResult);
|
|
317
|
-
this.callbacks.onProgress?.(this.completedChunks, this.totalChunks);
|
|
318
|
-
this.chunkResults[chunkIndex] = null;
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* 所有chunk处理完成后,合并特征并调用onComplete。
|
|
322
|
-
*/
|
|
323
|
-
async finalize() {
|
|
324
|
-
if (this.completedChunks === 0) {
|
|
325
|
-
this.callbacks.onError?.("No chunks were processed.");
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
const totalDimensions = [
|
|
329
|
-
this.totalFramesProcessed,
|
|
330
|
-
NUM_SEQUENCE_FRAMES,
|
|
331
|
-
NUM_MEL_BINS
|
|
332
|
-
];
|
|
333
|
-
this.callbacks.onComplete?.(totalDimensions);
|
|
334
|
-
}
|
|
335
|
-
/**
|
|
336
|
-
* 清理内部状态和资源。
|
|
337
|
-
*/
|
|
338
|
-
cleanup() {
|
|
339
|
-
this.isRunning = false;
|
|
340
|
-
this.audioBuffer = null;
|
|
341
|
-
if (this.worker) {
|
|
342
|
-
this.worker.terminate();
|
|
343
|
-
this.worker = null;
|
|
344
|
-
}
|
|
345
|
-
this.chunkResults.forEach((chunk) => {
|
|
346
|
-
if (chunk && chunk.features) {
|
|
347
|
-
chunk.features = null;
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
|
-
this.chunkResults = [];
|
|
351
|
-
this.callbacks = {};
|
|
352
|
-
this.completedChunks = 0;
|
|
353
|
-
this.totalChunks = 0;
|
|
354
|
-
this.totalFramesProcessed = 0;
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* 停止当前的流式处理。
|
|
358
|
-
*/
|
|
359
|
-
stop() {
|
|
360
|
-
if (this.isRunning) {
|
|
361
|
-
this.isRunning = false;
|
|
362
|
-
if (this.worker) {
|
|
363
|
-
this.worker.terminate();
|
|
364
|
-
this.worker = null;
|
|
365
|
-
}
|
|
366
|
-
this.callbacks = {};
|
|
367
|
-
this.chunkResults = [];
|
|
368
|
-
this.totalChunks = 0;
|
|
369
|
-
this.completedChunks = 0;
|
|
370
|
-
this.totalFramesProcessed = 0;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
export { StreamingFeatureExtractorService, createAudioContext };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file 共享常量
|
|
3
|
-
*
|
|
4
|
-
* 存储在多个服务中使用的常量,避免重复定义
|
|
5
|
-
*
|
|
6
|
-
* @author Zhonghan Li
|
|
7
|
-
*/
|
|
8
|
-
/** Mel 滤波器组的数量 */
|
|
9
|
-
export declare const NUM_MEL_BINS = 80;
|
|
10
|
-
/** 用于后续处理的序列帧数(每个块包含的帧数) */
|
|
11
|
-
export declare const NUM_SEQUENCE_FRAMES = 4;
|
|
12
|
-
/** 每个chunk的时长(秒) */
|
|
13
|
-
export declare const CHUNK_DURATION_SECONDS = 5;
|
|
14
|
-
/** 上下文窗口中的总块数 */
|
|
15
|
-
export declare const WINDOW_NUM_CHUNKS = 32;
|
|
16
|
-
/** 上下文窗口的单边块数(半径) */
|
|
17
|
-
export declare const WINDOW_NUM_CHUNKS_HALF: number;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export { C as CHUNK_DURATION_SECONDS, N as NUM_MEL_BINS, a as NUM_SEQUENCE_FRAMES, W as WINDOW_NUM_CHUNKS, b as WINDOW_NUM_CHUNKS_HALF } from '../../../constants.mjs';
|
|
2
|
-
|
|
3
|
-
function normalizeError(error) {
|
|
4
|
-
if (error instanceof Error) {
|
|
5
|
-
return error.message;
|
|
6
|
-
}
|
|
7
|
-
if (typeof error === "string") {
|
|
8
|
-
return error;
|
|
9
|
-
}
|
|
10
|
-
return "Unknown error occurred";
|
|
11
|
-
}
|
|
12
|
-
function createErrorHandler(context, _fallbackMessage = "Operation failed") {
|
|
13
|
-
return function(error) {
|
|
14
|
-
const errorMessage = normalizeError(error);
|
|
15
|
-
const fullMessage = `${context}: ${errorMessage}`;
|
|
16
|
-
console.error(fullMessage);
|
|
17
|
-
throw new Error(fullMessage);
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function isNonNull(value) {
|
|
21
|
-
return value !== null && value !== void 0;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { createErrorHandler, isNonNull, normalizeError };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file 共享工具函数
|
|
3
|
-
*
|
|
4
|
-
* 提供基础错误处理工具函数
|
|
5
|
-
*
|
|
6
|
-
* @author Zhonghan Li
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* 标准化错误对象
|
|
10
|
-
* @param error 原始错误
|
|
11
|
-
* @returns 标准化的错误消息
|
|
12
|
-
*/
|
|
13
|
-
export declare function normalizeError(error: unknown): string;
|
|
14
|
-
/**
|
|
15
|
-
* 创建错误处理包装器
|
|
16
|
-
* @param context 错误上下文
|
|
17
|
-
* @param fallbackMessage 备用错误消息
|
|
18
|
-
* @returns 错误处理函数
|
|
19
|
-
*/
|
|
20
|
-
export declare function createErrorHandler(context: string, _fallbackMessage?: string): (error: unknown) => never;
|
|
21
|
-
/**
|
|
22
|
-
* 检查值是否为非空
|
|
23
|
-
* @param value 要检查的值
|
|
24
|
-
* @returns 类型守卫结果
|
|
25
|
-
*/
|
|
26
|
-
export declare function isNonNull<T>(value: T | null | undefined): value is T;
|