@7h3laughingman/foundry-types 13.351.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +3 -0
- package/package.json +76 -0
- package/src/client/_module.d.mts +103 -0
- package/src/client/_types.d.mts +900 -0
- package/src/client/applications/_module.d.mts +27 -0
- package/src/client/applications/_types.d.mts +192 -0
- package/src/client/applications/api/_module.d.mts +8 -0
- package/src/client/applications/api/application.d.mts +456 -0
- package/src/client/applications/api/category-browser.d.mts +78 -0
- package/src/client/applications/api/dialog.d.mts +213 -0
- package/src/client/applications/api/document-sheet.d.mts +148 -0
- package/src/client/applications/api/handlebars-application.d.mts +120 -0
- package/src/client/applications/apps/_module.d.mts +10 -0
- package/src/client/applications/apps/av/_module.d.mts +2 -0
- package/src/client/applications/apps/av/camera-popout.d.mts +53 -0
- package/src/client/applications/apps/av/cameras.d.mts +235 -0
- package/src/client/applications/apps/combat-tracker-config.d.mts +27 -0
- package/src/client/applications/apps/compendium-art-config.d.mts +17 -0
- package/src/client/applications/apps/document-ownership.d.mts +17 -0
- package/src/client/applications/apps/document-sheet-config.d.mts +144 -0
- package/src/client/applications/apps/file-picker.d.mts +321 -0
- package/src/client/applications/apps/grid-config.d.mts +33 -0
- package/src/client/applications/apps/image-popout.d.mts +92 -0
- package/src/client/applications/apps/permission-config.d.mts +24 -0
- package/src/client/applications/dice/_module.d.mts +1 -0
- package/src/client/applications/dice/roll-resolver.d.mts +92 -0
- package/src/client/applications/elements/_module.d.mts +19 -0
- package/src/client/applications/elements/codemirror/element.d.mts +73 -0
- package/src/client/applications/elements/color-picker.d.mts +14 -0
- package/src/client/applications/elements/document-embed.d.mts +14 -0
- package/src/client/applications/elements/document-tags.d.mts +50 -0
- package/src/client/applications/elements/enriched-content.d.mts +31 -0
- package/src/client/applications/elements/file-picker.d.mts +59 -0
- package/src/client/applications/elements/form-element.d.mts +105 -0
- package/src/client/applications/elements/hue-slider.d.mts +35 -0
- package/src/client/applications/elements/multi-select.d.mts +89 -0
- package/src/client/applications/elements/prosemirror-editor.d.mts +32 -0
- package/src/client/applications/elements/range-picker.d.mts +23 -0
- package/src/client/applications/elements/secret-block.d.mts +28 -0
- package/src/client/applications/elements/string-tags.d.mts +50 -0
- package/src/client/applications/forms/fields.d.mts +132 -0
- package/src/client/applications/handlebars.d.mts +303 -0
- package/src/client/applications/hud/_module.d.mts +5 -0
- package/src/client/applications/hud/container.d.mts +38 -0
- package/src/client/applications/hud/drawing-hud.d.mts +14 -0
- package/src/client/applications/hud/placeable-hud.d.mts +72 -0
- package/src/client/applications/hud/tile-hud.d.mts +21 -0
- package/src/client/applications/hud/token-hud.d.mts +69 -0
- package/src/client/applications/settings/_module.d.mts +2 -0
- package/src/client/applications/settings/config.d.mts +38 -0
- package/src/client/applications/settings/menus/_module.d.mts +6 -0
- package/src/client/applications/settings/menus/av-config.d.mts +37 -0
- package/src/client/applications/settings/menus/default-sheets-config.d.mts +23 -0
- package/src/client/applications/settings/menus/dice-config.d.mts +23 -0
- package/src/client/applications/settings/menus/font-config.d.mts +145 -0
- package/src/client/applications/settings/menus/prototype-overrides.d.mts +20 -0
- package/src/client/applications/settings/menus/ui-config.d.mts +40 -0
- package/src/client/applications/sheets/_module.d.mts +9 -0
- package/src/client/applications/sheets/combatant-config.d.mts +21 -0
- package/src/client/applications/sheets/item-sheet.d.mts +13 -0
- package/src/client/applications/sheets/scene-config.d.mts +50 -0
- package/src/client/applications/sheets/template-config.d.mts +19 -0
- package/src/client/applications/sheets/token/mixin.mts +182 -0
- package/src/client/applications/sheets/token/prototype-config.d.mts +75 -0
- package/src/client/applications/sheets/token/token-config.d.mts +62 -0
- package/src/client/applications/sheets/user-config.d.mts +27 -0
- package/src/client/applications/sidebar/_module.d.mts +5 -0
- package/src/client/applications/sidebar/apps/_module.d.mts +9 -0
- package/src/client/applications/sidebar/apps/chat-popout.d.mts +45 -0
- package/src/client/applications/sidebar/apps/compendium.d.mts +65 -0
- package/src/client/applications/sidebar/apps/controls-config.d.mts +29 -0
- package/src/client/applications/sidebar/apps/folder-export.d.mts +11 -0
- package/src/client/applications/sidebar/apps/invitation-links.d.mts +10 -0
- package/src/client/applications/sidebar/apps/module-management.d.mts +65 -0
- package/src/client/applications/sidebar/apps/support-details.d.mts +72 -0
- package/src/client/applications/sidebar/apps/tours-management.d.mts +16 -0
- package/src/client/applications/sidebar/apps/world-config.d.mts +38 -0
- package/src/client/applications/sidebar/document-directory.d.mts +327 -0
- package/src/client/applications/sidebar/sidebar-tab.d.mts +89 -0
- package/src/client/applications/sidebar/sidebar.d.mts +93 -0
- package/src/client/applications/sidebar/tabs/_module.d.mts +14 -0
- package/src/client/applications/sidebar/tabs/actor-directory.d.mts +26 -0
- package/src/client/applications/sidebar/tabs/cards-directory.d.mts +19 -0
- package/src/client/applications/sidebar/tabs/chat.d.mts +271 -0
- package/src/client/applications/sidebar/tabs/combat-tracker.d.mts +198 -0
- package/src/client/applications/sidebar/tabs/compendium-directory.d.mts +289 -0
- package/src/client/applications/sidebar/tabs/item-directory.d.mts +24 -0
- package/src/client/applications/sidebar/tabs/journal-directory.d.mts +19 -0
- package/src/client/applications/sidebar/tabs/macro-directory.d.mts +12 -0
- package/src/client/applications/sidebar/tabs/playlist-directory.d.mts +267 -0
- package/src/client/applications/sidebar/tabs/roll-table-directory.d.mts +19 -0
- package/src/client/applications/sidebar/tabs/scene-directory.d.mts +26 -0
- package/src/client/applications/sidebar/tabs/settings.d.mts +16 -0
- package/src/client/applications/ui/_module.d.mts +9 -0
- package/src/client/applications/ui/game-pause.d.mts +15 -0
- package/src/client/applications/ui/hotbar.d.mts +86 -0
- package/src/client/applications/ui/main-menu.d.mts +48 -0
- package/src/client/applications/ui/notifications.d.mts +168 -0
- package/src/client/applications/ui/players.d.mts +92 -0
- package/src/client/applications/ui/region-legend.d.mts +47 -0
- package/src/client/applications/ui/scene-controls.d.mts +138 -0
- package/src/client/applications/ui/scene-navigation.d.mts +61 -0
- package/src/client/applications/ux/_module.d.mts +11 -0
- package/src/client/applications/ux/context-menu.d.mts +202 -0
- package/src/client/applications/ux/drag-drop.d.mts +131 -0
- package/src/client/applications/ux/draggable.d.mts +108 -0
- package/src/client/applications/ux/form-data-extended.d.mts +76 -0
- package/src/client/applications/ux/html-secret.d.mts +61 -0
- package/src/client/applications/ux/prosemirror-editor.d.mts +173 -0
- package/src/client/applications/ux/search-filter.d.mts +119 -0
- package/src/client/applications/ux/tabs.d.mts +94 -0
- package/src/client/applications/ux/text-editor.d.mts +329 -0
- package/src/client/appv1/_module.d.mts +2 -0
- package/src/client/appv1/api/_module.d.mts +8 -0
- package/src/client/appv1/api/application-v1.d.mts +388 -0
- package/src/client/appv1/api/dialog-v1.d.mts +191 -0
- package/src/client/appv1/api/document-sheet-v1.d.mts +96 -0
- package/src/client/appv1/api/form-application-v1.d.mts +203 -0
- package/src/client/appv1/sheets/_module.d.mts +9 -0
- package/src/client/appv1/sheets/actor-sheet.d.mts +129 -0
- package/src/client/appv1/sheets/adventure-importer.d.mts +43 -0
- package/src/client/appv1/sheets/item-sheet.d.mts +42 -0
- package/src/client/appv1/sheets/journal-page-sheet.d.mts +100 -0
- package/src/client/appv1/sheets/journal-sheet.d.mts +262 -0
- package/src/client/audio/_module.d.mts +9 -0
- package/src/client/audio/_types.d.mts +121 -0
- package/src/client/audio/biquad.d.mts +29 -0
- package/src/client/audio/cache.d.mts +58 -0
- package/src/client/audio/convolver.d.mts +50 -0
- package/src/client/audio/helper.d.mts +306 -0
- package/src/client/audio/sound.d.mts +289 -0
- package/src/client/audio/timeout.d.mts +71 -0
- package/src/client/av/_module.d.mts +7 -0
- package/src/client/av/client.d.mts +167 -0
- package/src/client/av/clients/_module.d.mts +1 -0
- package/src/client/av/clients/simplepeer.d.mts +123 -0
- package/src/client/av/master.d.mts +128 -0
- package/src/client/av/settings.d.mts +100 -0
- package/src/client/canvas/_module.d.mts +20 -0
- package/src/client/canvas/animation/_module.d.mts +5 -0
- package/src/client/canvas/animation/_types.d.mts +73 -0
- package/src/client/canvas/animation/canvas-animation.d.mts +114 -0
- package/src/client/canvas/animation/chat-bubbles.d.mts +58 -0
- package/src/client/canvas/animation/smooth-noise.d.mts +34 -0
- package/src/client/canvas/board.d.mts +413 -0
- package/src/client/canvas/containers/_module.d.mts +20 -0
- package/src/client/canvas/containers/_types.d.mts +21 -0
- package/src/client/canvas/containers/advanced/cached-container.d.mts +108 -0
- package/src/client/canvas/containers/advanced/full-canvas-mixin.d.mts +12 -0
- package/src/client/canvas/containers/advanced/full-container-mixin.d.mts +12 -0
- package/src/client/canvas/containers/advanced/unbound-container.d.mts +12 -0
- package/src/client/canvas/containers/elements/control-icon.d.mts +40 -0
- package/src/client/canvas/containers/elements/cursor.d.mts +37 -0
- package/src/client/canvas/containers/elements/door-control.d.mts +66 -0
- package/src/client/canvas/containers/elements/door-mesh.d.mts +127 -0
- package/src/client/canvas/containers/elements/grid-highlight.d.mts +25 -0
- package/src/client/canvas/containers/elements/grid-mesh.d.mts +34 -0
- package/src/client/canvas/containers/elements/particles/leaves.d.mts +15 -0
- package/src/client/canvas/containers/elements/particles/particle-effect.d.mts +45 -0
- package/src/client/canvas/containers/elements/point-source-mesh.d.mts +29 -0
- package/src/client/canvas/containers/elements/precise-text.d.mts +18 -0
- package/src/client/canvas/containers/elements/quad-mesh.d.mts +41 -0
- package/src/client/canvas/containers/elements/resize-handle.d.mts +61 -0
- package/src/client/canvas/containers/elements/sprite-mesh.d.mts +319 -0
- package/src/client/canvas/extensions/_module.d.mts +4 -0
- package/src/client/canvas/extensions/circle-extension.d.mts +4 -0
- package/src/client/canvas/extensions/graphics-extension.d.mts +5 -0
- package/src/client/canvas/extensions/polygon-extension.d.mts +4 -0
- package/src/client/canvas/extensions/rectangle-extension.d.mts +4 -0
- package/src/client/canvas/framebuffer-snapshot.d.mts +20 -0
- package/src/client/canvas/geometry/_module.d.mts +12 -0
- package/src/client/canvas/geometry/_types.d.mts +90 -0
- package/src/client/canvas/geometry/clockwise-sweep.d.mts +129 -0
- package/src/client/canvas/geometry/edges/_module.d.mts +5 -0
- package/src/client/canvas/geometry/edges/collision.d.mts +58 -0
- package/src/client/canvas/geometry/edges/edge.d.mts +144 -0
- package/src/client/canvas/geometry/edges/edges.d.mts +14 -0
- package/src/client/canvas/geometry/edges/vertex.d.mts +85 -0
- package/src/client/canvas/geometry/observable-transform.d.mts +28 -0
- package/src/client/canvas/geometry/quad-tree.d.mts +150 -0
- package/src/client/canvas/geometry/shapes/limited-angle-polygon.d.mts +69 -0
- package/src/client/canvas/geometry/shapes/polygon-mesher.d.mts +50 -0
- package/src/client/canvas/geometry/shapes/ray.d.mts +126 -0
- package/src/client/canvas/geometry/shapes/source-polygon.d.mts +161 -0
- package/src/client/canvas/geometry/unbound-transform.d.mts +9 -0
- package/src/client/canvas/geometry/weiler-atherton-clipping.d.mts +120 -0
- package/src/client/canvas/groups/_module.d.mts +10 -0
- package/src/client/canvas/groups/canvas-group-mixin.mts +95 -0
- package/src/client/canvas/groups/effects.d.mts +118 -0
- package/src/client/canvas/groups/environment.d.mts +79 -0
- package/src/client/canvas/groups/hidden.d.mts +42 -0
- package/src/client/canvas/groups/interface.d.mts +31 -0
- package/src/client/canvas/groups/overlay.d.mts +11 -0
- package/src/client/canvas/groups/primary.d.mts +223 -0
- package/src/client/canvas/groups/rendered.d.mts +7 -0
- package/src/client/canvas/groups/visibility.d.mts +154 -0
- package/src/client/canvas/interaction/_module.d.mts +15 -0
- package/src/client/canvas/interaction/_types.d.mts +67 -0
- package/src/client/canvas/interaction/mouse-handler.d.mts +231 -0
- package/src/client/canvas/interaction/ping/alert.d.mts +16 -0
- package/src/client/canvas/interaction/ping/arrow.d.mts +16 -0
- package/src/client/canvas/interaction/ping/chevron.d.mts +25 -0
- package/src/client/canvas/interaction/ping/ping.d.mts +35 -0
- package/src/client/canvas/interaction/ping/pulse.d.mts +28 -0
- package/src/client/canvas/interaction/render-flags.d.mts +69 -0
- package/src/client/canvas/interaction/ruler/base-ruler.d.mts +179 -0
- package/src/client/canvas/interaction/ruler/ruler.d.mts +56 -0
- package/src/client/canvas/layers/_module.d.mts +31 -0
- package/src/client/canvas/layers/_types.d.mts +89 -0
- package/src/client/canvas/layers/base/canvas-layer.d.mts +71 -0
- package/src/client/canvas/layers/base/interaction-layer.d.mts +176 -0
- package/src/client/canvas/layers/base/placeables-layer.d.mts +410 -0
- package/src/client/canvas/layers/controls.d.mts +181 -0
- package/src/client/canvas/layers/drawings.d.mts +75 -0
- package/src/client/canvas/layers/effects/background-effects.d.mts +32 -0
- package/src/client/canvas/layers/effects/coloration-effects.d.mts +23 -0
- package/src/client/canvas/layers/effects/darkness-effects.d.mts +14 -0
- package/src/client/canvas/layers/effects/illumination-effects.d.mts +72 -0
- package/src/client/canvas/layers/effects/weather-effects.d.mts +137 -0
- package/src/client/canvas/layers/grid.d.mts +112 -0
- package/src/client/canvas/layers/lighting.d.mts +59 -0
- package/src/client/canvas/layers/masks/depth.d.mts +53 -0
- package/src/client/canvas/layers/masks/occlusion.d.mts +84 -0
- package/src/client/canvas/layers/masks/vision.d.mts +44 -0
- package/src/client/canvas/layers/notes.d.mts +59 -0
- package/src/client/canvas/layers/regions.d.mts +70 -0
- package/src/client/canvas/layers/sounds.d.mts +190 -0
- package/src/client/canvas/layers/templates.d.mts +41 -0
- package/src/client/canvas/layers/tiles.d.mts +66 -0
- package/src/client/canvas/layers/tokens.d.mts +171 -0
- package/src/client/canvas/layers/walls.d.mts +99 -0
- package/src/client/canvas/loader.d.mts +135 -0
- package/src/client/canvas/perception/_module.d.mts +13 -0
- package/src/client/canvas/perception/_types.d.mts +61 -0
- package/src/client/canvas/perception/detection-mode.d.mts +122 -0
- package/src/client/canvas/perception/detection-modes/darkvision.d.mts +11 -0
- package/src/client/canvas/perception/detection-modes/invisibility-perception.d.mts +15 -0
- package/src/client/canvas/perception/detection-modes/light-perception.d.mts +18 -0
- package/src/client/canvas/perception/detection-modes/super-perception.d.mts +13 -0
- package/src/client/canvas/perception/detection-modes/tremor-perception.d.mts +13 -0
- package/src/client/canvas/perception/fog.d.mts +65 -0
- package/src/client/canvas/perception/perception-manager.d.mts +72 -0
- package/src/client/canvas/perception/vision-mode.d.mts +133 -0
- package/src/client/canvas/placeables/_module.d.mts +15 -0
- package/src/client/canvas/placeables/_types.d.mts +29 -0
- package/src/client/canvas/placeables/drawing.d.mts +106 -0
- package/src/client/canvas/placeables/light.d.mts +155 -0
- package/src/client/canvas/placeables/note.d.mts +61 -0
- package/src/client/canvas/placeables/placeable-object.d.mts +415 -0
- package/src/client/canvas/placeables/region.d.mts +129 -0
- package/src/client/canvas/placeables/regions/_module.d.mts +2 -0
- package/src/client/canvas/placeables/regions/geometry.d.mts +19 -0
- package/src/client/canvas/placeables/regions/mesh.d.mts +72 -0
- package/src/client/canvas/placeables/sound.d.mts +93 -0
- package/src/client/canvas/placeables/template.d.mts +164 -0
- package/src/client/canvas/placeables/tile.d.mts +189 -0
- package/src/client/canvas/placeables/token.d.mts +675 -0
- package/src/client/canvas/placeables/tokens/_module.d.mts +8 -0
- package/src/client/canvas/placeables/tokens/base-ruler.d.mts +68 -0
- package/src/client/canvas/placeables/tokens/ring-config.d.mts +201 -0
- package/src/client/canvas/placeables/tokens/ring-data.d.mts +56 -0
- package/src/client/canvas/placeables/tokens/ring.d.mts +194 -0
- package/src/client/canvas/placeables/tokens/ruler.d.mts +96 -0
- package/src/client/canvas/placeables/tokens/targets.d.mts +22 -0
- package/src/client/canvas/placeables/tokens/turn-marker-data.d.mts +52 -0
- package/src/client/canvas/placeables/tokens/turn-marker.d.mts +45 -0
- package/src/client/canvas/placeables/wall.d.mts +155 -0
- package/src/client/canvas/primary/_module.d.mts +7 -0
- package/src/client/canvas/primary/primary-canvas-container.d.mts +40 -0
- package/src/client/canvas/primary/primary-canvas-object.mts +215 -0
- package/src/client/canvas/primary/primary-graphics.d.mts +22 -0
- package/src/client/canvas/primary/primary-occludable-object.mts +139 -0
- package/src/client/canvas/primary/primary-particle-effect.d.mts +50 -0
- package/src/client/canvas/primary/primary-sprite-mesh.d.mts +127 -0
- package/src/client/canvas/rendering/_module.d.mts +5 -0
- package/src/client/canvas/rendering/batching/_module.d.mts +2 -0
- package/src/client/canvas/rendering/batching/batch-renderer.d.mts +71 -0
- package/src/client/canvas/rendering/batching/batch-shader-generator.d.mts +13 -0
- package/src/client/canvas/rendering/blend-modes.d.mts +37 -0
- package/src/client/canvas/rendering/filters/_module.d.mts +13 -0
- package/src/client/canvas/rendering/filters/base-filter.d.mts +28 -0
- package/src/client/canvas/rendering/filters/base-mask-filter.d.mts +14 -0
- package/src/client/canvas/rendering/filters/blur.d.mts +152 -0
- package/src/client/canvas/rendering/filters/effects-masking.d.mts +84 -0
- package/src/client/canvas/rendering/filters/environment.d.mts +22 -0
- package/src/client/canvas/rendering/filters/glow-overlay.d.mts +41 -0
- package/src/client/canvas/rendering/filters/invisibility.d.mts +11 -0
- package/src/client/canvas/rendering/filters/outline-overlay.d.mts +43 -0
- package/src/client/canvas/rendering/filters/smaa/_module.d.mts +4 -0
- package/src/client/canvas/rendering/filters/smaa/blend.d.mts +6 -0
- package/src/client/canvas/rendering/filters/smaa/edges.d.mts +11 -0
- package/src/client/canvas/rendering/filters/smaa/smaa.d.mts +102 -0
- package/src/client/canvas/rendering/filters/smaa/weights.d.mts +11 -0
- package/src/client/canvas/rendering/filters/transition.d.mts +97 -0
- package/src/client/canvas/rendering/filters/visibility.d.mts +46 -0
- package/src/client/canvas/rendering/filters/vision-mask-filter.d.mts +15 -0
- package/src/client/canvas/rendering/filters/void.d.mts +6 -0
- package/src/client/canvas/rendering/filters/weather-occlusion-mask.d.mts +30 -0
- package/src/client/canvas/rendering/mixins/_module.d.mts +2 -0
- package/src/client/canvas/rendering/mixins/base-shader-mixin.d.mts +118 -0
- package/src/client/canvas/rendering/mixins/fragment-channel-mixin.d.mts +21 -0
- package/src/client/canvas/rendering/shaders/_module.d.mts +80 -0
- package/src/client/canvas/rendering/shaders/_types.d.mts +98 -0
- package/src/client/canvas/rendering/shaders/base-shader.d.mts +58 -0
- package/src/client/canvas/rendering/shaders/graphics/dash-line.d.mts +13 -0
- package/src/client/canvas/rendering/shaders/grid/grid.d.mts +99 -0
- package/src/client/canvas/rendering/shaders/lighting/background-lighting.d.mts +50 -0
- package/src/client/canvas/rendering/shaders/lighting/base-lighting.d.mts +164 -0
- package/src/client/canvas/rendering/shaders/lighting/coloration-lighting.d.mts +48 -0
- package/src/client/canvas/rendering/shaders/lighting/darkness-lighting.d.mts +45 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/bewitching-wave.d.mts +10 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/black-hole.d.mts +5 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/chroma.d.mts +5 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/emanation.d.mts +5 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/energy-field.d.mts +5 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/fairy-light.d.mts +10 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/flame.d.mts +75 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/fog.d.mts +5 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/force-grid.d.mts +5 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/ghost-light.d.mts +10 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/hexa-dome.d.mts +5 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/light-dome.d.mts +5 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/magical-gloom.d.mts +5 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/pulse.d.mts +41 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/radial-rainbow.d.mts +5 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/revolving-light.d.mts +38 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/roiling-mass.d.mts +5 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/siren-light.d.mts +80 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/smoke-patch.d.mts +10 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/star-light.d.mts +5 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/sunburst.d.mts +10 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/swirling-rainbow.d.mts +5 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/torch.d.mts +41 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/vortex.d.mts +10 -0
- package/src/client/canvas/rendering/shaders/lighting/effects/wave.d.mts +10 -0
- package/src/client/canvas/rendering/shaders/lighting/illumination-lighting.d.mts +51 -0
- package/src/client/canvas/rendering/shaders/region/adjust-darkness-level.d.mts +58 -0
- package/src/client/canvas/rendering/shaders/region/base.d.mts +20 -0
- package/src/client/canvas/rendering/shaders/region/highlight.d.mts +18 -0
- package/src/client/canvas/rendering/shaders/samplers/amplification.d.mts +30 -0
- package/src/client/canvas/rendering/shaders/samplers/base-sampler.d.mts +141 -0
- package/src/client/canvas/rendering/shaders/samplers/baseline-illumination.d.mts +15 -0
- package/src/client/canvas/rendering/shaders/samplers/color-adjustments.d.mts +36 -0
- package/src/client/canvas/rendering/shaders/samplers/colorize-brightness.d.mts +17 -0
- package/src/client/canvas/rendering/shaders/samplers/fog-of-war.d.mts +9 -0
- package/src/client/canvas/rendering/shaders/samplers/primary/depth.d.mts +66 -0
- package/src/client/canvas/rendering/shaders/samplers/primary/occlusion.d.mts +77 -0
- package/src/client/canvas/rendering/shaders/samplers/primary/primary.d.mts +28 -0
- package/src/client/canvas/rendering/shaders/samplers/primary/token-ring.d.mts +33 -0
- package/src/client/canvas/rendering/shaders/vision/background-vision.d.mts +47 -0
- package/src/client/canvas/rendering/shaders/vision/base-vision.d.mts +11 -0
- package/src/client/canvas/rendering/shaders/vision/coloration-vision.d.mts +43 -0
- package/src/client/canvas/rendering/shaders/vision/effects/amplification.d.mts +35 -0
- package/src/client/canvas/rendering/shaders/vision/effects/wave.d.mts +10 -0
- package/src/client/canvas/rendering/shaders/vision/illumination-vision.d.mts +45 -0
- package/src/client/canvas/rendering/shaders/weather/base-weather.d.mts +87 -0
- package/src/client/canvas/rendering/shaders/weather/effect.d.mts +27 -0
- package/src/client/canvas/rendering/shaders/weather/fog.d.mts +26 -0
- package/src/client/canvas/rendering/shaders/weather/rain.d.mts +16 -0
- package/src/client/canvas/rendering/shaders/weather/snow.d.mts +12 -0
- package/src/client/canvas/scene-manager.d.mts +101 -0
- package/src/client/canvas/sources/_module.d.mts +10 -0
- package/src/client/canvas/sources/base-effect-source.d.mts +179 -0
- package/src/client/canvas/sources/base-light-source.d.mts +141 -0
- package/src/client/canvas/sources/global-light-source.d.mts +36 -0
- package/src/client/canvas/sources/point-darkness-source.d.mts +87 -0
- package/src/client/canvas/sources/point-effect-source.d.mts +105 -0
- package/src/client/canvas/sources/point-light-source.d.mts +54 -0
- package/src/client/canvas/sources/point-movement-source.d.mts +10 -0
- package/src/client/canvas/sources/point-sound-source.d.mts +29 -0
- package/src/client/canvas/sources/point-vision-source.d.mts +151 -0
- package/src/client/canvas/sources/rendered-effect-source.d.mts +214 -0
- package/src/client/canvas/texture-extractor.d.mts +98 -0
- package/src/client/canvas/workers/_module.d.mts +1 -0
- package/src/client/canvas/workers/texture-worker.d.mts +73 -0
- package/src/client/client.d.mts +15 -0
- package/src/client/config.d.mts +868 -0
- package/src/client/data/_module.d.mts +11 -0
- package/src/client/data/_types.d.mts +97 -0
- package/src/client/data/calendar.d.mts +175 -0
- package/src/client/data/client-backend.d.mts +82 -0
- package/src/client/data/combat-config.d.mts +84 -0
- package/src/client/data/region-behaviors/_module.d.mts +9 -0
- package/src/client/data/region-behaviors/adjust-darkness-level.d.mts +29 -0
- package/src/client/data/region-behaviors/base.d.mts +70 -0
- package/src/client/data/region-behaviors/execute-macro.d.mts +17 -0
- package/src/client/data/region-behaviors/execute-script.d.mts +15 -0
- package/src/client/data/region-behaviors/increase-movement-cost.d.mts +36 -0
- package/src/client/data/region-behaviors/pause-game.d.mts +15 -0
- package/src/client/data/region-behaviors/suppress-weather.d.mts +13 -0
- package/src/client/data/region-behaviors/teleport-token.d.mts +27 -0
- package/src/client/data/region-behaviors/toggle-behavior.d.mts +19 -0
- package/src/client/data/region-shapes/_module.d.mts +2 -0
- package/src/client/data/region-shapes/polygon-tree.d.mts +101 -0
- package/src/client/data/region-shapes/shape.d.mts +97 -0
- package/src/client/data/terrain-data.d.mts +70 -0
- package/src/client/dice/_module.d.mts +14 -0
- package/src/client/dice/_types.d.mts +89 -0
- package/src/client/dice/parser.d.mts +83 -0
- package/src/client/dice/roll.d.mts +542 -0
- package/src/client/dice/terms/_module.d.mts +16 -0
- package/src/client/dice/terms/_types.d.mts +10 -0
- package/src/client/dice/terms/coin.d.mts +35 -0
- package/src/client/dice/terms/dice.d.mts +263 -0
- package/src/client/dice/terms/die.d.mts +199 -0
- package/src/client/dice/terms/fate.d.mts +22 -0
- package/src/client/dice/terms/function.d.mts +60 -0
- package/src/client/dice/terms/numeric.d.mts +39 -0
- package/src/client/dice/terms/operator.d.mts +28 -0
- package/src/client/dice/terms/parenthetical.d.mts +70 -0
- package/src/client/dice/terms/pool.d.mts +170 -0
- package/src/client/dice/terms/string.d.mts +23 -0
- package/src/client/dice/terms/term.d.mts +135 -0
- package/src/client/dice/twister.d.mts +87 -0
- package/src/client/documents/_module.d.mts +70 -0
- package/src/client/documents/_types.d.mts +736 -0
- package/src/client/documents/abstract/_module.d.mts +6 -0
- package/src/client/documents/abstract/canvas-document.d.mts +65 -0
- package/src/client/documents/abstract/client-document.d.mts +545 -0
- package/src/client/documents/abstract/directory-collection-mixin.d.mts +79 -0
- package/src/client/documents/abstract/document-collection.d.mts +124 -0
- package/src/client/documents/abstract/world-collection.d.mts +157 -0
- package/src/client/documents/active-effect.d.mts +203 -0
- package/src/client/documents/actor-delta.d.mts +76 -0
- package/src/client/documents/actor.d.mts +269 -0
- package/src/client/documents/adventure.d.mts +38 -0
- package/src/client/documents/ambient-light.d.mts +34 -0
- package/src/client/documents/ambient-sound.d.mts +16 -0
- package/src/client/documents/card.d.mts +102 -0
- package/src/client/documents/cards.d.mts +38 -0
- package/src/client/documents/chat-message.d.mts +190 -0
- package/src/client/documents/collections/_module.d.mts +19 -0
- package/src/client/documents/collections/actors.d.mts +28 -0
- package/src/client/documents/collections/card-stacks.d.mts +14 -0
- package/src/client/documents/collections/chat-messages.d.mts +29 -0
- package/src/client/documents/collections/combat-encounters.d.mts +32 -0
- package/src/client/documents/collections/compendium-collection.d.mts +170 -0
- package/src/client/documents/collections/compendium-folders.d.mts +30 -0
- package/src/client/documents/collections/compendium-packs.d.mts +23 -0
- package/src/client/documents/collections/fog-explorations.d.mts +19 -0
- package/src/client/documents/collections/folders.d.mts +20 -0
- package/src/client/documents/collections/items.d.mts +13 -0
- package/src/client/documents/collections/journal.d.mts +24 -0
- package/src/client/documents/collections/macros.d.mts +15 -0
- package/src/client/documents/collections/playlists.d.mts +28 -0
- package/src/client/documents/collections/roll-tables.d.mts +20 -0
- package/src/client/documents/collections/scenes.d.mts +60 -0
- package/src/client/documents/collections/users.d.mts +57 -0
- package/src/client/documents/collections/world-settings.d.mts +34 -0
- package/src/client/documents/combat.d.mts +371 -0
- package/src/client/documents/combatant-group.d.mts +42 -0
- package/src/client/documents/combatant.d.mts +125 -0
- package/src/client/documents/drawing.d.mts +27 -0
- package/src/client/documents/fog-exploration.d.mts +30 -0
- package/src/client/documents/folder.d.mts +124 -0
- package/src/client/documents/item.d.mts +73 -0
- package/src/client/documents/journal-entry-category.d.mts +15 -0
- package/src/client/documents/journal-entry-page.d.mts +77 -0
- package/src/client/documents/journal-entry.d.mts +78 -0
- package/src/client/documents/macro.d.mts +56 -0
- package/src/client/documents/measured-template.d.mts +41 -0
- package/src/client/documents/note.d.mts +28 -0
- package/src/client/documents/playlist-sound.d.mts +107 -0
- package/src/client/documents/playlist.d.mts +163 -0
- package/src/client/documents/region-behavior.d.mts +55 -0
- package/src/client/documents/region.d.mts +98 -0
- package/src/client/documents/roll-table.d.mts +172 -0
- package/src/client/documents/scene.d.mts +282 -0
- package/src/client/documents/setting.d.mts +35 -0
- package/src/client/documents/table-result.d.mts +35 -0
- package/src/client/documents/tile.d.mts +22 -0
- package/src/client/documents/token.d.mts +621 -0
- package/src/client/documents/user.d.mts +148 -0
- package/src/client/documents/wall.d.mts +20 -0
- package/src/client/game.d.mts +231 -0
- package/src/client/global.d.mts +28 -0
- package/src/client/helpers/_module.d.mts +13 -0
- package/src/client/helpers/_types.d.mts +26 -0
- package/src/client/helpers/client-issues.d.mts +90 -0
- package/src/client/helpers/client-settings.d.mts +191 -0
- package/src/client/helpers/document-index.d.mts +81 -0
- package/src/client/helpers/hooks.d.mts +210 -0
- package/src/client/helpers/interaction/_module.d.mts +6 -0
- package/src/client/helpers/interaction/client-keybindings.d.mts +143 -0
- package/src/client/helpers/interaction/clipboard-helper.d.mts +14 -0
- package/src/client/helpers/interaction/gamepad-manager.d.mts +15 -0
- package/src/client/helpers/interaction/keyboard-manager.d.mts +189 -0
- package/src/client/helpers/interaction/mouse-manager.d.mts +20 -0
- package/src/client/helpers/interaction/tooltip-manager.d.mts +227 -0
- package/src/client/helpers/localization.d.mts +143 -0
- package/src/client/helpers/media/_module.d.mts +3 -0
- package/src/client/helpers/media/compendium-art.d.mts +29 -0
- package/src/client/helpers/media/image-helper.d.mts +116 -0
- package/src/client/helpers/media/video-helper.d.mts +113 -0
- package/src/client/helpers/socket-interface.d.mts +14 -0
- package/src/client/helpers/time.d.mts +92 -0
- package/src/client/helpers/workers.d.mts +92 -0
- package/src/client/nue/_module.d.mts +13 -0
- package/src/client/nue/nue-manager.d.mts +13 -0
- package/src/client/nue/tour.d.mts +283 -0
- package/src/client/nue/tours/_module.d.mts +1 -0
- package/src/client/nue/tours-collection.d.mts +23 -0
- package/src/client/packages/_module.d.mts +19 -0
- package/src/client/packages/_types.d.mts +12 -0
- package/src/client/packages/client-package.mts +145 -0
- package/src/client/packages/module.d.mts +12 -0
- package/src/client/packages/system.d.mts +9 -0
- package/src/client/packages/world.d.mts +28 -0
- package/src/client/ui.d.mts +86 -0
- package/src/client/utils/_module.d.mts +4 -0
- package/src/client/utils/helpers.d.mts +148 -0
- package/src/common/_types.d.mts +151 -0
- package/src/common/abstract/_module.d.mts +8 -0
- package/src/common/abstract/_types.d.mts +187 -0
- package/src/common/abstract/backend.d.mts +159 -0
- package/src/common/abstract/data.d.mts +213 -0
- package/src/common/abstract/document.d.mts +700 -0
- package/src/common/abstract/embedded-collection.d.mts +141 -0
- package/src/common/abstract/socket.d.mts +35 -0
- package/src/common/abstract/type-data.d.mts +163 -0
- package/src/common/config.d.mts +147 -0
- package/src/common/constants.d.mts +2184 -0
- package/src/common/data/_module.d.mts +6 -0
- package/src/common/data/_types.d.mts +329 -0
- package/src/common/data/data.d.mts +390 -0
- package/src/common/data/fields.d.mts +1377 -0
- package/src/common/data/validation-failure.d.mts +127 -0
- package/src/common/data/validators.d.mts +35 -0
- package/src/common/documents/_module.d.mts +64 -0
- package/src/common/documents/_types.d.mts +1 -0
- package/src/common/documents/active-effect.d.mts +87 -0
- package/src/common/documents/actor-delta.d.mts +81 -0
- package/src/common/documents/actor.d.mts +105 -0
- package/src/common/documents/adventure.d.mts +105 -0
- package/src/common/documents/ambient-light.d.mts +49 -0
- package/src/common/documents/ambient-sound.d.mts +72 -0
- package/src/common/documents/card.d.mts +98 -0
- package/src/common/documents/cards.d.mts +89 -0
- package/src/common/documents/chat-message.d.mts +107 -0
- package/src/common/documents/combat.d.mts +55 -0
- package/src/common/documents/combatant-group.d.mts +45 -0
- package/src/common/documents/combatant.d.mts +48 -0
- package/src/common/documents/drawing.d.mts +101 -0
- package/src/common/documents/fog-exploration.d.mts +50 -0
- package/src/common/documents/folder.d.mts +65 -0
- package/src/common/documents/item.d.mts +86 -0
- package/src/common/documents/journal-entry-category.d.mts +32 -0
- package/src/common/documents/journal-entry-page.d.mts +76 -0
- package/src/common/documents/journal-entry.d.mts +50 -0
- package/src/common/documents/macro.d.mts +87 -0
- package/src/common/documents/measured-template.d.mts +72 -0
- package/src/common/documents/note.d.mts +82 -0
- package/src/common/documents/playlist-sound.d.mts +53 -0
- package/src/common/documents/playlist.d.mts +48 -0
- package/src/common/documents/region-behavior.d.mts +49 -0
- package/src/common/documents/region.d.mts +61 -0
- package/src/common/documents/roll-table.d.mts +70 -0
- package/src/common/documents/scene.d.mts +237 -0
- package/src/common/documents/setting.d.mts +49 -0
- package/src/common/documents/table-result.d.mts +61 -0
- package/src/common/documents/tile.d.mts +88 -0
- package/src/common/documents/token.d.mts +213 -0
- package/src/common/documents/user.d.mts +82 -0
- package/src/common/documents/wall.d.mts +72 -0
- package/src/common/grid/_module.d.mts +6 -0
- package/src/common/grid/_types.d.mts +250 -0
- package/src/common/grid/base.d.mts +266 -0
- package/src/common/grid/grid-hex.d.mts +53 -0
- package/src/common/grid/gridless.d.mts +85 -0
- package/src/common/grid/hexagonal.d.mts +191 -0
- package/src/common/grid/square.d.mts +90 -0
- package/src/common/packages/_module.d.mts +6 -0
- package/src/common/packages/_types.d.mts +7 -0
- package/src/common/packages/base-module.d.mts +32 -0
- package/src/common/packages/base-package.d.mts +297 -0
- package/src/common/packages/base-system.d.mts +42 -0
- package/src/common/packages/base-world.d.mts +51 -0
- package/src/common/packages/sub-types.d.mts +12 -0
- package/src/common/primitives/_module.d.mts +10 -0
- package/src/common/primitives/array.d.mts +58 -0
- package/src/common/primitives/date.d.mts +24 -0
- package/src/common/primitives/math.d.mts +70 -0
- package/src/common/primitives/number.d.mts +79 -0
- package/src/common/primitives/regexp.d.mts +12 -0
- package/src/common/primitives/set.d.mts +129 -0
- package/src/common/primitives/string.d.mts +24 -0
- package/src/common/primitives/url.d.mts +12 -0
- package/src/common/prosemirror/_module.d.mts +77 -0
- package/src/common/prosemirror/_types.d.mts +75 -0
- package/src/common/prosemirror/click-handler.d.mts +24 -0
- package/src/common/prosemirror/content-link-plugin.d.mts +34 -0
- package/src/common/prosemirror/dirty-plugin.d.mts +10 -0
- package/src/common/prosemirror/dom-parser.d.mts +7 -0
- package/src/common/prosemirror/dropdown.d.mts +50 -0
- package/src/common/prosemirror/highlight-matches-plugin.d.mts +38 -0
- package/src/common/prosemirror/image-plugin.d.mts +70 -0
- package/src/common/prosemirror/input-rules.d.mts +24 -0
- package/src/common/prosemirror/keymaps.d.mts +27 -0
- package/src/common/prosemirror/menu.d.mts +206 -0
- package/src/common/prosemirror/paste-transformer.d.mts +10 -0
- package/src/common/prosemirror/plugin.d.mts +21 -0
- package/src/common/prosemirror/schema/_types.d.mts +15 -0
- package/src/common/prosemirror/schema/attribute-capture.d.mts +13 -0
- package/src/common/prosemirror/schema/core.d.mts +58 -0
- package/src/common/prosemirror/schema/image-link-node.d.mts +27 -0
- package/src/common/prosemirror/schema/image-node.d.mts +17 -0
- package/src/common/prosemirror/schema/link-mark.d.mts +29 -0
- package/src/common/prosemirror/schema/lists.d.mts +71 -0
- package/src/common/prosemirror/schema/marks.d.mts +49 -0
- package/src/common/prosemirror/schema/other.d.mts +161 -0
- package/src/common/prosemirror/schema/schema-definition.d.mts +43 -0
- package/src/common/prosemirror/schema/secret-node.d.mts +25 -0
- package/src/common/prosemirror/schema/tables.d.mts +161 -0
- package/src/common/prosemirror/schema/utils.d.mts +37 -0
- package/src/common/prosemirror/schema.d.mts +7 -0
- package/src/common/prosemirror/string-serializer.d.mts +84 -0
- package/src/common/prosemirror/util.d.mts +32 -0
- package/src/common/utils/_module.d.mts +19 -0
- package/src/common/utils/_types.d.mts +83 -0
- package/src/common/utils/bitmask.d.mts +122 -0
- package/src/common/utils/collection.d.mts +148 -0
- package/src/common/utils/color.d.mts +308 -0
- package/src/common/utils/event-emitter.d.mts +36 -0
- package/src/common/utils/geometry.d.mts +94 -0
- package/src/common/utils/helpers.d.mts +396 -0
- package/src/common/utils/http.d.mts +40 -0
- package/src/common/utils/iterable-weak-map.d.mts +26 -0
- package/src/common/utils/iterable-weak-set.d.mts +1 -0
- package/src/common/utils/logging.d.mts +25 -0
- package/src/common/utils/semaphore.d.mts +59 -0
- package/src/common/utils/string-tree.d.mts +60 -0
- package/src/common/utils/word-tree.d.mts +34 -0
- package/src/global-external.d.mts +48 -0
- package/src/index.d.ts +87 -0
- package/src/public/scripts/clipper.d.mts +920 -0
- package/src/tinymce-stub.d.mts +123 -0
- package/src/util.d.mts +67 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import { BandName, ContextName, SoundCreationOptions } from "./_types.mjs";
|
|
2
|
+
import AudioBufferCache from "./cache.mjs";
|
|
3
|
+
import Sound from "./sound.mjs";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A helper class to provide common functionality for working with the Web Audio API.
|
|
7
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API
|
|
8
|
+
* A singleton instance of this class is available as game#audio.
|
|
9
|
+
* @see {@link foundry.Game#audio}
|
|
10
|
+
*/
|
|
11
|
+
export default class AudioHelper {
|
|
12
|
+
constructor();
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* An array containing all possible audio context names.
|
|
16
|
+
*/
|
|
17
|
+
static AUDIO_CONTEXTS: readonly ContextName[];
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The Native interval for the AudioHelper to analyse audio levels from streams
|
|
21
|
+
* Any interval passed to startLevelReports() would need to be a multiple of this value.
|
|
22
|
+
*/
|
|
23
|
+
static levelAnalyserNativeInterval: number;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The cache size threshold after which audio buffers will be expired from the cache to make more room.
|
|
27
|
+
* 1 gigabyte, by default.
|
|
28
|
+
*/
|
|
29
|
+
static THRESHOLD_CACHE_SIZE_BYTES: number;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Audio Context singleton used for analysing audio levels of each stream
|
|
33
|
+
* Only created if necessary to listen to audio streams.
|
|
34
|
+
*/
|
|
35
|
+
static #analyzerContext: AudioContext;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The set of singleton Sound instances which are shared across multiple uses of the same sound path.
|
|
39
|
+
*/
|
|
40
|
+
sounds: Map<string, WeakRef<Sound>>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Get a map of the Sound objects which are currently playing.
|
|
44
|
+
*/
|
|
45
|
+
playing: Map<number, Sound>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A user gesture must be registered before audio can be played.
|
|
49
|
+
* This Array contains the Sound instances which are requested for playback prior to a gesture.
|
|
50
|
+
* Once a gesture is observed, we begin playing all elements of this Array.
|
|
51
|
+
* @see {@link Sound}
|
|
52
|
+
*/
|
|
53
|
+
pending: Function[];
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A Promise which resolves once the game audio API is unlocked and ready to use.
|
|
57
|
+
*/
|
|
58
|
+
unlock: Promise<void>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* A flag for whether video playback is currently locked by awaiting a user gesture
|
|
62
|
+
*/
|
|
63
|
+
locked: boolean;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* A singleton audio context used for playback of music.
|
|
67
|
+
*/
|
|
68
|
+
music: AudioContext;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* A singleton audio context used for playback of environmental audio.
|
|
72
|
+
*/
|
|
73
|
+
environment: AudioContext;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* A singleton audio context used for playback of interface sounds and effects.
|
|
77
|
+
*/
|
|
78
|
+
interface: AudioContext;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* For backwards compatibility, AudioHelper#context refers to the context used for music playback.
|
|
82
|
+
*/
|
|
83
|
+
get context(): AudioContext;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* A singleton cache used for audio buffers.
|
|
87
|
+
*/
|
|
88
|
+
buffers: AudioBufferCache;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* A global mute which suppresses all 3 audio channels.
|
|
92
|
+
*/
|
|
93
|
+
get globalMute(): boolean;
|
|
94
|
+
|
|
95
|
+
set globalMute(muted);
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Create a Sound instance for a given audio source URL
|
|
99
|
+
* @param options Sound creation options
|
|
100
|
+
*/
|
|
101
|
+
create(options?: SoundCreationOptions): Sound;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Test whether a source file has a supported audio extension type
|
|
105
|
+
* @param src A requested audio source path
|
|
106
|
+
* @returns Does the filename end with a valid audio extension?
|
|
107
|
+
*/
|
|
108
|
+
static hasAudioExtension(src: string): boolean;
|
|
109
|
+
|
|
110
|
+
/* -------------------------------------------- */
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Given an input file path, determine a default name for the sound based on the filename
|
|
114
|
+
* @param src An input file path
|
|
115
|
+
* @returns A default sound name for the path
|
|
116
|
+
*/
|
|
117
|
+
static getDefaultSoundName(src: string): string;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Play a single Sound by providing its source.
|
|
121
|
+
* @param src The file path to the audio source beingplayed
|
|
122
|
+
* @param options Additional options which configure playback
|
|
123
|
+
* @param options.context A specific AudioContext within which to play
|
|
124
|
+
* @returns The created Sound which is now playing
|
|
125
|
+
*/
|
|
126
|
+
play(src: string, options?: { context?: AudioContext }): Promise<Sound>;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Register an event listener to await the first mousemove gesture and begin playback once observed.
|
|
130
|
+
* @returns The unlocked audio context
|
|
131
|
+
*/
|
|
132
|
+
awaitFirstGesture(): Promise<void>;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Request that other connected clients begin preloading a certain sound path.
|
|
136
|
+
* @param src The source file path requested for preload
|
|
137
|
+
* @returns A Promise which resolves once the preload is complete
|
|
138
|
+
*/
|
|
139
|
+
preload(src: string): Promise<Sound>;
|
|
140
|
+
|
|
141
|
+
/* -------------------------------------------- */
|
|
142
|
+
/* Settings and Volume Controls */
|
|
143
|
+
/* -------------------------------------------- */
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Register client-level settings for global volume controls.
|
|
147
|
+
*/
|
|
148
|
+
static registerSettings(): void;
|
|
149
|
+
|
|
150
|
+
/* -------------------------------------------- */
|
|
151
|
+
/* Socket Listeners and Handlers */
|
|
152
|
+
/* -------------------------------------------- */
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Open socket listeners which transact ChatMessage data
|
|
156
|
+
*/
|
|
157
|
+
static _activateSocketListeners(socket: io.Socket): void;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Play a one-off sound effect which is not part of a Playlist
|
|
161
|
+
* @param data An object configuring the audio data toplay.
|
|
162
|
+
* @param data.src The audio source file path, either a public URL or a local path relative to the public directory.
|
|
163
|
+
* @param data.channel An audio channel in CONST.AUDIO_CHANNELS where the sound should play. Default: `"interface"`.
|
|
164
|
+
* @param data.volume The volume level at which to play the audio, between 0 and 1. Default: `1`.
|
|
165
|
+
* @param data.autoplay Begin playback of the audio effect immediately once it is loaded. Default: `false`.
|
|
166
|
+
* @param data.loop Loop the audio effect and continue playing it until it is manually stopped. Default: `false`.
|
|
167
|
+
* @param socketOptions Options which only apply when emitting playback over websocket. As a boolean, emits (true)
|
|
168
|
+
* or does not emit (false) playback to all other clients. As an object, can configure which
|
|
169
|
+
* recipients (an array of User IDs) should receive the event (all clients by default).
|
|
170
|
+
* Default: `false`.
|
|
171
|
+
* @returns A Sound instance which controls audio playback, or nothing if `data.autoplay` is false.
|
|
172
|
+
*
|
|
173
|
+
* @example Play the sound of a locked door for all players
|
|
174
|
+
* ```js
|
|
175
|
+
* AudioHelper.play({src: "sounds/lock.wav", volume: 0.8, loop: false}, true);
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
static play(
|
|
179
|
+
data: { src: string; channel?: string; volume?: number; autoplay?: boolean; loop?: boolean },
|
|
180
|
+
socketOptions: boolean | { recipients: string[] },
|
|
181
|
+
): Sound | void;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Begin loading the sound for a provided source URL adding its
|
|
185
|
+
* @param src The audio source path topreload
|
|
186
|
+
* @returns The created and loaded Sound ready for playback
|
|
187
|
+
*/
|
|
188
|
+
static preloadSound(src: string): Promise<Sound>;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Returns the volume value based on a range input volume control's position.
|
|
192
|
+
* This is using an exponential approximation of the logarithmic nature of audio level perception
|
|
193
|
+
* @param value Value between [0, 1] of the range input
|
|
194
|
+
* @param order The exponent of the curve
|
|
195
|
+
*/
|
|
196
|
+
static inputToVolume(value: number | string, order?: number): number;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Counterpart to inputToVolume()
|
|
200
|
+
* Returns the input range value based on a volume
|
|
201
|
+
* @param volume Value between [0, 1of the volume level
|
|
202
|
+
* @param order The exponent of the curve
|
|
203
|
+
*/
|
|
204
|
+
static volumeToInput(volume: number, order?: number): number;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Converts a volume level to a human-readable percentage value.
|
|
208
|
+
* @param volume Value in the interval [0, 1of the volume level.
|
|
209
|
+
* @param options.label Prefix the returned tooltip with a localized 'Volume: ' label. This should be used if the
|
|
210
|
+
* returned string is intended for assistive technologies, such as the aria-valuetext
|
|
211
|
+
* attribute.
|
|
212
|
+
* @param options.decimalPlaces The number of decimal places to round the percentage to.
|
|
213
|
+
*/
|
|
214
|
+
static volumeToPercentage(volume: number, options?: { label?: boolean; decimalPlaces?: number }): string;
|
|
215
|
+
|
|
216
|
+
/* -------------------------------------------- */
|
|
217
|
+
/* Audio Stream Analysis */
|
|
218
|
+
/* -------------------------------------------- */
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Returns a singleton AudioContext if one can be created.
|
|
222
|
+
* An audio context may not be available due to limited resources or browser compatibility
|
|
223
|
+
* in which case null will be returned
|
|
224
|
+
*
|
|
225
|
+
* @returns A singleton AudioContext or null if one is not available
|
|
226
|
+
*/
|
|
227
|
+
getAnalyzerContext(): AudioContext;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Registers a stream for periodic reports of audio levels.
|
|
231
|
+
* Once added, the callback will be called with the maximum decibel level of
|
|
232
|
+
* the audio tracks in that stream since the last time the event was fired.
|
|
233
|
+
* The interval needs to be a multiple of AudioHelper.levelAnalyserNativeInterval which defaults at 50ms
|
|
234
|
+
*
|
|
235
|
+
* @param id An id to assign to this report. Can be used to stop reports
|
|
236
|
+
* @param stream The MediaStream instance to report activity on.
|
|
237
|
+
* @param callback The callback function to call with the decibel level. `callback(dbLevel)`
|
|
238
|
+
* @param interval The interval at which to produce reports.
|
|
239
|
+
* @param smoothing The smoothingTimeConstant to set on the audio analyser.
|
|
240
|
+
* @returns Returns whether listening to the stream was successful
|
|
241
|
+
*/
|
|
242
|
+
startLevelReports(id: string, stream: MediaStream, callback: Function, interval?: number, smoothing?: number): boolean;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Stop sending audio level reports
|
|
246
|
+
* This stops listening to a stream and stops sending reports.
|
|
247
|
+
* If we aren't listening to any more streams, cancel the global analyser timer.
|
|
248
|
+
* @param id The id of the reports that passed to startLevelReports.
|
|
249
|
+
*/
|
|
250
|
+
stopLevelReports(id: string): void;
|
|
251
|
+
|
|
252
|
+
/* -------------------------------------------- */
|
|
253
|
+
/* Event Handlers */
|
|
254
|
+
/* -------------------------------------------- */
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Log a debugging message if the audio debugging flag is enabled.
|
|
258
|
+
* @param message The message to log
|
|
259
|
+
*/
|
|
260
|
+
debug(message: string): void;
|
|
261
|
+
|
|
262
|
+
/* -------------------------------------------- */
|
|
263
|
+
/* Public Analyzer Methods and Properties */
|
|
264
|
+
/* -------------------------------------------- */
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* A static inactivity threshold for audio analysis, in milliseconds.
|
|
268
|
+
* If no band value is requested for a channel within this duration,
|
|
269
|
+
* the analyzer is disabled to conserve resources (unless the analyzer is enabled with the `keepAlive=true` option)
|
|
270
|
+
*/
|
|
271
|
+
static ANALYSIS_TIMEOUT_MS: number;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Enable the analyzer for a given context (music, environment, interface),
|
|
275
|
+
* attaching an AnalyserNode to its gain node if not already active.
|
|
276
|
+
* @param options.keepAlive If true, this analyzer will not auto-disable after inactivity.
|
|
277
|
+
*/
|
|
278
|
+
enableAnalyzer(contextName: ContextName, options?: { keepAlive?: boolean }): void;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Disable the analyzer for a given context, disconnecting the AnalyserNode.
|
|
282
|
+
*/
|
|
283
|
+
disableAnalyzer(contextName: ContextName): void;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Returns a normalized band value in [0,1].
|
|
287
|
+
* Optionally, we can subtract the actual gainNode (global) volume from the measurement.
|
|
288
|
+
* - Important:
|
|
289
|
+
* - Local gain applied to {@link foundry.audio.Sound} source can't be ignored.
|
|
290
|
+
* - If this method needs to activate the analyzer, the latter requires a brief warm-up.
|
|
291
|
+
* One or two frames may be needed before it produces meaningful values (instead of returning 0).
|
|
292
|
+
* @param options.ignoreVolume If true, remove the real-time channel volume from the measurement.
|
|
293
|
+
* @returns The normalized band value in [0,1].
|
|
294
|
+
*/
|
|
295
|
+
getBandLevel(contextName: ContextName, bandName: BandName, options?: { ignoreVolume?: boolean }): number;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Retrieve a single "peak" analyzer value across the three main audio contexts (music, environment, interface).
|
|
299
|
+
* This takes the maximum of the three normalized [0,1] values for a given frequency band.
|
|
300
|
+
* @param band The frequency band for which to retrieve an analyzer value.
|
|
301
|
+
* @param options
|
|
302
|
+
* @param options.ignoreVolume If true, remove the real-time channel volume from the measurement.
|
|
303
|
+
* @returns A number in the [0,1] range representing the loudest band value among the three contexts.
|
|
304
|
+
*/
|
|
305
|
+
getMaxBandLevel(band?: BandName, options?: { ignoreVolume?: boolean }): number;
|
|
306
|
+
}
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { EventEmitter } from "./../../common/utils/event-emitter.mjs";
|
|
2
|
+
import { SoundPlaybackOptions, SoundScheduleCallback } from "./_types.mjs";
|
|
3
|
+
|
|
4
|
+
type SoundState = (typeof Sound.STATES)[keyof typeof Sound.STATES];
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A container around an AudioNode which manages sound playback in Foundry Virtual Tabletop.
|
|
8
|
+
* Each Sound is either an AudioBufferSourceNode (for short sources) or a MediaElementAudioSourceNode (for long ones).
|
|
9
|
+
* This class provides an interface around both types which allows standardized control over playback.
|
|
10
|
+
*/
|
|
11
|
+
export default class Sound extends EventEmitter {
|
|
12
|
+
/**
|
|
13
|
+
* Construct a Sound by providing the source URL and other options.
|
|
14
|
+
* @param src The audio source path, either a relative path or a remote URL
|
|
15
|
+
* @param options Additional options which configure the Sound
|
|
16
|
+
* @param options.context A non-default audio context within which the sound should play
|
|
17
|
+
* @param options.forceBuffer Force use of an AudioBufferSourceNode even if the audio duration is long
|
|
18
|
+
*/
|
|
19
|
+
constructor(src: string, options?: { context?: AudioContext; forceBuffer?: boolean });
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The sequence of container loading states.
|
|
23
|
+
*/
|
|
24
|
+
static STATES: {
|
|
25
|
+
FAILED: -1;
|
|
26
|
+
NONE: 0;
|
|
27
|
+
LOADING: 1;
|
|
28
|
+
LOADED: 2;
|
|
29
|
+
STARTING: 3;
|
|
30
|
+
PLAYING: 4;
|
|
31
|
+
PAUSED: 5;
|
|
32
|
+
STOPPING: 6;
|
|
33
|
+
STOPPED: 7;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The maximum duration, in seconds, for which an AudioBufferSourceNode will be used.
|
|
38
|
+
* Otherwise, a MediaElementAudioSourceNode will be used.
|
|
39
|
+
*/
|
|
40
|
+
static MAX_BUFFER_DURATION: number;
|
|
41
|
+
|
|
42
|
+
static override emittedEvents: string[];
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* A unique integer identifier for this sound.
|
|
46
|
+
*/
|
|
47
|
+
id: number;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The audio source path.
|
|
51
|
+
* Either a relative path served by the running Foundry VTT game server or a remote URL.
|
|
52
|
+
*/
|
|
53
|
+
src: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The audio context within which this Sound is played.
|
|
57
|
+
*/
|
|
58
|
+
get context(): AudioContext;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The AudioSourceNode used to control sound playback.
|
|
62
|
+
*/
|
|
63
|
+
get sourceNode(): AudioBufferSourceNode | MediaElementAudioSourceNode;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The GainNode used to control volume for this sound.
|
|
67
|
+
*/
|
|
68
|
+
gainNode: GainNode;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* An AudioBuffer instance, if this Sound uses an AudioBufferSourceNode for playback.
|
|
72
|
+
*/
|
|
73
|
+
buffer: AudioBuffer | null;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* An HTMLAudioElement, if this Sound uses a MediaElementAudioSourceNode for playback.
|
|
77
|
+
*/
|
|
78
|
+
element: HTMLAudioElement | null;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The life-cycle state of the sound.
|
|
82
|
+
*/
|
|
83
|
+
protected _state: SoundState;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Has the audio file been loaded either fully or for streaming.
|
|
87
|
+
*/
|
|
88
|
+
get loaded(): boolean;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Did the audio file fail to load.
|
|
92
|
+
*/
|
|
93
|
+
get failed(): boolean;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Is this sound currently playing?
|
|
97
|
+
*/
|
|
98
|
+
get playing(): boolean;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Does this Sound use an AudioBufferSourceNode?
|
|
102
|
+
* Otherwise, the Sound uses a streamed MediaElementAudioSourceNode.
|
|
103
|
+
*/
|
|
104
|
+
get isBuffer(): boolean;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* A convenience reference to the GainNode gain audio parameter.
|
|
108
|
+
*/
|
|
109
|
+
get gain(): AudioParam | undefined;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The AudioNode destination which is the output target for the Sound.
|
|
113
|
+
*/
|
|
114
|
+
destination: AudioNode;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* A pipeline of AudioNode instances to be applied to Sound playback.
|
|
118
|
+
*/
|
|
119
|
+
effects: AudioNode[];
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* The currently playing volume of the sound.
|
|
123
|
+
* Undefined until playback has started for the first time.
|
|
124
|
+
*/
|
|
125
|
+
get volume(): number | undefined;
|
|
126
|
+
|
|
127
|
+
set volume(value);
|
|
128
|
+
/**
|
|
129
|
+
* The time in seconds at which playback was started.
|
|
130
|
+
*/
|
|
131
|
+
startTime: number;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* The time in seconds at which playback was paused.
|
|
135
|
+
*/
|
|
136
|
+
pausedTime: number;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* The total duration of the audio source in seconds.
|
|
140
|
+
*/
|
|
141
|
+
get duration(): number;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The current playback time of the sound.
|
|
145
|
+
*/
|
|
146
|
+
get currentTime(): number;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Is the sound looping?
|
|
150
|
+
*/
|
|
151
|
+
get loop(): boolean;
|
|
152
|
+
|
|
153
|
+
set loop(value);
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* An internal reference to some object which is managing this Sound instance.
|
|
157
|
+
* @internal
|
|
158
|
+
*/
|
|
159
|
+
_manager: object | null;
|
|
160
|
+
|
|
161
|
+
/* -------------------------------------------- */
|
|
162
|
+
/* Life-Cycle Methods */
|
|
163
|
+
/* -------------------------------------------- */
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Load the audio source and prepare it for playback, either using an AudioBuffer or a streamed HTMLAudioElement.
|
|
167
|
+
* @param options Additional options which affect resource loading
|
|
168
|
+
* @param options.autoplay Automatically begin playback of the sound once loaded
|
|
169
|
+
* @param options.autoplayOptions Playback options passed to Sound#play, if autoplay
|
|
170
|
+
* @returns A Promise which resolves to the Sound once it is loaded
|
|
171
|
+
*/
|
|
172
|
+
load(options?: { autoplay?: boolean; autoplayOptions?: SoundPlaybackOptions }): Promise<this>;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* An inner method which handles loading so that it can be de-duplicated under a single shared Promise resolution.
|
|
176
|
+
* This method is factored out to allow for subclasses to override loading behavior.
|
|
177
|
+
* @returns A Promise which resolves once the sound is loaded
|
|
178
|
+
* @throws An error if loading failed for any reason
|
|
179
|
+
*/
|
|
180
|
+
protected _load(): Promise<void>;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Begin playback for the Sound.
|
|
184
|
+
* This method is asynchronous because playback may not start until after an initially provided delay.
|
|
185
|
+
* The Promise resolves *before* the fade-in of any configured volume transition.
|
|
186
|
+
* @param options Options which configure the beginning of sound playback
|
|
187
|
+
* @returns A Promise which resolves once playback has started (excluding fade)
|
|
188
|
+
*/
|
|
189
|
+
play(options?: SoundPlaybackOptions): Promise<this>;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Begin playback for the configured pipeline and playback options.
|
|
193
|
+
* This method is factored out so that subclass implementations of Sound can implement alternative behavior.
|
|
194
|
+
*/
|
|
195
|
+
protected _play(): void;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Pause playback of the Sound.
|
|
199
|
+
* For AudioBufferSourceNode this stops playback after recording the current time.
|
|
200
|
+
* Calling Sound#play will resume playback from the pausedTime unless some other offset is passed.
|
|
201
|
+
* For a MediaElementAudioSourceNode this simply calls the HTMLAudioElement#pause method directly.
|
|
202
|
+
*/
|
|
203
|
+
pause(): void;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Pause playback of the Sound.
|
|
207
|
+
* This method is factored out so that subclass implementations of Sound can implement alternative behavior.
|
|
208
|
+
*/
|
|
209
|
+
protected _pause(): void;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Stop playback for the Sound.
|
|
213
|
+
* This method is asynchronous because playback may not stop until after an initially provided delay.
|
|
214
|
+
* The Promise resolves *after* the fade-out of any configured volume transition.
|
|
215
|
+
* @param options Options which configure the stopping of sound playback
|
|
216
|
+
* @returns A Promise which resolves once playback is fully stopped (including fade)
|
|
217
|
+
*/
|
|
218
|
+
stop(options?: SoundPlaybackOptions): Promise<this>;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Stop playback of the Sound.
|
|
222
|
+
* This method is factored out so that subclass implementations of Sound can implement alternative behavior.
|
|
223
|
+
*/
|
|
224
|
+
protected _stop(): void;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Fade the volume for this sound between its current level and a desired target volume.
|
|
228
|
+
* @param volume The desired target volume level between 0 and 1
|
|
229
|
+
* @param options Additional options that configure the fade operation
|
|
230
|
+
* @param options.duration The duration of the fade effect in milliseconds
|
|
231
|
+
* @param options.from A volume level to start from, the current volume by default
|
|
232
|
+
* @param options.type The type of fade easing, "linear" or "exponential"
|
|
233
|
+
* @returns A Promise that resolves after the requested fade duration
|
|
234
|
+
*/
|
|
235
|
+
fade(volume: number, options?: { duration?: number; from?: number; type?: "linear" | "exponential" }): Promise<void>;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Wait a certain scheduled duration within this sound's own AudioContext.
|
|
239
|
+
* @param duration The duration to wait in milliseconds
|
|
240
|
+
* @returns A promise which resolves after the waited duration
|
|
241
|
+
*/
|
|
242
|
+
wait(duration: number): Promise<void>;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Schedule a function to occur at the next occurrence of a specific playbackTime for this Sound.
|
|
246
|
+
* @param fn A function that will be called with this Sound as its single argument
|
|
247
|
+
* @param playbackTime The desired playback time at which the function should be called
|
|
248
|
+
* @returns A Promise which resolves to the returned value of the provided function once it has been evaluated.
|
|
249
|
+
*
|
|
250
|
+
* @example Schedule audio playback changes
|
|
251
|
+
* ```js
|
|
252
|
+
* sound.schedule(() => console.log("Do something exactly 30 seconds into the track"), 30);
|
|
253
|
+
* sound.schedule(() => console.log("Do something next time the track loops back to the beginning"), 0);
|
|
254
|
+
* sound.schedule(() => console.log("Do something 5 seconds before the end of the track"), sound.duration - 5);
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
schedule(fn: SoundScheduleCallback, playbackTime: number): Promise<unknown>;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Update the array of effects applied to a Sound instance.
|
|
261
|
+
* Optionally a new array of effects can be assigned. If no effects are passed, the current effects are re-applied.
|
|
262
|
+
* @param effects An array of AudioNode effects to apply
|
|
263
|
+
*/
|
|
264
|
+
applyEffects(effects?: AudioNode[]): void;
|
|
265
|
+
|
|
266
|
+
/* -------------------------------------------- */
|
|
267
|
+
/* Helper Methods */
|
|
268
|
+
/* -------------------------------------------- */
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Create any AudioNode instances required for playback of this Sound.
|
|
272
|
+
*/
|
|
273
|
+
protected _createNodes(): void;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Create the audio pipeline used to play this Sound.
|
|
277
|
+
* The GainNode is reused each time to link volume changes across multiple playbacks.
|
|
278
|
+
* The AudioSourceNode is re-created every time that Sound#play is called.
|
|
279
|
+
*/
|
|
280
|
+
protected _connectPipeline(): void;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Disconnect the audio pipeline once playback is stopped.
|
|
284
|
+
* Walk backwards along the Sound##pipeline from the Sound#destination, disconnecting each node.
|
|
285
|
+
*/
|
|
286
|
+
protected _disconnectPipeline(): void;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export interface AudioTimeoutOptions {
|
|
2
|
+
context?: AudioContext;
|
|
3
|
+
callback?: () => unknown;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A framework for scheduled audio events with more precise and synchronized timing than using window.setTimeout.
|
|
8
|
+
* This approach creates an empty audio buffer of the desired duration played using the shared game audio context.
|
|
9
|
+
* The onended event of the AudioBufferSourceNode provides a very precise way to synchronize audio events.
|
|
10
|
+
* For audio timing, this is preferable because it avoids numerous issues with window.setTimeout.
|
|
11
|
+
*
|
|
12
|
+
* @example Using a callback function
|
|
13
|
+
* ```js
|
|
14
|
+
* function playForDuration(sound, duration) {
|
|
15
|
+
* sound.play();
|
|
16
|
+
* const wait = new AudioTimeout(duration, {callback: () => sound.stop()})
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @example Using an awaited Promise
|
|
21
|
+
* ```js
|
|
22
|
+
* async function playForDuration(sound, duration) {
|
|
23
|
+
* sound.play();
|
|
24
|
+
* const timeout = new AudioTimeout(delay);
|
|
25
|
+
* await timeout.complete;
|
|
26
|
+
* sound.stop();
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example Using the wait helper
|
|
31
|
+
* ```js
|
|
32
|
+
* async function playForDuration(sound, duration) {
|
|
33
|
+
* sound.play();
|
|
34
|
+
* await AudioTimeout.wait(duration);
|
|
35
|
+
* sound.stop();
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export default class AudioTimeout {
|
|
40
|
+
/**
|
|
41
|
+
* Create an AudioTimeout by providing a delay and callback.
|
|
42
|
+
* @param delayMS A desired delay timing in milliseconds
|
|
43
|
+
* @param options Additional options which modify timeout behavior
|
|
44
|
+
*/
|
|
45
|
+
constructor(delayMS: number, options?: AudioTimeoutOptions);
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Is the timeout complete?
|
|
49
|
+
* This can be used to await the completion of the AudioTimeout if necessary.
|
|
50
|
+
* The Promise resolves to the returned value of the provided callback function.
|
|
51
|
+
*/
|
|
52
|
+
complete: Promise<unknown>;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Cancel an AudioTimeout by ending it early, rejecting its completion promise, and skipping any callback function.
|
|
56
|
+
*/
|
|
57
|
+
cancel(): void;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* End the timeout, either on schedule or prematurely. Executing any callback function
|
|
61
|
+
*/
|
|
62
|
+
end(): void;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Schedule a task according to some audio timeout.
|
|
66
|
+
* @param delayMS A desired delay timing in milliseconds
|
|
67
|
+
* @param options Additional options which modify timeout behavior
|
|
68
|
+
* @returns A promise which resolves as a returned value of the callback or void
|
|
69
|
+
*/
|
|
70
|
+
static wait(delayMS: number, options?: AudioTimeoutOptions): Promise<unknown>;
|
|
71
|
+
}
|