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BU2I,IqHv5BkF,SACxF/H,EACAqF,EACAgB,EACAkf,EACAvZ,GAiLJ,CrH6xBwEmyB,CACpEn+B,GACAqF,GACAgB,GACAkf,GACAvZ,IsHj+B0F,SAC1F3G,EACA6F,GAEA,OAAO,SAAC/a,EAAkB5E,EAAQmR,GAC9B,GAA6C,OAAzCwO,EACA,MAAM,IAAIve,MAAM,uDAGpB,IACI,OAAO,IAAIue,EAAqC/a,EAAkB5E,EAAQmR,E,CAC5E,MAAOzM,GAEL,GAAiB,gBAAbA,EAAIyJ,KACJ,MAAM2L,IAGV,MAAMpV,C,CAEd,CACJ,CtHo9BwCmuC,CACpC/4B,GACA6F,KAEE2W,GuH3+BsD,SACxD3R,EACAnH,EACAgB,EACA+uB,EACArX,EACAnyB,EACAihB,EACAM,GAEA,OAAO,SAAC9d,EAAagI,GAAyB,OAC1CgP,EAAqBhX,GAChByX,OAAOzX,EAAagI,GAKpBsO,MAAK,kBACFlU,QAAQiV,IACJxe,MAAMoB,KAAK8rC,EAA+B/9B,IAA4BxO,KAAI,SAAC4nC,GAAgB,OACvFpqB,EAAqBoqB,GAAkB3pB,OAAO2pB,EAAkBp5B,EAA0B,IAEjG,IAEJsO,MAAK,kBAAMoY,EAAgC1mB,EAA0B,IACrEsO,MAAK,SAACxZ,GAiBH,MAd2C,oBAAhCA,EAAYmK,iBACnBuW,EAAkC1gB,GAClCD,EAAoCC,IAGnCkZ,EAAgBzZ,GAAqD,kBAClEA,EAAoDO,EAAY,KAGpEghB,EAA6ChhB,GAGjDqgB,EAAiBjiB,IAAI4B,GAEdA,CACX,GAAE,CACd,CvH+7BuBwuC,CACnBnuB,GACAnH,GACAgB,GACA+uB,GACArX,GACAnyB,EACAihB,GACAM,G","sources":["../node_modules/standardized-audio-context/src/globals.ts","../node_modules/standardized-audio-context/src/helpers/is-constructible.ts","../node_modules/standardized-audio-context/src/helpers/split-import-statements.ts","../node_modules/standardized-audio-context/src/factories/add-audio-worklet-module.ts","../node_modules/standardized-audio-context/src/helpers/get-value-for-key.ts","../node_modules/standardized-audio-context/src/helpers/pick-element-from-set.ts","../node_modules/standardized-audio-context/src/helpers/delete-passive-input-connection-to-audio-node.ts","../node_modules/standardized-audio-context/src/helpers/get-event-listeners-of-audio-node.ts","../node_modules/standardized-audio-context/src/helpers/set-internal-state-to-active.ts","../node_modules/standardized-audio-context/src/guards/audio-worklet-node.ts","../node_modules/standardized-audio-context/src/helpers/set-internal-state-to-passive.ts","../node_modules/standardized-audio-context/src/helpers/set-internal-state-to-passive-when-necessary.ts","../node_modules/standardized-audio-context/src/factories/analyser-node-constructor.ts","../node_modules/standardized-audio-context/src/helpers/is-owned-by-context.ts","../node_modules/standardized-audio-context/src/helpers/test-audio-buffer-copy-channel-methods-out-of-bounds-support.ts","../node_modules/standardized-audio-context/src/factories/index-size-error.ts","../node_modules/standardized-audio-context/src/helpers/wrap-audio-buffer-get-channel-data-method.ts","../node_modules/standardized-audio-context/src/factories/audio-buffer-constructor.ts","../node_modules/standardized-audio-context/src/constants.ts","../node_modules/standardized-audio-context/src/helpers/is-active-audio-node.ts","../node_modules/standardized-audio-context/src/factories/audio-buffer-source-node-constructor.ts","../node_modules/standardized-audio-context/src/helpers/get-audio-node-connections.ts","../node_modules/standardized-audio-context/src/helpers/get-audio-param-connections.ts","../node_modules/standardized-audio-context/src/helpers/deactivate-active-audio-node-input-connections.ts","../node_modules/standardized-audio-context/src/guards/audio-buffer-source-node.ts","../node_modules/standardized-audio-context/src/guards/biquad-filter-node.ts","../node_modules/standardized-audio-context/src/guards/constant-source-node.ts","../node_modules/standardized-audio-context/src/guards/gain-node.ts","../node_modules/standardized-audio-context/src/guards/oscillator-node.ts","../node_modules/standardized-audio-context/src/guards/stereo-panner-node.ts","../node_modules/standardized-audio-context/src/helpers/deactivate-audio-graph.ts","../node_modules/standardized-audio-context/src/helpers/is-valid-latency-hint.ts","../node_modules/standardized-audio-context/src/guards/audio-node.ts","../node_modules/standardized-audio-context/src/guards/audio-node-output-connection.ts","../node_modules/standardized-audio-context/src/helpers/insert-element-in-set.ts","../node_modules/standardized-audio-context/src/helpers/add-active-input-connection-to-audio-param.ts","../node_modules/standardized-audio-context/src/helpers/add-passive-input-connection-to-audio-param.ts","../node_modules/standardized-audio-context/src/guards/native-audio-node-faker.ts","../node_modules/standardized-audio-context/src/helpers/connect-native-audio-node-to-native-audio-node.ts","../node_modules/standardized-audio-context/src/helpers/delete-active-input-connection.ts","../node_modules/standardized-audio-context/src/helpers/delete-event-listeners-of-audio-node.ts","../node_modules/standardized-audio-context/src/helpers/delete-passive-input-connection-to-audio-param.ts","../node_modules/standardized-audio-context/src/helpers/disconnect-native-audio-node-from-native-audio-node.ts","../node_modules/standardized-audio-context/src/helpers/get-native-audio-node.ts","../node_modules/standardized-audio-context/src/helpers/get-native-audio-param.ts","../node_modules/standardized-audio-context/src/helpers/is-part-of-a-cycle.ts","../node_modules/standardized-audio-context/src/helpers/is-passive-audio-node.ts","../node_modules/standardized-audio-context/src/helpers/test-audio-node-disconnect-method-support.ts","../node_modules/standardized-audio-context/src/helpers/visit-each-audio-node-once.ts","../node_modules/standardized-audio-context/src/guards/native-audio-node.ts","../node_modules/standardized-audio-context/src/helpers/wrap-audio-node-disconnect-method.ts","../node_modules/standardized-audio-context/src/factories/audio-node-constructor.ts","../node_modules/standardized-audio-context/src/helpers/delete-active-input-connection-to-audio-param.ts","../node_modules/standardized-audio-context/src/read-only-map.ts","../node_modules/standardized-audio-context/src/factories/audio-worklet-node-constructor.ts","../node_modules/standardized-audio-context/src/helpers/copy-from-channel.ts","../node_modules/standardized-audio-context/src/helpers/copy-to-channel.ts","../node_modules/standardized-audio-context/src/helpers/create-nested-arrays.ts","../node_modules/standardized-audio-context/src/helpers/get-audio-worklet-processor.ts","../node_modules/standardized-audio-context/src/factories/audio-worklet-node-renderer-factory.ts","../node_modules/standardized-audio-context/src/factories/biquad-filter-node-constructor.ts","../node_modules/standardized-audio-context/src/factories/channel-merger-node-constructor.ts","../node_modules/standardized-audio-context/src/factories/channel-splitter-node-constructor.ts","../node_modules/standardized-audio-context/src/factories/constant-source-node-constructor.ts","../node_modules/standardized-audio-context/src/factories/convolver-node-constructor.ts","../node_modules/standardized-audio-context/src/helpers/detach-array-buffer.ts","../node_modules/standardized-audio-context/src/factories/delay-node-constructor.ts","../node_modules/standardized-audio-context/src/factories/disconnect-multiple-outputs.ts","../node_modules/standardized-audio-context/src/factories/dynamics-compressor-node-constructor.ts","../node_modules/standardized-audio-context/src/factories/gain-node-constructor.ts","../node_modules/standardized-audio-context/src/factories/invalid-state-error.ts","../node_modules/standardized-audio-context/src/factories/invalid-access-error.ts","../node_modules/standardized-audio-context/src/factories/iir-filter-node-constructor.ts","../node_modules/standardized-audio-context/src/helpers/filter-buffer.ts","../node_modules/standardized-audio-context/src/factories/iir-filter-node-renderer-factory.ts","../node_modules/standardized-audio-context/src/factories/media-stream-audio-destination-node-constructor.ts","../node_modules/standardized-audio-context/src/helpers/test-promise-support.ts","../node_modules/standardized-audio-context/src/factories/minimal-offline-audio-context-constructor.ts","../node_modules/standardized-audio-context/src/helpers/assign-native-audio-node-option.ts","../node_modules/standardized-audio-context/src/helpers/assign-native-audio-node-options.ts","../node_modules/standardized-audio-context/src/helpers/test-analyser-node-get-float-time-domain-data-method-support.ts","../node_modules/standardized-audio-context/src/helpers/assign-native-audio-node-audio-param-value.ts","../node_modules/standardized-audio-context/src/helpers/wrap-audio-scheduled-source-node-start-method-negative-parameters.ts","../node_modules/standardized-audio-context/src/helpers/wrap-audio-scheduled-source-node-stop-method-negative-parameters.ts","../node_modules/standardized-audio-context/src/helpers/compute-buffer-size.ts","../node_modules/standardized-audio-context/src/helpers/clone-audio-worklet-node-options.ts","../node_modules/standardized-audio-context/src/helpers/create-audio-worklet-processor-promise.ts","../node_modules/standardized-audio-context/src/factories/native-biquad-filter-node.ts","../node_modules/standardized-audio-context/src/factories/native-channel-splitter-node.ts","../node_modules/standardized-audio-context/src/helpers/wrap-channel-splitter-node.ts","../node_modules/standardized-audio-context/src/helpers/intercept-connections.ts","../node_modules/standardized-audio-context/src/factories/native-delay-node.ts","../node_modules/standardized-audio-context/src/factories/native-gain-node.ts","../node_modules/standardized-audio-context/src/factories/native-iir-filter-node-faker-factory.ts","../node_modules/standardized-audio-context/src/factories/cache-test-result.ts","../node_modules/standardized-audio-context/src/factories/get-native-context.ts","../node_modules/standardized-audio-context/src/factories/add-audio-node-connections.ts","../node_modules/standardized-audio-context/src/factories/convert-number-to-unsigned-long.ts","../node_modules/standardized-audio-context/src/factories/add-audio-param-connections.ts","../node_modules/standardized-audio-context/src/factories/native-script-processor-node.ts","../node_modules/standardized-audio-context/src/factories/not-supported-error.ts","../node_modules/standardized-audio-context/src/factories/offline-audio-context-constructor.ts","../node_modules/standardized-audio-context/src/factories/oscillator-node-constructor.ts","../node_modules/standardized-audio-context/src/factories/panner-node-constructor.ts","../node_modules/standardized-audio-context/src/factories/periodic-wave-constructor.ts","../node_modules/standardized-audio-context/src/factories/stereo-panner-node-constructor.ts","../node_modules/standardized-audio-context/src/factories/unknown-error.ts","../node_modules/standardized-audio-context/src/factories/wave-shaper-node-constructor.ts","../node_modules/standardized-audio-context/src/helpers/get-first-sample.ts","../node_modules/standardized-audio-context/src/helpers/is-dc-curve.ts","../node_modules/standardized-audio-context/src/helpers/overwrite-accessors.ts","../node_modules/standardized-audio-context/src/helpers/test-audio-scheduled-source-node-start-method-negative-parameters-support.ts","../node_modules/standardized-audio-context/src/helpers/test-audio-scheduled-source-node-stop-method-consecutive-calls-support.ts","../node_modules/standardized-audio-context/src/helpers/test-audio-scheduled-source-node-stop-method-negative-parameters-support.ts","../node_modules/standardized-audio-context/src/helpers/wrap-audio-scheduled-source-node-stop-method-consecutive-calls.ts","../node_modules/standardized-audio-context/src/helpers/wrap-event-listener.ts","../node_modules/standardized-audio-context/src/module.ts","../node_modules/standardized-audio-context/src/factories/add-active-input-connection-to-audio-node.ts","../node_modules/standardized-audio-context/src/factories/add-passive-input-connection-to-audio-node.ts","../node_modules/standardized-audio-context/src/factories/delete-active-input-connection-to-audio-node.ts","../node_modules/standardized-audio-context/src/factories/get-audio-node-tail-time.ts","../node_modules/standardized-audio-context/src/factories/window.ts","../node_modules/standardized-audio-context/src/factories/native-analyser-node-factory.ts","../node_modules/standardized-audio-context/src/helpers/wrap-analyser-node-get-float-time-domain-data-method.ts","../node_modules/standardized-audio-context/src/factories/get-audio-node-renderer.ts","../node_modules/standardized-audio-context/src/factories/render-inputs-of-audio-node.ts","../node_modules/standardized-audio-context/src/factories/analyser-node-renderer-factory.ts","../node_modules/standardized-audio-context/src/factories/native-offline-audio-context-constructor.ts","../node_modules/standardized-audio-context/src/factories/is-native-offline-audio-context.ts","../node_modules/standardized-audio-context/src/factories/event-target-constructor.ts","../node_modules/standardized-audio-context/src/factories/native-audio-context-constructor.ts","../node_modules/standardized-audio-context/src/factories/is-native-audio-context.ts","../node_modules/standardized-audio-context/src/factories/is-native-audio-node.ts","../node_modules/standardized-audio-context/src/factories/is-native-audio-param.ts","../node_modules/standardized-audio-context/src/factories/native-audio-worklet-node-constructor.ts","../node_modules/standardized-audio-context/src/factories/add-connection-to-audio-node.ts","../node_modules/standardized-audio-context/src/factories/increment-cycle-counter-factory.ts","../node_modules/standardized-audio-context/src/factories/decrement-cycle-counter.ts","../node_modules/standardized-audio-context/src/factories/detect-cycles.ts","../node_modules/standardized-audio-context/src/guards/delay-node.ts","../node_modules/standardized-audio-context/src/factories/native-audio-buffer-constructor.ts","../node_modules/standardized-audio-context/src/factories/wrap-audio-buffer-copy-channel-methods.ts","../node_modules/standardized-audio-context/src/factories/wrap-audio-buffer-copy-channel-methods-out-of-bounds.ts","../node_modules/standardized-audio-context/src/factories/test-audio-buffer-constructor-support.ts","../node_modules/standardized-audio-context/src/factories/add-silent-connection.ts","../node_modules/standardized-audio-context/src/factories/render-inputs-of-audio-param.ts","../node_modules/standardized-audio-context/src/factories/connect-audio-param.ts","../node_modules/standardized-audio-context/src/factories/native-audio-buffer-source-node-factory.ts","../node_modules/standardized-audio-context/src/helpers/wrap-audio-buffer-source-node-start-method-consecutive-calls.ts","../node_modules/standardized-audio-context/src/helpers/test-audio-buffer-source-node-start-method-consecutive-calls-support.ts","../node_modules/standardized-audio-context/src/helpers/test-audio-buffer-source-node-start-method-offset-clamping-support.ts","../node_modules/standardized-audio-context/src/helpers/test-audio-buffer-source-node-stop-method-nullified-buffer-support.ts","../node_modules/standardized-audio-context/src/helpers/wrap-audio-buffer-source-node-start-method-offset-clamping.ts","../node_modules/standardized-audio-context/src/factories/wrap-audio-buffer-source-node-stop-method-nullified-buffer.ts","../node_modules/standardized-audio-context/src/factories/render-automation.ts","../node_modules/standardized-audio-context/src/factories/get-audio-param-renderer.ts","../node_modules/standardized-audio-context/src/factories/audio-buffer-source-node-renderer-factory.ts","../node_modules/standardized-audio-context/src/factories/audio-param-factory.ts","../node_modules/standardized-audio-context/src/factories/audio-param-renderer.ts","../node_modules/standardized-audio-context/src/helpers/set-value-at-time-until-possible.ts","../node_modules/standardized-audio-context/src/factories/audio-destination-node-constructor.ts","../node_modules/standardized-audio-context/src/factories/audio-destination-node-renderer-factory.ts","../node_modules/standardized-audio-context/src/factories/native-audio-destination-node.ts","../node_modules/standardized-audio-context/src/factories/biquad-filter-node-renderer-factory.ts","../node_modules/standardized-audio-context/src/factories/set-audio-node-tail-time.ts","../node_modules/standardized-audio-context/src/factories/monitor-connections.ts","../node_modules/standardized-audio-context/src/factories/wrap-channel-merger-node.ts","../node_modules/standardized-audio-context/src/factories/native-channel-merger-node-factory.ts","../node_modules/standardized-audio-context/src/factories/channel-merger-node-renderer-factory.ts","../node_modules/standardized-audio-context/src/factories/channel-splitter-node-renderer-factory.ts","../node_modules/standardized-audio-context/src/helpers/sanitize-channel-splitter-options.ts","../node_modules/standardized-audio-context/src/factories/native-constant-source-node-faker-factory.ts","../node_modules/standardized-audio-context/src/factories/native-constant-source-node-factory.ts","../node_modules/standardized-audio-context/src/factories/constant-source-node-renderer-factory.ts","../node_modules/standardized-audio-context/src/factories/native-convolver-node-factory.ts","../node_modules/standardized-audio-context/src/factories/convolver-node-renderer-factory.ts","../node_modules/standardized-audio-context/src/factories/delay-node-renderer-factory.ts","../node_modules/standardized-audio-context/src/factories/native-dynamics-compressor-node-factory.ts","../node_modules/standardized-audio-context/src/factories/dynamics-compressor-node-renderer-factory.ts","../node_modules/standardized-audio-context/src/factories/gain-node-renderer-factory.ts","../node_modules/standardized-audio-context/src/factories/render-native-offline-audio-context.ts","../node_modules/standardized-audio-context/src/factories/test-offline-audio-context-current-time-support.ts","../node_modules/standardized-audio-context/src/factories/native-iir-filter-node-factory.ts","../node_modules/standardized-audio-context/src/helpers/wrap-iir-filter-node-get-frequency-response-method.ts","../node_modules/standardized-audio-context/src/factories/audio-listener-factory.ts","../node_modules/standardized-audio-context/src/factories/minimal-base-audio-context-constructor.ts","../node_modules/standardized-audio-context/src/factories/native-oscillator-node-factory.ts","../node_modules/standardized-audio-context/src/factories/oscillator-node-renderer-factory.ts","../node_modules/standardized-audio-context/src/factories/connected-native-audio-buffer-source-node-factory.ts","../node_modules/standardized-audio-context/src/factories/native-wave-shaper-node-faker-factory.ts","../node_modules/standardized-audio-context/src/factories/native-wave-shaper-node-factory.ts","../node_modules/standardized-audio-context/src/factories/native-panner-node-faker-factory.ts","../node_modules/standardized-audio-context/src/factories/native-panner-node-factory.ts","../node_modules/standardized-audio-context/src/factories/panner-node-renderer-factory.ts","../node_modules/standardized-audio-context/src/factories/native-periodic-wave-factory.ts","../node_modules/standardized-audio-context/src/helpers/sanitize-periodic-wave-options.ts","../node_modules/standardized-audio-context/src/factories/native-stereo-panner-node-faker-factory.ts","../node_modules/standardized-audio-context/src/factories/native-stereo-panner-node-factory.ts","../node_modules/standardized-audio-context/src/factories/stereo-panner-node-renderer-factory.ts","../node_modules/standardized-audio-context/src/factories/wave-shaper-node-renderer-factory.ts","../node_modules/standardized-audio-context/src/factories/is-secure-context.ts","../node_modules/standardized-audio-context/src/factories/expose-current-frame-and-current-time.ts","../node_modules/standardized-audio-context/src/factories/get-or-create-backup-offline-audio-context.ts","../node_modules/standardized-audio-context/src/factories/evaluate-source.ts","../node_modules/standardized-audio-context/src/factories/fetch-source.ts","../node_modules/standardized-audio-context/src/factories/abort-error.ts","../node_modules/standardized-audio-context/src/factories/test-audio-worklet-processor-post-message-support.ts","../node_modules/standardized-audio-context/src/factories/is-native-context.ts","../node_modules/standardized-audio-context/src/factories/decode-audio-data.ts","../node_modules/standardized-audio-context/src/factories/data-clone-error.ts","../node_modules/standardized-audio-context/src/factories/encoding-error.ts","../node_modules/standardized-audio-context/src/factories/base-audio-context-constructor.ts","../node_modules/standardized-audio-context/src/factories/media-element-audio-source-node-constructor.ts","../node_modules/standardized-audio-context/src/factories/native-media-element-audio-source-node.ts","../node_modules/standardized-audio-context/src/factories/native-media-stream-audio-destination-node.ts","../node_modules/standardized-audio-context/src/factories/media-stream-audio-source-node-constructor.ts","../node_modules/standardized-audio-context/src/factories/native-media-stream-audio-source-node.ts","../node_modules/standardized-audio-context/src/factories/native-media-stream-track-audio-source-node-factory.ts","../node_modules/standardized-audio-context/src/factories/media-stream-track-audio-source-node-constructor.ts","../node_modules/standardized-audio-context/src/factories/audio-context-constructor.ts","../node_modules/standardized-audio-context/src/factories/get-unrendered-audio-worklet-nodes.ts","../node_modules/standardized-audio-context/src/factories/add-unrendered-audio-worklet-node.ts","../node_modules/standardized-audio-context/src/factories/connect-multiple-outputs.ts","../node_modules/standardized-audio-context/src/factories/delete-unrendered-audio-worklet-node.ts","../node_modules/standardized-audio-context/src/factories/get-active-audio-worklet-node-inputs.ts","../node_modules/standardized-audio-context/src/factories/native-audio-worklet-node-faker-factory.ts","../node_modules/standardized-audio-context/src/helpers/create-audio-worklet-processor.ts","../node_modules/standardized-audio-context/src/factories/native-audio-worklet-node-factory.ts","../node_modules/standardized-audio-context/src/helpers/test-clonability-of-audio-worklet-node-options.ts","../node_modules/standardized-audio-context/src/factories/get-backup-offline-audio-context.ts","../node_modules/standardized-audio-context/src/factories/set-active-audio-worklet-node-inputs.ts","../node_modules/standardized-audio-context/src/helpers/sanitize-audio-worklet-node-options.ts","../node_modules/standardized-audio-context/src/helpers/test-audio-worklet-node-options-clonability.ts","../node_modules/standardized-audio-context/src/factories/minimal-audio-context-constructor.ts","../node_modules/standardized-audio-context/src/factories/create-native-offline-audio-context.ts","../node_modules/standardized-audio-context/src/factories/start-rendering.ts"],"sourcesContent":["import { IAudioNode, IAudioWorkletProcessor, IAudioWorkletProcessorConstructor } from './interfaces';\nimport {\n TAudioNodeConnectionsStore,\n TAudioNodeStore,\n TAudioParamConnectionsStore,\n TAudioParamStore,\n TContext,\n TContextStore,\n TCycleCounters,\n TInternalStateEventListener,\n TNativeAudioWorkletNode,\n TNativeContext\n} from './types';\n\nexport const ACTIVE_AUDIO_NODE_STORE: WeakSet> = new WeakSet();\n\nexport const AUDIO_NODE_CONNECTIONS_STORE: TAudioNodeConnectionsStore = new WeakMap();\n\nexport const AUDIO_NODE_STORE: TAudioNodeStore = new WeakMap();\n\nexport const AUDIO_PARAM_CONNECTIONS_STORE: TAudioParamConnectionsStore = new WeakMap();\n\nexport const AUDIO_PARAM_STORE: TAudioParamStore = new WeakMap();\n\nexport const CONTEXT_STORE: TContextStore = new WeakMap();\n\nexport const EVENT_LISTENERS: WeakMap, Set> = new WeakMap();\n\nexport const CYCLE_COUNTERS: TCycleCounters = new WeakMap();\n\n// This clunky name is borrowed from the spec. :-)\nexport const NODE_NAME_TO_PROCESSOR_CONSTRUCTOR_MAPS: WeakMap<\n TNativeContext,\n Map\n> = new WeakMap();\n\nexport const NODE_TO_PROCESSOR_MAPS: WeakMap<\n TNativeContext,\n WeakMap>\n> = new WeakMap();\n","import { TConstructor } from '../types';\n\nconst handler = {\n construct(): any {\n return handler;\n }\n};\n\nexport const isConstructible = (constructible: TConstructor): boolean => {\n try {\n const proxy = new Proxy(constructible, handler);\n\n new proxy(); // tslint:disable-line:no-unused-expression\n } catch {\n return false;\n }\n\n return true;\n};\n","/*\n * This massive regex tries to cover all the following cases.\n *\n * import './path';\n * import defaultImport from './path';\n * import { namedImport } from './path';\n * import { namedImport as renamendImport } from './path';\n * import * as namespaceImport from './path';\n * import defaultImport, { namedImport } from './path';\n * import defaultImport, { namedImport as renamendImport } from './path';\n * import defaultImport, * as namespaceImport from './path';\n */\nconst IMPORT_STATEMENT_REGEX = /^import(?:(?:[\\s]+[\\w]+|(?:[\\s]+[\\w]+[\\s]*,)?[\\s]*\\{[\\s]*[\\w]+(?:[\\s]+as[\\s]+[\\w]+)?(?:[\\s]*,[\\s]*[\\w]+(?:[\\s]+as[\\s]+[\\w]+)?)*[\\s]*}|(?:[\\s]+[\\w]+[\\s]*,)?[\\s]*\\*[\\s]+as[\\s]+[\\w]+)[\\s]+from)?(?:[\\s]*)(\"([^\"\\\\]|\\\\.)+\"|'([^'\\\\]|\\\\.)+')(?:[\\s]*);?/; // tslint:disable-line:max-line-length\n\nexport const splitImportStatements = (source: string, url: string): [string, string] => {\n const importStatements = [];\n\n let sourceWithoutImportStatements = source.replace(/^[\\s]+/, '');\n let result = sourceWithoutImportStatements.match(IMPORT_STATEMENT_REGEX);\n\n while (result !== null) {\n const unresolvedUrl = result[1].slice(1, -1);\n\n const importStatementWithResolvedUrl = result[0]\n .replace(/([\\s]+)?;?$/, '')\n .replace(unresolvedUrl, new URL(unresolvedUrl, url).toString());\n importStatements.push(importStatementWithResolvedUrl);\n\n sourceWithoutImportStatements = sourceWithoutImportStatements.slice(result[0].length).replace(/^[\\s]+/, '');\n result = sourceWithoutImportStatements.match(IMPORT_STATEMENT_REGEX);\n }\n\n return [importStatements.join(';'), sourceWithoutImportStatements];\n};\n","import { NODE_NAME_TO_PROCESSOR_CONSTRUCTOR_MAPS } from '../globals';\nimport { isConstructible } from '../helpers/is-constructible';\nimport { splitImportStatements } from '../helpers/split-import-statements';\nimport { IAudioWorkletProcessorConstructor } from '../interfaces';\nimport { TAddAudioWorkletModuleFactory, TEvaluateAudioWorkletGlobalScopeFunction } from '../types';\n\nconst verifyParameterDescriptors = (parameterDescriptors: IAudioWorkletProcessorConstructor['parameterDescriptors']) => {\n if (parameterDescriptors !== undefined && !Array.isArray(parameterDescriptors)) {\n throw new TypeError('The parameterDescriptors property of given value for processorCtor is not an array.');\n }\n};\n\nconst verifyProcessorCtor = (processorCtor: T) => {\n if (!isConstructible(processorCtor)) {\n throw new TypeError('The given value for processorCtor should be a constructor.');\n }\n\n if (processorCtor.prototype === null || typeof processorCtor.prototype !== 'object') {\n throw new TypeError('The given value for processorCtor should have a prototype.');\n }\n};\n\nexport const createAddAudioWorkletModule: TAddAudioWorkletModuleFactory = (\n cacheTestResult,\n createNotSupportedError,\n evaluateSource,\n exposeCurrentFrameAndCurrentTime,\n fetchSource,\n getNativeContext,\n getOrCreateBackupOfflineAudioContext,\n isNativeOfflineAudioContext,\n nativeAudioWorkletNodeConstructor,\n ongoingRequests,\n resolvedRequests,\n testAudioWorkletProcessorPostMessageSupport,\n window\n) => {\n let index = 0;\n\n return (context, moduleURL, options = { credentials: 'omit' }) => {\n const resolvedRequestsOfContext = resolvedRequests.get(context);\n\n if (resolvedRequestsOfContext !== undefined && resolvedRequestsOfContext.has(moduleURL)) {\n return Promise.resolve();\n }\n\n const ongoingRequestsOfContext = ongoingRequests.get(context);\n\n if (ongoingRequestsOfContext !== undefined) {\n const promiseOfOngoingRequest = ongoingRequestsOfContext.get(moduleURL);\n\n if (promiseOfOngoingRequest !== undefined) {\n return promiseOfOngoingRequest;\n }\n }\n\n const nativeContext = getNativeContext(context);\n\n // Bug #59: Safari does not implement the audioWorklet property.\n const promise =\n nativeContext.audioWorklet === undefined\n ? fetchSource(moduleURL)\n .then(([source, absoluteUrl]) => {\n const [importStatements, sourceWithoutImportStatements] = splitImportStatements(source, absoluteUrl);\n\n /*\n * This is the unminified version of the code used below:\n *\n * ```js\n * ${ importStatements };\n * ((a, b) => {\n * (a[b] = a[b] || [ ]).push(\n * (AudioWorkletProcessor, global, registerProcessor, sampleRate, self, window) => {\n * ${ sourceWithoutImportStatements }\n * }\n * );\n * })(window, '_AWGS');\n * ```\n */\n // tslint:disable-next-line:max-line-length\n const wrappedSource = `${importStatements};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${sourceWithoutImportStatements}\n})})(window,'_AWGS')`;\n\n // @todo Evaluating the given source code is a possible security problem.\n return evaluateSource(wrappedSource);\n })\n .then(() => {\n const evaluateAudioWorkletGlobalScope = ((window)._AWGS).pop();\n\n if (evaluateAudioWorkletGlobalScope === undefined) {\n // Bug #182 Chrome and Edge do throw an instance of a SyntaxError instead of a DOMException.\n throw new SyntaxError();\n }\n\n exposeCurrentFrameAndCurrentTime(nativeContext.currentTime, nativeContext.sampleRate, () =>\n evaluateAudioWorkletGlobalScope(\n class AudioWorkletProcessor {},\n undefined,\n (name, processorCtor) => {\n if (name.trim() === '') {\n throw createNotSupportedError();\n }\n\n const nodeNameToProcessorConstructorMap = NODE_NAME_TO_PROCESSOR_CONSTRUCTOR_MAPS.get(nativeContext);\n\n if (nodeNameToProcessorConstructorMap !== undefined) {\n if (nodeNameToProcessorConstructorMap.has(name)) {\n throw createNotSupportedError();\n }\n\n verifyProcessorCtor(processorCtor);\n verifyParameterDescriptors(processorCtor.parameterDescriptors);\n\n nodeNameToProcessorConstructorMap.set(name, processorCtor);\n } else {\n verifyProcessorCtor(processorCtor);\n verifyParameterDescriptors(processorCtor.parameterDescriptors);\n\n NODE_NAME_TO_PROCESSOR_CONSTRUCTOR_MAPS.set(nativeContext, new Map([[name, processorCtor]]));\n }\n },\n nativeContext.sampleRate,\n undefined,\n undefined\n )\n );\n })\n : Promise.all([\n fetchSource(moduleURL),\n Promise.resolve(\n cacheTestResult(testAudioWorkletProcessorPostMessageSupport, testAudioWorkletProcessorPostMessageSupport)\n )\n ]).then(([[source, absoluteUrl], isSupportingPostMessage]) => {\n const currentIndex = index + 1;\n\n index = currentIndex;\n\n const [importStatements, sourceWithoutImportStatements] = splitImportStatements(source, absoluteUrl);\n /*\n * Bug #179: Firefox does not allow to transfer any buffer which has been passed to the process() method as an argument.\n *\n * This is the unminified version of the code used below.\n *\n * ```js\n * class extends AudioWorkletProcessor {\n *\n * __buffers = new WeakSet();\n *\n * constructor () {\n * super();\n *\n * this.port.postMessage = ((postMessage) => {\n * return (message, transferables) => {\n * const filteredTransferables = (transferables)\n * ? transferables.filter((transferable) => !this.__buffers.has(transferable))\n * : transferables;\n *\n * return postMessage.call(this.port, message, filteredTransferables);\n * };\n * })(this.port.postMessage);\n * }\n * }\n * ```\n */\n const patchedAudioWorkletProcessor = isSupportingPostMessage\n ? 'AudioWorkletProcessor'\n : 'class extends AudioWorkletProcessor {__b=new WeakSet();constructor(){super();(p=>p.postMessage=(q=>(m,t)=>q.call(p,m,t?t.filter(u=>!this.__b.has(u)):t))(p.postMessage))(this.port)}}';\n /*\n * Bug #170: Chrome and Edge do call process() with an array with empty channelData for each input if no input is connected.\n *\n * Bug #179: Firefox does not allow to transfer any buffer which has been passed to the process() method as an argument.\n *\n * Bug #190: Safari doesn't throw an error when loading an unparsable module.\n *\n * This is the unminified version of the code used below:\n *\n * ```js\n * `${ importStatements };\n * ((AudioWorkletProcessor, registerProcessor) => {${ sourceWithoutImportStatements }\n * })(\n * ${ patchedAudioWorkletProcessor },\n * (name, processorCtor) => registerProcessor(name, class extends processorCtor {\n *\n * __collectBuffers = (array) => {\n * array.forEach((element) => this.__buffers.add(element.buffer));\n * };\n *\n * process (inputs, outputs, parameters) {\n * inputs.forEach(this.__collectBuffers);\n * outputs.forEach(this.__collectBuffers);\n * this.__collectBuffers(Object.values(parameters));\n *\n * return super.process(\n * (inputs.map((input) => input.some((channelData) => channelData.length === 0)) ? [ ] : input),\n * outputs,\n * parameters\n * );\n * }\n *\n * })\n * );\n *\n * registerProcessor(`__sac${currentIndex}`, class extends AudioWorkletProcessor{\n *\n * process () {\n * return false;\n * }\n *\n * })`\n * ```\n */\n const memberDefinition = isSupportingPostMessage ? '' : '__c = (a) => a.forEach(e=>this.__b.add(e.buffer));';\n const bufferRegistration = isSupportingPostMessage\n ? ''\n : 'i.forEach(this.__c);o.forEach(this.__c);this.__c(Object.values(p));';\n const wrappedSource = `${importStatements};((AudioWorkletProcessor,registerProcessor)=>{${sourceWithoutImportStatements}\n})(${patchedAudioWorkletProcessor},(n,p)=>registerProcessor(n,class extends p{${memberDefinition}process(i,o,p){${bufferRegistration}return super.process(i.map(j=>j.some(k=>k.length===0)?[]:j),o,p)}}));registerProcessor('__sac${currentIndex}',class extends AudioWorkletProcessor{process(){return !1}})`;\n const blob = new Blob([wrappedSource], { type: 'application/javascript; charset=utf-8' });\n const url = URL.createObjectURL(blob);\n\n return nativeContext.audioWorklet\n .addModule(url, options)\n .then(() => {\n if (isNativeOfflineAudioContext(nativeContext)) {\n return nativeContext;\n }\n\n // Bug #186: Chrome and Edge do not allow to create an AudioWorkletNode on a closed AudioContext.\n const backupOfflineAudioContext = getOrCreateBackupOfflineAudioContext(nativeContext);\n\n return backupOfflineAudioContext.audioWorklet.addModule(url, options).then(() => backupOfflineAudioContext);\n })\n .then((nativeContextOrBackupOfflineAudioContext) => {\n if (nativeAudioWorkletNodeConstructor === null) {\n throw new SyntaxError();\n }\n\n try {\n // Bug #190: Safari doesn't throw an error when loading an unparsable module.\n new nativeAudioWorkletNodeConstructor(nativeContextOrBackupOfflineAudioContext, `__sac${currentIndex}`); // tslint:disable-line:no-unused-expression\n } catch {\n throw new SyntaxError();\n }\n })\n .finally(() => URL.revokeObjectURL(url));\n });\n\n if (ongoingRequestsOfContext === undefined) {\n ongoingRequests.set(context, new Map([[moduleURL, promise]]));\n } else {\n ongoingRequestsOfContext.set(moduleURL, promise);\n }\n\n promise\n .then(() => {\n const updatedResolvedRequestsOfContext = resolvedRequests.get(context);\n\n if (updatedResolvedRequestsOfContext === undefined) {\n resolvedRequests.set(context, new Set([moduleURL]));\n } else {\n updatedResolvedRequestsOfContext.add(moduleURL);\n }\n })\n .finally(() => {\n const updatedOngoingRequestsOfContext = ongoingRequests.get(context);\n\n if (updatedOngoingRequestsOfContext !== undefined) {\n updatedOngoingRequestsOfContext.delete(moduleURL);\n }\n });\n\n return promise;\n };\n};\n","import { TGetValueForKeyFunction } from '../types';\n\nexport const getValueForKey: TGetValueForKeyFunction = (map, key) => {\n const value = map.get(key);\n\n if (value === undefined) {\n throw new Error('A value with the given key could not be found.');\n }\n\n return value;\n};\n","import { TPickElementFromSetFunction } from '../types';\n\nexport const pickElementFromSet: TPickElementFromSetFunction = (set, predicate) => {\n const matchingElements = Array.from(set).filter(predicate);\n\n if (matchingElements.length > 1) {\n throw Error('More than one element was found.');\n }\n\n if (matchingElements.length === 0) {\n throw Error('No element was found.');\n }\n\n const [matchingElement] = matchingElements;\n\n set.delete(matchingElement);\n\n return matchingElement;\n};\n","import { IAudioNode } from '../interfaces';\nimport { TContext, TPassiveAudioNodeInputConnection } from '../types';\nimport { getValueForKey } from './get-value-for-key';\nimport { pickElementFromSet } from './pick-element-from-set';\n\nexport const deletePassiveInputConnectionToAudioNode = (\n passiveInputs: WeakMap, Set>,\n source: IAudioNode,\n output: number,\n input: number\n) => {\n const passiveInputConnections = getValueForKey(passiveInputs, source);\n const matchingConnection = pickElementFromSet(\n passiveInputConnections,\n (passiveInputConnection) => passiveInputConnection[0] === output && passiveInputConnection[1] === input\n );\n\n if (passiveInputConnections.size === 0) {\n passiveInputs.delete(source);\n }\n\n return matchingConnection;\n};\n","import { EVENT_LISTENERS } from '../globals';\nimport { TGetEventListenersOfAudioNodeFunction } from '../types';\nimport { getValueForKey } from './get-value-for-key';\n\nexport const getEventListenersOfAudioNode: TGetEventListenersOfAudioNodeFunction = (audioNode) => {\n return getValueForKey(EVENT_LISTENERS, audioNode);\n};\n","import { ACTIVE_AUDIO_NODE_STORE } from '../globals';\nimport { IAudioNode } from '../interfaces';\nimport { TContext } from '../types';\nimport { getEventListenersOfAudioNode } from './get-event-listeners-of-audio-node';\n\nexport const setInternalStateToActive = (audioNode: IAudioNode) => {\n if (ACTIVE_AUDIO_NODE_STORE.has(audioNode)) {\n throw new Error('The AudioNode is already stored.');\n }\n\n ACTIVE_AUDIO_NODE_STORE.add(audioNode);\n\n getEventListenersOfAudioNode(audioNode).forEach((eventListener) => eventListener(true));\n};\n","import { IAudioNode, IAudioWorkletNode } from '../interfaces';\nimport { TContext } from '../types';\n\nexport const isAudioWorkletNode = (audioNode: IAudioNode): audioNode is IAudioWorkletNode => {\n return 'port' in audioNode;\n};\n","import { ACTIVE_AUDIO_NODE_STORE } from '../globals';\nimport { IAudioNode } from '../interfaces';\nimport { TContext } from '../types';\nimport { getEventListenersOfAudioNode } from './get-event-listeners-of-audio-node';\n\nexport const setInternalStateToPassive = (audioNode: IAudioNode) => {\n if (!ACTIVE_AUDIO_NODE_STORE.has(audioNode)) {\n throw new Error('The AudioNode is not stored.');\n }\n\n ACTIVE_AUDIO_NODE_STORE.delete(audioNode);\n\n getEventListenersOfAudioNode(audioNode).forEach((eventListener) => eventListener(false));\n};\n","import { isAudioWorkletNode } from '../guards/audio-worklet-node';\nimport { IAudioNode } from '../interfaces';\nimport { TActiveInputConnection, TContext } from '../types';\nimport { setInternalStateToPassive } from './set-internal-state-to-passive';\n\n// Set the internalState of the audioNode to 'passive' if it is not an AudioWorkletNode and if it has no 'active' input connections.\nexport const setInternalStateToPassiveWhenNecessary = (\n audioNode: IAudioNode,\n activeInputs: Set>[]\n) => {\n if (!isAudioWorkletNode(audioNode) && activeInputs.every((connections) => connections.size === 0)) {\n setInternalStateToPassive(audioNode);\n }\n};\n","import { IAnalyserNode, IAnalyserOptions } from '../interfaces';\nimport { TAnalyserNodeConstructorFactory, TAudioNodeRenderer, TContext, TNativeAnalyserNode } from '../types';\n\nconst DEFAULT_OPTIONS = {\n channelCount: 2,\n channelCountMode: 'max',\n channelInterpretation: 'speakers',\n fftSize: 2048,\n maxDecibels: -30,\n minDecibels: -100,\n smoothingTimeConstant: 0.8\n} as const;\n\nexport const createAnalyserNodeConstructor: TAnalyserNodeConstructorFactory = (\n audionNodeConstructor,\n createAnalyserNodeRenderer,\n createIndexSizeError,\n createNativeAnalyserNode,\n getNativeContext,\n isNativeOfflineAudioContext\n) => {\n return class AnalyserNode extends audionNodeConstructor implements IAnalyserNode {\n private _nativeAnalyserNode: TNativeAnalyserNode;\n\n constructor(context: T, options?: Partial) {\n const nativeContext = getNativeContext(context);\n const mergedOptions = { ...DEFAULT_OPTIONS, ...options };\n const nativeAnalyserNode = createNativeAnalyserNode(nativeContext, mergedOptions);\n const analyserNodeRenderer = >(\n (isNativeOfflineAudioContext(nativeContext) ? createAnalyserNodeRenderer() : null)\n );\n\n super(context, false, nativeAnalyserNode, analyserNodeRenderer);\n\n this._nativeAnalyserNode = nativeAnalyserNode;\n }\n\n get fftSize(): number {\n return this._nativeAnalyserNode.fftSize;\n }\n\n set fftSize(value) {\n this._nativeAnalyserNode.fftSize = value;\n }\n\n get frequencyBinCount(): number {\n return this._nativeAnalyserNode.frequencyBinCount;\n }\n\n get maxDecibels(): number {\n return this._nativeAnalyserNode.maxDecibels;\n }\n\n set maxDecibels(value) {\n // Bug #118: Safari does not throw an error if maxDecibels is not more than minDecibels.\n const maxDecibels = this._nativeAnalyserNode.maxDecibels;\n\n this._nativeAnalyserNode.maxDecibels = value;\n\n if (!(value > this._nativeAnalyserNode.minDecibels)) {\n this._nativeAnalyserNode.maxDecibels = maxDecibels;\n\n throw createIndexSizeError();\n }\n }\n\n get minDecibels(): number {\n return this._nativeAnalyserNode.minDecibels;\n }\n\n set minDecibels(value) {\n // Bug #118: Safari does not throw an error if maxDecibels is not more than minDecibels.\n const minDecibels = this._nativeAnalyserNode.minDecibels;\n\n this._nativeAnalyserNode.minDecibels = value;\n\n if (!(this._nativeAnalyserNode.maxDecibels > value)) {\n this._nativeAnalyserNode.minDecibels = minDecibels;\n\n throw createIndexSizeError();\n }\n }\n\n get smoothingTimeConstant(): number {\n return this._nativeAnalyserNode.smoothingTimeConstant;\n }\n\n set smoothingTimeConstant(value) {\n this._nativeAnalyserNode.smoothingTimeConstant = value;\n }\n\n public getByteFrequencyData(array: Uint8Array): void {\n this._nativeAnalyserNode.getByteFrequencyData(array);\n }\n\n public getByteTimeDomainData(array: Uint8Array): void {\n this._nativeAnalyserNode.getByteTimeDomainData(array);\n }\n\n public getFloatFrequencyData(array: Float32Array): void {\n this._nativeAnalyserNode.getFloatFrequencyData(array);\n }\n\n public getFloatTimeDomainData(array: Float32Array): void {\n this._nativeAnalyserNode.getFloatTimeDomainData(array);\n }\n };\n};\n","import { TNativeAudioNode, TNativeContext } from '../types';\n\nexport const isOwnedByContext = (nativeAudioNode: TNativeAudioNode, nativeContext: TNativeContext): boolean => {\n return nativeAudioNode.context === nativeContext;\n};\n","import { TNativeAudioBuffer } from '../types';\n\nexport const testAudioBufferCopyChannelMethodsOutOfBoundsSupport = (nativeAudioBuffer: TNativeAudioBuffer): boolean => {\n try {\n nativeAudioBuffer.copyToChannel(new Float32Array(1), 0, -1);\n } catch {\n return false;\n }\n\n return true;\n};\n","import { TIndexSizeErrorFactory } from '../types';\n\nexport const createIndexSizeError: TIndexSizeErrorFactory = () => new DOMException('', 'IndexSizeError');\n","import { createIndexSizeError } from '../factories/index-size-error';\nimport { TNativeAudioBuffer } from '../types';\n\nexport const wrapAudioBufferGetChannelDataMethod = (audioBuffer: TNativeAudioBuffer): void => {\n audioBuffer.getChannelData = ((getChannelData) => {\n return (channel: number) => {\n try {\n return getChannelData.call(audioBuffer, channel);\n } catch (err) {\n if (err.code === 12) {\n throw createIndexSizeError();\n }\n\n throw err;\n }\n };\n })(audioBuffer.getChannelData);\n};\n","import { testAudioBufferCopyChannelMethodsOutOfBoundsSupport } from '../helpers/test-audio-buffer-copy-channel-methods-out-of-bounds-support';\nimport { wrapAudioBufferGetChannelDataMethod } from '../helpers/wrap-audio-buffer-get-channel-data-method';\nimport { IAudioBuffer, IAudioBufferOptions } from '../interfaces';\nimport { TAudioBufferConstructorFactory, TNativeOfflineAudioContext } from '../types';\n\nconst DEFAULT_OPTIONS = {\n numberOfChannels: 1\n} as const;\n\nexport const createAudioBufferConstructor: TAudioBufferConstructorFactory = (\n audioBufferStore,\n cacheTestResult,\n createNotSupportedError,\n nativeAudioBufferConstructor,\n nativeOfflineAudioContextConstructor,\n testNativeAudioBufferConstructorSupport,\n wrapAudioBufferCopyChannelMethods,\n wrapAudioBufferCopyChannelMethodsOutOfBounds\n) => {\n let nativeOfflineAudioContext: null | TNativeOfflineAudioContext = null;\n\n return class AudioBuffer implements IAudioBuffer {\n // This field needs to be defined to convince TypeScript that the IAudioBuffer will be implemented.\n public copyFromChannel!: (destination: Float32Array, channelNumber: number, bufferOffset?: number) => void;\n\n // This field needs to be defined to convince TypeScript that the IAudioBuffer will be implemented.\n public copyToChannel!: (source: Float32Array, channelNumber: number, bufferOffset?: number) => void;\n\n // This field needs to be defined to convince TypeScript that the IAudioBuffer will be implemented.\n public duration!: number;\n\n // This field needs to be defined to convince TypeScript that the IAudioBuffer will be implemented.\n public getChannelData!: (channel: number) => Float32Array;\n\n // This field needs to be defined to convince TypeScript that the IAudioBuffer will be implemented.\n public length!: number;\n\n // This field needs to be defined to convince TypeScript that the IAudioBuffer will be implemented.\n public numberOfChannels!: number;\n\n // This field needs to be defined to convince TypeScript that the IAudioBuffer will be implemented.\n public sampleRate!: number;\n\n constructor(options: IAudioBufferOptions) {\n if (nativeOfflineAudioContextConstructor === null) {\n throw new Error('Missing the native OfflineAudioContext constructor.');\n }\n\n const { length, numberOfChannels, sampleRate } = { ...DEFAULT_OPTIONS, ...options };\n\n if (nativeOfflineAudioContext === null) {\n nativeOfflineAudioContext = new nativeOfflineAudioContextConstructor(1, 1, 44100);\n }\n\n /*\n * Bug #99: Firefox does not throw a NotSupportedError when the numberOfChannels is zero. But it only does it when using the\n * factory function. But since Firefox also supports the constructor everything should be fine.\n */\n const audioBuffer =\n nativeAudioBufferConstructor !== null &&\n cacheTestResult(testNativeAudioBufferConstructorSupport, testNativeAudioBufferConstructorSupport)\n ? new nativeAudioBufferConstructor({ length, numberOfChannels, sampleRate })\n : nativeOfflineAudioContext.createBuffer(numberOfChannels, length, sampleRate);\n\n // Bug #99: Safari does not throw an error when the numberOfChannels is zero.\n if (audioBuffer.numberOfChannels === 0) {\n throw createNotSupportedError();\n }\n\n // Bug #5: Safari does not support copyFromChannel() and copyToChannel().\n // Bug #100: Safari does throw a wrong error when calling getChannelData() with an out-of-bounds value.\n if (typeof audioBuffer.copyFromChannel !== 'function') {\n wrapAudioBufferCopyChannelMethods(audioBuffer);\n wrapAudioBufferGetChannelDataMethod(audioBuffer);\n // Bug #157: Firefox does not allow the bufferOffset to be out-of-bounds.\n } else if (\n !cacheTestResult(testAudioBufferCopyChannelMethodsOutOfBoundsSupport, () =>\n testAudioBufferCopyChannelMethodsOutOfBoundsSupport(audioBuffer)\n )\n ) {\n wrapAudioBufferCopyChannelMethodsOutOfBounds(audioBuffer);\n }\n\n audioBufferStore.add(audioBuffer);\n\n /*\n * This does violate all good pratices but it is necessary to allow this AudioBuffer to be used with native\n * (Offline)AudioContexts.\n */\n return audioBuffer;\n }\n\n public static [Symbol.hasInstance](instance: unknown): boolean {\n return (\n (instance !== null && typeof instance === 'object' && Object.getPrototypeOf(instance) === AudioBuffer.prototype) ||\n audioBufferStore.has(instance)\n );\n }\n };\n};\n","export const MOST_NEGATIVE_SINGLE_FLOAT = -3.4028234663852886e38;\n\nexport const MOST_POSITIVE_SINGLE_FLOAT = -MOST_NEGATIVE_SINGLE_FLOAT;\n","import { ACTIVE_AUDIO_NODE_STORE } from '../globals';\nimport { TIsActiveAudioNodeFunction } from '../types';\n\nexport const isActiveAudioNode: TIsActiveAudioNodeFunction = (audioNode) => ACTIVE_AUDIO_NODE_STORE.has(audioNode);\n","import { MOST_NEGATIVE_SINGLE_FLOAT, MOST_POSITIVE_SINGLE_FLOAT } from '../constants';\nimport { isActiveAudioNode } from '../helpers/is-active-audio-node';\nimport { setInternalStateToActive } from '../helpers/set-internal-state-to-active';\nimport { setInternalStateToPassive } from '../helpers/set-internal-state-to-passive';\nimport { IAudioBufferSourceNode, IAudioBufferSourceOptions, IAudioParam, IAudioScheduledSourceNodeEventMap } from '../interfaces';\nimport {\n TAnyAudioBuffer,\n TAudioBufferSourceNodeConstructorFactory,\n TAudioBufferSourceNodeRenderer,\n TContext,\n TEventHandler,\n TNativeAudioBufferSourceNode\n} from '../types';\n\nconst DEFAULT_OPTIONS = {\n buffer: null,\n channelCount: 2,\n channelCountMode: 'max',\n channelInterpretation: 'speakers',\n // Bug #149: Safari does not yet support the detune AudioParam.\n loop: false,\n loopEnd: 0,\n loopStart: 0,\n playbackRate: 1\n} as const;\n\nexport const createAudioBufferSourceNodeConstructor: TAudioBufferSourceNodeConstructorFactory = (\n audioNodeConstructor,\n createAudioBufferSourceNodeRenderer,\n createAudioParam,\n createInvalidStateError,\n createNativeAudioBufferSourceNode,\n getNativeContext,\n isNativeOfflineAudioContext,\n wrapEventListener\n) => {\n return class AudioBufferSourceNode\n extends audioNodeConstructor\n implements IAudioBufferSourceNode\n {\n private _audioBufferSourceNodeRenderer: TAudioBufferSourceNodeRenderer;\n\n private _isBufferNullified: boolean;\n\n private _isBufferSet: boolean;\n\n private _nativeAudioBufferSourceNode: TNativeAudioBufferSourceNode;\n\n private _onended: null | TEventHandler;\n\n private _playbackRate: IAudioParam;\n\n constructor(context: T, options?: Partial) {\n const nativeContext = getNativeContext(context);\n const mergedOptions = { ...DEFAULT_OPTIONS, ...options };\n const nativeAudioBufferSourceNode = createNativeAudioBufferSourceNode(nativeContext, mergedOptions);\n const isOffline = isNativeOfflineAudioContext(nativeContext);\n const audioBufferSourceNodeRenderer = >(\n (isOffline ? createAudioBufferSourceNodeRenderer() : null)\n );\n\n super(context, false, nativeAudioBufferSourceNode, audioBufferSourceNodeRenderer);\n\n this._audioBufferSourceNodeRenderer = audioBufferSourceNodeRenderer;\n this._isBufferNullified = false;\n this._isBufferSet = mergedOptions.buffer !== null;\n this._nativeAudioBufferSourceNode = nativeAudioBufferSourceNode;\n this._onended = null;\n // Bug #73: Safari does not export the correct values for maxValue and minValue.\n this._playbackRate = createAudioParam(\n this,\n isOffline,\n nativeAudioBufferSourceNode.playbackRate,\n MOST_POSITIVE_SINGLE_FLOAT,\n MOST_NEGATIVE_SINGLE_FLOAT\n );\n }\n\n get buffer(): null | TAnyAudioBuffer {\n if (this._isBufferNullified) {\n return null;\n }\n\n return this._nativeAudioBufferSourceNode.buffer;\n }\n\n set buffer(value) {\n this._nativeAudioBufferSourceNode.buffer = value;\n\n // Bug #72: Only Chrome & Edge do not allow to reassign the buffer yet.\n if (value !== null) {\n if (this._isBufferSet) {\n throw createInvalidStateError();\n }\n\n this._isBufferSet = true;\n }\n }\n\n get loop(): boolean {\n return this._nativeAudioBufferSourceNode.loop;\n }\n\n set loop(value) {\n this._nativeAudioBufferSourceNode.loop = value;\n }\n\n get loopEnd(): number {\n return this._nativeAudioBufferSourceNode.loopEnd;\n }\n\n set loopEnd(value) {\n this._nativeAudioBufferSourceNode.loopEnd = value;\n }\n\n get loopStart(): number {\n return this._nativeAudioBufferSourceNode.loopStart;\n }\n\n set loopStart(value) {\n this._nativeAudioBufferSourceNode.loopStart = value;\n }\n\n get onended(): null | TEventHandler {\n return this._onended;\n }\n\n set onended(value) {\n const wrappedListener = typeof value === 'function' ? wrapEventListener(this, value) : null;\n\n this._nativeAudioBufferSourceNode.onended = wrappedListener;\n\n const nativeOnEnded = this._nativeAudioBufferSourceNode.onended;\n\n this._onended = nativeOnEnded !== null && nativeOnEnded === wrappedListener ? value : nativeOnEnded;\n }\n\n get playbackRate(): IAudioParam {\n return this._playbackRate;\n }\n\n public start(when = 0, offset = 0, duration?: number): void {\n this._nativeAudioBufferSourceNode.start(when, offset, duration);\n\n if (this._audioBufferSourceNodeRenderer !== null) {\n this._audioBufferSourceNodeRenderer.start = duration === undefined ? [when, offset] : [when, offset, duration];\n }\n\n if (this.context.state !== 'closed') {\n setInternalStateToActive(this);\n\n const resetInternalStateToPassive = () => {\n this._nativeAudioBufferSourceNode.removeEventListener('ended', resetInternalStateToPassive);\n\n if (isActiveAudioNode(this)) {\n setInternalStateToPassive(this);\n }\n };\n\n this._nativeAudioBufferSourceNode.addEventListener('ended', resetInternalStateToPassive);\n }\n }\n\n public stop(when = 0): void {\n this._nativeAudioBufferSourceNode.stop(when);\n\n if (this._audioBufferSourceNodeRenderer !== null) {\n this._audioBufferSourceNodeRenderer.stop = when;\n }\n }\n };\n};\n","import { AUDIO_NODE_CONNECTIONS_STORE } from '../globals';\nimport { IAudioNode } from '../interfaces';\nimport { TAudioNodeConnections, TContext, TGetAudioNodeConnectionsFunction } from '../types';\nimport { getValueForKey } from './get-value-for-key';\n\nexport const getAudioNodeConnections: TGetAudioNodeConnectionsFunction = (\n audioNode: IAudioNode\n): TAudioNodeConnections => {\n return >getValueForKey(AUDIO_NODE_CONNECTIONS_STORE, audioNode);\n};\n","import { AUDIO_PARAM_CONNECTIONS_STORE } from '../globals';\nimport { IAudioParam } from '../interfaces';\nimport { TAudioParamConnections, TContext, TGetAudioParamConnectionsFunction } from '../types';\nimport { getValueForKey } from './get-value-for-key';\n\nexport const getAudioParamConnections: TGetAudioParamConnectionsFunction = (\n audioParam: IAudioParam\n): TAudioParamConnections => {\n return >getValueForKey(AUDIO_PARAM_CONNECTIONS_STORE, audioParam);\n};\n","import { isAudioBufferSourceNode } from '../guards/audio-buffer-source-node';\nimport { isAudioWorkletNode } from '../guards/audio-worklet-node';\nimport { isBiquadFilterNode } from '../guards/biquad-filter-node';\nimport { isConstantSourceNode } from '../guards/constant-source-node';\nimport { isGainNode } from '../guards/gain-node';\nimport { isOscillatorNode } from '../guards/oscillator-node';\nimport { isStereoPannerNode } from '../guards/stereo-panner-node';\nimport { IAudioNode } from '../interfaces';\nimport { TContext } from '../types';\nimport { getAudioNodeConnections } from './get-audio-node-connections';\nimport { getAudioParamConnections } from './get-audio-param-connections';\nimport { isActiveAudioNode } from './is-active-audio-node';\nimport { setInternalStateToPassive } from './set-internal-state-to-passive';\n\nexport const deactivateActiveAudioNodeInputConnections = (\n audioNode: IAudioNode,\n trace: readonly IAudioNode[]\n) => {\n const { activeInputs } = getAudioNodeConnections(audioNode);\n\n activeInputs.forEach((connections) =>\n connections.forEach(([source]) => {\n if (!trace.includes(audioNode)) {\n deactivateActiveAudioNodeInputConnections(source, [...trace, audioNode]);\n }\n })\n );\n\n const audioParams = isAudioBufferSourceNode(audioNode)\n ? [\n // Bug #149: Safari does not yet support the detune AudioParam.\n audioNode.playbackRate\n ]\n : isAudioWorkletNode(audioNode)\n ? Array.from(audioNode.parameters.values())\n : isBiquadFilterNode(audioNode)\n ? [audioNode.Q, audioNode.detune, audioNode.frequency, audioNode.gain]\n : isConstantSourceNode(audioNode)\n ? [audioNode.offset]\n : isGainNode(audioNode)\n ? [audioNode.gain]\n : isOscillatorNode(audioNode)\n ? [audioNode.detune, audioNode.frequency]\n : isStereoPannerNode(audioNode)\n ? [audioNode.pan]\n : [];\n\n for (const audioParam of audioParams) {\n const audioParamConnections = getAudioParamConnections(audioParam);\n\n if (audioParamConnections !== undefined) {\n audioParamConnections.activeInputs.forEach(([source]) => deactivateActiveAudioNodeInputConnections(source, trace));\n }\n }\n\n if (isActiveAudioNode(audioNode)) {\n setInternalStateToPassive(audioNode);\n }\n};\n","import { IAudioBufferSourceNode, IAudioNode } from '../interfaces';\nimport { TContext } from '../types';\n\nexport const isAudioBufferSourceNode = (audioNode: IAudioNode): audioNode is IAudioBufferSourceNode => {\n return 'playbackRate' in audioNode;\n};\n","import { IAudioNode, IBiquadFilterNode } from '../interfaces';\nimport { TContext } from '../types';\n\nexport const isBiquadFilterNode = (audioNode: IAudioNode): audioNode is IBiquadFilterNode => {\n return 'frequency' in audioNode && 'gain' in audioNode;\n};\n","import { IAudioNode, IConstantSourceNode } from '../interfaces';\nimport { TContext } from '../types';\n\nexport const isConstantSourceNode = (audioNode: IAudioNode): audioNode is IConstantSourceNode => {\n return 'offset' in audioNode;\n};\n","import { IAudioNode, IGainNode } from '../interfaces';\nimport { TContext } from '../types';\n\nexport const isGainNode = (audioNode: IAudioNode): audioNode is IGainNode => {\n return !('frequency' in audioNode) && 'gain' in audioNode;\n};\n","import { IAudioNode, IOscillatorNode } from '../interfaces';\nimport { TContext } from '../types';\n\nexport const isOscillatorNode = (audioNode: IAudioNode): audioNode is IOscillatorNode => {\n return 'detune' in audioNode && 'frequency' in audioNode;\n};\n","import { IAudioNode, IStereoPannerNode } from '../interfaces';\nimport { TContext } from '../types';\n\nexport const isStereoPannerNode = (audioNode: IAudioNode): audioNode is IStereoPannerNode => {\n return 'pan' in audioNode;\n};\n","import { IAudioDestinationNode } from '../interfaces';\nimport { TContext } from '../types';\nimport { deactivateActiveAudioNodeInputConnections } from './deactivate-active-audio-node-input-connections';\n\nexport const deactivateAudioGraph = (context: T): void => {\n deactivateActiveAudioNodeInputConnections(>context.destination, []);\n};\n","import { IAudioContextOptions } from '../interfaces';\n\nexport const isValidLatencyHint = (latencyHint: IAudioContextOptions['latencyHint']) => {\n return (\n latencyHint === undefined ||\n typeof latencyHint === 'number' ||\n (typeof latencyHint === 'string' && (latencyHint === 'balanced' || latencyHint === 'interactive' || latencyHint === 'playback'))\n );\n};\n","import { IAudioNode, IAudioParam } from '../interfaces';\nimport { TContext } from '../types';\n\nexport const isAudioNode = (\n audioNodeOrAudioParam: IAudioNode | IAudioParam\n): audioNodeOrAudioParam is IAudioNode => {\n return 'context' in audioNodeOrAudioParam;\n};\n","import { TAudioNodeOutputConnection, TContext, TOutputConnection } from '../types';\nimport { isAudioNode } from './audio-node';\n\nexport const isAudioNodeOutputConnection = (\n outputConnection: TOutputConnection\n): outputConnection is TAudioNodeOutputConnection => {\n return isAudioNode(outputConnection[0]);\n};\n","import { TInsertElementInSetFunction } from '../types';\n\nexport const insertElementInSet: TInsertElementInSetFunction = (set, element, predicate, ignoreDuplicates) => {\n for (const lmnt of set) {\n if (predicate(lmnt)) {\n if (ignoreDuplicates) {\n return false;\n }\n\n throw Error('The set contains at least one similar element.');\n }\n }\n\n set.add(element);\n\n return true;\n};\n","import { IAudioNode } from '../interfaces';\nimport { TActiveInputConnection, TContext, TPassiveAudioParamInputConnection } from '../types';\nimport { insertElementInSet } from './insert-element-in-set';\n\nexport const addActiveInputConnectionToAudioParam = (\n activeInputs: Set>,\n source: IAudioNode,\n [output, eventListener]: TPassiveAudioParamInputConnection,\n ignoreDuplicates: boolean\n) => {\n insertElementInSet(\n activeInputs,\n [source, output, eventListener],\n (activeInputConnection) => activeInputConnection[0] === source && activeInputConnection[1] === output,\n ignoreDuplicates\n );\n};\n","import { IAudioNode } from '../interfaces';\nimport { TActiveInputConnection, TContext, TPassiveAudioParamInputConnection } from '../types';\nimport { insertElementInSet } from './insert-element-in-set';\n\nexport const addPassiveInputConnectionToAudioParam = (\n passiveInputs: WeakMap, Set>,\n [source, output, eventListener]: TActiveInputConnection,\n ignoreDuplicates: boolean\n) => {\n const passiveInputConnections = passiveInputs.get(source);\n\n if (passiveInputConnections === undefined) {\n passiveInputs.set(source, new Set([[output, eventListener]]));\n } else {\n insertElementInSet(\n passiveInputConnections,\n [output, eventListener],\n (passiveInputConnection) => passiveInputConnection[0] === output,\n ignoreDuplicates\n );\n }\n};\n","import { INativeAudioNodeFaker } from '../interfaces';\nimport { TNativeAudioNode } from '../types';\n\nexport const isNativeAudioNodeFaker = (\n nativeAudioNodeOrNativeAudioNodeFaker: TNativeAudioNode | INativeAudioNodeFaker\n): nativeAudioNodeOrNativeAudioNodeFaker is INativeAudioNodeFaker => {\n return 'inputs' in nativeAudioNodeOrNativeAudioNodeFaker;\n};\n","import { isNativeAudioNodeFaker } from '../guards/native-audio-node-faker';\nimport { INativeAudioNodeFaker } from '../interfaces';\nimport { TConnectNativeAudioNodeToNativeAudioNodeFunction, TNativeAudioNode } from '../types';\n\nexport const connectNativeAudioNodeToNativeAudioNode: TConnectNativeAudioNodeToNativeAudioNodeFunction = (\n nativeSourceAudioNode: INativeAudioNodeFaker | TNativeAudioNode,\n nativeDestinationAudioNode: INativeAudioNodeFaker | TNativeAudioNode,\n output: number,\n input: number\n): [TNativeAudioNode, number, number] => {\n if (isNativeAudioNodeFaker(nativeDestinationAudioNode)) {\n const fakeNativeDestinationAudioNode = nativeDestinationAudioNode.inputs[input];\n\n nativeSourceAudioNode.connect(fakeNativeDestinationAudioNode, output, 0);\n\n return [fakeNativeDestinationAudioNode, output, 0];\n }\n\n nativeSourceAudioNode.connect(nativeDestinationAudioNode, output, input);\n\n return [nativeDestinationAudioNode, output, input];\n};\n","import { IAudioNode } from '../interfaces';\nimport { TActiveInputConnection, TContext } from '../types';\n\nexport const deleteActiveInputConnection = (\n activeInputConnections: Set>,\n source: IAudioNode,\n output: number\n): null | TActiveInputConnection => {\n for (const activeInputConnection of activeInputConnections) {\n if (activeInputConnection[0] === source && activeInputConnection[1] === output) {\n activeInputConnections.delete(activeInputConnection);\n\n return activeInputConnection;\n }\n }\n\n return null;\n};\n","import { IAudioNode } from '../interfaces';\nimport { TContext, TInternalStateEventListener } from '../types';\nimport { getEventListenersOfAudioNode } from './get-event-listeners-of-audio-node';\n\nexport const deleteEventListenerOfAudioNode = (\n audioNode: IAudioNode,\n eventListener: TInternalStateEventListener\n) => {\n const eventListeners = getEventListenersOfAudioNode(audioNode);\n\n if (!eventListeners.delete(eventListener)) {\n throw new Error('Missing the expected event listener.');\n }\n};\n","import { IAudioNode } from '../interfaces';\nimport { TContext, TPassiveAudioParamInputConnection } from '../types';\nimport { getValueForKey } from './get-value-for-key';\nimport { pickElementFromSet } from './pick-element-from-set';\n\nexport const deletePassiveInputConnectionToAudioParam = (\n passiveInputs: WeakMap, Set>,\n source: IAudioNode,\n output: number\n) => {\n const passiveInputConnections = getValueForKey(passiveInputs, source);\n const matchingConnection = pickElementFromSet(\n passiveInputConnections,\n (passiveInputConnection) => passiveInputConnection[0] === output\n );\n\n if (passiveInputConnections.size === 0) {\n passiveInputs.delete(source);\n }\n\n return matchingConnection;\n};\n","import { isNativeAudioNodeFaker } from '../guards/native-audio-node-faker';\nimport { TDisconnectNativeAudioNodeFromNativeAudioNodeFunction } from '../types';\n\nexport const disconnectNativeAudioNodeFromNativeAudioNode: TDisconnectNativeAudioNodeFromNativeAudioNodeFunction = (\n nativeSourceAudioNode,\n nativeDestinationAudioNode,\n output,\n input\n) => {\n if (isNativeAudioNodeFaker(nativeDestinationAudioNode)) {\n nativeSourceAudioNode.disconnect(nativeDestinationAudioNode.inputs[input], output, 0);\n } else {\n nativeSourceAudioNode.disconnect(nativeDestinationAudioNode, output, input);\n }\n};\n","import { AUDIO_NODE_STORE } from '../globals';\nimport { IAudioNode, INativeAudioNodeFaker } from '../interfaces';\nimport { TContext, TGetNativeAudioNodeFunction, TNativeAudioNode } from '../types';\nimport { getValueForKey } from './get-value-for-key';\n\nexport const getNativeAudioNode: TGetNativeAudioNodeFunction = (\n audioNode: IAudioNode\n): U => {\n return getValueForKey(AUDIO_NODE_STORE, audioNode);\n};\n","import { AUDIO_PARAM_STORE } from '../globals';\nimport { IAudioParam } from '../interfaces';\nimport { TNativeAudioParam } from '../types';\nimport { getValueForKey } from './get-value-for-key';\n\nexport const getNativeAudioParam = (audioParam: IAudioParam): TNativeAudioParam => {\n return getValueForKey(AUDIO_PARAM_STORE, audioParam);\n};\n","import { CYCLE_COUNTERS } from '../globals';\nimport { TIsPartOfACycleFunction } from '../types';\n\nexport const isPartOfACycle: TIsPartOfACycleFunction = (audioNode) => {\n return CYCLE_COUNTERS.has(audioNode);\n};\n","import { ACTIVE_AUDIO_NODE_STORE } from '../globals';\nimport { TIsPassiveAudioNodeFunction } from '../types';\n\nexport const isPassiveAudioNode: TIsPassiveAudioNodeFunction = (audioNode) => {\n return !ACTIVE_AUDIO_NODE_STORE.has(audioNode);\n};\n","import { TNativeAudioContext, TNativeAudioWorkletNodeConstructor } from '../types';\n\nexport const testAudioNodeDisconnectMethodSupport = (\n nativeAudioContext: TNativeAudioContext,\n nativeAudioWorkletNodeConstructor: null | TNativeAudioWorkletNodeConstructor\n): Promise => {\n return new Promise((resolve) => {\n /*\n * This bug existed in Safari up until v14.0.2. Since AudioWorklets were not supported in Safari until v14.1 the presence of the\n * constructor for an AudioWorkletNode can be used here to skip the test.\n */\n if (nativeAudioWorkletNodeConstructor !== null) {\n resolve(true);\n } else {\n const analyzer = nativeAudioContext.createScriptProcessor(256, 1, 1); // tslint:disable-line deprecation\n const dummy = nativeAudioContext.createGain();\n // Bug #95: Safari does not play one sample buffers.\n const ones = nativeAudioContext.createBuffer(1, 2, 44100);\n const channelData = ones.getChannelData(0);\n\n channelData[0] = 1;\n channelData[1] = 1;\n\n const source = nativeAudioContext.createBufferSource();\n\n source.buffer = ones;\n source.loop = true;\n\n source.connect(analyzer).connect(nativeAudioContext.destination);\n source.connect(dummy);\n source.disconnect(dummy);\n\n // tslint:disable-next-line:deprecation\n analyzer.onaudioprocess = (event) => {\n const chnnlDt = event.inputBuffer.getChannelData(0); // tslint:disable-line deprecation\n\n if (Array.prototype.some.call(chnnlDt, (sample: number) => sample === 1)) {\n resolve(true);\n } else {\n resolve(false);\n }\n\n source.stop();\n\n analyzer.onaudioprocess = null; // tslint:disable-line:deprecation\n\n source.disconnect(analyzer);\n analyzer.disconnect(nativeAudioContext.destination);\n };\n\n source.start();\n }\n });\n};\n","import { IAudioNode } from '../interfaces';\nimport { TContext } from '../types';\n\nexport const visitEachAudioNodeOnce = (\n cycles: IAudioNode[][],\n visitor: (audioNode: IAudioNode, count: number) => void\n): void => {\n const counts = new Map, number>();\n\n for (const cycle of cycles) {\n for (const audioNode of cycle) {\n const count = counts.get(audioNode);\n\n counts.set(audioNode, count === undefined ? 1 : count + 1);\n }\n }\n\n counts.forEach((count, audioNode) => visitor(audioNode, count));\n};\n","import { TNativeAudioNode, TNativeAudioParam } from '../types';\n\nexport const isNativeAudioNode = (\n nativeAudioNodeOrAudioParam: TNativeAudioNode | TNativeAudioParam\n): nativeAudioNodeOrAudioParam is TNativeAudioNode => {\n return 'context' in nativeAudioNodeOrAudioParam;\n};\n","import { isNativeAudioNode } from '../guards/native-audio-node';\nimport { TNativeAudioNode, TNativeAudioParam } from '../types';\n\nexport const wrapAudioNodeDisconnectMethod = (nativeAudioNode: TNativeAudioNode): void => {\n const connections = new Map();\n\n nativeAudioNode.connect = ((connect) => {\n // tslint:disable-next-line:invalid-void no-inferrable-types\n return (destination: TNativeAudioNode | TNativeAudioParam, output = 0, input: number = 0): void | TNativeAudioNode => {\n const returnValue = isNativeAudioNode(destination) ? connect(destination, output, input) : connect(destination, output);\n\n // Save the new connection only if the calls to connect above didn't throw an error.\n const connectionsToDestination = connections.get(destination);\n\n if (connectionsToDestination === undefined) {\n connections.set(destination, [{ input, output }]);\n } else {\n if (connectionsToDestination.every((connection) => connection.input !== input || connection.output !== output)) {\n connectionsToDestination.push({ input, output });\n }\n }\n\n return returnValue;\n };\n })(nativeAudioNode.connect.bind(nativeAudioNode));\n\n nativeAudioNode.disconnect = ((disconnect) => {\n return (destinationOrOutput?: number | TNativeAudioNode | TNativeAudioParam, output?: number, input?: number): void => {\n disconnect.apply(nativeAudioNode);\n\n if (destinationOrOutput === undefined) {\n connections.clear();\n } else if (typeof destinationOrOutput === 'number') {\n for (const [destination, connectionsToDestination] of connections) {\n const filteredConnections = connectionsToDestination.filter((connection) => connection.output !== destinationOrOutput);\n\n if (filteredConnections.length === 0) {\n connections.delete(destination);\n } else {\n connections.set(destination, filteredConnections);\n }\n }\n } else if (connections.has(destinationOrOutput)) {\n if (output === undefined) {\n connections.delete(destinationOrOutput);\n } else {\n const connectionsToDestination = connections.get(destinationOrOutput);\n\n if (connectionsToDestination !== undefined) {\n const filteredConnections = connectionsToDestination.filter(\n (connection) => connection.output !== output && (connection.input !== input || input === undefined)\n );\n\n if (filteredConnections.length === 0) {\n connections.delete(destinationOrOutput);\n } else {\n connections.set(destinationOrOutput, filteredConnections);\n }\n }\n }\n }\n\n for (const [destination, connectionsToDestination] of connections) {\n connectionsToDestination.forEach((connection) => {\n if (isNativeAudioNode(destination)) {\n nativeAudioNode.connect(destination, connection.output, connection.input);\n } else {\n nativeAudioNode.connect(destination, connection.output);\n }\n });\n }\n };\n })(nativeAudioNode.disconnect);\n};\n","import { AUDIO_NODE_STORE, EVENT_LISTENERS } from '../globals';\nimport { isAudioNode } from '../guards/audio-node';\nimport { isAudioNodeOutputConnection } from '../guards/audio-node-output-connection';\nimport { addActiveInputConnectionToAudioParam } from '../helpers/add-active-input-connection-to-audio-param';\nimport { addPassiveInputConnectionToAudioParam } from '../helpers/add-passive-input-connection-to-audio-param';\nimport { connectNativeAudioNodeToNativeAudioNode } from '../helpers/connect-native-audio-node-to-native-audio-node';\nimport { deleteActiveInputConnection } from '../helpers/delete-active-input-connection';\nimport { deleteActiveInputConnectionToAudioParam } from '../helpers/delete-active-input-connection-to-audio-param';\nimport { deleteEventListenerOfAudioNode } from '../helpers/delete-event-listeners-of-audio-node';\nimport { deletePassiveInputConnectionToAudioNode } from '../helpers/delete-passive-input-connection-to-audio-node';\nimport { deletePassiveInputConnectionToAudioParam } from '../helpers/delete-passive-input-connection-to-audio-param';\nimport { disconnectNativeAudioNodeFromNativeAudioNode } from '../helpers/disconnect-native-audio-node-from-native-audio-node';\nimport { getAudioNodeConnections } from '../helpers/get-audio-node-connections';\nimport { getAudioParamConnections } from '../helpers/get-audio-param-connections';\nimport { getEventListenersOfAudioNode } from '../helpers/get-event-listeners-of-audio-node';\nimport { getNativeAudioNode } from '../helpers/get-native-audio-node';\nimport { getNativeAudioParam } from '../helpers/get-native-audio-param';\nimport { insertElementInSet } from '../helpers/insert-element-in-set';\nimport { isActiveAudioNode } from '../helpers/is-active-audio-node';\nimport { isPartOfACycle } from '../helpers/is-part-of-a-cycle';\nimport { isPassiveAudioNode } from '../helpers/is-passive-audio-node';\nimport { setInternalStateToActive } from '../helpers/set-internal-state-to-active';\nimport { setInternalStateToPassiveWhenNecessary } from '../helpers/set-internal-state-to-passive-when-necessary';\nimport { testAudioNodeDisconnectMethodSupport } from '../helpers/test-audio-node-disconnect-method-support';\nimport { visitEachAudioNodeOnce } from '../helpers/visit-each-audio-node-once';\nimport { wrapAudioNodeDisconnectMethod } from '../helpers/wrap-audio-node-disconnect-method';\nimport {\n IAudioNode,\n IAudioNodeRenderer,\n IAudioParam,\n IMinimalOfflineAudioContext,\n INativeAudioNodeFaker,\n IOfflineAudioContext\n} from '../interfaces';\nimport {\n TAudioNodeConstructorFactory,\n TChannelCountMode,\n TChannelInterpretation,\n TContext,\n TInternalStateEventListener,\n TNativeAudioNode,\n TNativeAudioParam\n} from '../types';\n\nconst addConnectionToAudioParamOfAudioContext = (\n source: IAudioNode,\n destination: IAudioParam,\n output: number,\n isOffline: boolean\n): boolean => {\n const { activeInputs, passiveInputs } = getAudioParamConnections(destination);\n const { outputs } = getAudioNodeConnections(source);\n const eventListeners = getEventListenersOfAudioNode(source);\n\n const eventListener: TInternalStateEventListener = (isActive) => {\n const nativeAudioNode = getNativeAudioNode(source);\n const nativeAudioParam = getNativeAudioParam(destination);\n\n if (isActive) {\n const partialConnection = deletePassiveInputConnectionToAudioParam(passiveInputs, source, output);\n\n addActiveInputConnectionToAudioParam(activeInputs, source, partialConnection, false);\n\n if (!isOffline && !isPartOfACycle(source)) {\n nativeAudioNode.connect(nativeAudioParam, output);\n }\n } else {\n const partialConnection = deleteActiveInputConnectionToAudioParam(activeInputs, source, output);\n\n addPassiveInputConnectionToAudioParam(passiveInputs, partialConnection, false);\n\n if (!isOffline && !isPartOfACycle(source)) {\n nativeAudioNode.disconnect(nativeAudioParam, output);\n }\n }\n };\n\n if (\n insertElementInSet(\n outputs,\n [destination, output],\n (outputConnection) => outputConnection[0] === destination && outputConnection[1] === output,\n true\n )\n ) {\n eventListeners.add(eventListener);\n\n if (isActiveAudioNode(source)) {\n addActiveInputConnectionToAudioParam(activeInputs, source, [output, eventListener], true);\n } else {\n addPassiveInputConnectionToAudioParam(passiveInputs, [source, output, eventListener], true);\n }\n\n return true;\n }\n\n return false;\n};\n\nconst deleteInputConnectionOfAudioNode = (\n source: IAudioNode,\n destination: IAudioNode,\n output: number,\n input: number\n): [null | TInternalStateEventListener, boolean] => {\n const { activeInputs, passiveInputs } = getAudioNodeConnections(destination);\n\n const activeInputConnection = deleteActiveInputConnection(activeInputs[input], source, output);\n\n if (activeInputConnection === null) {\n const passiveInputConnection = deletePassiveInputConnectionToAudioNode(passiveInputs, source, output, input);\n\n return [passiveInputConnection[2], false];\n }\n\n return [activeInputConnection[2], true];\n};\n\nconst deleteInputConnectionOfAudioParam = (\n source: IAudioNode,\n destination: IAudioParam,\n output: number\n): [null | TInternalStateEventListener, boolean] => {\n const { activeInputs, passiveInputs } = getAudioParamConnections(destination);\n\n const activeInputConnection = deleteActiveInputConnection(activeInputs, source, output);\n\n if (activeInputConnection === null) {\n const passiveInputConnection = deletePassiveInputConnectionToAudioParam(passiveInputs, source, output);\n\n return [passiveInputConnection[1], false];\n }\n\n return [activeInputConnection[2], true];\n};\n\nconst deleteInputsOfAudioNode = (\n source: IAudioNode,\n isOffline: boolean,\n destination: IAudioNode,\n output: number,\n input: number\n) => {\n const [listener, isActive] = deleteInputConnectionOfAudioNode(source, destination, output, input);\n\n if (listener !== null) {\n deleteEventListenerOfAudioNode(source, listener);\n\n if (isActive && !isOffline && !isPartOfACycle(source)) {\n disconnectNativeAudioNodeFromNativeAudioNode(getNativeAudioNode(source), getNativeAudioNode(destination), output, input);\n }\n }\n\n if (isActiveAudioNode(destination)) {\n const { activeInputs } = getAudioNodeConnections(destination);\n\n setInternalStateToPassiveWhenNecessary(destination, activeInputs);\n }\n};\n\nconst deleteInputsOfAudioParam = (\n source: IAudioNode,\n isOffline: boolean,\n destination: IAudioParam,\n output: number\n) => {\n const [listener, isActive] = deleteInputConnectionOfAudioParam(source, destination, output);\n\n if (listener !== null) {\n deleteEventListenerOfAudioNode(source, listener);\n\n if (isActive && !isOffline && !isPartOfACycle(source)) {\n getNativeAudioNode(source).disconnect(getNativeAudioParam(destination), output);\n }\n }\n};\n\nconst deleteAnyConnection = (source: IAudioNode, isOffline: boolean): (IAudioNode | IAudioParam)[] => {\n const audioNodeConnectionsOfSource = getAudioNodeConnections(source);\n const destinations = [];\n\n for (const outputConnection of audioNodeConnectionsOfSource.outputs) {\n if (isAudioNodeOutputConnection(outputConnection)) {\n deleteInputsOfAudioNode(source, isOffline, ...outputConnection);\n } else {\n deleteInputsOfAudioParam(source, isOffline, ...outputConnection);\n }\n\n destinations.push(outputConnection[0]);\n }\n\n audioNodeConnectionsOfSource.outputs.clear();\n\n return destinations;\n};\n\nconst deleteConnectionAtOutput = (\n source: IAudioNode,\n isOffline: boolean,\n output: number\n): (IAudioNode | IAudioParam)[] => {\n const audioNodeConnectionsOfSource = getAudioNodeConnections(source);\n const destinations = [];\n\n for (const outputConnection of audioNodeConnectionsOfSource.outputs) {\n if (outputConnection[1] === output) {\n if (isAudioNodeOutputConnection(outputConnection)) {\n deleteInputsOfAudioNode(source, isOffline, ...outputConnection);\n } else {\n deleteInputsOfAudioParam(source, isOffline, ...outputConnection);\n }\n\n destinations.push(outputConnection[0]);\n audioNodeConnectionsOfSource.outputs.delete(outputConnection);\n }\n }\n\n return destinations;\n};\n\nconst deleteConnectionToDestination = (\n source: IAudioNode,\n isOffline: boolean,\n destination: IAudioNode | IAudioParam,\n output?: number,\n input?: number\n): (IAudioNode | IAudioParam)[] => {\n const audioNodeConnectionsOfSource = getAudioNodeConnections(source);\n\n return Array.from(audioNodeConnectionsOfSource.outputs)\n .filter(\n (outputConnection) =>\n outputConnection[0] === destination &&\n (output === undefined || outputConnection[1] === output) &&\n (input === undefined || outputConnection[2] === input)\n )\n .map((outputConnection) => {\n if (isAudioNodeOutputConnection(outputConnection)) {\n deleteInputsOfAudioNode(source, isOffline, ...outputConnection);\n } else {\n deleteInputsOfAudioParam(source, isOffline, ...outputConnection);\n }\n\n audioNodeConnectionsOfSource.outputs.delete(outputConnection);\n\n return outputConnection[0];\n });\n};\n\nexport const createAudioNodeConstructor: TAudioNodeConstructorFactory = (\n addAudioNodeConnections,\n addConnectionToAudioNode,\n cacheTestResult,\n createIncrementCycleCounter,\n createIndexSizeError,\n createInvalidAccessError,\n createNotSupportedError,\n decrementCycleCounter,\n detectCycles,\n eventTargetConstructor,\n getNativeContext,\n isNativeAudioContext,\n isNativeAudioNode,\n isNativeAudioParam,\n isNativeOfflineAudioContext,\n nativeAudioWorkletNodeConstructor\n) => {\n return class AudioNode = {}>\n extends eventTargetConstructor\n implements IAudioNode\n {\n private _context: T;\n\n private _nativeAudioNode: INativeAudioNodeFaker | TNativeAudioNode;\n\n constructor(\n context: T,\n isActive: boolean,\n nativeAudioNode: INativeAudioNodeFaker | TNativeAudioNode,\n audioNodeRenderer: T extends IMinimalOfflineAudioContext | IOfflineAudioContext ? IAudioNodeRenderer> : null\n ) {\n super(nativeAudioNode);\n\n this._context = context;\n this._nativeAudioNode = nativeAudioNode;\n\n const nativeContext = getNativeContext(context);\n\n // Bug #12: Safari does not support to disconnect a specific destination.\n if (\n isNativeAudioContext(nativeContext) &&\n true !==\n cacheTestResult(testAudioNodeDisconnectMethodSupport, () => {\n return testAudioNodeDisconnectMethodSupport(nativeContext, nativeAudioWorkletNodeConstructor);\n })\n ) {\n wrapAudioNodeDisconnectMethod(nativeAudioNode);\n }\n\n AUDIO_NODE_STORE.set(this, nativeAudioNode);\n EVENT_LISTENERS.set(this, new Set());\n\n if (context.state !== 'closed' && isActive) {\n setInternalStateToActive(this);\n }\n\n addAudioNodeConnections(this, audioNodeRenderer, nativeAudioNode);\n }\n\n get channelCount(): number {\n return this._nativeAudioNode.channelCount;\n }\n\n set channelCount(value) {\n this._nativeAudioNode.channelCount = value;\n }\n\n get channelCountMode(): TChannelCountMode {\n return this._nativeAudioNode.channelCountMode;\n }\n\n set channelCountMode(value) {\n this._nativeAudioNode.channelCountMode = value;\n }\n\n get channelInterpretation(): TChannelInterpretation {\n return this._nativeAudioNode.channelInterpretation;\n }\n\n set channelInterpretation(value) {\n this._nativeAudioNode.channelInterpretation = value;\n }\n\n get context(): T {\n return this._context;\n }\n\n get numberOfInputs(): number {\n return this._nativeAudioNode.numberOfInputs;\n }\n\n get numberOfOutputs(): number {\n return this._nativeAudioNode.numberOfOutputs;\n }\n\n public connect>(destinationNode: V, output?: number, input?: number): V;\n public connect(destinationParam: IAudioParam, output?: number): void;\n // tslint:disable-next-line:invalid-void\n public connect>(destination: V | IAudioParam, output = 0, input = 0): void | V {\n // Bug #174: Safari does expose a wrong numberOfOutputs for MediaStreamAudioDestinationNodes.\n if (output < 0 || output >= this._nativeAudioNode.numberOfOutputs) {\n throw createIndexSizeError();\n }\n\n const nativeContext = getNativeContext(this._context);\n const isOffline = isNativeOfflineAudioContext(nativeContext);\n\n if (isNativeAudioNode(destination) || isNativeAudioParam(destination)) {\n throw createInvalidAccessError();\n }\n\n if (isAudioNode(destination)) {\n const nativeDestinationAudioNode = getNativeAudioNode(destination);\n\n try {\n const connection = connectNativeAudioNodeToNativeAudioNode(\n this._nativeAudioNode,\n nativeDestinationAudioNode,\n output,\n input\n );\n\n const isPassive = isPassiveAudioNode(this);\n\n if (isOffline || isPassive) {\n this._nativeAudioNode.disconnect(...connection);\n }\n\n if (this.context.state !== 'closed' && !isPassive && isPassiveAudioNode(destination)) {\n setInternalStateToActive(destination);\n }\n } catch (err) {\n // Bug #41: Safari does not throw the correct exception so far.\n if (err.code === 12) {\n throw createInvalidAccessError();\n }\n\n throw err;\n }\n\n const isNewConnectionToAudioNode = addConnectionToAudioNode(\n this,\n >destination,\n output,\n input,\n isOffline\n );\n\n // Bug #164: Only Firefox detects cycles so far.\n if (isNewConnectionToAudioNode) {\n const cycles = detectCycles([this], >(destination));\n\n visitEachAudioNodeOnce(cycles, createIncrementCycleCounter(isOffline));\n }\n\n return destination;\n }\n\n const nativeAudioParam = getNativeAudioParam(destination);\n\n /*\n * Bug #73, #147 & #153: Safari does not support to connect an input signal to the playbackRate AudioParam of an\n * AudioBufferSourceNode. This can't be easily detected and that's why the outdated name property is used here to identify\n * Safari. In addition to that the maxValue property is used to only detect the affected versions below v14.0.2.\n */\n if ((nativeAudioParam).name === 'playbackRate' && nativeAudioParam.maxValue === 1024) {\n throw createNotSupportedError();\n }\n\n try {\n this._nativeAudioNode.connect(nativeAudioParam, output);\n\n if (isOffline || isPassiveAudioNode(this)) {\n this._nativeAudioNode.disconnect(nativeAudioParam, output);\n }\n } catch (err) {\n // Bug #58: Safari doesn't throw an InvalidAccessError yet.\n if (err.code === 12) {\n throw createInvalidAccessError();\n }\n\n throw err;\n }\n\n const isNewConnectionToAudioParam = addConnectionToAudioParamOfAudioContext(this, destination, output, isOffline);\n\n // Bug #164: Only Firefox detects cycles so far.\n if (isNewConnectionToAudioParam) {\n const cycles = detectCycles([this], destination);\n\n visitEachAudioNodeOnce(cycles, createIncrementCycleCounter(isOffline));\n }\n }\n\n public disconnect(output?: number): void;\n public disconnect(destinationNode: IAudioNode, output?: number, input?: number): void;\n public disconnect(destinationParam: IAudioParam, output?: number): void;\n public disconnect(\n destinationOrOutput?: number | IAudioNode | IAudioParam,\n output?: number,\n input?: number\n ): void {\n let destinations: (IAudioNode | IAudioParam)[];\n\n const nativeContext = getNativeContext(this._context);\n const isOffline = isNativeOfflineAudioContext(nativeContext);\n\n if (destinationOrOutput === undefined) {\n destinations = deleteAnyConnection(this, isOffline);\n } else if (typeof destinationOrOutput === 'number') {\n if (destinationOrOutput < 0 || destinationOrOutput >= this.numberOfOutputs) {\n throw createIndexSizeError();\n }\n\n destinations = deleteConnectionAtOutput(this, isOffline, destinationOrOutput);\n } else {\n if (output !== undefined && (output < 0 || output >= this.numberOfOutputs)) {\n throw createIndexSizeError();\n }\n\n if (isAudioNode(destinationOrOutput) && input !== undefined && (input < 0 || input >= destinationOrOutput.numberOfInputs)) {\n throw createIndexSizeError();\n }\n\n destinations = deleteConnectionToDestination(this, isOffline, destinationOrOutput, output, input);\n\n if (destinations.length === 0) {\n throw createInvalidAccessError();\n }\n }\n\n // Bug #164: Only Firefox detects cycles so far.\n for (const destination of destinations) {\n const cycles = detectCycles([this], destination);\n\n visitEachAudioNodeOnce(cycles, decrementCycleCounter);\n }\n }\n };\n};\n","import { IAudioNode } from '../interfaces';\nimport { TActiveInputConnection, TContext } from '../types';\nimport { pickElementFromSet } from './pick-element-from-set';\n\nexport const deleteActiveInputConnectionToAudioParam = (\n activeInputs: Set>,\n source: IAudioNode,\n output: number\n) => {\n return pickElementFromSet(\n activeInputs,\n (activeInputConnection) => activeInputConnection[0] === source && activeInputConnection[1] === output\n );\n};\n","import { IReadOnlyMap } from './interfaces';\n\nexport class ReadOnlyMap implements IReadOnlyMap {\n private _map: Map;\n\n constructor(parameters: [T, U][]) {\n this._map = new Map(parameters);\n }\n\n get size(): number {\n return this._map.size;\n }\n\n public entries(): IterableIterator<[T, U]> {\n return this._map.entries();\n }\n\n public forEach(callback: (audioParam: U, name: T, map: ReadOnlyMap) => void, thisArg: any = null): void {\n return this._map.forEach((value: U, key: T) => callback.call(thisArg, value, key, this));\n }\n\n public get(name: T): undefined | U {\n return this._map.get(name);\n }\n\n public has(name: T): boolean {\n return this._map.has(name);\n }\n\n public keys(): IterableIterator {\n return this._map.keys();\n }\n\n public values(): IterableIterator {\n return this._map.values();\n }\n}\n","import { NODE_NAME_TO_PROCESSOR_CONSTRUCTOR_MAPS } from '../globals';\nimport {\n IAudioParam,\n IAudioWorkletNode,\n IAudioWorkletNodeEventMap,\n IAudioWorkletNodeOptions,\n IMinimalAudioContext,\n IMinimalOfflineAudioContext,\n IOfflineAudioContext,\n IReadOnlyMap\n} from '../interfaces';\nimport { ReadOnlyMap } from '../read-only-map';\nimport {\n TAudioNodeRenderer,\n TAudioParamMap,\n TAudioWorkletNodeConstructorFactory,\n TContext,\n TErrorEventHandler,\n TNativeAudioContext,\n TNativeAudioParam,\n TNativeAudioWorkletNode\n} from '../types';\n\nconst DEFAULT_OPTIONS = {\n channelCount: 2,\n // Bug #61: The channelCountMode should be 'max' according to the spec but is set to 'explicit' to achieve consistent behavior.\n channelCountMode: 'explicit',\n channelInterpretation: 'speakers',\n numberOfInputs: 1,\n numberOfOutputs: 1,\n parameterData: {},\n processorOptions: {}\n} as const;\n\nexport const createAudioWorkletNodeConstructor: TAudioWorkletNodeConstructorFactory = (\n addUnrenderedAudioWorkletNode,\n audioNodeConstructor,\n createAudioParam,\n createAudioWorkletNodeRenderer,\n createNativeAudioWorkletNode,\n getAudioNodeConnections,\n getBackupOfflineAudioContext,\n getNativeContext,\n isNativeOfflineAudioContext,\n nativeAudioWorkletNodeConstructor,\n sanitizeAudioWorkletNodeOptions,\n setActiveAudioWorkletNodeInputs,\n testAudioWorkletNodeOptionsClonability,\n wrapEventListener\n) => {\n return class AudioWorkletNode\n extends audioNodeConstructor\n implements IAudioWorkletNode\n {\n private _nativeAudioWorkletNode: TNativeAudioWorkletNode;\n\n private _onprocessorerror: null | TErrorEventHandler;\n\n private _parameters: null | TAudioParamMap;\n\n constructor(context: T, name: string, options?: Partial) {\n const nativeContext = getNativeContext(context);\n const isOffline = isNativeOfflineAudioContext(nativeContext);\n const mergedOptions = sanitizeAudioWorkletNodeOptions({ ...DEFAULT_OPTIONS, ...options });\n\n // Bug #191: Safari doesn't throw an error if the options aren't clonable.\n testAudioWorkletNodeOptionsClonability(mergedOptions);\n\n const nodeNameToProcessorConstructorMap = NODE_NAME_TO_PROCESSOR_CONSTRUCTOR_MAPS.get(nativeContext);\n const processorConstructor = nodeNameToProcessorConstructorMap?.get(name);\n // Bug #186: Chrome and Edge do not allow to create an AudioWorkletNode on a closed AudioContext.\n const nativeContextOrBackupOfflineAudioContext =\n isOffline || nativeContext.state !== 'closed'\n ? nativeContext\n : getBackupOfflineAudioContext(nativeContext) ?? nativeContext;\n const nativeAudioWorkletNode = createNativeAudioWorkletNode(\n nativeContextOrBackupOfflineAudioContext,\n isOffline ? null : ((context)).baseLatency,\n nativeAudioWorkletNodeConstructor,\n name,\n processorConstructor,\n mergedOptions\n );\n const audioWorkletNodeRenderer = >(\n (isOffline ? createAudioWorkletNodeRenderer(name, mergedOptions, processorConstructor) : null)\n );\n\n /*\n * @todo Add a mechanism to switch an AudioWorkletNode to passive once the process() function of the AudioWorkletProcessor\n * returns false.\n */\n super(context, true, nativeAudioWorkletNode, audioWorkletNodeRenderer);\n\n const parameters: [string, IAudioParam][] = [];\n\n nativeAudioWorkletNode.parameters.forEach((nativeAudioParam, nm) => {\n const audioParam = createAudioParam(this, isOffline, nativeAudioParam);\n\n parameters.push([nm, audioParam]);\n });\n\n this._nativeAudioWorkletNode = nativeAudioWorkletNode;\n this._onprocessorerror = null;\n this._parameters = new ReadOnlyMap(parameters);\n\n /*\n * Bug #86 & #87: Invoking the renderer of an AudioWorkletNode might be necessary if it has no direct or indirect connection to\n * the destination.\n */\n if (isOffline) {\n addUnrenderedAudioWorkletNode(nativeContext, >this);\n }\n\n const { activeInputs } = getAudioNodeConnections(this);\n\n setActiveAudioWorkletNodeInputs(nativeAudioWorkletNode, activeInputs);\n }\n\n get onprocessorerror(): null | TErrorEventHandler {\n return this._onprocessorerror;\n }\n\n set onprocessorerror(value) {\n const wrappedListener = typeof value === 'function' ? wrapEventListener(this, value) : null;\n\n this._nativeAudioWorkletNode.onprocessorerror = wrappedListener;\n\n const nativeOnProcessorError = this._nativeAudioWorkletNode.onprocessorerror;\n\n this._onprocessorerror =\n nativeOnProcessorError !== null && nativeOnProcessorError === wrappedListener\n ? value\n : >nativeOnProcessorError;\n }\n\n get parameters(): TAudioParamMap {\n if (this._parameters === null) {\n // @todo The definition that TypeScript uses of the AudioParamMap is lacking many methods.\n return >this._nativeAudioWorkletNode.parameters;\n }\n\n return this._parameters;\n }\n\n get port(): MessagePort {\n return this._nativeAudioWorkletNode.port;\n }\n };\n};\n","import { TNativeAudioBuffer } from '../types';\n\nexport function copyFromChannel(\n audioBuffer: TNativeAudioBuffer,\n parent: { [key: number]: Float32Array },\n key: number,\n channelNumber: number,\n bufferOffset: number\n): void;\nexport function copyFromChannel(\n audioBuffer: TNativeAudioBuffer,\n parent: { [key: string]: Float32Array },\n key: string,\n channelNumber: number,\n bufferOffset: number\n): void;\nexport function copyFromChannel(\n audioBuffer: TNativeAudioBuffer,\n // @todo There is currently no way to define something like { [ key: number | string ]: Float32Array }\n parent: any,\n key: number | string,\n channelNumber: number,\n bufferOffset: number\n): void {\n if (typeof audioBuffer.copyFromChannel === 'function') {\n // The byteLength will be 0 when the ArrayBuffer was transferred.\n if (parent[key].byteLength === 0) {\n parent[key] = new Float32Array(128);\n }\n\n audioBuffer.copyFromChannel(parent[key], channelNumber, bufferOffset);\n\n // Bug #5: Safari does not support copyFromChannel().\n } else {\n const channelData = audioBuffer.getChannelData(channelNumber);\n\n // The byteLength will be 0 when the ArrayBuffer was transferred.\n if (parent[key].byteLength === 0) {\n parent[key] = channelData.slice(bufferOffset, bufferOffset + 128);\n } else {\n const slicedInput = new Float32Array(channelData.buffer, bufferOffset * Float32Array.BYTES_PER_ELEMENT, 128);\n\n parent[key].set(slicedInput);\n }\n }\n}\n","import { TNativeAudioBuffer } from '../types';\n\nexport const copyToChannel = (\n audioBuffer: TNativeAudioBuffer,\n parent: { [key: number]: Float32Array },\n key: number,\n channelNumber: number,\n bufferOffset: number\n): void => {\n if (typeof audioBuffer.copyToChannel === 'function') {\n // The byteLength will be 0 when the ArrayBuffer was transferred.\n if (parent[key].byteLength !== 0) {\n audioBuffer.copyToChannel(parent[key], channelNumber, bufferOffset);\n }\n\n // Bug #5: Safari does not support copyToChannel().\n } else {\n // The byteLength will be 0 when the ArrayBuffer was transferred.\n if (parent[key].byteLength !== 0) {\n audioBuffer.getChannelData(channelNumber).set(parent[key], bufferOffset);\n }\n }\n};\n","export const createNestedArrays = (x: number, y: number | number[]): Float32Array[][] => {\n const arrays: Float32Array[][] = [];\n\n for (let i = 0; i < x; i += 1) {\n const array = [];\n\n const length = typeof y === 'number' ? y : y[i];\n\n for (let j = 0; j < length; j += 1) {\n array.push(new Float32Array(128));\n }\n\n arrays.push(array);\n }\n\n return arrays;\n};\n","import { NODE_TO_PROCESSOR_MAPS } from '../globals';\nimport { IAudioNode, IAudioWorkletProcessor } from '../interfaces';\nimport { TContext, TNativeAudioWorkletNode, TNativeOfflineAudioContext } from '../types';\nimport { getNativeAudioNode } from './get-native-audio-node';\nimport { getValueForKey } from './get-value-for-key';\n\nexport const getAudioWorkletProcessor = (\n nativeOfflineAudioContext: TNativeOfflineAudioContext,\n proxy: IAudioNode\n): Promise => {\n const nodeToProcessorMap = getValueForKey(NODE_TO_PROCESSOR_MAPS, nativeOfflineAudioContext);\n const nativeAudioWorkletNode = getNativeAudioNode(proxy);\n\n return getValueForKey(nodeToProcessorMap, nativeAudioWorkletNode);\n};\n","import { copyFromChannel } from '../helpers/copy-from-channel';\nimport { copyToChannel } from '../helpers/copy-to-channel';\nimport { createNestedArrays } from '../helpers/create-nested-arrays';\nimport { getAudioNodeConnections } from '../helpers/get-audio-node-connections';\nimport { getAudioWorkletProcessor } from '../helpers/get-audio-worklet-processor';\nimport { isOwnedByContext } from '../helpers/is-owned-by-context';\nimport {\n IAudioWorkletNode,\n IAudioWorkletNodeOptions,\n IAudioWorkletProcessorConstructor,\n IMinimalOfflineAudioContext,\n IOfflineAudioContext,\n IReadOnlyMap\n} from '../interfaces';\nimport {\n TAudioWorkletNodeRendererFactoryFactory,\n TExposeCurrentFrameAndCurrentTimeFunction,\n TNativeAudioBuffer,\n TNativeAudioNode,\n TNativeAudioParam,\n TNativeAudioWorkletNode,\n TNativeChannelMergerNode,\n TNativeChannelSplitterNode,\n TNativeGainNode,\n TNativeOfflineAudioContext\n} from '../types';\n\nconst processBuffer = async (\n proxy: IAudioWorkletNode,\n renderedBuffer: null | TNativeAudioBuffer,\n nativeOfflineAudioContext: TNativeOfflineAudioContext,\n options: IAudioWorkletNodeOptions,\n outputChannelCount: number[],\n processorConstructor: undefined | IAudioWorkletProcessorConstructor,\n exposeCurrentFrameAndCurrentTime: TExposeCurrentFrameAndCurrentTimeFunction\n): Promise => {\n // Ceil the length to the next full render quantum.\n // Bug #17: Safari does not yet expose the length.\n const length = renderedBuffer === null ? Math.ceil(proxy.context.length / 128) * 128 : renderedBuffer.length;\n const numberOfInputChannels = options.channelCount * options.numberOfInputs;\n const numberOfOutputChannels = outputChannelCount.reduce((sum, value) => sum + value, 0);\n const processedBuffer =\n numberOfOutputChannels === 0\n ? null\n : nativeOfflineAudioContext.createBuffer(numberOfOutputChannels, length, nativeOfflineAudioContext.sampleRate);\n\n if (processorConstructor === undefined) {\n throw new Error('Missing the processor constructor.');\n }\n\n const audioNodeConnections = getAudioNodeConnections(proxy);\n const audioWorkletProcessor = await getAudioWorkletProcessor(nativeOfflineAudioContext, proxy);\n const inputs = createNestedArrays(options.numberOfInputs, options.channelCount);\n const outputs = createNestedArrays(options.numberOfOutputs, outputChannelCount);\n const parameters: { [name: string]: Float32Array } = Array.from(proxy.parameters.keys()).reduce(\n (prmtrs, name) => ({ ...prmtrs, [name]: new Float32Array(128) }),\n {}\n );\n\n for (let i = 0; i < length; i += 128) {\n if (options.numberOfInputs > 0 && renderedBuffer !== null) {\n for (let j = 0; j < options.numberOfInputs; j += 1) {\n for (let k = 0; k < options.channelCount; k += 1) {\n copyFromChannel(renderedBuffer, inputs[j], k, k, i);\n }\n }\n }\n\n if (processorConstructor.parameterDescriptors !== undefined && renderedBuffer !== null) {\n processorConstructor.parameterDescriptors.forEach(({ name }, index) => {\n copyFromChannel(renderedBuffer, parameters, name, numberOfInputChannels + index, i);\n });\n }\n\n for (let j = 0; j < options.numberOfInputs; j += 1) {\n for (let k = 0; k < outputChannelCount[j]; k += 1) {\n // The byteLength will be 0 when the ArrayBuffer was transferred.\n if (outputs[j][k].byteLength === 0) {\n outputs[j][k] = new Float32Array(128);\n }\n }\n }\n\n try {\n const potentiallyEmptyInputs = inputs.map((input, index) => {\n if (audioNodeConnections.activeInputs[index].size === 0) {\n return [];\n }\n\n return input;\n });\n const activeSourceFlag = exposeCurrentFrameAndCurrentTime(\n i / nativeOfflineAudioContext.sampleRate,\n nativeOfflineAudioContext.sampleRate,\n () => audioWorkletProcessor.process(potentiallyEmptyInputs, outputs, parameters)\n );\n\n if (processedBuffer !== null) {\n for (let j = 0, outputChannelSplitterNodeOutput = 0; j < options.numberOfOutputs; j += 1) {\n for (let k = 0; k < outputChannelCount[j]; k += 1) {\n copyToChannel(processedBuffer, outputs[j], k, outputChannelSplitterNodeOutput + k, i);\n }\n\n outputChannelSplitterNodeOutput += outputChannelCount[j];\n }\n }\n\n if (!activeSourceFlag) {\n break;\n }\n } catch (error) {\n proxy.dispatchEvent(\n new ErrorEvent('processorerror', {\n colno: error.colno,\n filename: error.filename,\n lineno: error.lineno,\n message: error.message\n })\n );\n\n break;\n }\n }\n\n return processedBuffer;\n};\n\nexport const createAudioWorkletNodeRendererFactory: TAudioWorkletNodeRendererFactoryFactory = (\n connectAudioParam,\n connectMultipleOutputs,\n createNativeAudioBufferSourceNode,\n createNativeChannelMergerNode,\n createNativeChannelSplitterNode,\n createNativeConstantSourceNode,\n createNativeGainNode,\n deleteUnrenderedAudioWorkletNode,\n disconnectMultipleOutputs,\n exposeCurrentFrameAndCurrentTime,\n getNativeAudioNode,\n nativeAudioWorkletNodeConstructor,\n nativeOfflineAudioContextConstructor,\n renderAutomation,\n renderInputsOfAudioNode,\n renderNativeOfflineAudioContext\n) => {\n return (\n name: string,\n options: IAudioWorkletNodeOptions,\n processorConstructor: undefined | IAudioWorkletProcessorConstructor\n ) => {\n const renderedNativeAudioNodes = new WeakMap();\n\n let processedBufferPromise: null | Promise = null;\n\n const createAudioNode = async (proxy: IAudioWorkletNode, nativeOfflineAudioContext: TNativeOfflineAudioContext) => {\n let nativeAudioWorkletNode = getNativeAudioNode(proxy);\n let nativeOutputNodes: null | [TNativeChannelSplitterNode, TNativeChannelMergerNode[], TNativeGainNode] = null;\n\n const nativeAudioWorkletNodeIsOwnedByContext = isOwnedByContext(nativeAudioWorkletNode, nativeOfflineAudioContext);\n const outputChannelCount = Array.isArray(options.outputChannelCount)\n ? options.outputChannelCount\n : Array.from(options.outputChannelCount);\n\n // Bug #61: Only Chrome, Edge & Firefox have an implementation of the AudioWorkletNode yet.\n if (nativeAudioWorkletNodeConstructor === null) {\n const numberOfOutputChannels = outputChannelCount.reduce((sum, value) => sum + value, 0);\n const outputChannelSplitterNode = createNativeChannelSplitterNode(nativeOfflineAudioContext, {\n channelCount: Math.max(1, numberOfOutputChannels),\n channelCountMode: 'explicit',\n channelInterpretation: 'discrete',\n numberOfOutputs: Math.max(1, numberOfOutputChannels)\n });\n const outputChannelMergerNodes: TNativeChannelMergerNode[] = [];\n\n for (let i = 0; i < proxy.numberOfOutputs; i += 1) {\n outputChannelMergerNodes.push(\n createNativeChannelMergerNode(nativeOfflineAudioContext, {\n channelCount: 1,\n channelCountMode: 'explicit',\n channelInterpretation: 'speakers',\n numberOfInputs: outputChannelCount[i]\n })\n );\n }\n\n const outputGainNode = createNativeGainNode(nativeOfflineAudioContext, {\n channelCount: options.channelCount,\n channelCountMode: options.channelCountMode,\n channelInterpretation: options.channelInterpretation,\n gain: 1\n });\n\n outputGainNode.connect = connectMultipleOutputs.bind(null, outputChannelMergerNodes);\n outputGainNode.disconnect = disconnectMultipleOutputs.bind(null, outputChannelMergerNodes);\n\n nativeOutputNodes = [outputChannelSplitterNode, outputChannelMergerNodes, outputGainNode];\n } else if (!nativeAudioWorkletNodeIsOwnedByContext) {\n nativeAudioWorkletNode = new nativeAudioWorkletNodeConstructor(nativeOfflineAudioContext, name);\n }\n\n renderedNativeAudioNodes.set(\n nativeOfflineAudioContext,\n nativeOutputNodes === null ? nativeAudioWorkletNode : nativeOutputNodes[2]\n );\n\n if (nativeOutputNodes !== null) {\n if (processedBufferPromise === null) {\n if (processorConstructor === undefined) {\n throw new Error('Missing the processor constructor.');\n }\n\n if (nativeOfflineAudioContextConstructor === null) {\n throw new Error('Missing the native OfflineAudioContext constructor.');\n }\n\n // Bug #47: The AudioDestinationNode in Safari gets not initialized correctly.\n const numberOfInputChannels = proxy.channelCount * proxy.numberOfInputs;\n const numberOfParameters =\n processorConstructor.parameterDescriptors === undefined ? 0 : processorConstructor.parameterDescriptors.length;\n const numberOfChannels = numberOfInputChannels + numberOfParameters;\n\n const renderBuffer = async () => {\n const partialOfflineAudioContext = new nativeOfflineAudioContextConstructor(\n numberOfChannels,\n // Ceil the length to the next full render quantum.\n // Bug #17: Safari does not yet expose the length.\n Math.ceil(proxy.context.length / 128) * 128,\n nativeOfflineAudioContext.sampleRate\n );\n const gainNodes: TNativeGainNode[] = [];\n const inputChannelSplitterNodes = [];\n\n for (let i = 0; i < options.numberOfInputs; i += 1) {\n gainNodes.push(\n createNativeGainNode(partialOfflineAudioContext, {\n channelCount: options.channelCount,\n channelCountMode: options.channelCountMode,\n channelInterpretation: options.channelInterpretation,\n gain: 1\n })\n );\n inputChannelSplitterNodes.push(\n createNativeChannelSplitterNode(partialOfflineAudioContext, {\n channelCount: options.channelCount,\n channelCountMode: 'explicit',\n channelInterpretation: 'discrete',\n numberOfOutputs: options.channelCount\n })\n );\n }\n\n const constantSourceNodes = await Promise.all(\n Array.from(proxy.parameters.values()).map(async (audioParam) => {\n const constantSourceNode = createNativeConstantSourceNode(partialOfflineAudioContext, {\n channelCount: 1,\n channelCountMode: 'explicit',\n channelInterpretation: 'discrete',\n offset: audioParam.value\n });\n\n await renderAutomation(partialOfflineAudioContext, audioParam, constantSourceNode.offset);\n\n return constantSourceNode;\n })\n );\n\n const inputChannelMergerNode = createNativeChannelMergerNode(partialOfflineAudioContext, {\n channelCount: 1,\n channelCountMode: 'explicit',\n channelInterpretation: 'speakers',\n numberOfInputs: Math.max(1, numberOfInputChannels + numberOfParameters)\n });\n\n for (let i = 0; i < options.numberOfInputs; i += 1) {\n gainNodes[i].connect(inputChannelSplitterNodes[i]);\n\n for (let j = 0; j < options.channelCount; j += 1) {\n inputChannelSplitterNodes[i].connect(inputChannelMergerNode, j, i * options.channelCount + j);\n }\n }\n\n for (const [index, constantSourceNode] of constantSourceNodes.entries()) {\n constantSourceNode.connect(inputChannelMergerNode, 0, numberOfInputChannels + index);\n constantSourceNode.start(0);\n }\n\n inputChannelMergerNode.connect(partialOfflineAudioContext.destination);\n\n await Promise.all(\n gainNodes.map((gainNode) => renderInputsOfAudioNode(proxy, partialOfflineAudioContext, gainNode))\n );\n\n return renderNativeOfflineAudioContext(partialOfflineAudioContext);\n };\n\n processedBufferPromise = processBuffer(\n proxy,\n numberOfChannels === 0 ? null : await renderBuffer(),\n nativeOfflineAudioContext,\n options,\n outputChannelCount,\n processorConstructor,\n exposeCurrentFrameAndCurrentTime\n );\n }\n\n const processedBuffer = await processedBufferPromise;\n const audioBufferSourceNode = createNativeAudioBufferSourceNode(nativeOfflineAudioContext, {\n buffer: null,\n channelCount: 2,\n channelCountMode: 'max',\n channelInterpretation: 'speakers',\n loop: false,\n loopEnd: 0,\n loopStart: 0,\n playbackRate: 1\n });\n const [outputChannelSplitterNode, outputChannelMergerNodes, outputGainNode] = nativeOutputNodes;\n\n if (processedBuffer !== null) {\n audioBufferSourceNode.buffer = processedBuffer;\n audioBufferSourceNode.start(0);\n }\n\n audioBufferSourceNode.connect(outputChannelSplitterNode);\n\n for (let i = 0, outputChannelSplitterNodeOutput = 0; i < proxy.numberOfOutputs; i += 1) {\n const outputChannelMergerNode = outputChannelMergerNodes[i];\n\n for (let j = 0; j < outputChannelCount[i]; j += 1) {\n outputChannelSplitterNode.connect(outputChannelMergerNode, outputChannelSplitterNodeOutput + j, j);\n }\n\n outputChannelSplitterNodeOutput += outputChannelCount[i];\n }\n\n return outputGainNode;\n }\n\n if (!nativeAudioWorkletNodeIsOwnedByContext) {\n for (const [nm, audioParam] of proxy.parameters.entries()) {\n await renderAutomation(\n nativeOfflineAudioContext,\n audioParam,\n // @todo The definition that TypeScript uses of the AudioParamMap is lacking many methods.\n (>nativeAudioWorkletNode.parameters).get(nm)\n );\n }\n } else {\n for (const [nm, audioParam] of proxy.parameters.entries()) {\n await connectAudioParam(\n nativeOfflineAudioContext,\n audioParam,\n // @todo The definition that TypeScript uses of the AudioParamMap is lacking many methods.\n (>nativeAudioWorkletNode.parameters).get(nm)\n );\n }\n }\n\n await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeAudioWorkletNode);\n\n return nativeAudioWorkletNode;\n };\n\n return {\n render(\n proxy: IAudioWorkletNode,\n nativeOfflineAudioContext: TNativeOfflineAudioContext\n ): Promise {\n deleteUnrenderedAudioWorkletNode(nativeOfflineAudioContext, proxy);\n\n const renderedNativeAudioWorkletNodeOrGainNode = renderedNativeAudioNodes.get(nativeOfflineAudioContext);\n\n if (renderedNativeAudioWorkletNodeOrGainNode !== undefined) {\n return Promise.resolve(renderedNativeAudioWorkletNodeOrGainNode);\n }\n\n return createAudioNode(proxy, nativeOfflineAudioContext);\n }\n };\n };\n};\n","import { MOST_NEGATIVE_SINGLE_FLOAT, MOST_POSITIVE_SINGLE_FLOAT } from '../constants';\nimport { IAudioParam, IBiquadFilterNode, IBiquadFilterOptions } from '../interfaces';\nimport { TAudioNodeRenderer, TBiquadFilterNodeConstructorFactory, TBiquadFilterType, TContext, TNativeBiquadFilterNode } from '../types';\n\nconst DEFAULT_OPTIONS = {\n Q: 1,\n channelCount: 2,\n channelCountMode: 'max',\n channelInterpretation: 'speakers',\n detune: 0,\n frequency: 350,\n gain: 0,\n type: 'lowpass'\n} as const;\n\nexport const createBiquadFilterNodeConstructor: TBiquadFilterNodeConstructorFactory = (\n audioNodeConstructor,\n createAudioParam,\n createBiquadFilterNodeRenderer,\n createInvalidAccessError,\n createNativeBiquadFilterNode,\n getNativeContext,\n isNativeOfflineAudioContext,\n setAudioNodeTailTime\n) => {\n return class BiquadFilterNode extends audioNodeConstructor implements IBiquadFilterNode {\n private _detune: IAudioParam;\n\n private _frequency: IAudioParam;\n\n private _gain: IAudioParam;\n\n private _nativeBiquadFilterNode: TNativeBiquadFilterNode;\n\n private _Q: IAudioParam;\n\n constructor(context: T, options?: Partial) {\n const nativeContext = getNativeContext(context);\n const mergedOptions = { ...DEFAULT_OPTIONS, ...options };\n const nativeBiquadFilterNode = createNativeBiquadFilterNode(nativeContext, mergedOptions);\n const isOffline = isNativeOfflineAudioContext(nativeContext);\n const biquadFilterNodeRenderer = >(isOffline ? createBiquadFilterNodeRenderer() : null);\n\n super(context, false, nativeBiquadFilterNode, biquadFilterNodeRenderer);\n\n // Bug #80: Safari does not export the correct values for maxValue and minValue.\n this._Q = createAudioParam(this, isOffline, nativeBiquadFilterNode.Q, MOST_POSITIVE_SINGLE_FLOAT, MOST_NEGATIVE_SINGLE_FLOAT);\n // Bug #78: Firefox & Safari do not export the correct values for maxValue and minValue.\n this._detune = createAudioParam(\n this,\n isOffline,\n nativeBiquadFilterNode.detune,\n 1200 * Math.log2(MOST_POSITIVE_SINGLE_FLOAT),\n -1200 * Math.log2(MOST_POSITIVE_SINGLE_FLOAT)\n );\n // Bug #77: Firefox & Safari do not export the correct value for minValue.\n this._frequency = createAudioParam(this, isOffline, nativeBiquadFilterNode.frequency, context.sampleRate / 2, 0);\n // Bug #79: Firefox & Safari do not export the correct values for maxValue and minValue.\n this._gain = createAudioParam(\n this,\n isOffline,\n nativeBiquadFilterNode.gain,\n 40 * Math.log10(MOST_POSITIVE_SINGLE_FLOAT),\n MOST_NEGATIVE_SINGLE_FLOAT\n );\n this._nativeBiquadFilterNode = nativeBiquadFilterNode;\n\n // @todo Determine a meaningful tail-time instead of just using one second.\n setAudioNodeTailTime(this, 1);\n }\n\n get detune(): IAudioParam {\n return this._detune;\n }\n\n get frequency(): IAudioParam {\n return this._frequency;\n }\n\n get gain(): IAudioParam {\n return this._gain;\n }\n\n get Q(): IAudioParam {\n return this._Q;\n }\n\n get type(): TBiquadFilterType {\n return this._nativeBiquadFilterNode.type;\n }\n\n set type(value) {\n this._nativeBiquadFilterNode.type = value;\n }\n\n public getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void {\n // Bug #189: Safari does throw an InvalidStateError.\n try {\n this._nativeBiquadFilterNode.getFrequencyResponse(frequencyHz, magResponse, phaseResponse);\n } catch (err) {\n if (err.code === 11) {\n throw createInvalidAccessError();\n }\n\n throw err;\n }\n\n // Bug #68: Safari does not throw an error if the parameters differ in their length.\n if (frequencyHz.length !== magResponse.length || magResponse.length !== phaseResponse.length) {\n throw createInvalidAccessError();\n }\n }\n };\n};\n","import { IChannelMergerOptions } from '../interfaces';\nimport { TAudioNodeRenderer, TChannelMergerNodeConstructorFactory, TContext } from '../types';\n\nconst DEFAULT_OPTIONS = {\n channelCount: 1,\n channelCountMode: 'explicit',\n channelInterpretation: 'speakers',\n numberOfInputs: 6\n} as const;\n\nexport const createChannelMergerNodeConstructor: TChannelMergerNodeConstructorFactory = (\n audioNodeConstructor,\n createChannelMergerNodeRenderer,\n createNativeChannelMergerNode,\n getNativeContext,\n isNativeOfflineAudioContext\n) => {\n return class ChannelMergerNode extends audioNodeConstructor {\n constructor(context: T, options?: Partial) {\n const nativeContext = getNativeContext(context);\n const mergedOptions = { ...DEFAULT_OPTIONS, ...options };\n const nativeChannelMergerNode = createNativeChannelMergerNode(nativeContext, mergedOptions);\n const channelMergerNodeRenderer = >(\n (isNativeOfflineAudioContext(nativeContext) ? createChannelMergerNodeRenderer() : null)\n );\n\n super(context, false, nativeChannelMergerNode, channelMergerNodeRenderer);\n }\n };\n};\n","import { IChannelSplitterOptions } from '../interfaces';\nimport { TAudioNodeRenderer, TChannelSplitterNodeConstructorFactory, TContext } from '../types';\n\nconst DEFAULT_OPTIONS = {\n channelCount: 6,\n channelCountMode: 'explicit',\n channelInterpretation: 'discrete',\n numberOfOutputs: 6\n} as const;\n\nexport const createChannelSplitterNodeConstructor: TChannelSplitterNodeConstructorFactory = (\n audioNodeConstructor,\n createChannelSplitterNodeRenderer,\n createNativeChannelSplitterNode,\n getNativeContext,\n isNativeOfflineAudioContext,\n sanitizeChannelSplitterOptions\n) => {\n return class ChannelSplitterNode extends audioNodeConstructor {\n constructor(context: T, options?: Partial) {\n const nativeContext = getNativeContext(context);\n const mergedOptions = sanitizeChannelSplitterOptions({ ...DEFAULT_OPTIONS, ...options });\n const nativeChannelSplitterNode = createNativeChannelSplitterNode(nativeContext, mergedOptions);\n const channelSplitterNodeRenderer = >(\n (isNativeOfflineAudioContext(nativeContext) ? createChannelSplitterNodeRenderer() : null)\n );\n\n super(context, false, nativeChannelSplitterNode, channelSplitterNodeRenderer);\n }\n };\n};\n","import { MOST_NEGATIVE_SINGLE_FLOAT, MOST_POSITIVE_SINGLE_FLOAT } from '../constants';\nimport { isActiveAudioNode } from '../helpers/is-active-audio-node';\nimport { setInternalStateToActive } from '../helpers/set-internal-state-to-active';\nimport { setInternalStateToPassive } from '../helpers/set-internal-state-to-passive';\nimport { IAudioParam, IAudioScheduledSourceNodeEventMap, IConstantSourceNode, IConstantSourceOptions } from '../interfaces';\nimport {\n TConstantSourceNodeConstructorFactory,\n TConstantSourceNodeRenderer,\n TContext,\n TEventHandler,\n TNativeConstantSourceNode\n} from '../types';\n\nconst DEFAULT_OPTIONS = {\n channelCount: 2,\n channelCountMode: 'max',\n channelInterpretation: 'speakers',\n offset: 1\n} as const;\n\nexport const createConstantSourceNodeConstructor: TConstantSourceNodeConstructorFactory = (\n audioNodeConstructor,\n createAudioParam,\n createConstantSourceNodeRendererFactory,\n createNativeConstantSourceNode,\n getNativeContext,\n isNativeOfflineAudioContext,\n wrapEventListener\n) => {\n return class ConstantSourceNode\n extends audioNodeConstructor\n implements IConstantSourceNode\n {\n private _constantSourceNodeRenderer: TConstantSourceNodeRenderer;\n\n private _nativeConstantSourceNode: TNativeConstantSourceNode;\n\n private _offset: IAudioParam;\n\n private _onended: null | TEventHandler;\n\n constructor(context: T, options?: Partial) {\n const nativeContext = getNativeContext(context);\n const mergedOptions = { ...DEFAULT_OPTIONS, ...options };\n const nativeConstantSourceNode = createNativeConstantSourceNode(nativeContext, mergedOptions);\n const isOffline = isNativeOfflineAudioContext(nativeContext);\n const constantSourceNodeRenderer = >(\n (isOffline ? createConstantSourceNodeRendererFactory() : null)\n );\n\n super(context, false, nativeConstantSourceNode, constantSourceNodeRenderer);\n\n this._constantSourceNodeRenderer = constantSourceNodeRenderer;\n this._nativeConstantSourceNode = nativeConstantSourceNode;\n /*\n * Bug #62 & #74: Safari does not support ConstantSourceNodes and does not export the correct values for maxValue and minValue\n * for GainNodes.\n */\n this._offset = createAudioParam(\n this,\n isOffline,\n nativeConstantSourceNode.offset,\n MOST_POSITIVE_SINGLE_FLOAT,\n MOST_NEGATIVE_SINGLE_FLOAT\n );\n this._onended = null;\n }\n\n get offset(): IAudioParam {\n return this._offset;\n }\n\n get onended(): null | TEventHandler {\n return this._onended;\n }\n\n set onended(value) {\n const wrappedListener = typeof value === 'function' ? wrapEventListener(this, value) : null;\n\n this._nativeConstantSourceNode.onended = wrappedListener;\n\n const nativeOnEnded = this._nativeConstantSourceNode.onended;\n\n this._onended = nativeOnEnded !== null && nativeOnEnded === wrappedListener ? value : nativeOnEnded;\n }\n\n public start(when = 0): void {\n this._nativeConstantSourceNode.start(when);\n\n if (this._constantSourceNodeRenderer !== null) {\n this._constantSourceNodeRenderer.start = when;\n }\n\n if (this.context.state !== 'closed') {\n setInternalStateToActive(this);\n\n const resetInternalStateToPassive = () => {\n this._nativeConstantSourceNode.removeEventListener('ended', resetInternalStateToPassive);\n\n if (isActiveAudioNode(this)) {\n setInternalStateToPassive(this);\n }\n };\n\n this._nativeConstantSourceNode.addEventListener('ended', resetInternalStateToPassive);\n }\n }\n\n public stop(when = 0): void {\n this._nativeConstantSourceNode.stop(when);\n\n if (this._constantSourceNodeRenderer !== null) {\n this._constantSourceNodeRenderer.stop = when;\n }\n }\n };\n};\n","import { IConvolverNode, IConvolverOptions } from '../interfaces';\nimport { TAnyAudioBuffer, TAudioNodeRenderer, TContext, TConvolverNodeConstructorFactory, TNativeConvolverNode } from '../types';\n\nconst DEFAULT_OPTIONS = {\n buffer: null,\n channelCount: 2,\n channelCountMode: 'clamped-max',\n channelInterpretation: 'speakers',\n disableNormalization: false\n} as const;\n\nexport const createConvolverNodeConstructor: TConvolverNodeConstructorFactory = (\n audioNodeConstructor,\n createConvolverNodeRenderer,\n createNativeConvolverNode,\n getNativeContext,\n isNativeOfflineAudioContext,\n setAudioNodeTailTime\n) => {\n return class ConvolverNode extends audioNodeConstructor implements IConvolverNode {\n private _isBufferNullified: boolean;\n\n private _nativeConvolverNode: TNativeConvolverNode;\n\n constructor(context: T, options?: Partial) {\n const nativeContext = getNativeContext(context);\n const mergedOptions = { ...DEFAULT_OPTIONS, ...options };\n const nativeConvolverNode = createNativeConvolverNode(nativeContext, mergedOptions);\n const isOffline = isNativeOfflineAudioContext(nativeContext);\n const convolverNodeRenderer = >(isOffline ? createConvolverNodeRenderer() : null);\n\n super(context, false, nativeConvolverNode, convolverNodeRenderer);\n\n this._isBufferNullified = false;\n this._nativeConvolverNode = nativeConvolverNode;\n\n if (mergedOptions.buffer !== null) {\n setAudioNodeTailTime(this, mergedOptions.buffer.duration);\n }\n }\n\n get buffer(): null | TAnyAudioBuffer {\n if (this._isBufferNullified) {\n return null;\n }\n\n return this._nativeConvolverNode.buffer;\n }\n\n set buffer(value) {\n this._nativeConvolverNode.buffer = value;\n\n // Bug #115: Safari does not allow to set the buffer to null.\n if (value === null && this._nativeConvolverNode.buffer !== null) {\n const nativeContext = this._nativeConvolverNode.context;\n\n this._nativeConvolverNode.buffer = nativeContext.createBuffer(1, 1, nativeContext.sampleRate);\n this._isBufferNullified = true;\n\n setAudioNodeTailTime(this, 0);\n } else {\n this._isBufferNullified = false;\n\n setAudioNodeTailTime(this, this._nativeConvolverNode.buffer === null ? 0 : this._nativeConvolverNode.buffer.duration);\n }\n }\n\n get normalize(): boolean {\n return this._nativeConvolverNode.normalize;\n }\n\n set normalize(value) {\n this._nativeConvolverNode.normalize = value;\n }\n };\n};\n","export const detachArrayBuffer = (arrayBuffer: ArrayBuffer): Promise => {\n const { port1, port2 } = new MessageChannel();\n\n return new Promise((resolve) => {\n const closeAndResolve = () => {\n port2.onmessage = null;\n\n port1.close();\n port2.close();\n\n resolve();\n };\n\n port2.onmessage = () => closeAndResolve();\n\n try {\n port1.postMessage(arrayBuffer, [arrayBuffer]);\n } catch {\n // Ignore errors.\n } finally {\n closeAndResolve();\n }\n });\n};\n","import { IAudioParam, IDelayNode, IDelayOptions } from '../interfaces';\nimport { TAudioNodeRenderer, TContext, TDelayNodeConstructorFactory } from '../types';\n\nconst DEFAULT_OPTIONS = {\n channelCount: 2,\n channelCountMode: 'max',\n channelInterpretation: 'speakers',\n delayTime: 0,\n maxDelayTime: 1\n} as const;\n\nexport const createDelayNodeConstructor: TDelayNodeConstructorFactory = (\n audioNodeConstructor,\n createAudioParam,\n createDelayNodeRenderer,\n createNativeDelayNode,\n getNativeContext,\n isNativeOfflineAudioContext,\n setAudioNodeTailTime\n) => {\n return class DelayNode extends audioNodeConstructor implements IDelayNode {\n private _delayTime: IAudioParam;\n\n constructor(context: T, options?: Partial) {\n const nativeContext = getNativeContext(context);\n const mergedOptions = { ...DEFAULT_OPTIONS, ...options };\n const nativeDelayNode = createNativeDelayNode(nativeContext, mergedOptions);\n const isOffline = isNativeOfflineAudioContext(nativeContext);\n const delayNodeRenderer = >(isOffline ? createDelayNodeRenderer(mergedOptions.maxDelayTime) : null);\n\n super(context, false, nativeDelayNode, delayNodeRenderer);\n\n this._delayTime = createAudioParam(this, isOffline, nativeDelayNode.delayTime);\n\n setAudioNodeTailTime(this, mergedOptions.maxDelayTime);\n }\n\n get delayTime(): IAudioParam {\n return this._delayTime;\n }\n };\n};\n","import { isNativeAudioNode } from '../guards/native-audio-node';\nimport { TDisconnectMultipleOutputsFactory, TIndexSizeErrorFactory, TNativeAudioNode } from '../types';\n\nconst getOutputAudioNodeAtIndex = (\n createIndexSizeError: TIndexSizeErrorFactory,\n outputAudioNodes: TNativeAudioNode[],\n output: number\n): TNativeAudioNode => {\n const outputAudioNode = outputAudioNodes[output];\n\n if (outputAudioNode === undefined) {\n throw createIndexSizeError();\n }\n\n return outputAudioNode;\n};\n\nexport const createDisconnectMultipleOutputs: TDisconnectMultipleOutputsFactory = (createIndexSizeError) => {\n return (outputAudioNodes, destinationOrOutput = undefined, output = undefined, input = 0) => {\n if (destinationOrOutput === undefined) {\n return outputAudioNodes.forEach((outputAudioNode) => outputAudioNode.disconnect());\n }\n\n if (typeof destinationOrOutput === 'number') {\n return getOutputAudioNodeAtIndex(createIndexSizeError, outputAudioNodes, destinationOrOutput).disconnect();\n }\n\n if (isNativeAudioNode(destinationOrOutput)) {\n if (output === undefined) {\n return outputAudioNodes.forEach((outputAudioNode) => outputAudioNode.disconnect(destinationOrOutput));\n }\n\n if (input === undefined) {\n return getOutputAudioNodeAtIndex(createIndexSizeError, outputAudioNodes, output).disconnect(destinationOrOutput, 0);\n }\n\n return getOutputAudioNodeAtIndex(createIndexSizeError, outputAudioNodes, output).disconnect(destinationOrOutput, 0, input);\n }\n\n if (output === undefined) {\n return outputAudioNodes.forEach((outputAudioNode) => outputAudioNode.disconnect(destinationOrOutput));\n }\n\n return getOutputAudioNodeAtIndex(createIndexSizeError, outputAudioNodes, output).disconnect(destinationOrOutput, 0);\n };\n};\n","import { IAudioParam, IDynamicsCompressorNode, IDynamicsCompressorOptions } from '../interfaces';\nimport {\n TAudioNodeRenderer,\n TChannelCountMode,\n TContext,\n TDynamicsCompressorNodeConstructorFactory,\n TNativeAudioParam,\n TNativeDynamicsCompressorNode\n} from '../types';\n\nconst DEFAULT_OPTIONS = {\n attack: 0.003,\n channelCount: 2,\n channelCountMode: 'clamped-max',\n channelInterpretation: 'speakers',\n knee: 30,\n ratio: 12,\n release: 0.25,\n threshold: -24\n} as const;\n\nexport const createDynamicsCompressorNodeConstructor: TDynamicsCompressorNodeConstructorFactory = (\n audioNodeConstructor,\n createAudioParam,\n createDynamicsCompressorNodeRenderer,\n createNativeDynamicsCompressorNode,\n createNotSupportedError,\n getNativeContext,\n isNativeOfflineAudioContext,\n setAudioNodeTailTime\n) => {\n return class DynamicsCompressorNode extends audioNodeConstructor implements IDynamicsCompressorNode {\n private _attack: IAudioParam;\n\n private _knee: IAudioParam;\n\n private _nativeDynamicsCompressorNode: TNativeDynamicsCompressorNode;\n\n private _ratio: IAudioParam;\n\n private _release: IAudioParam;\n\n private _threshold: IAudioParam;\n\n constructor(context: T, options?: Partial) {\n const nativeContext = getNativeContext(context);\n const mergedOptions = { ...DEFAULT_OPTIONS, ...options };\n const nativeDynamicsCompressorNode = createNativeDynamicsCompressorNode(nativeContext, mergedOptions);\n const isOffline = isNativeOfflineAudioContext(nativeContext);\n const dynamicsCompressorNodeRenderer = >(isOffline ? createDynamicsCompressorNodeRenderer() : null);\n\n super(context, false, nativeDynamicsCompressorNode, dynamicsCompressorNodeRenderer);\n\n this._attack = createAudioParam(this, isOffline, nativeDynamicsCompressorNode.attack);\n this._knee = createAudioParam(this, isOffline, nativeDynamicsCompressorNode.knee);\n this._nativeDynamicsCompressorNode = nativeDynamicsCompressorNode;\n this._ratio = createAudioParam(this, isOffline, nativeDynamicsCompressorNode.ratio);\n this._release = createAudioParam(this, isOffline, nativeDynamicsCompressorNode.release);\n this._threshold = createAudioParam(this, isOffline, nativeDynamicsCompressorNode.threshold);\n\n setAudioNodeTailTime(this, 0.006);\n }\n\n get attack(): IAudioParam {\n return this._attack;\n }\n\n // Bug #108: Safari allows a channelCount of three and above which is why the getter and setter needs to be overwritten here.\n get channelCount(): number {\n return this._nativeDynamicsCompressorNode.channelCount;\n }\n\n set channelCount(value) {\n const previousChannelCount = this._nativeDynamicsCompressorNode.channelCount;\n\n this._nativeDynamicsCompressorNode.channelCount = value;\n\n if (value > 2) {\n this._nativeDynamicsCompressorNode.channelCount = previousChannelCount;\n\n throw createNotSupportedError();\n }\n }\n\n /*\n * Bug #109: Only Chrome and Firefox disallow a channelCountMode of 'max' yet which is why the getter and setter needs to be\n * overwritten here.\n */\n get channelCountMode(): TChannelCountMode {\n return this._nativeDynamicsCompressorNode.channelCountMode;\n }\n\n set channelCountMode(value) {\n const previousChannelCount = this._nativeDynamicsCompressorNode.channelCountMode;\n\n this._nativeDynamicsCompressorNode.channelCountMode = value;\n\n if (value === 'max') {\n this._nativeDynamicsCompressorNode.channelCountMode = previousChannelCount;\n\n throw createNotSupportedError();\n }\n }\n\n get knee(): IAudioParam {\n return this._knee;\n }\n\n get ratio(): IAudioParam {\n return this._ratio;\n }\n\n get reduction(): number {\n // Bug #111: Safari returns an AudioParam instead of a number.\n if (typeof ((this._nativeDynamicsCompressorNode.reduction)).value === 'number') {\n return ((this._nativeDynamicsCompressorNode.reduction)).value;\n }\n\n return this._nativeDynamicsCompressorNode.reduction;\n }\n\n get release(): IAudioParam {\n return this._release;\n }\n\n get threshold(): IAudioParam {\n return this._threshold;\n }\n };\n};\n","import { MOST_NEGATIVE_SINGLE_FLOAT, MOST_POSITIVE_SINGLE_FLOAT } from '../constants';\nimport { IAudioParam, IGainNode, IGainOptions } from '../interfaces';\nimport { TAudioNodeRenderer, TContext, TGainNodeConstructorFactory } from '../types';\n\nconst DEFAULT_OPTIONS = {\n channelCount: 2,\n channelCountMode: 'max',\n channelInterpretation: 'speakers',\n gain: 1\n} as const;\n\nexport const createGainNodeConstructor: TGainNodeConstructorFactory = (\n audioNodeConstructor,\n createAudioParam,\n createGainNodeRenderer,\n createNativeGainNode,\n getNativeContext,\n isNativeOfflineAudioContext\n) => {\n return class GainNode extends audioNodeConstructor implements IGainNode {\n private _gain: IAudioParam;\n\n constructor(context: T, options?: Partial) {\n const nativeContext = getNativeContext(context);\n const mergedOptions = { ...DEFAULT_OPTIONS, ...options };\n const nativeGainNode = createNativeGainNode(nativeContext, mergedOptions);\n const isOffline = isNativeOfflineAudioContext(nativeContext);\n const gainNodeRenderer = >(isOffline ? createGainNodeRenderer() : null);\n\n super(context, false, nativeGainNode, gainNodeRenderer);\n\n // Bug #74: Safari does not export the correct values for maxValue and minValue.\n this._gain = createAudioParam(this, isOffline, nativeGainNode.gain, MOST_POSITIVE_SINGLE_FLOAT, MOST_NEGATIVE_SINGLE_FLOAT);\n }\n\n get gain(): IAudioParam {\n return this._gain;\n }\n };\n};\n","import { TInvalidStateErrorFactory } from '../types';\n\nexport const createInvalidStateError: TInvalidStateErrorFactory = () => new DOMException('', 'InvalidStateError');\n","import { TInvalidAccessErrorFactory } from '../types';\n\nexport const createInvalidAccessError: TInvalidAccessErrorFactory = () => new DOMException('', 'InvalidAccessError');\n","import { wrapIIRFilterNodeGetFrequencyResponseMethod } from '../helpers/wrap-iir-filter-node-get-frequency-response-method';\nimport { IIIRFilterNode, IIIRFilterOptions, IMinimalAudioContext } from '../interfaces';\nimport { TAudioNodeRenderer, TContext, TIIRFilterNodeConstructorFactory, TNativeIIRFilterNode } from '../types';\n\nconst DEFAULT_OPTIONS = {\n channelCount: 2,\n channelCountMode: 'max',\n channelInterpretation: 'speakers'\n} as const;\n\nexport const createIIRFilterNodeConstructor: TIIRFilterNodeConstructorFactory = (\n audioNodeConstructor,\n createNativeIIRFilterNode,\n createIIRFilterNodeRenderer,\n getNativeContext,\n isNativeOfflineAudioContext,\n setAudioNodeTailTime\n) => {\n return class IIRFilterNode extends audioNodeConstructor implements IIIRFilterNode {\n private _nativeIIRFilterNode: TNativeIIRFilterNode;\n\n constructor(\n context: T,\n options: { feedback: IIIRFilterOptions['feedback']; feedforward: IIIRFilterOptions['feedforward'] } & Partial\n ) {\n const nativeContext = getNativeContext(context);\n const isOffline = isNativeOfflineAudioContext(nativeContext);\n const mergedOptions = { ...DEFAULT_OPTIONS, ...options };\n const nativeIIRFilterNode = createNativeIIRFilterNode(\n nativeContext,\n isOffline ? null : ((context)).baseLatency,\n mergedOptions\n );\n const iirFilterNodeRenderer = >(\n (isOffline ? createIIRFilterNodeRenderer(mergedOptions.feedback, mergedOptions.feedforward) : null)\n );\n\n super(context, false, nativeIIRFilterNode, iirFilterNodeRenderer);\n\n // Bug #23 & #24: FirefoxDeveloper does not throw an InvalidAccessError.\n // @todo Write a test which allows other browsers to remain unpatched.\n wrapIIRFilterNodeGetFrequencyResponseMethod(nativeIIRFilterNode);\n\n this._nativeIIRFilterNode = nativeIIRFilterNode;\n\n // @todo Determine a meaningful tail-time instead of just using one second.\n setAudioNodeTailTime(this, 1);\n }\n\n public getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void {\n return this._nativeIIRFilterNode.getFrequencyResponse(frequencyHz, magResponse, phaseResponse);\n }\n };\n};\n","// This implementation as shamelessly inspired by source code of\n// tslint:disable-next-line:max-line-length\n// {@link https://chromium.googlesource.com/chromium/src.git/+/master/third_party/WebKit/Source/platform/audio/IIRFilter.cpp|Chromium's IIRFilter}.\nexport const filterBuffer = (\n feedback: Float64Array,\n feedbackLength: number,\n feedforward: Float64Array,\n feedforwardLength: number,\n minLength: number,\n xBuffer: Float32Array,\n yBuffer: Float32Array,\n bufferIndex: number,\n bufferLength: number,\n input: Float32Array,\n output: Float32Array\n) => {\n const inputLength = input.length;\n\n let i = bufferIndex;\n\n for (let j = 0; j < inputLength; j += 1) {\n let y = feedforward[0] * input[j];\n\n for (let k = 1; k < minLength; k += 1) {\n const x = (i - k) & (bufferLength - 1); // tslint:disable-line:no-bitwise\n\n y += feedforward[k] * xBuffer[x];\n y -= feedback[k] * yBuffer[x];\n }\n\n for (let k = minLength; k < feedforwardLength; k += 1) {\n y += feedforward[k] * xBuffer[(i - k) & (bufferLength - 1)]; // tslint:disable-line:no-bitwise\n }\n\n for (let k = minLength; k < feedbackLength; k += 1) {\n y -= feedback[k] * yBuffer[(i - k) & (bufferLength - 1)]; // tslint:disable-line:no-bitwise\n }\n\n xBuffer[i] = input[j];\n yBuffer[i] = y;\n\n i = (i + 1) & (bufferLength - 1); // tslint:disable-line:no-bitwise\n\n output[j] = y;\n }\n\n return i;\n};\n","import { filterBuffer } from '../helpers/filter-buffer';\nimport { isOwnedByContext } from '../helpers/is-owned-by-context';\nimport { IIIRFilterNode, IMinimalOfflineAudioContext, IOfflineAudioContext } from '../interfaces';\nimport {\n TIIRFilterNodeRendererFactoryFactory,\n TNativeAudioBuffer,\n TNativeAudioBufferSourceNode,\n TNativeIIRFilterNode,\n TNativeOfflineAudioContext\n} from '../types';\n\nconst filterFullBuffer = (\n renderedBuffer: TNativeAudioBuffer,\n nativeOfflineAudioContext: TNativeOfflineAudioContext,\n feedback: Iterable,\n feedforward: Iterable\n) => {\n const convertedFeedback = feedback instanceof Float64Array ? feedback : new Float64Array(feedback);\n const convertedFeedforward = feedforward instanceof Float64Array ? feedforward : new Float64Array(feedforward);\n const feedbackLength = convertedFeedback.length;\n const feedforwardLength = convertedFeedforward.length;\n const minLength = Math.min(feedbackLength, feedforwardLength);\n\n if (convertedFeedback[0] !== 1) {\n for (let i = 0; i < feedbackLength; i += 1) {\n convertedFeedforward[i] /= convertedFeedback[0];\n }\n\n for (let i = 1; i < feedforwardLength; i += 1) {\n convertedFeedback[i] /= convertedFeedback[0];\n }\n }\n\n const bufferLength = 32;\n const xBuffer = new Float32Array(bufferLength);\n const yBuffer = new Float32Array(bufferLength);\n\n const filteredBuffer = nativeOfflineAudioContext.createBuffer(\n renderedBuffer.numberOfChannels,\n renderedBuffer.length,\n renderedBuffer.sampleRate\n );\n\n const numberOfChannels = renderedBuffer.numberOfChannels;\n\n for (let i = 0; i < numberOfChannels; i += 1) {\n const input = renderedBuffer.getChannelData(i);\n const output = filteredBuffer.getChannelData(i);\n\n xBuffer.fill(0);\n yBuffer.fill(0);\n\n filterBuffer(\n convertedFeedback,\n feedbackLength,\n convertedFeedforward,\n feedforwardLength,\n minLength,\n xBuffer,\n yBuffer,\n 0,\n bufferLength,\n input,\n output\n );\n }\n\n return filteredBuffer;\n};\n\nexport const createIIRFilterNodeRendererFactory: TIIRFilterNodeRendererFactoryFactory = (\n createNativeAudioBufferSourceNode,\n getNativeAudioNode,\n nativeOfflineAudioContextConstructor,\n renderInputsOfAudioNode,\n renderNativeOfflineAudioContext\n) => {\n return (feedback: Iterable, feedforward: Iterable) => {\n const renderedNativeAudioNodes = new WeakMap();\n\n let filteredBufferPromise: null | Promise = null;\n\n const createAudioNode = async (proxy: IIIRFilterNode, nativeOfflineAudioContext: TNativeOfflineAudioContext) => {\n let nativeAudioBufferSourceNode: null | TNativeAudioBufferSourceNode = null;\n let nativeIIRFilterNode = getNativeAudioNode(proxy);\n\n // If the initially used nativeIIRFilterNode was not constructed on the same OfflineAudioContext it needs to be created again.\n const nativeIIRFilterNodeIsOwnedByContext = isOwnedByContext(nativeIIRFilterNode, nativeOfflineAudioContext);\n\n // Bug #9: Safari does not support IIRFilterNodes.\n if (nativeOfflineAudioContext.createIIRFilter === undefined) {\n nativeAudioBufferSourceNode = createNativeAudioBufferSourceNode(nativeOfflineAudioContext, {\n buffer: null,\n channelCount: 2,\n channelCountMode: 'max',\n channelInterpretation: 'speakers',\n loop: false,\n loopEnd: 0,\n loopStart: 0,\n playbackRate: 1\n });\n } else if (!nativeIIRFilterNodeIsOwnedByContext) {\n // @todo TypeScript defines the parameters of createIIRFilter() as arrays of numbers.\n nativeIIRFilterNode = nativeOfflineAudioContext.createIIRFilter(feedforward, feedback);\n }\n\n renderedNativeAudioNodes.set(\n nativeOfflineAudioContext,\n nativeAudioBufferSourceNode === null ? nativeIIRFilterNode : nativeAudioBufferSourceNode\n );\n\n if (nativeAudioBufferSourceNode !== null) {\n if (filteredBufferPromise === null) {\n if (nativeOfflineAudioContextConstructor === null) {\n throw new Error('Missing the native OfflineAudioContext constructor.');\n }\n\n const partialOfflineAudioContext = new nativeOfflineAudioContextConstructor(\n // Bug #47: The AudioDestinationNode in Safari gets not initialized correctly.\n proxy.context.destination.channelCount,\n // Bug #17: Safari does not yet expose the length.\n proxy.context.length,\n nativeOfflineAudioContext.sampleRate\n );\n\n filteredBufferPromise = (async () => {\n await renderInputsOfAudioNode(proxy, partialOfflineAudioContext, partialOfflineAudioContext.destination);\n\n const renderedBuffer = await renderNativeOfflineAudioContext(partialOfflineAudioContext);\n\n return filterFullBuffer(renderedBuffer, nativeOfflineAudioContext, feedback, feedforward);\n })();\n }\n\n const filteredBuffer = await filteredBufferPromise;\n\n nativeAudioBufferSourceNode.buffer = filteredBuffer;\n nativeAudioBufferSourceNode.start(0);\n\n return nativeAudioBufferSourceNode;\n }\n\n await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeIIRFilterNode);\n\n return nativeIIRFilterNode;\n };\n\n return {\n render(\n proxy: IIIRFilterNode,\n nativeOfflineAudioContext: TNativeOfflineAudioContext\n ): Promise {\n const renderedNativeAudioNode = renderedNativeAudioNodes.get(nativeOfflineAudioContext);\n\n if (renderedNativeAudioNode !== undefined) {\n return Promise.resolve(renderedNativeAudioNode);\n }\n\n return createAudioNode(proxy, nativeOfflineAudioContext);\n }\n };\n };\n};\n","import { IAudioContext, IAudioNodeOptions, IMediaStreamAudioDestinationNode, IMinimalAudioContext } from '../interfaces';\nimport { TAudioNodeRenderer, TMediaStreamAudioDestinationNodeConstructorFactory, TNativeMediaStreamAudioDestinationNode } from '../types';\n\nconst DEFAULT_OPTIONS = {\n channelCount: 2,\n channelCountMode: 'explicit',\n channelInterpretation: 'speakers'\n} as const;\n\nexport const createMediaStreamAudioDestinationNodeConstructor: TMediaStreamAudioDestinationNodeConstructorFactory = (\n audioNodeConstructor,\n createNativeMediaStreamAudioDestinationNode,\n getNativeContext,\n isNativeOfflineAudioContext\n) => {\n return class MediaStreamAudioDestinationNode extends audioNodeConstructor\n implements IMediaStreamAudioDestinationNode {\n private _nativeMediaStreamAudioDestinationNode: TNativeMediaStreamAudioDestinationNode;\n\n constructor(context: T, options?: Partial) {\n const nativeContext = getNativeContext(context);\n\n // Bug #173: Safari allows to create a MediaStreamAudioDestinationNode with an OfflineAudioContext.\n if (isNativeOfflineAudioContext(nativeContext)) {\n throw new TypeError();\n }\n\n const mergedOptions = { ...DEFAULT_OPTIONS, ...options };\n const nativeMediaStreamAudioDestinationNode = createNativeMediaStreamAudioDestinationNode(nativeContext, mergedOptions);\n\n super(context, false, nativeMediaStreamAudioDestinationNode, >null);\n\n this._nativeMediaStreamAudioDestinationNode = nativeMediaStreamAudioDestinationNode;\n }\n\n get stream(): MediaStream {\n return this._nativeMediaStreamAudioDestinationNode.stream;\n }\n };\n};\n","import { TNativeContext } from '../types';\n\nexport const testPromiseSupport = (nativeContext: TNativeContext): boolean => {\n // This 12 numbers represent the 48 bytes of an empty WAVE file with a single sample.\n const uint32Array = new Uint32Array([1179011410, 40, 1163280727, 544501094, 16, 131073, 44100, 176400, 1048580, 1635017060, 4, 0]);\n\n try {\n // Bug #1: Safari requires a successCallback.\n const promise = nativeContext.decodeAudioData(uint32Array.buffer, () => {\n // Ignore the success callback.\n });\n\n if (promise === undefined) {\n return false;\n }\n\n promise.catch(() => {\n // Ignore rejected errors.\n });\n\n return true;\n } catch {\n // Ignore errors.\n }\n\n return false;\n};\n","import { deactivateAudioGraph } from '../helpers/deactivate-audio-graph';\nimport { testPromiseSupport } from '../helpers/test-promise-support';\nimport { IAudioBuffer, IMinimalOfflineAudioContext, IOfflineAudioContextOptions } from '../interfaces';\nimport { TAudioContextState, TMinimalOfflineAudioContextConstructorFactory, TNativeOfflineAudioContext } from '../types';\n\nconst DEFAULT_OPTIONS = {\n numberOfChannels: 1\n} as const;\n\nexport const createMinimalOfflineAudioContextConstructor: TMinimalOfflineAudioContextConstructorFactory = (\n cacheTestResult,\n createInvalidStateError,\n createNativeOfflineAudioContext,\n minimalBaseAudioContextConstructor,\n startRendering\n) => {\n return class MinimalOfflineAudioContext extends minimalBaseAudioContextConstructor\n implements IMinimalOfflineAudioContext {\n private _length: number;\n\n private _nativeOfflineAudioContext: TNativeOfflineAudioContext;\n\n private _state: null | TAudioContextState;\n\n constructor(options: IOfflineAudioContextOptions) {\n const { length, numberOfChannels, sampleRate } = { ...DEFAULT_OPTIONS, ...options };\n\n const nativeOfflineAudioContext = createNativeOfflineAudioContext(numberOfChannels, length, sampleRate);\n\n // #21 Safari does not support promises and therefore would fire the statechange event before the promise can be resolved.\n if (!cacheTestResult(testPromiseSupport, () => testPromiseSupport(nativeOfflineAudioContext))) {\n nativeOfflineAudioContext.addEventListener(\n 'statechange',\n (() => {\n let i = 0;\n\n const delayStateChangeEvent = (event: Event) => {\n if (this._state === 'running') {\n if (i > 0) {\n nativeOfflineAudioContext.removeEventListener('statechange', delayStateChangeEvent);\n event.stopImmediatePropagation();\n\n this._waitForThePromiseToSettle(event);\n } else {\n i += 1;\n }\n }\n };\n\n return delayStateChangeEvent;\n })()\n );\n }\n\n super(nativeOfflineAudioContext, numberOfChannels);\n\n this._length = length;\n this._nativeOfflineAudioContext = nativeOfflineAudioContext;\n this._state = null;\n }\n\n get length(): number {\n // Bug #17: Safari does not yet expose the length.\n if (this._nativeOfflineAudioContext.length === undefined) {\n return this._length;\n }\n\n return this._nativeOfflineAudioContext.length;\n }\n\n get state(): TAudioContextState {\n return this._state === null ? this._nativeOfflineAudioContext.state : this._state;\n }\n\n public startRendering(): Promise {\n /*\n * Bug #9 & #59: It is theoretically possible that startRendering() will first render a partialOfflineAudioContext. Therefore\n * the state of the nativeOfflineAudioContext might no transition to running immediately.\n */\n if (this._state === 'running') {\n return Promise.reject(createInvalidStateError());\n }\n\n this._state = 'running';\n\n return startRendering(this.destination, this._nativeOfflineAudioContext).finally(() => {\n this._state = null;\n\n deactivateAudioGraph(this);\n });\n }\n\n private _waitForThePromiseToSettle(event: Event): void {\n if (this._state === null) {\n this._nativeOfflineAudioContext.dispatchEvent(event);\n } else {\n setTimeout(() => this._waitForThePromiseToSettle(event));\n }\n }\n };\n};\n","export const assignNativeAudioNodeOption = (\n nativeAudioNode: Record,\n options: Record,\n option: T\n) => {\n const value = options[option];\n\n if (value !== undefined && value !== nativeAudioNode[option]) {\n nativeAudioNode[option] = value;\n }\n};\n","import { IAudioNodeOptions } from '../interfaces';\nimport { TNativeAudioNode } from '../types';\nimport { assignNativeAudioNodeOption } from './assign-native-audio-node-option';\n\nexport const assignNativeAudioNodeOptions = (nativeAudioNode: TNativeAudioNode, options: IAudioNodeOptions): void => {\n assignNativeAudioNodeOption(nativeAudioNode, options, 'channelCount');\n assignNativeAudioNodeOption(nativeAudioNode, options, 'channelCountMode');\n assignNativeAudioNodeOption(nativeAudioNode, options, 'channelInterpretation');\n};\n","import { TNativeAnalyserNode } from '../types';\n\nexport const testAnalyserNodeGetFloatTimeDomainDataMethodSupport = (nativeAnalyserNode: TNativeAnalyserNode): boolean => {\n return typeof nativeAnalyserNode.getFloatTimeDomainData === 'function';\n};\n","export const assignNativeAudioNodeAudioParamValue = (\n nativeAudioNode: T,\n options: U,\n audioParam: keyof T & keyof U\n) => {\n const value = options[audioParam];\n\n if (value !== undefined && value !== nativeAudioNode[audioParam].value) {\n nativeAudioNode[audioParam].value = value;\n }\n};\n","import { TNativeAudioBufferSourceNode, TNativeConstantSourceNode, TNativeOscillatorNode } from '../types';\n\nexport const wrapAudioScheduledSourceNodeStartMethodNegativeParameters = (\n nativeAudioScheduledSourceNode: TNativeAudioBufferSourceNode | TNativeConstantSourceNode | TNativeOscillatorNode\n): void => {\n nativeAudioScheduledSourceNode.start = ((start) => {\n return (when = 0, offset = 0, duration?: number) => {\n if ((typeof duration === 'number' && duration < 0) || offset < 0 || when < 0) {\n throw new RangeError(\"The parameters can't be negative.\");\n }\n\n // @todo TypeScript cannot infer the overloaded signature with 3 arguments yet.\n (<(when: number, offset: number, duration?: number) => void>start).call(nativeAudioScheduledSourceNode, when, offset, duration);\n };\n })(nativeAudioScheduledSourceNode.start);\n};\n","import { TNativeAudioBufferSourceNode, TNativeConstantSourceNode, TNativeOscillatorNode } from '../types';\n\nexport const wrapAudioScheduledSourceNodeStopMethodNegativeParameters = (\n nativeAudioScheduledSourceNode: TNativeAudioBufferSourceNode | TNativeConstantSourceNode | TNativeOscillatorNode\n): void => {\n nativeAudioScheduledSourceNode.stop = ((stop) => {\n return (when = 0) => {\n if (when < 0) {\n throw new RangeError(\"The parameter can't be negative.\");\n }\n\n stop.call(nativeAudioScheduledSourceNode, when);\n };\n })(nativeAudioScheduledSourceNode.stop);\n};\n","export const computeBufferSize = (baseLatency: null | number, sampleRate: number) => {\n if (baseLatency === null) {\n return 512;\n }\n\n return Math.max(512, Math.min(16384, Math.pow(2, Math.round(Math.log2(baseLatency * sampleRate)))));\n};\n","import { IAudioWorkletNodeOptions } from '../interfaces';\n\nexport const cloneAudioWorkletNodeOptions = (audioWorkletNodeOptions: IAudioWorkletNodeOptions): Promise => {\n return new Promise((resolve, reject) => {\n const { port1, port2 } = new MessageChannel();\n\n port1.onmessage = ({ data }) => {\n port1.close();\n port2.close();\n\n resolve(data);\n };\n port1.onmessageerror = ({ data }) => {\n port1.close();\n port2.close();\n\n reject(data);\n };\n\n // This will throw an error if the audioWorkletNodeOptions are not clonable.\n port2.postMessage(audioWorkletNodeOptions);\n });\n};\n","import { IAudioWorkletNodeOptions, IAudioWorkletProcessor, IAudioWorkletProcessorConstructor } from '../interfaces';\nimport { cloneAudioWorkletNodeOptions } from './clone-audio-worklet-node-options';\n\nexport const createAudioWorkletProcessorPromise = async (\n processorConstructor: IAudioWorkletProcessorConstructor,\n audioWorkletNodeOptions: IAudioWorkletNodeOptions\n): Promise => {\n const clonedAudioWorkletNodeOptions = await cloneAudioWorkletNodeOptions(audioWorkletNodeOptions);\n\n return new processorConstructor(clonedAudioWorkletNodeOptions);\n};\n","import { assignNativeAudioNodeAudioParamValue } from '../helpers/assign-native-audio-node-audio-param-value';\nimport { assignNativeAudioNodeOption } from '../helpers/assign-native-audio-node-option';\nimport { assignNativeAudioNodeOptions } from '../helpers/assign-native-audio-node-options';\nimport { TNativeBiquadFilterNodeFactory } from '../types';\n\nexport const createNativeBiquadFilterNode: TNativeBiquadFilterNodeFactory = (nativeContext, options) => {\n const nativeBiquadFilterNode = nativeContext.createBiquadFilter();\n\n assignNativeAudioNodeOptions(nativeBiquadFilterNode, options);\n\n assignNativeAudioNodeAudioParamValue(nativeBiquadFilterNode, options, 'Q');\n assignNativeAudioNodeAudioParamValue(nativeBiquadFilterNode, options, 'detune');\n assignNativeAudioNodeAudioParamValue(nativeBiquadFilterNode, options, 'frequency');\n assignNativeAudioNodeAudioParamValue(nativeBiquadFilterNode, options, 'gain');\n\n assignNativeAudioNodeOption(nativeBiquadFilterNode, options, 'type');\n\n return nativeBiquadFilterNode;\n};\n","import { assignNativeAudioNodeOptions } from '../helpers/assign-native-audio-node-options';\nimport { wrapChannelSplitterNode } from '../helpers/wrap-channel-splitter-node';\nimport { TNativeChannelSplitterNodeFactory } from '../types';\n\nexport const createNativeChannelSplitterNode: TNativeChannelSplitterNodeFactory = (nativeContext, options) => {\n const nativeChannelSplitterNode = nativeContext.createChannelSplitter(options.numberOfOutputs);\n\n // Bug #96: Safari does not have the correct channelCount.\n // Bug #29: Safari does not have the correct channelCountMode.\n // Bug #31: Safari does not have the correct channelInterpretation.\n assignNativeAudioNodeOptions(nativeChannelSplitterNode, options);\n\n // Bug #29, #30, #31, #32, #96 & #97: Only Chrome, Edge & Firefox partially support the spec yet.\n wrapChannelSplitterNode(nativeChannelSplitterNode);\n\n return nativeChannelSplitterNode;\n};\n","import { createInvalidStateError } from '../factories/invalid-state-error';\nimport { TNativeChannelSplitterNode } from '../types';\n\nexport const wrapChannelSplitterNode = (channelSplitterNode: TNativeChannelSplitterNode): void => {\n const channelCount = channelSplitterNode.numberOfOutputs;\n\n // Bug #97: Safari does not throw an error when attempting to change the channelCount to something other than its initial value.\n Object.defineProperty(channelSplitterNode, 'channelCount', {\n get: () => channelCount,\n set: (value) => {\n if (value !== channelCount) {\n throw createInvalidStateError();\n }\n }\n });\n\n // Bug #30: Safari does not throw an error when attempting to change the channelCountMode to something other than explicit.\n Object.defineProperty(channelSplitterNode, 'channelCountMode', {\n get: () => 'explicit',\n set: (value) => {\n if (value !== 'explicit') {\n throw createInvalidStateError();\n }\n }\n });\n\n // Bug #32: Safari does not throw an error when attempting to change the channelInterpretation to something other than discrete.\n Object.defineProperty(channelSplitterNode, 'channelInterpretation', {\n get: () => 'discrete',\n set: (value) => {\n if (value !== 'discrete') {\n throw createInvalidStateError();\n }\n }\n });\n};\n","import { TNativeAudioNode } from '../types';\n\nexport const interceptConnections = (\n original: T,\n interceptor: TNativeAudioNode\n): T & { connect: TNativeAudioNode['connect']; disconnect: TNativeAudioNode['disconnect'] } => {\n (original).connect = interceptor.connect.bind(interceptor);\n\n (original).disconnect = interceptor.disconnect.bind(interceptor);\n\n return original;\n};\n","import { assignNativeAudioNodeAudioParamValue } from '../helpers/assign-native-audio-node-audio-param-value';\nimport { assignNativeAudioNodeOptions } from '../helpers/assign-native-audio-node-options';\nimport { TNativeDelayNodeFactory } from '../types';\n\nexport const createNativeDelayNode: TNativeDelayNodeFactory = (nativeContext, options) => {\n const nativeDelayNode = nativeContext.createDelay(options.maxDelayTime);\n\n assignNativeAudioNodeOptions(nativeDelayNode, options);\n\n assignNativeAudioNodeAudioParamValue(nativeDelayNode, options, 'delayTime');\n\n return nativeDelayNode;\n};\n","import { assignNativeAudioNodeAudioParamValue } from '../helpers/assign-native-audio-node-audio-param-value';\nimport { assignNativeAudioNodeOptions } from '../helpers/assign-native-audio-node-options';\nimport { TNativeGainNodeFactory } from '../types';\n\nexport const createNativeGainNode: TNativeGainNodeFactory = (nativeContext, options) => {\n const nativeGainNode = nativeContext.createGain();\n\n assignNativeAudioNodeOptions(nativeGainNode, options);\n\n assignNativeAudioNodeAudioParamValue(nativeGainNode, options, 'gain');\n\n return nativeGainNode;\n};\n","import { computeBufferSize } from '../helpers/compute-buffer-size';\nimport { filterBuffer } from '../helpers/filter-buffer';\nimport { interceptConnections } from '../helpers/intercept-connections';\nimport { TNativeAudioNode, TNativeIIRFilterNode, TNativeIIRFilterNodeFakerFactoryFactory } from '../types';\n\nfunction divide(a: [number, number], b: [number, number]): [number, number] {\n const denominator = b[0] * b[0] + b[1] * b[1];\n\n return [(a[0] * b[0] + a[1] * b[1]) / denominator, (a[1] * b[0] - a[0] * b[1]) / denominator];\n}\n\nfunction multiply(a: [number, number], b: [number, number]): [number, number] {\n return [a[0] * b[0] - a[1] * b[1], a[0] * b[1] + a[1] * b[0]];\n}\n\nfunction evaluatePolynomial(coefficient: Float64Array, z: [number, number]): [number, number] {\n let result: [number, number] = [0, 0];\n\n for (let i = coefficient.length - 1; i >= 0; i -= 1) {\n result = multiply(result, z);\n\n result[0] += coefficient[i];\n }\n\n return result;\n}\n\nexport const createNativeIIRFilterNodeFakerFactory: TNativeIIRFilterNodeFakerFactoryFactory = (\n createInvalidAccessError,\n createInvalidStateError,\n createNativeScriptProcessorNode,\n createNotSupportedError\n) => {\n return (nativeContext, baseLatency, { channelCount, channelCountMode, channelInterpretation, feedback, feedforward }) => {\n const bufferSize = computeBufferSize(baseLatency, nativeContext.sampleRate);\n const convertedFeedback = feedback instanceof Float64Array ? feedback : new Float64Array(feedback);\n const convertedFeedforward = feedforward instanceof Float64Array ? feedforward : new Float64Array(feedforward);\n const feedbackLength = convertedFeedback.length;\n const feedforwardLength = convertedFeedforward.length;\n const minLength = Math.min(feedbackLength, feedforwardLength);\n\n if (feedbackLength === 0 || feedbackLength > 20) {\n throw createNotSupportedError();\n }\n\n if (convertedFeedback[0] === 0) {\n throw createInvalidStateError();\n }\n\n if (feedforwardLength === 0 || feedforwardLength > 20) {\n throw createNotSupportedError();\n }\n\n if (convertedFeedforward[0] === 0) {\n throw createInvalidStateError();\n }\n\n if (convertedFeedback[0] !== 1) {\n for (let i = 0; i < feedforwardLength; i += 1) {\n convertedFeedforward[i] /= convertedFeedback[0];\n }\n\n for (let i = 1; i < feedbackLength; i += 1) {\n convertedFeedback[i] /= convertedFeedback[0];\n }\n }\n\n const scriptProcessorNode = createNativeScriptProcessorNode(nativeContext, bufferSize, channelCount, channelCount);\n\n scriptProcessorNode.channelCount = channelCount;\n scriptProcessorNode.channelCountMode = channelCountMode;\n scriptProcessorNode.channelInterpretation = channelInterpretation;\n\n const bufferLength = 32;\n const bufferIndexes: number[] = [];\n const xBuffers: Float32Array[] = [];\n const yBuffers: Float32Array[] = [];\n\n for (let i = 0; i < channelCount; i += 1) {\n bufferIndexes.push(0);\n\n const xBuffer = new Float32Array(bufferLength);\n const yBuffer = new Float32Array(bufferLength);\n\n xBuffer.fill(0);\n yBuffer.fill(0);\n\n xBuffers.push(xBuffer);\n yBuffers.push(yBuffer);\n }\n\n // tslint:disable-next-line:deprecation\n scriptProcessorNode.onaudioprocess = (event: AudioProcessingEvent) => {\n const inputBuffer = event.inputBuffer;\n const outputBuffer = event.outputBuffer;\n\n const numberOfChannels = inputBuffer.numberOfChannels;\n\n for (let i = 0; i < numberOfChannels; i += 1) {\n const input = inputBuffer.getChannelData(i);\n const output = outputBuffer.getChannelData(i);\n\n bufferIndexes[i] = filterBuffer(\n convertedFeedback,\n feedbackLength,\n convertedFeedforward,\n feedforwardLength,\n minLength,\n xBuffers[i],\n yBuffers[i],\n bufferIndexes[i],\n bufferLength,\n input,\n output\n );\n }\n };\n\n const nyquist = nativeContext.sampleRate / 2;\n\n const nativeIIRFilterNodeFaker = {\n get bufferSize(): number {\n return bufferSize;\n },\n get channelCount(): number {\n return scriptProcessorNode.channelCount;\n },\n set channelCount(value) {\n scriptProcessorNode.channelCount = value;\n },\n get channelCountMode(): TNativeIIRFilterNode['channelCountMode'] {\n return scriptProcessorNode.channelCountMode;\n },\n set channelCountMode(value) {\n scriptProcessorNode.channelCountMode = value;\n },\n get channelInterpretation(): TNativeIIRFilterNode['channelInterpretation'] {\n return scriptProcessorNode.channelInterpretation;\n },\n set channelInterpretation(value) {\n scriptProcessorNode.channelInterpretation = value;\n },\n get context(): TNativeIIRFilterNode['context'] {\n return scriptProcessorNode.context;\n },\n get inputs(): TNativeAudioNode[] {\n return [scriptProcessorNode];\n },\n get numberOfInputs(): number {\n return scriptProcessorNode.numberOfInputs;\n },\n get numberOfOutputs(): number {\n return scriptProcessorNode.numberOfOutputs;\n },\n addEventListener(...args: any[]): void {\n // @todo Dissallow adding an audioprocess listener.\n return scriptProcessorNode.addEventListener(args[0], args[1], args[2]);\n },\n dispatchEvent(...args: any[]): boolean {\n return scriptProcessorNode.dispatchEvent(args[0]);\n },\n getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void {\n if (frequencyHz.length !== magResponse.length || magResponse.length !== phaseResponse.length) {\n throw createInvalidAccessError();\n }\n\n const length = frequencyHz.length;\n\n for (let i = 0; i < length; i += 1) {\n const omega = -Math.PI * (frequencyHz[i] / nyquist);\n const z: [number, number] = [Math.cos(omega), Math.sin(omega)];\n const numerator = evaluatePolynomial(convertedFeedforward, z);\n const denominator = evaluatePolynomial(convertedFeedback, z);\n const response = divide(numerator, denominator);\n\n magResponse[i] = Math.sqrt(response[0] * response[0] + response[1] * response[1]);\n phaseResponse[i] = Math.atan2(response[1], response[0]);\n }\n },\n removeEventListener(...args: any[]): void {\n return scriptProcessorNode.removeEventListener(args[0], args[1], args[2]);\n }\n };\n\n return interceptConnections(nativeIIRFilterNodeFaker, scriptProcessorNode);\n };\n};\n","import { TCacheTestResultFactory } from '../types';\n\nexport const createCacheTestResult: TCacheTestResultFactory = (ongoingTests, testResults) => {\n return (tester, test) => {\n const cachedTestResult = testResults.get(tester);\n\n if (cachedTestResult !== undefined) {\n return cachedTestResult;\n }\n\n const ongoingTest = ongoingTests.get(tester);\n\n if (ongoingTest !== undefined) {\n return ongoingTest;\n }\n\n try {\n const synchronousTestResult = test();\n\n if (synchronousTestResult instanceof Promise) {\n ongoingTests.set(tester, synchronousTestResult);\n\n return synchronousTestResult\n .catch(() => false)\n .then((finalTestResult) => {\n ongoingTests.delete(tester);\n testResults.set(tester, finalTestResult);\n\n return finalTestResult;\n });\n }\n\n testResults.set(tester, synchronousTestResult);\n\n return synchronousTestResult;\n } catch {\n testResults.set(tester, false);\n\n return false;\n }\n };\n};\n","import { IMinimalOfflineAudioContext, IOfflineAudioContext } from '../interfaces';\nimport { TContext, TGetNativeContextFactory, TNativeAudioContext, TNativeOfflineAudioContext } from '../types';\nimport { createInvalidStateError } from './invalid-state-error';\n\nexport const createGetNativeContext: TGetNativeContextFactory = (contextStore) => {\n return (\n context: T\n ): T extends IMinimalOfflineAudioContext | IOfflineAudioContext ? TNativeOfflineAudioContext : TNativeAudioContext => {\n const nativeContext = contextStore.get(context);\n\n if (nativeContext === undefined) {\n throw createInvalidStateError();\n }\n\n return (\n nativeContext\n );\n };\n};\n","import { IAudioNode, IAudioNodeRenderer, IMinimalOfflineAudioContext, IOfflineAudioContext } from '../interfaces';\nimport { TActiveInputConnection, TAddAudioNodeConnectionsFactory, TContext, TNativeAudioNode } from '../types';\n\nexport const createAddAudioNodeConnections: TAddAudioNodeConnectionsFactory = (audioNodeConnectionsStore) => {\n return (\n audioNode: IAudioNode,\n audioNodeRenderer: T extends IMinimalOfflineAudioContext | IOfflineAudioContext ? IAudioNodeRenderer> : null,\n nativeAudioNode: TNativeAudioNode\n ) => {\n const activeInputs = [];\n\n for (let i = 0; i < nativeAudioNode.numberOfInputs; i += 1) {\n activeInputs.push(new Set>());\n }\n\n audioNodeConnectionsStore.set(audioNode, {\n activeInputs,\n outputs: new Set(),\n passiveInputs: new WeakMap(),\n renderer: audioNodeRenderer\n });\n };\n};\n","import { TConvertNumberToUnsignedLongFactory } from '../types';\n\nexport const createConvertNumberToUnsignedLong: TConvertNumberToUnsignedLongFactory = (unit32Array) => {\n return (value) => {\n unit32Array[0] = value;\n\n return unit32Array[0];\n };\n};\n","import { IAudioParam, IAudioParamRenderer, IMinimalOfflineAudioContext, IOfflineAudioContext } from '../interfaces';\nimport { TAddAudioParamConnectionsFactory, TContext } from '../types';\n\nexport const createAddAudioParamConnections: TAddAudioParamConnectionsFactory = (audioParamConnectionsStore) => {\n return (\n audioParam: IAudioParam,\n audioParamRenderer: T extends IMinimalOfflineAudioContext | IOfflineAudioContext ? IAudioParamRenderer : null\n ) => {\n audioParamConnectionsStore.set(audioParam, { activeInputs: new Set(), passiveInputs: new WeakMap(), renderer: audioParamRenderer });\n };\n};\n","import { TNativeScriptProcessorNodeFactory } from '../types';\n\nexport const createNativeScriptProcessorNode: TNativeScriptProcessorNodeFactory = (\n nativeContext,\n bufferSize,\n numberOfInputChannels,\n numberOfOutputChannels\n) => {\n return nativeContext.createScriptProcessor(bufferSize, numberOfInputChannels, numberOfOutputChannels); // tslint:disable-line deprecation\n};\n","import { TNotSupportedErrorFactory } from '../types';\n\nexport const createNotSupportedError: TNotSupportedErrorFactory = () => new DOMException('', 'NotSupportedError');\n","import { deactivateAudioGraph } from '../helpers/deactivate-audio-graph';\nimport { testPromiseSupport } from '../helpers/test-promise-support';\nimport { IAudioBuffer, IOfflineAudioContext, IOfflineAudioContextOptions } from '../interfaces';\nimport { TAudioContextState, TNativeOfflineAudioContext, TOfflineAudioContextConstructorFactory } from '../types';\n\nconst DEFAULT_OPTIONS = {\n numberOfChannels: 1\n} as const;\n\nexport const createOfflineAudioContextConstructor: TOfflineAudioContextConstructorFactory = (\n baseAudioContextConstructor,\n cacheTestResult,\n createInvalidStateError,\n createNativeOfflineAudioContext,\n startRendering\n) => {\n return class OfflineAudioContext extends baseAudioContextConstructor implements IOfflineAudioContext {\n private _length: number;\n\n private _nativeOfflineAudioContext: TNativeOfflineAudioContext;\n\n private _state: null | TAudioContextState;\n\n constructor(options: IOfflineAudioContextOptions);\n constructor(numberOfChannels: number, length: number, sampleRate: number);\n constructor(a: number | IOfflineAudioContextOptions, b?: number, c?: number) {\n let options: IOfflineAudioContextOptions;\n\n if (typeof a === 'number' && b !== undefined && c !== undefined) {\n options = { length: b, numberOfChannels: a, sampleRate: c };\n } else if (typeof a === 'object') {\n options = a;\n } else {\n throw new Error('The given parameters are not valid.');\n }\n\n const { length, numberOfChannels, sampleRate } = { ...DEFAULT_OPTIONS, ...options };\n\n const nativeOfflineAudioContext = createNativeOfflineAudioContext(numberOfChannels, length, sampleRate);\n\n // #21 Safari does not support promises and therefore would fire the statechange event before the promise can be resolved.\n if (!cacheTestResult(testPromiseSupport, () => testPromiseSupport(nativeOfflineAudioContext))) {\n nativeOfflineAudioContext.addEventListener(\n 'statechange',\n (() => {\n let i = 0;\n\n const delayStateChangeEvent = (event: Event) => {\n if (this._state === 'running') {\n if (i > 0) {\n nativeOfflineAudioContext.removeEventListener('statechange', delayStateChangeEvent);\n event.stopImmediatePropagation();\n\n this._waitForThePromiseToSettle(event);\n } else {\n i += 1;\n }\n }\n };\n\n return delayStateChangeEvent;\n })()\n );\n }\n\n super(nativeOfflineAudioContext, numberOfChannels);\n\n this._length = length;\n this._nativeOfflineAudioContext = nativeOfflineAudioContext;\n this._state = null;\n }\n\n get length(): number {\n // Bug #17: Safari does not yet expose the length.\n if (this._nativeOfflineAudioContext.length === undefined) {\n return this._length;\n }\n\n return this._nativeOfflineAudioContext.length;\n }\n\n get state(): TAudioContextState {\n return this._state === null ? this._nativeOfflineAudioContext.state : this._state;\n }\n\n public startRendering(): Promise {\n /*\n * Bug #9 & #59: It is theoretically possible that startRendering() will first render a partialOfflineAudioContext. Therefore\n * the state of the nativeOfflineAudioContext might no transition to running immediately.\n */\n if (this._state === 'running') {\n return Promise.reject(createInvalidStateError());\n }\n\n this._state = 'running';\n\n return startRendering(this.destination, this._nativeOfflineAudioContext).finally(() => {\n this._state = null;\n\n deactivateAudioGraph(this);\n });\n }\n\n private _waitForThePromiseToSettle(event: Event): void {\n if (this._state === null) {\n this._nativeOfflineAudioContext.dispatchEvent(event);\n } else {\n setTimeout(() => this._waitForThePromiseToSettle(event));\n }\n }\n };\n};\n","import { isActiveAudioNode } from '../helpers/is-active-audio-node';\nimport { setInternalStateToActive } from '../helpers/set-internal-state-to-active';\nimport { setInternalStateToPassive } from '../helpers/set-internal-state-to-passive';\nimport {\n IAudioParam,\n IAudioScheduledSourceNodeEventMap,\n IMinimalOfflineAudioContext,\n IOscillatorNode,\n IOscillatorNodeRenderer,\n IOscillatorOptions\n} from '../interfaces';\nimport {\n TContext,\n TEventHandler,\n TNativeOscillatorNode,\n TOscillatorNodeConstructorFactory,\n TOscillatorNodeRenderer,\n TOscillatorType\n} from '../types';\n\nconst DEFAULT_OPTIONS = {\n channelCount: 2,\n channelCountMode: 'max', // This attribute has no effect for nodes with no inputs.\n channelInterpretation: 'speakers', // This attribute has no effect for nodes with no inputs.\n detune: 0,\n frequency: 440,\n periodicWave: undefined,\n type: 'sine'\n} as const;\n\nexport const createOscillatorNodeConstructor: TOscillatorNodeConstructorFactory = (\n audioNodeConstructor,\n createAudioParam,\n createNativeOscillatorNode,\n createOscillatorNodeRenderer,\n getNativeContext,\n isNativeOfflineAudioContext,\n wrapEventListener\n) => {\n return class OscillatorNode\n extends audioNodeConstructor\n implements IOscillatorNode\n {\n private _detune: IAudioParam;\n\n private _frequency: IAudioParam;\n\n private _nativeOscillatorNode: TNativeOscillatorNode;\n\n private _onended: null | TEventHandler;\n\n private _oscillatorNodeRenderer: TOscillatorNodeRenderer;\n\n constructor(context: T, options?: Partial) {\n const nativeContext = getNativeContext(context);\n const mergedOptions = { ...DEFAULT_OPTIONS, ...options };\n const nativeOscillatorNode = createNativeOscillatorNode(nativeContext, mergedOptions);\n const isOffline = isNativeOfflineAudioContext(nativeContext);\n const oscillatorNodeRenderer = >(isOffline ? createOscillatorNodeRenderer() : null);\n const nyquist = context.sampleRate / 2;\n\n super(context, false, nativeOscillatorNode, oscillatorNodeRenderer);\n\n // Bug #81: Firefox & Safari do not export the correct values for maxValue and minValue.\n this._detune = createAudioParam(this, isOffline, nativeOscillatorNode.detune, 153600, -153600);\n // Bug #76: Safari does not export the correct values for maxValue and minValue.\n this._frequency = createAudioParam(this, isOffline, nativeOscillatorNode.frequency, nyquist, -nyquist);\n this._nativeOscillatorNode = nativeOscillatorNode;\n this._onended = null;\n this._oscillatorNodeRenderer = oscillatorNodeRenderer;\n\n if (this._oscillatorNodeRenderer !== null && mergedOptions.periodicWave !== undefined) {\n (>this._oscillatorNodeRenderer).periodicWave =\n mergedOptions.periodicWave;\n }\n }\n\n get detune(): IAudioParam {\n return this._detune;\n }\n\n get frequency(): IAudioParam {\n return this._frequency;\n }\n\n get onended(): null | TEventHandler {\n return this._onended;\n }\n\n set onended(value) {\n const wrappedListener = typeof value === 'function' ? wrapEventListener(this, value) : null;\n\n this._nativeOscillatorNode.onended = wrappedListener;\n\n const nativeOnEnded = this._nativeOscillatorNode.onended;\n\n this._onended = nativeOnEnded !== null && nativeOnEnded === wrappedListener ? value : nativeOnEnded;\n }\n\n get type(): TOscillatorType {\n return this._nativeOscillatorNode.type;\n }\n\n set type(value) {\n this._nativeOscillatorNode.type = value;\n\n if (this._oscillatorNodeRenderer !== null) {\n this._oscillatorNodeRenderer.periodicWave = null;\n }\n }\n\n public setPeriodicWave(periodicWave: PeriodicWave): void {\n this._nativeOscillatorNode.setPeriodicWave(periodicWave);\n\n if (this._oscillatorNodeRenderer !== null) {\n this._oscillatorNodeRenderer.periodicWave = periodicWave;\n }\n }\n\n public start(when = 0): void {\n this._nativeOscillatorNode.start(when);\n\n if (this._oscillatorNodeRenderer !== null) {\n this._oscillatorNodeRenderer.start = when;\n }\n\n if (this.context.state !== 'closed') {\n setInternalStateToActive(this);\n\n const resetInternalStateToPassive = () => {\n this._nativeOscillatorNode.removeEventListener('ended', resetInternalStateToPassive);\n\n if (isActiveAudioNode(this)) {\n setInternalStateToPassive(this);\n }\n };\n\n this._nativeOscillatorNode.addEventListener('ended', resetInternalStateToPassive);\n }\n }\n\n public stop(when = 0): void {\n this._nativeOscillatorNode.stop(when);\n\n if (this._oscillatorNodeRenderer !== null) {\n this._oscillatorNodeRenderer.stop = when;\n }\n }\n };\n};\n","import { MOST_NEGATIVE_SINGLE_FLOAT, MOST_POSITIVE_SINGLE_FLOAT } from '../constants';\nimport { IAudioParam, IPannerNode, IPannerOptions } from '../interfaces';\nimport {\n TAudioNodeRenderer,\n TContext,\n TDistanceModelType,\n TNativePannerNode,\n TPannerNodeConstructorFactory,\n TPanningModelType\n} from '../types';\n\nconst DEFAULT_OPTIONS = {\n channelCount: 2,\n channelCountMode: 'clamped-max',\n channelInterpretation: 'speakers',\n coneInnerAngle: 360,\n coneOuterAngle: 360,\n coneOuterGain: 0,\n distanceModel: 'inverse',\n maxDistance: 10000,\n orientationX: 1,\n orientationY: 0,\n orientationZ: 0,\n panningModel: 'equalpower',\n positionX: 0,\n positionY: 0,\n positionZ: 0,\n refDistance: 1,\n rolloffFactor: 1\n} as const;\n\nexport const createPannerNodeConstructor: TPannerNodeConstructorFactory = (\n audioNodeConstructor,\n createAudioParam,\n createNativePannerNode,\n createPannerNodeRenderer,\n getNativeContext,\n isNativeOfflineAudioContext,\n setAudioNodeTailTime\n) => {\n return class PannerNode extends audioNodeConstructor implements IPannerNode {\n private _nativePannerNode: TNativePannerNode;\n\n private _orientationX: IAudioParam;\n\n private _orientationY: IAudioParam;\n\n private _orientationZ: IAudioParam;\n\n private _positionX: IAudioParam;\n\n private _positionY: IAudioParam;\n\n private _positionZ: IAudioParam;\n\n constructor(context: T, options?: Partial) {\n const nativeContext = getNativeContext(context);\n const mergedOptions = { ...DEFAULT_OPTIONS, ...options };\n const nativePannerNode = createNativePannerNode(nativeContext, mergedOptions);\n const isOffline = isNativeOfflineAudioContext(nativeContext);\n const pannerNodeRenderer = >(isOffline ? createPannerNodeRenderer() : null);\n\n super(context, false, nativePannerNode, pannerNodeRenderer);\n\n this._nativePannerNode = nativePannerNode;\n // Bug #74: Safari does not export the correct values for maxValue and minValue.\n this._orientationX = createAudioParam(\n this,\n isOffline,\n nativePannerNode.orientationX,\n MOST_POSITIVE_SINGLE_FLOAT,\n MOST_NEGATIVE_SINGLE_FLOAT\n );\n this._orientationY = createAudioParam(\n this,\n isOffline,\n nativePannerNode.orientationY,\n MOST_POSITIVE_SINGLE_FLOAT,\n MOST_NEGATIVE_SINGLE_FLOAT\n );\n this._orientationZ = createAudioParam(\n this,\n isOffline,\n nativePannerNode.orientationZ,\n MOST_POSITIVE_SINGLE_FLOAT,\n MOST_NEGATIVE_SINGLE_FLOAT\n );\n this._positionX = createAudioParam(\n this,\n isOffline,\n nativePannerNode.positionX,\n MOST_POSITIVE_SINGLE_FLOAT,\n MOST_NEGATIVE_SINGLE_FLOAT\n );\n this._positionY = createAudioParam(\n this,\n isOffline,\n nativePannerNode.positionY,\n MOST_POSITIVE_SINGLE_FLOAT,\n MOST_NEGATIVE_SINGLE_FLOAT\n );\n this._positionZ = createAudioParam(\n this,\n isOffline,\n nativePannerNode.positionZ,\n MOST_POSITIVE_SINGLE_FLOAT,\n MOST_NEGATIVE_SINGLE_FLOAT\n );\n\n // @todo Determine a meaningful tail-time instead of just using one second.\n setAudioNodeTailTime(this, 1);\n }\n\n get coneInnerAngle(): number {\n return this._nativePannerNode.coneInnerAngle;\n }\n\n set coneInnerAngle(value) {\n this._nativePannerNode.coneInnerAngle = value;\n }\n\n get coneOuterAngle(): number {\n return this._nativePannerNode.coneOuterAngle;\n }\n\n set coneOuterAngle(value) {\n this._nativePannerNode.coneOuterAngle = value;\n }\n\n get coneOuterGain(): number {\n return this._nativePannerNode.coneOuterGain;\n }\n\n set coneOuterGain(value) {\n this._nativePannerNode.coneOuterGain = value;\n }\n\n get distanceModel(): TDistanceModelType {\n return this._nativePannerNode.distanceModel;\n }\n\n set distanceModel(value) {\n this._nativePannerNode.distanceModel = value;\n }\n\n get maxDistance(): number {\n return this._nativePannerNode.maxDistance;\n }\n\n set maxDistance(value) {\n this._nativePannerNode.maxDistance = value;\n }\n\n get orientationX(): IAudioParam {\n return this._orientationX;\n }\n\n get orientationY(): IAudioParam {\n return this._orientationY;\n }\n\n get orientationZ(): IAudioParam {\n return this._orientationZ;\n }\n\n get panningModel(): TPanningModelType {\n return this._nativePannerNode.panningModel;\n }\n\n set panningModel(value) {\n this._nativePannerNode.panningModel = value;\n }\n\n get positionX(): IAudioParam {\n return this._positionX;\n }\n\n get positionY(): IAudioParam {\n return this._positionY;\n }\n\n get positionZ(): IAudioParam {\n return this._positionZ;\n }\n\n get refDistance(): number {\n return this._nativePannerNode.refDistance;\n }\n\n set refDistance(value) {\n this._nativePannerNode.refDistance = value;\n }\n\n get rolloffFactor(): number {\n return this._nativePannerNode.rolloffFactor;\n }\n\n set rolloffFactor(value) {\n this._nativePannerNode.rolloffFactor = value;\n }\n };\n};\n","import { IPeriodicWave, IPeriodicWaveOptions } from '../interfaces';\nimport { TContext, TPeriodicWaveConstructorFactory } from '../types';\n\nconst DEFAULT_OPTIONS = {\n disableNormalization: false\n} as const;\n\nexport const createPeriodicWaveConstructor: TPeriodicWaveConstructorFactory = (\n createNativePeriodicWave,\n getNativeContext,\n periodicWaveStore,\n sanitizePeriodicWaveOptions\n) => {\n return class PeriodicWave implements IPeriodicWave {\n constructor(context: T, options?: Partial) {\n const nativeContext = getNativeContext(context);\n const mergedOptions = sanitizePeriodicWaveOptions({ ...DEFAULT_OPTIONS, ...options });\n const periodicWave = createNativePeriodicWave(nativeContext, mergedOptions);\n\n periodicWaveStore.add(periodicWave);\n\n // This does violate all good pratices but it is used here to simplify the handling of periodic waves.\n return periodicWave;\n }\n\n public static [Symbol.hasInstance](instance: unknown): boolean {\n return (\n (instance !== null && typeof instance === 'object' && Object.getPrototypeOf(instance) === PeriodicWave.prototype) ||\n periodicWaveStore.has(instance)\n );\n }\n };\n};\n","import { IAudioParam, IStereoPannerNode, IStereoPannerOptions } from '../interfaces';\nimport { TAudioNodeRenderer, TContext, TStereoPannerNodeConstructorFactory } from '../types';\n\nconst DEFAULT_OPTIONS = {\n channelCount: 2,\n /*\n * Bug #105: The channelCountMode should be 'clamped-max' according to the spec but is set to 'explicit' to achieve consistent\n * behavior.\n */\n channelCountMode: 'explicit',\n channelInterpretation: 'speakers',\n pan: 0\n} as const;\n\nexport const createStereoPannerNodeConstructor: TStereoPannerNodeConstructorFactory = (\n audioNodeConstructor,\n createAudioParam,\n createNativeStereoPannerNode,\n createStereoPannerNodeRenderer,\n getNativeContext,\n isNativeOfflineAudioContext\n) => {\n return class StereoPannerNode extends audioNodeConstructor implements IStereoPannerNode {\n private _pan: IAudioParam;\n\n constructor(context: T, options?: Partial) {\n const nativeContext = getNativeContext(context);\n const mergedOptions = { ...DEFAULT_OPTIONS, ...options };\n const nativeStereoPannerNode = createNativeStereoPannerNode(nativeContext, mergedOptions);\n const isOffline = isNativeOfflineAudioContext(nativeContext);\n const stereoPannerNodeRenderer = >(isOffline ? createStereoPannerNodeRenderer() : null);\n\n super(context, false, nativeStereoPannerNode, stereoPannerNodeRenderer);\n\n this._pan = createAudioParam(this, isOffline, nativeStereoPannerNode.pan);\n }\n\n get pan(): IAudioParam {\n return this._pan;\n }\n };\n};\n","import { TUnknownErrorFactory } from '../types';\n\nexport const createUnknownError: TUnknownErrorFactory = () => new DOMException('', 'UnknownError');\n","import { IWaveShaperNode, IWaveShaperOptions } from '../interfaces';\nimport { TAudioNodeRenderer, TContext, TNativeWaveShaperNode, TOverSampleType, TWaveShaperNodeConstructorFactory } from '../types';\n\nconst DEFAULT_OPTIONS = {\n channelCount: 2,\n channelCountMode: 'max',\n channelInterpretation: 'speakers',\n curve: null,\n oversample: 'none'\n} as const;\n\nexport const createWaveShaperNodeConstructor: TWaveShaperNodeConstructorFactory = (\n audioNodeConstructor,\n createInvalidStateError,\n createNativeWaveShaperNode,\n createWaveShaperNodeRenderer,\n getNativeContext,\n isNativeOfflineAudioContext,\n setAudioNodeTailTime\n) => {\n return class WaveShaperNode extends audioNodeConstructor implements IWaveShaperNode {\n private _isCurveNullified: boolean;\n\n private _nativeWaveShaperNode: TNativeWaveShaperNode;\n\n constructor(context: T, options?: Partial) {\n const nativeContext = getNativeContext(context);\n const mergedOptions = { ...DEFAULT_OPTIONS, ...options };\n const nativeWaveShaperNode = createNativeWaveShaperNode(nativeContext, mergedOptions);\n const isOffline = isNativeOfflineAudioContext(nativeContext);\n const waveShaperNodeRenderer = >(isOffline ? createWaveShaperNodeRenderer() : null);\n\n // @todo Add a mechanism to only switch a WaveShaperNode to active while it is connected.\n super(context, true, nativeWaveShaperNode, waveShaperNodeRenderer);\n\n this._isCurveNullified = false;\n this._nativeWaveShaperNode = nativeWaveShaperNode;\n\n // @todo Determine a meaningful tail-time instead of just using one second.\n setAudioNodeTailTime(this, 1);\n }\n\n get curve(): null | Float32Array {\n if (this._isCurveNullified) {\n return null;\n }\n\n return this._nativeWaveShaperNode.curve;\n }\n\n set curve(value) {\n // Bug #103: Safari does not allow to set the curve to null.\n if (value === null) {\n this._isCurveNullified = true;\n this._nativeWaveShaperNode.curve = new Float32Array([0, 0]);\n } else {\n // Bug #102: Safari does not throw an InvalidStateError when the curve has less than two samples.\n // Bug #104: Chrome and Edge will throw an InvalidAccessError when the curve has less than two samples.\n if (value.length < 2) {\n throw createInvalidStateError();\n }\n\n this._isCurveNullified = false;\n this._nativeWaveShaperNode.curve = value;\n }\n }\n\n get oversample(): TOverSampleType {\n return this._nativeWaveShaperNode.oversample;\n }\n\n set oversample(value) {\n this._nativeWaveShaperNode.oversample = value;\n }\n };\n};\n","import { TGetFirstSampleFunction } from '../types';\n\nexport const getFirstSample: TGetFirstSampleFunction = (audioBuffer, buffer, channelNumber) => {\n // Bug #5: Safari does not support copyFromChannel() and copyToChannel().\n if (audioBuffer.copyFromChannel === undefined) {\n return audioBuffer.getChannelData(channelNumber)[0];\n }\n\n audioBuffer.copyFromChannel(buffer, channelNumber);\n\n return buffer[0];\n};\n","import { TIsDCCurveFunction } from '../types';\n\nexport const isDCCurve: TIsDCCurveFunction = (curve) => {\n if (curve === null) {\n return false;\n }\n\n const length = curve.length;\n\n if (length % 2 !== 0) {\n return curve[Math.floor(length / 2)] !== 0;\n }\n\n return curve[length / 2 - 1] + curve[length / 2] !== 0;\n};\n","import { TOverwriteAccessorsFunction } from '../types';\n\nexport const overwriteAccessors: TOverwriteAccessorsFunction = (object, property, createGetter, createSetter) => {\n let prototype = object;\n\n while (!prototype.hasOwnProperty(property)) {\n prototype = Object.getPrototypeOf(prototype);\n }\n\n const { get, set } = >Object.getOwnPropertyDescriptor(prototype, property);\n\n Object.defineProperty(object, property, { get: createGetter(get), set: createSetter(set) });\n};\n","import { TNativeContext } from '../types';\n\nexport const testAudioScheduledSourceNodeStartMethodNegativeParametersSupport = (nativeContext: TNativeContext) => {\n const nativeAudioBufferSourceNode = nativeContext.createOscillator();\n\n try {\n nativeAudioBufferSourceNode.start(-1);\n } catch (err) {\n return err instanceof RangeError;\n }\n\n return false;\n};\n","import { TNativeContext } from '../types';\n\nexport const testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport = (nativeContext: TNativeContext) => {\n const nativeAudioBuffer = nativeContext.createBuffer(1, 1, 44100);\n const nativeAudioBufferSourceNode = nativeContext.createBufferSource();\n\n nativeAudioBufferSourceNode.buffer = nativeAudioBuffer;\n nativeAudioBufferSourceNode.start();\n nativeAudioBufferSourceNode.stop();\n\n try {\n nativeAudioBufferSourceNode.stop();\n\n return true;\n } catch {\n return false;\n }\n};\n","import { TNativeContext } from '../types';\n\nexport const testAudioScheduledSourceNodeStopMethodNegativeParametersSupport = (nativeContext: TNativeContext) => {\n const nativeAudioBufferSourceNode = nativeContext.createOscillator();\n\n try {\n nativeAudioBufferSourceNode.stop(-1);\n } catch (err) {\n return err instanceof RangeError;\n }\n\n return false;\n};\n","import { TNativeAudioNode, TWrapAudioScheduledSourceNodeStopMethodConsecutiveCallsFunction } from '../types';\nimport { interceptConnections } from './intercept-connections';\n\nexport const wrapAudioScheduledSourceNodeStopMethodConsecutiveCalls: TWrapAudioScheduledSourceNodeStopMethodConsecutiveCallsFunction = (\n nativeAudioScheduledSourceNode,\n nativeContext\n) => {\n const nativeGainNode = nativeContext.createGain();\n\n nativeAudioScheduledSourceNode.connect(nativeGainNode);\n\n const disconnectGainNode = ((disconnect) => {\n return () => {\n // @todo TypeScript cannot infer the overloaded signature with 1 argument yet.\n (<(destinaton: TNativeAudioNode) => void>disconnect).call(nativeAudioScheduledSourceNode, nativeGainNode);\n nativeAudioScheduledSourceNode.removeEventListener('ended', disconnectGainNode);\n };\n })(nativeAudioScheduledSourceNode.disconnect);\n\n nativeAudioScheduledSourceNode.addEventListener('ended', disconnectGainNode);\n\n interceptConnections(nativeAudioScheduledSourceNode, nativeGainNode);\n\n nativeAudioScheduledSourceNode.stop = ((stop) => {\n let isStopped = false;\n\n return (when = 0) => {\n if (isStopped) {\n try {\n stop.call(nativeAudioScheduledSourceNode, when);\n } catch {\n nativeGainNode.gain.setValueAtTime(0, when);\n }\n } else {\n stop.call(nativeAudioScheduledSourceNode, when);\n\n isStopped = true;\n }\n };\n })(nativeAudioScheduledSourceNode.stop);\n};\n","import { TWrapEventListenerFunction } from '../types';\n\nexport const wrapEventListener: TWrapEventListenerFunction = (target, eventListener) => {\n return (event) => {\n const descriptor = { value: target };\n\n Object.defineProperties(event, {\n currentTarget: descriptor,\n target: descriptor\n });\n\n if (typeof eventListener === 'function') {\n return eventListener.call(target, event);\n }\n\n return eventListener.handleEvent.call(target, event);\n };\n};\n","import {\n createCancelAndHoldAutomationEvent,\n createCancelScheduledValuesAutomationEvent,\n createExponentialRampToValueAutomationEvent,\n createLinearRampToValueAutomationEvent,\n createSetTargetAutomationEvent,\n createSetValueAutomationEvent,\n createSetValueCurveAutomationEvent\n} from 'automation-events';\nimport { createAbortError } from './factories/abort-error';\nimport { createAddActiveInputConnectionToAudioNode } from './factories/add-active-input-connection-to-audio-node';\nimport { createAddAudioNodeConnections } from './factories/add-audio-node-connections';\nimport { createAddAudioParamConnections } from './factories/add-audio-param-connections';\nimport { createAddAudioWorkletModule } from './factories/add-audio-worklet-module';\nimport { createAddConnectionToAudioNode } from './factories/add-connection-to-audio-node';\nimport { createAddPassiveInputConnectionToAudioNode } from './factories/add-passive-input-connection-to-audio-node';\nimport { createAddSilentConnection } from './factories/add-silent-connection';\nimport { createAddUnrenderedAudioWorkletNode } from './factories/add-unrendered-audio-worklet-node';\nimport { createAnalyserNodeConstructor } from './factories/analyser-node-constructor';\nimport { createAnalyserNodeRendererFactory } from './factories/analyser-node-renderer-factory';\nimport { createAudioBufferConstructor } from './factories/audio-buffer-constructor';\nimport { createAudioBufferSourceNodeConstructor } from './factories/audio-buffer-source-node-constructor';\nimport { createAudioBufferSourceNodeRendererFactory } from './factories/audio-buffer-source-node-renderer-factory';\nimport { createAudioContextConstructor } from './factories/audio-context-constructor';\nimport { createAudioDestinationNodeConstructor } from './factories/audio-destination-node-constructor';\nimport { createAudioDestinationNodeRenderer } from './factories/audio-destination-node-renderer-factory';\nimport { createAudioListenerFactory } from './factories/audio-listener-factory';\nimport { createAudioNodeConstructor } from './factories/audio-node-constructor';\nimport { createAudioParamFactory } from './factories/audio-param-factory';\nimport { createAudioParamRenderer } from './factories/audio-param-renderer';\nimport { createAudioWorkletNodeConstructor } from './factories/audio-worklet-node-constructor';\nimport { createAudioWorkletNodeRendererFactory } from './factories/audio-worklet-node-renderer-factory';\nimport { createBaseAudioContextConstructor } from './factories/base-audio-context-constructor';\nimport { createBiquadFilterNodeConstructor } from './factories/biquad-filter-node-constructor';\nimport { createBiquadFilterNodeRendererFactory } from './factories/biquad-filter-node-renderer-factory';\nimport { createCacheTestResult } from './factories/cache-test-result';\nimport { createChannelMergerNodeConstructor } from './factories/channel-merger-node-constructor';\nimport { createChannelMergerNodeRendererFactory } from './factories/channel-merger-node-renderer-factory';\nimport { createChannelSplitterNodeConstructor } from './factories/channel-splitter-node-constructor';\nimport { createChannelSplitterNodeRendererFactory } from './factories/channel-splitter-node-renderer-factory';\nimport { createConnectAudioParam } from './factories/connect-audio-param';\nimport { createConnectMultipleOutputs } from './factories/connect-multiple-outputs';\nimport { createConnectedNativeAudioBufferSourceNodeFactory } from './factories/connected-native-audio-buffer-source-node-factory';\nimport { createConstantSourceNodeConstructor } from './factories/constant-source-node-constructor';\nimport { createConstantSourceNodeRendererFactory } from './factories/constant-source-node-renderer-factory';\nimport { createConvertNumberToUnsignedLong } from './factories/convert-number-to-unsigned-long';\nimport { createConvolverNodeConstructor } from './factories/convolver-node-constructor';\nimport { createConvolverNodeRendererFactory } from './factories/convolver-node-renderer-factory';\nimport { createCreateNativeOfflineAudioContext } from './factories/create-native-offline-audio-context';\nimport { createDataCloneError } from './factories/data-clone-error';\nimport { createDecodeAudioData } from './factories/decode-audio-data';\nimport { createDecrementCycleCounter } from './factories/decrement-cycle-counter';\nimport { createDelayNodeConstructor } from './factories/delay-node-constructor';\nimport { createDelayNodeRendererFactory } from './factories/delay-node-renderer-factory';\nimport { createDeleteActiveInputConnectionToAudioNode } from './factories/delete-active-input-connection-to-audio-node';\nimport { createDeleteUnrenderedAudioWorkletNode } from './factories/delete-unrendered-audio-worklet-node';\nimport { createDetectCycles } from './factories/detect-cycles';\nimport { createDisconnectMultipleOutputs } from './factories/disconnect-multiple-outputs';\nimport { createDynamicsCompressorNodeConstructor } from './factories/dynamics-compressor-node-constructor';\nimport { createDynamicsCompressorNodeRendererFactory } from './factories/dynamics-compressor-node-renderer-factory';\nimport { createEncodingError } from './factories/encoding-error';\nimport { createEvaluateSource } from './factories/evaluate-source';\nimport { createEventTargetConstructor } from './factories/event-target-constructor';\nimport { createExposeCurrentFrameAndCurrentTime } from './factories/expose-current-frame-and-current-time';\nimport { createFetchSource } from './factories/fetch-source';\nimport { createGainNodeConstructor } from './factories/gain-node-constructor';\nimport { createGainNodeRendererFactory } from './factories/gain-node-renderer-factory';\nimport { createGetActiveAudioWorkletNodeInputs } from './factories/get-active-audio-worklet-node-inputs';\nimport { createGetAudioNodeRenderer } from './factories/get-audio-node-renderer';\nimport { createGetAudioNodeTailTime } from './factories/get-audio-node-tail-time';\nimport { createGetAudioParamRenderer } from './factories/get-audio-param-renderer';\nimport { createGetBackupOfflineAudioContext } from './factories/get-backup-offline-audio-context';\nimport { createGetNativeContext } from './factories/get-native-context';\nimport { createGetOrCreateBackupOfflineAudioContext } from './factories/get-or-create-backup-offline-audio-context';\nimport { createGetUnrenderedAudioWorkletNodes } from './factories/get-unrendered-audio-worklet-nodes';\nimport { createIIRFilterNodeConstructor } from './factories/iir-filter-node-constructor';\nimport { createIIRFilterNodeRendererFactory } from './factories/iir-filter-node-renderer-factory';\nimport { createIncrementCycleCounterFactory } from './factories/increment-cycle-counter-factory';\nimport { createIndexSizeError } from './factories/index-size-error';\nimport { createInvalidAccessError } from './factories/invalid-access-error';\nimport { createInvalidStateError } from './factories/invalid-state-error';\nimport { createIsAnyAudioContext } from './factories/is-any-audio-context';\nimport { createIsAnyAudioNode } from './factories/is-any-audio-node';\nimport { createIsAnyAudioParam } from './factories/is-any-audio-param';\nimport { createIsAnyOfflineAudioContext } from './factories/is-any-offline-audio-context';\nimport { createIsNativeAudioContext } from './factories/is-native-audio-context';\nimport { createIsNativeAudioNode } from './factories/is-native-audio-node';\nimport { createIsNativeAudioParam } from './factories/is-native-audio-param';\nimport { createIsNativeContext } from './factories/is-native-context';\nimport { createIsNativeOfflineAudioContext } from './factories/is-native-offline-audio-context';\nimport { createIsSecureContext } from './factories/is-secure-context';\nimport { createIsSupportedPromise } from './factories/is-supported-promise';\nimport { createMediaElementAudioSourceNodeConstructor } from './factories/media-element-audio-source-node-constructor';\nimport { createMediaStreamAudioDestinationNodeConstructor } from './factories/media-stream-audio-destination-node-constructor';\nimport { createMediaStreamAudioSourceNodeConstructor } from './factories/media-stream-audio-source-node-constructor';\nimport { createMediaStreamTrackAudioSourceNodeConstructor } from './factories/media-stream-track-audio-source-node-constructor';\nimport { createMinimalAudioContextConstructor } from './factories/minimal-audio-context-constructor';\nimport { createMinimalBaseAudioContextConstructor } from './factories/minimal-base-audio-context-constructor';\nimport { createMinimalOfflineAudioContextConstructor } from './factories/minimal-offline-audio-context-constructor';\nimport { createMonitorConnections } from './factories/monitor-connections';\nimport { createNativeAnalyserNodeFactory } from './factories/native-analyser-node-factory';\nimport { createNativeAudioBufferConstructor } from './factories/native-audio-buffer-constructor';\nimport { createNativeAudioBufferSourceNodeFactory } from './factories/native-audio-buffer-source-node-factory';\nimport { createNativeAudioContextConstructor } from './factories/native-audio-context-constructor';\nimport { createNativeAudioDestinationNodeFactory } from './factories/native-audio-destination-node';\nimport { createNativeAudioWorkletNodeConstructor } from './factories/native-audio-worklet-node-constructor';\nimport { createNativeAudioWorkletNodeFactory } from './factories/native-audio-worklet-node-factory';\nimport { createNativeAudioWorkletNodeFakerFactory } from './factories/native-audio-worklet-node-faker-factory';\nimport { createNativeBiquadFilterNode } from './factories/native-biquad-filter-node';\nimport { createNativeChannelMergerNodeFactory } from './factories/native-channel-merger-node-factory';\nimport { createNativeChannelSplitterNode } from './factories/native-channel-splitter-node';\nimport { createNativeConstantSourceNodeFactory } from './factories/native-constant-source-node-factory';\nimport { createNativeConstantSourceNodeFakerFactory } from './factories/native-constant-source-node-faker-factory';\nimport { createNativeConvolverNodeFactory } from './factories/native-convolver-node-factory';\nimport { createNativeDelayNode } from './factories/native-delay-node';\nimport { createNativeDynamicsCompressorNodeFactory } from './factories/native-dynamics-compressor-node-factory';\nimport { createNativeGainNode } from './factories/native-gain-node';\nimport { createNativeIIRFilterNodeFactory } from './factories/native-iir-filter-node-factory';\nimport { createNativeIIRFilterNodeFakerFactory } from './factories/native-iir-filter-node-faker-factory';\nimport { createNativeMediaElementAudioSourceNode } from './factories/native-media-element-audio-source-node';\nimport { createNativeMediaStreamAudioDestinationNode } from './factories/native-media-stream-audio-destination-node';\nimport { createNativeMediaStreamAudioSourceNode } from './factories/native-media-stream-audio-source-node';\nimport { createNativeMediaStreamTrackAudioSourceNodeFactory } from './factories/native-media-stream-track-audio-source-node-factory';\nimport { createNativeOfflineAudioContextConstructor } from './factories/native-offline-audio-context-constructor';\nimport { createNativeOscillatorNodeFactory } from './factories/native-oscillator-node-factory';\nimport { createNativePannerNodeFactory } from './factories/native-panner-node-factory';\nimport { createNativePannerNodeFakerFactory } from './factories/native-panner-node-faker-factory';\nimport { createNativePeriodicWaveFactory } from './factories/native-periodic-wave-factory';\nimport { createNativeScriptProcessorNode } from './factories/native-script-processor-node';\nimport { createNativeStereoPannerNodeFactory } from './factories/native-stereo-panner-node-factory';\nimport { createNativeStereoPannerNodeFakerFactory } from './factories/native-stereo-panner-node-faker-factory';\nimport { createNativeWaveShaperNodeFactory } from './factories/native-wave-shaper-node-factory';\nimport { createNativeWaveShaperNodeFakerFactory } from './factories/native-wave-shaper-node-faker-factory';\nimport { createNotSupportedError } from './factories/not-supported-error';\nimport { createOfflineAudioContextConstructor } from './factories/offline-audio-context-constructor';\nimport { createOscillatorNodeConstructor } from './factories/oscillator-node-constructor';\nimport { createOscillatorNodeRendererFactory } from './factories/oscillator-node-renderer-factory';\nimport { createPannerNodeConstructor } from './factories/panner-node-constructor';\nimport { createPannerNodeRendererFactory } from './factories/panner-node-renderer-factory';\nimport { createPeriodicWaveConstructor } from './factories/periodic-wave-constructor';\nimport { createRenderAutomation } from './factories/render-automation';\nimport { createRenderInputsOfAudioNode } from './factories/render-inputs-of-audio-node';\nimport { createRenderInputsOfAudioParam } from './factories/render-inputs-of-audio-param';\nimport { createRenderNativeOfflineAudioContext } from './factories/render-native-offline-audio-context';\nimport { createSetActiveAudioWorkletNodeInputs } from './factories/set-active-audio-worklet-node-inputs';\nimport { createSetAudioNodeTailTime } from './factories/set-audio-node-tail-time';\nimport { createStartRendering } from './factories/start-rendering';\nimport { createStereoPannerNodeConstructor } from './factories/stereo-panner-node-constructor';\nimport { createStereoPannerNodeRendererFactory } from './factories/stereo-panner-node-renderer-factory';\nimport { createTestAudioBufferConstructorSupport } from './factories/test-audio-buffer-constructor-support';\nimport { createTestAudioBufferCopyChannelMethodsSubarraySupport } from './factories/test-audio-buffer-copy-channel-methods-subarray-support';\nimport { createTestAudioContextCloseMethodSupport } from './factories/test-audio-context-close-method-support';\nimport { createTestAudioContextDecodeAudioDataMethodTypeErrorSupport } from './factories/test-audio-context-decode-audio-data-method-type-error-support';\nimport { createTestAudioContextOptionsSupport } from './factories/test-audio-context-options-support';\nimport { createTestAudioNodeConnectMethodSupport } from './factories/test-audio-node-connect-method-support';\nimport { createTestAudioWorkletProcessorNoOutputsSupport } from './factories/test-audio-worklet-processor-no-outputs-support';\nimport { createTestAudioWorkletProcessorPostMessageSupport } from './factories/test-audio-worklet-processor-post-message-support';\nimport { createTestChannelMergerNodeChannelCountSupport } from './factories/test-channel-merger-node-channel-count-support';\nimport { createTestConstantSourceNodeAccurateSchedulingSupport } from './factories/test-constant-source-node-accurate-scheduling-support';\nimport { createTestConvolverNodeBufferReassignabilitySupport } from './factories/test-convolver-node-buffer-reassignability-support';\nimport { createTestConvolverNodeChannelCountSupport } from './factories/test-convolver-node-channel-count-support';\nimport { createTestIsSecureContextSupport } from './factories/test-is-secure-context-support';\nimport { createTestMediaStreamAudioSourceNodeMediaStreamWithoutAudioTrackSupport } from './factories/test-media-stream-audio-source-node-media-stream-without-audio-track-support';\nimport { createTestOfflineAudioContextCurrentTimeSupport } from './factories/test-offline-audio-context-current-time-support';\nimport { createTestStereoPannerNodeDefaultValueSupport } from './factories/test-stereo-panner-node-default-value-support';\nimport { createUnknownError } from './factories/unknown-error';\nimport { createWaveShaperNodeConstructor } from './factories/wave-shaper-node-constructor';\nimport { createWaveShaperNodeRendererFactory } from './factories/wave-shaper-node-renderer-factory';\nimport { createWindow } from './factories/window';\nimport { createWrapAudioBufferCopyChannelMethods } from './factories/wrap-audio-buffer-copy-channel-methods';\nimport { createWrapAudioBufferCopyChannelMethodsOutOfBounds } from './factories/wrap-audio-buffer-copy-channel-methods-out-of-bounds';\nimport { createWrapAudioBufferSourceNodeStopMethodNullifiedBuffer } from './factories/wrap-audio-buffer-source-node-stop-method-nullified-buffer';\nimport { createWrapChannelMergerNode } from './factories/wrap-channel-merger-node';\nimport {\n AUDIO_NODE_CONNECTIONS_STORE,\n AUDIO_NODE_STORE,\n AUDIO_PARAM_CONNECTIONS_STORE,\n AUDIO_PARAM_STORE,\n CONTEXT_STORE,\n CYCLE_COUNTERS\n} from './globals';\nimport { connectNativeAudioNodeToNativeAudioNode } from './helpers/connect-native-audio-node-to-native-audio-node';\nimport { disconnectNativeAudioNodeFromNativeAudioNode } from './helpers/disconnect-native-audio-node-from-native-audio-node';\nimport { getAudioNodeConnections } from './helpers/get-audio-node-connections';\nimport { getAudioParamConnections } from './helpers/get-audio-param-connections';\nimport { getEventListenersOfAudioNode } from './helpers/get-event-listeners-of-audio-node';\nimport { getFirstSample } from './helpers/get-first-sample';\nimport { getNativeAudioNode } from './helpers/get-native-audio-node';\nimport { getNativeAudioParam } from './helpers/get-native-audio-param';\nimport { getValueForKey } from './helpers/get-value-for-key';\nimport { insertElementInSet } from './helpers/insert-element-in-set';\nimport { isActiveAudioNode } from './helpers/is-active-audio-node';\nimport { isDCCurve } from './helpers/is-dc-curve';\nimport { isPartOfACycle } from './helpers/is-part-of-a-cycle';\nimport { isPassiveAudioNode } from './helpers/is-passive-audio-node';\nimport { overwriteAccessors } from './helpers/overwrite-accessors';\nimport { pickElementFromSet } from './helpers/pick-element-from-set';\nimport { sanitizeAudioWorkletNodeOptions } from './helpers/sanitize-audio-worklet-node-options';\nimport { sanitizeChannelSplitterOptions } from './helpers/sanitize-channel-splitter-options';\nimport { sanitizePeriodicWaveOptions } from './helpers/sanitize-periodic-wave-options';\nimport { setValueAtTimeUntilPossible } from './helpers/set-value-at-time-until-possible';\nimport { testAudioBufferCopyChannelMethodsOutOfBoundsSupport } from './helpers/test-audio-buffer-copy-channel-methods-out-of-bounds-support';\nimport { testAudioBufferSourceNodeStartMethodConsecutiveCallsSupport } from './helpers/test-audio-buffer-source-node-start-method-consecutive-calls-support';\nimport { testAudioBufferSourceNodeStartMethodOffsetClampingSupport } from './helpers/test-audio-buffer-source-node-start-method-offset-clamping-support';\nimport { testAudioBufferSourceNodeStopMethodNullifiedBufferSupport } from './helpers/test-audio-buffer-source-node-stop-method-nullified-buffer-support';\nimport { testAudioScheduledSourceNodeStartMethodNegativeParametersSupport } from './helpers/test-audio-scheduled-source-node-start-method-negative-parameters-support';\nimport { testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport } from './helpers/test-audio-scheduled-source-node-stop-method-consecutive-calls-support';\nimport { testAudioScheduledSourceNodeStopMethodNegativeParametersSupport } from './helpers/test-audio-scheduled-source-node-stop-method-negative-parameters-support';\nimport { testAudioWorkletNodeOptionsClonability } from './helpers/test-audio-worklet-node-options-clonability';\nimport { testDomExceptionConstructorSupport } from './helpers/test-dom-exception-constructor-support';\nimport { testPromiseSupport } from './helpers/test-promise-support';\nimport { testTransferablesSupport } from './helpers/test-transferables-support';\nimport { wrapAudioBufferSourceNodeStartMethodOffsetClamping } from './helpers/wrap-audio-buffer-source-node-start-method-offset-clamping';\nimport { wrapAudioScheduledSourceNodeStopMethodConsecutiveCalls } from './helpers/wrap-audio-scheduled-source-node-stop-method-consecutive-calls';\nimport { wrapEventListener } from './helpers/wrap-event-listener';\nimport {\n IAnalyserNode,\n IAudioBuffer,\n IAudioBufferSourceNode,\n IAudioContext,\n IAudioNode,\n IAudioWorkletNode,\n IBiquadFilterNode,\n IConstantSourceNode,\n IConvolverNode,\n IDelayNode,\n IDynamicsCompressorNode,\n IGainNode,\n IIIRFilterNode,\n IMediaElementAudioSourceNode,\n IMediaStreamAudioDestinationNode,\n IMediaStreamAudioSourceNode,\n IMediaStreamTrackAudioSourceNode,\n IMinimalAudioContext,\n IMinimalOfflineAudioContext,\n IOfflineAudioContext,\n IOfflineAudioContextConstructor,\n IOscillatorNode,\n IPannerNode,\n IPeriodicWave,\n IStereoPannerNode,\n IWaveShaperNode\n} from './interfaces';\nimport {\n TActiveAudioWorkletNodeInputsStore,\n TAddAudioWorkletModuleFunction,\n TAnalyserNodeConstructor,\n TAudioBufferConstructor,\n TAudioBufferSourceNodeConstructor,\n TAudioBufferStore,\n TAudioContextConstructor,\n TAudioParamAudioNodeStore,\n TAudioWorkletNodeConstructor,\n TBackupOfflineAudioContextStore,\n TBiquadFilterNodeConstructor,\n TChannelMergerNodeConstructor,\n TChannelSplitterNodeConstructor,\n TConstantSourceNodeConstructor,\n TContext,\n TConvolverNodeConstructor,\n TDecodeAudioDataFunction,\n TDelayNodeConstructor,\n TDynamicsCompressorNodeConstructor,\n TGainNodeConstructor,\n TIIRFilterNodeConstructor,\n TMediaElementAudioSourceNodeConstructor,\n TMediaStreamAudioDestinationNodeConstructor,\n TMediaStreamAudioSourceNodeConstructor,\n TMediaStreamTrackAudioSourceNodeConstructor,\n TMinimalAudioContextConstructor,\n TMinimalOfflineAudioContextConstructor,\n TOscillatorNodeConstructor,\n TPannerNodeConstructor,\n TPeriodicWaveConstructor,\n TStereoPannerNodeConstructor,\n TUnrenderedAudioWorkletNodeStore,\n TWaveShaperNodeConstructor\n} from './types';\n\n/*\n * @todo Explicitly referencing the barrel file seems to be necessary when enabling the\n * isolatedModules compiler option.\n */\nexport * from './interfaces/index';\nexport * from './types/index';\n\nconst addActiveInputConnectionToAudioNode = createAddActiveInputConnectionToAudioNode(insertElementInSet);\nconst addPassiveInputConnectionToAudioNode = createAddPassiveInputConnectionToAudioNode(insertElementInSet);\nconst deleteActiveInputConnectionToAudioNode = createDeleteActiveInputConnectionToAudioNode(pickElementFromSet);\nconst audioNodeTailTimeStore = new WeakMap();\nconst getAudioNodeTailTime = createGetAudioNodeTailTime(audioNodeTailTimeStore);\nconst cacheTestResult = createCacheTestResult(new Map(), new WeakMap());\nconst window = createWindow();\nconst createNativeAnalyserNode = createNativeAnalyserNodeFactory(cacheTestResult, createIndexSizeError);\nconst getAudioNodeRenderer = createGetAudioNodeRenderer(getAudioNodeConnections);\nconst renderInputsOfAudioNode = createRenderInputsOfAudioNode(getAudioNodeConnections, getAudioNodeRenderer, isPartOfACycle);\nconst createAnalyserNodeRenderer = createAnalyserNodeRendererFactory(createNativeAnalyserNode, getNativeAudioNode, renderInputsOfAudioNode);\nconst getNativeContext = createGetNativeContext(CONTEXT_STORE);\nconst nativeOfflineAudioContextConstructor = createNativeOfflineAudioContextConstructor(window);\nconst isNativeOfflineAudioContext = createIsNativeOfflineAudioContext(nativeOfflineAudioContextConstructor);\nconst audioParamAudioNodeStore: TAudioParamAudioNodeStore = new WeakMap();\nconst eventTargetConstructor = createEventTargetConstructor(wrapEventListener);\nconst nativeAudioContextConstructor = createNativeAudioContextConstructor(window);\nconst isNativeAudioContext = createIsNativeAudioContext(nativeAudioContextConstructor);\nconst isNativeAudioNode = createIsNativeAudioNode(window);\nconst isNativeAudioParam = createIsNativeAudioParam(window);\nconst nativeAudioWorkletNodeConstructor = createNativeAudioWorkletNodeConstructor(window);\nconst audioNodeConstructor = createAudioNodeConstructor(\n createAddAudioNodeConnections(AUDIO_NODE_CONNECTIONS_STORE),\n createAddConnectionToAudioNode(\n addActiveInputConnectionToAudioNode,\n addPassiveInputConnectionToAudioNode,\n connectNativeAudioNodeToNativeAudioNode,\n deleteActiveInputConnectionToAudioNode,\n disconnectNativeAudioNodeFromNativeAudioNode,\n getAudioNodeConnections,\n getAudioNodeTailTime,\n getEventListenersOfAudioNode,\n getNativeAudioNode,\n insertElementInSet,\n isActiveAudioNode,\n isPartOfACycle,\n isPassiveAudioNode\n ),\n cacheTestResult,\n createIncrementCycleCounterFactory(\n CYCLE_COUNTERS,\n disconnectNativeAudioNodeFromNativeAudioNode,\n getAudioNodeConnections,\n getNativeAudioNode,\n getNativeAudioParam,\n isActiveAudioNode\n ),\n createIndexSizeError,\n createInvalidAccessError,\n createNotSupportedError,\n createDecrementCycleCounter(\n connectNativeAudioNodeToNativeAudioNode,\n CYCLE_COUNTERS,\n getAudioNodeConnections,\n getNativeAudioNode,\n getNativeAudioParam,\n getNativeContext,\n isActiveAudioNode,\n isNativeOfflineAudioContext\n ),\n createDetectCycles(audioParamAudioNodeStore, getAudioNodeConnections, getValueForKey),\n eventTargetConstructor,\n getNativeContext,\n isNativeAudioContext,\n isNativeAudioNode,\n isNativeAudioParam,\n isNativeOfflineAudioContext,\n nativeAudioWorkletNodeConstructor\n);\nconst analyserNodeConstructor: TAnalyserNodeConstructor = createAnalyserNodeConstructor(\n audioNodeConstructor,\n createAnalyserNodeRenderer,\n createIndexSizeError,\n createNativeAnalyserNode,\n getNativeContext,\n isNativeOfflineAudioContext\n);\n\ntype analyserNodeConstructor = IAnalyserNode;\n\nexport { analyserNodeConstructor as AnalyserNode };\n\nconst audioBufferStore: TAudioBufferStore = new WeakSet();\nconst nativeAudioBufferConstructor = createNativeAudioBufferConstructor(window);\nconst convertNumberToUnsignedLong = createConvertNumberToUnsignedLong(new Uint32Array(1));\nconst wrapAudioBufferCopyChannelMethods = createWrapAudioBufferCopyChannelMethods(convertNumberToUnsignedLong, createIndexSizeError);\nconst wrapAudioBufferCopyChannelMethodsOutOfBounds = createWrapAudioBufferCopyChannelMethodsOutOfBounds(convertNumberToUnsignedLong);\nconst audioBufferConstructor: TAudioBufferConstructor = createAudioBufferConstructor(\n audioBufferStore,\n cacheTestResult,\n createNotSupportedError,\n nativeAudioBufferConstructor,\n nativeOfflineAudioContextConstructor,\n createTestAudioBufferConstructorSupport(nativeAudioBufferConstructor),\n wrapAudioBufferCopyChannelMethods,\n wrapAudioBufferCopyChannelMethodsOutOfBounds\n);\n\ntype audioBufferConstructor = IAudioBuffer;\n\nexport { audioBufferConstructor as AudioBuffer };\n\nconst addSilentConnection = createAddSilentConnection(createNativeGainNode);\nconst renderInputsOfAudioParam = createRenderInputsOfAudioParam(getAudioNodeRenderer, getAudioParamConnections, isPartOfACycle);\nconst connectAudioParam = createConnectAudioParam(renderInputsOfAudioParam);\nconst createNativeAudioBufferSourceNode = createNativeAudioBufferSourceNodeFactory(\n addSilentConnection,\n cacheTestResult,\n testAudioBufferSourceNodeStartMethodConsecutiveCallsSupport,\n testAudioBufferSourceNodeStartMethodOffsetClampingSupport,\n testAudioBufferSourceNodeStopMethodNullifiedBufferSupport,\n testAudioScheduledSourceNodeStartMethodNegativeParametersSupport,\n testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport,\n testAudioScheduledSourceNodeStopMethodNegativeParametersSupport,\n wrapAudioBufferSourceNodeStartMethodOffsetClamping,\n createWrapAudioBufferSourceNodeStopMethodNullifiedBuffer(overwriteAccessors),\n wrapAudioScheduledSourceNodeStopMethodConsecutiveCalls\n);\nconst renderAutomation = createRenderAutomation(createGetAudioParamRenderer(getAudioParamConnections), renderInputsOfAudioParam);\nconst createAudioBufferSourceNodeRenderer = createAudioBufferSourceNodeRendererFactory(\n connectAudioParam,\n createNativeAudioBufferSourceNode,\n getNativeAudioNode,\n renderAutomation,\n renderInputsOfAudioNode\n);\nconst createAudioParam = createAudioParamFactory(\n createAddAudioParamConnections(AUDIO_PARAM_CONNECTIONS_STORE),\n audioParamAudioNodeStore,\n AUDIO_PARAM_STORE,\n createAudioParamRenderer,\n createCancelAndHoldAutomationEvent,\n createCancelScheduledValuesAutomationEvent,\n createExponentialRampToValueAutomationEvent,\n createLinearRampToValueAutomationEvent,\n createSetTargetAutomationEvent,\n createSetValueAutomationEvent,\n createSetValueCurveAutomationEvent,\n nativeAudioContextConstructor,\n setValueAtTimeUntilPossible\n);\nconst audioBufferSourceNodeConstructor: TAudioBufferSourceNodeConstructor = createAudioBufferSourceNodeConstructor(\n audioNodeConstructor,\n createAudioBufferSourceNodeRenderer,\n createAudioParam,\n createInvalidStateError,\n createNativeAudioBufferSourceNode,\n getNativeContext,\n isNativeOfflineAudioContext,\n wrapEventListener\n);\n\ntype audioBufferSourceNodeConstructor = IAudioBufferSourceNode;\n\nexport { audioBufferSourceNodeConstructor as AudioBufferSourceNode };\n\nconst audioDestinationNodeConstructor = createAudioDestinationNodeConstructor(\n audioNodeConstructor,\n createAudioDestinationNodeRenderer,\n createIndexSizeError,\n createInvalidStateError,\n createNativeAudioDestinationNodeFactory(createNativeGainNode, overwriteAccessors),\n getNativeContext,\n isNativeOfflineAudioContext,\n renderInputsOfAudioNode\n);\nconst createBiquadFilterNodeRenderer = createBiquadFilterNodeRendererFactory(\n connectAudioParam,\n createNativeBiquadFilterNode,\n getNativeAudioNode,\n renderAutomation,\n renderInputsOfAudioNode\n);\nconst setAudioNodeTailTime = createSetAudioNodeTailTime(audioNodeTailTimeStore);\nconst biquadFilterNodeConstructor: TBiquadFilterNodeConstructor = createBiquadFilterNodeConstructor(\n audioNodeConstructor,\n createAudioParam,\n createBiquadFilterNodeRenderer,\n createInvalidAccessError,\n createNativeBiquadFilterNode,\n getNativeContext,\n isNativeOfflineAudioContext,\n setAudioNodeTailTime\n);\nconst monitorConnections = createMonitorConnections(insertElementInSet, isNativeAudioNode);\nconst wrapChannelMergerNode = createWrapChannelMergerNode(createInvalidStateError, monitorConnections);\nconst createNativeChannelMergerNode = createNativeChannelMergerNodeFactory(nativeAudioContextConstructor, wrapChannelMergerNode);\nconst createChannelMergerNodeRenderer = createChannelMergerNodeRendererFactory(\n createNativeChannelMergerNode,\n getNativeAudioNode,\n renderInputsOfAudioNode\n);\nconst channelMergerNodeConstructor: TChannelMergerNodeConstructor = createChannelMergerNodeConstructor(\n audioNodeConstructor,\n createChannelMergerNodeRenderer,\n createNativeChannelMergerNode,\n getNativeContext,\n isNativeOfflineAudioContext\n);\nconst createChannelSplitterNodeRenderer = createChannelSplitterNodeRendererFactory(\n createNativeChannelSplitterNode,\n getNativeAudioNode,\n renderInputsOfAudioNode\n);\nconst channelSplitterNodeConstructor: TChannelSplitterNodeConstructor = createChannelSplitterNodeConstructor(\n audioNodeConstructor,\n createChannelSplitterNodeRenderer,\n createNativeChannelSplitterNode,\n getNativeContext,\n isNativeOfflineAudioContext,\n sanitizeChannelSplitterOptions\n);\nconst createNativeConstantSourceNodeFaker = createNativeConstantSourceNodeFakerFactory(\n addSilentConnection,\n createNativeAudioBufferSourceNode,\n createNativeGainNode,\n monitorConnections\n);\nconst createNativeConstantSourceNode = createNativeConstantSourceNodeFactory(\n addSilentConnection,\n cacheTestResult,\n createNativeConstantSourceNodeFaker,\n testAudioScheduledSourceNodeStartMethodNegativeParametersSupport,\n testAudioScheduledSourceNodeStopMethodNegativeParametersSupport\n);\nconst createConstantSourceNodeRenderer = createConstantSourceNodeRendererFactory(\n connectAudioParam,\n createNativeConstantSourceNode,\n getNativeAudioNode,\n renderAutomation,\n renderInputsOfAudioNode\n);\nconst constantSourceNodeConstructor: TConstantSourceNodeConstructor = createConstantSourceNodeConstructor(\n audioNodeConstructor,\n createAudioParam,\n createConstantSourceNodeRenderer,\n createNativeConstantSourceNode,\n getNativeContext,\n isNativeOfflineAudioContext,\n wrapEventListener\n);\nconst createNativeConvolverNode = createNativeConvolverNodeFactory(createNotSupportedError, overwriteAccessors);\nconst createConvolverNodeRenderer = createConvolverNodeRendererFactory(\n createNativeConvolverNode,\n getNativeAudioNode,\n renderInputsOfAudioNode\n);\nconst convolverNodeConstructor: TConvolverNodeConstructor = createConvolverNodeConstructor(\n audioNodeConstructor,\n createConvolverNodeRenderer,\n createNativeConvolverNode,\n getNativeContext,\n isNativeOfflineAudioContext,\n setAudioNodeTailTime\n);\nconst createDelayNodeRenderer = createDelayNodeRendererFactory(\n connectAudioParam,\n createNativeDelayNode,\n getNativeAudioNode,\n renderAutomation,\n renderInputsOfAudioNode\n);\nconst delayNodeConstructor: TDelayNodeConstructor = createDelayNodeConstructor(\n audioNodeConstructor,\n createAudioParam,\n createDelayNodeRenderer,\n createNativeDelayNode,\n getNativeContext,\n isNativeOfflineAudioContext,\n setAudioNodeTailTime\n);\nconst createNativeDynamicsCompressorNode = createNativeDynamicsCompressorNodeFactory(createNotSupportedError);\nconst createDynamicsCompressorNodeRenderer = createDynamicsCompressorNodeRendererFactory(\n connectAudioParam,\n createNativeDynamicsCompressorNode,\n getNativeAudioNode,\n renderAutomation,\n renderInputsOfAudioNode\n);\nconst dynamicsCompressorNodeConstructor: TDynamicsCompressorNodeConstructor = createDynamicsCompressorNodeConstructor(\n audioNodeConstructor,\n createAudioParam,\n createDynamicsCompressorNodeRenderer,\n createNativeDynamicsCompressorNode,\n createNotSupportedError,\n getNativeContext,\n isNativeOfflineAudioContext,\n setAudioNodeTailTime\n);\nconst createGainNodeRenderer = createGainNodeRendererFactory(\n connectAudioParam,\n createNativeGainNode,\n getNativeAudioNode,\n renderAutomation,\n renderInputsOfAudioNode\n);\nconst gainNodeConstructor: TGainNodeConstructor = createGainNodeConstructor(\n audioNodeConstructor,\n createAudioParam,\n createGainNodeRenderer,\n createNativeGainNode,\n getNativeContext,\n isNativeOfflineAudioContext\n);\nconst createNativeIIRFilterNodeFaker = createNativeIIRFilterNodeFakerFactory(\n createInvalidAccessError,\n createInvalidStateError,\n createNativeScriptProcessorNode,\n createNotSupportedError\n);\nconst renderNativeOfflineAudioContext = createRenderNativeOfflineAudioContext(\n cacheTestResult,\n createNativeGainNode,\n createNativeScriptProcessorNode,\n createTestOfflineAudioContextCurrentTimeSupport(createNativeGainNode, nativeOfflineAudioContextConstructor)\n);\nconst createIIRFilterNodeRenderer = createIIRFilterNodeRendererFactory(\n createNativeAudioBufferSourceNode,\n getNativeAudioNode,\n nativeOfflineAudioContextConstructor,\n renderInputsOfAudioNode,\n renderNativeOfflineAudioContext\n);\nconst createNativeIIRFilterNode = createNativeIIRFilterNodeFactory(createNativeIIRFilterNodeFaker);\nconst iIRFilterNodeConstructor: TIIRFilterNodeConstructor = createIIRFilterNodeConstructor(\n audioNodeConstructor,\n createNativeIIRFilterNode,\n createIIRFilterNodeRenderer,\n getNativeContext,\n isNativeOfflineAudioContext,\n setAudioNodeTailTime\n);\nconst createAudioListener = createAudioListenerFactory(\n createAudioParam,\n createNativeChannelMergerNode,\n createNativeConstantSourceNode,\n createNativeScriptProcessorNode,\n createNotSupportedError,\n getFirstSample,\n isNativeOfflineAudioContext,\n overwriteAccessors\n);\nconst unrenderedAudioWorkletNodeStore: TUnrenderedAudioWorkletNodeStore = new WeakMap();\nconst minimalBaseAudioContextConstructor = createMinimalBaseAudioContextConstructor(\n audioDestinationNodeConstructor,\n createAudioListener,\n eventTargetConstructor,\n isNativeOfflineAudioContext,\n unrenderedAudioWorkletNodeStore,\n wrapEventListener\n);\nconst createNativeOscillatorNode = createNativeOscillatorNodeFactory(\n addSilentConnection,\n cacheTestResult,\n testAudioScheduledSourceNodeStartMethodNegativeParametersSupport,\n testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport,\n testAudioScheduledSourceNodeStopMethodNegativeParametersSupport,\n wrapAudioScheduledSourceNodeStopMethodConsecutiveCalls\n);\nconst createOscillatorNodeRenderer = createOscillatorNodeRendererFactory(\n connectAudioParam,\n createNativeOscillatorNode,\n getNativeAudioNode,\n renderAutomation,\n renderInputsOfAudioNode\n);\nconst oscillatorNodeConstructor: TOscillatorNodeConstructor = createOscillatorNodeConstructor(\n audioNodeConstructor,\n createAudioParam,\n createNativeOscillatorNode,\n createOscillatorNodeRenderer,\n getNativeContext,\n isNativeOfflineAudioContext,\n wrapEventListener\n);\nconst createConnectedNativeAudioBufferSourceNode = createConnectedNativeAudioBufferSourceNodeFactory(createNativeAudioBufferSourceNode);\nconst createNativeWaveShaperNodeFaker = createNativeWaveShaperNodeFakerFactory(\n createConnectedNativeAudioBufferSourceNode,\n createInvalidStateError,\n createNativeGainNode,\n isDCCurve,\n monitorConnections\n);\nconst createNativeWaveShaperNode = createNativeWaveShaperNodeFactory(\n createConnectedNativeAudioBufferSourceNode,\n createInvalidStateError,\n createNativeWaveShaperNodeFaker,\n isDCCurve,\n monitorConnections,\n nativeAudioContextConstructor,\n overwriteAccessors\n);\nconst createNativePannerNodeFaker = createNativePannerNodeFakerFactory(\n connectNativeAudioNodeToNativeAudioNode,\n createInvalidStateError,\n createNativeChannelMergerNode,\n createNativeGainNode,\n createNativeScriptProcessorNode,\n createNativeWaveShaperNode,\n createNotSupportedError,\n disconnectNativeAudioNodeFromNativeAudioNode,\n getFirstSample,\n monitorConnections\n);\nconst createNativePannerNode = createNativePannerNodeFactory(createNativePannerNodeFaker);\nconst createPannerNodeRenderer = createPannerNodeRendererFactory(\n connectAudioParam,\n createNativeChannelMergerNode,\n createNativeConstantSourceNode,\n createNativeGainNode,\n createNativePannerNode,\n getNativeAudioNode,\n nativeOfflineAudioContextConstructor,\n renderAutomation,\n renderInputsOfAudioNode,\n renderNativeOfflineAudioContext\n);\nconst pannerNodeConstructor: TPannerNodeConstructor = createPannerNodeConstructor(\n audioNodeConstructor,\n createAudioParam,\n createNativePannerNode,\n createPannerNodeRenderer,\n getNativeContext,\n isNativeOfflineAudioContext,\n setAudioNodeTailTime\n);\nconst createNativePeriodicWave = createNativePeriodicWaveFactory(createIndexSizeError);\nconst periodicWaveConstructor: TPeriodicWaveConstructor = createPeriodicWaveConstructor(\n createNativePeriodicWave,\n getNativeContext,\n new WeakSet(),\n sanitizePeriodicWaveOptions\n);\nconst nativeStereoPannerNodeFakerFactory = createNativeStereoPannerNodeFakerFactory(\n createNativeChannelMergerNode,\n createNativeChannelSplitterNode,\n createNativeGainNode,\n createNativeWaveShaperNode,\n createNotSupportedError,\n monitorConnections\n);\nconst createNativeStereoPannerNode = createNativeStereoPannerNodeFactory(nativeStereoPannerNodeFakerFactory, createNotSupportedError);\nconst createStereoPannerNodeRenderer = createStereoPannerNodeRendererFactory(\n connectAudioParam,\n createNativeStereoPannerNode,\n getNativeAudioNode,\n renderAutomation,\n renderInputsOfAudioNode\n);\nconst stereoPannerNodeConstructor: TStereoPannerNodeConstructor = createStereoPannerNodeConstructor(\n audioNodeConstructor,\n createAudioParam,\n createNativeStereoPannerNode,\n createStereoPannerNodeRenderer,\n getNativeContext,\n isNativeOfflineAudioContext\n);\nconst createWaveShaperNodeRenderer = createWaveShaperNodeRendererFactory(\n createNativeWaveShaperNode,\n getNativeAudioNode,\n renderInputsOfAudioNode\n);\nconst waveShaperNodeConstructor: TWaveShaperNodeConstructor = createWaveShaperNodeConstructor(\n audioNodeConstructor,\n createInvalidStateError,\n createNativeWaveShaperNode,\n createWaveShaperNodeRenderer,\n getNativeContext,\n isNativeOfflineAudioContext,\n setAudioNodeTailTime\n);\nconst isSecureContext = createIsSecureContext(window);\nconst exposeCurrentFrameAndCurrentTime = createExposeCurrentFrameAndCurrentTime(window);\nconst backupOfflineAudioContextStore: TBackupOfflineAudioContextStore = new WeakMap();\nconst getOrCreateBackupOfflineAudioContext = createGetOrCreateBackupOfflineAudioContext(\n backupOfflineAudioContextStore,\n nativeOfflineAudioContextConstructor\n);\n\n// The addAudioWorkletModule() function is only available in a SecureContext.\nexport const addAudioWorkletModule: undefined | TAddAudioWorkletModuleFunction = isSecureContext\n ? createAddAudioWorkletModule(\n cacheTestResult,\n createNotSupportedError,\n createEvaluateSource(window),\n exposeCurrentFrameAndCurrentTime,\n createFetchSource(createAbortError),\n getNativeContext,\n getOrCreateBackupOfflineAudioContext,\n isNativeOfflineAudioContext,\n nativeAudioWorkletNodeConstructor,\n new WeakMap(),\n new WeakMap(),\n createTestAudioWorkletProcessorPostMessageSupport(nativeAudioWorkletNodeConstructor, nativeOfflineAudioContextConstructor),\n // @todo window is guaranteed to be defined because isSecureContext checks that as well.\n >window\n )\n : undefined;\n\nconst isNativeContext = createIsNativeContext(isNativeAudioContext, isNativeOfflineAudioContext);\n\nexport const decodeAudioData: TDecodeAudioDataFunction = createDecodeAudioData(\n audioBufferStore,\n cacheTestResult,\n createDataCloneError,\n createEncodingError,\n new WeakSet(),\n getNativeContext,\n isNativeContext,\n testAudioBufferCopyChannelMethodsOutOfBoundsSupport,\n testPromiseSupport,\n wrapAudioBufferCopyChannelMethods,\n wrapAudioBufferCopyChannelMethodsOutOfBounds\n);\n\nconst baseAudioContextConstructor = createBaseAudioContextConstructor(\n addAudioWorkletModule,\n analyserNodeConstructor,\n audioBufferConstructor,\n audioBufferSourceNodeConstructor,\n biquadFilterNodeConstructor,\n channelMergerNodeConstructor,\n channelSplitterNodeConstructor,\n constantSourceNodeConstructor,\n convolverNodeConstructor,\n decodeAudioData,\n delayNodeConstructor,\n dynamicsCompressorNodeConstructor,\n gainNodeConstructor,\n iIRFilterNodeConstructor,\n minimalBaseAudioContextConstructor,\n oscillatorNodeConstructor,\n pannerNodeConstructor,\n periodicWaveConstructor,\n stereoPannerNodeConstructor,\n waveShaperNodeConstructor\n);\nconst mediaElementAudioSourceNodeConstructor: TMediaElementAudioSourceNodeConstructor = createMediaElementAudioSourceNodeConstructor(\n audioNodeConstructor,\n createNativeMediaElementAudioSourceNode,\n getNativeContext,\n isNativeOfflineAudioContext\n);\nconst mediaStreamAudioDestinationNodeConstructor: TMediaStreamAudioDestinationNodeConstructor =\n createMediaStreamAudioDestinationNodeConstructor(\n audioNodeConstructor,\n createNativeMediaStreamAudioDestinationNode,\n getNativeContext,\n isNativeOfflineAudioContext\n );\nconst mediaStreamAudioSourceNodeConstructor: TMediaStreamAudioSourceNodeConstructor = createMediaStreamAudioSourceNodeConstructor(\n audioNodeConstructor,\n createNativeMediaStreamAudioSourceNode,\n getNativeContext,\n isNativeOfflineAudioContext\n);\nconst createNativeMediaStreamTrackAudioSourceNode = createNativeMediaStreamTrackAudioSourceNodeFactory(\n createInvalidStateError,\n isNativeOfflineAudioContext\n);\nconst mediaStreamTrackAudioSourceNodeConstructor: TMediaStreamTrackAudioSourceNodeConstructor =\n createMediaStreamTrackAudioSourceNodeConstructor(audioNodeConstructor, createNativeMediaStreamTrackAudioSourceNode, getNativeContext);\nconst audioContextConstructor: TAudioContextConstructor = createAudioContextConstructor(\n baseAudioContextConstructor,\n createInvalidStateError,\n createNotSupportedError,\n createUnknownError,\n mediaElementAudioSourceNodeConstructor,\n mediaStreamAudioDestinationNodeConstructor,\n mediaStreamAudioSourceNodeConstructor,\n mediaStreamTrackAudioSourceNodeConstructor,\n nativeAudioContextConstructor\n);\n\ntype audioContextConstructor = IAudioContext;\n\nexport { audioContextConstructor as AudioContext };\n\nconst getUnrenderedAudioWorkletNodes = createGetUnrenderedAudioWorkletNodes(unrenderedAudioWorkletNodeStore);\nconst addUnrenderedAudioWorkletNode = createAddUnrenderedAudioWorkletNode(getUnrenderedAudioWorkletNodes);\nconst connectMultipleOutputs = createConnectMultipleOutputs(createIndexSizeError);\nconst deleteUnrenderedAudioWorkletNode = createDeleteUnrenderedAudioWorkletNode(getUnrenderedAudioWorkletNodes);\nconst disconnectMultipleOutputs = createDisconnectMultipleOutputs(createIndexSizeError);\nconst activeAudioWorkletNodeInputsStore: TActiveAudioWorkletNodeInputsStore = new WeakMap();\nconst getActiveAudioWorkletNodeInputs = createGetActiveAudioWorkletNodeInputs(activeAudioWorkletNodeInputsStore, getValueForKey);\nconst createNativeAudioWorkletNodeFaker = createNativeAudioWorkletNodeFakerFactory(\n connectMultipleOutputs,\n createIndexSizeError,\n createInvalidStateError,\n createNativeChannelMergerNode,\n createNativeChannelSplitterNode,\n createNativeConstantSourceNode,\n createNativeGainNode,\n createNativeScriptProcessorNode,\n createNotSupportedError,\n disconnectMultipleOutputs,\n exposeCurrentFrameAndCurrentTime,\n getActiveAudioWorkletNodeInputs,\n monitorConnections\n);\nconst createNativeAudioWorkletNode = createNativeAudioWorkletNodeFactory(\n createInvalidStateError,\n createNativeAudioWorkletNodeFaker,\n createNativeGainNode,\n createNotSupportedError,\n monitorConnections\n);\nconst createAudioWorkletNodeRenderer = createAudioWorkletNodeRendererFactory(\n connectAudioParam,\n connectMultipleOutputs,\n createNativeAudioBufferSourceNode,\n createNativeChannelMergerNode,\n createNativeChannelSplitterNode,\n createNativeConstantSourceNode,\n createNativeGainNode,\n deleteUnrenderedAudioWorkletNode,\n disconnectMultipleOutputs,\n exposeCurrentFrameAndCurrentTime,\n getNativeAudioNode,\n nativeAudioWorkletNodeConstructor,\n nativeOfflineAudioContextConstructor,\n renderAutomation,\n renderInputsOfAudioNode,\n renderNativeOfflineAudioContext\n);\nconst getBackupOfflineAudioContext = createGetBackupOfflineAudioContext(backupOfflineAudioContextStore);\nconst setActiveAudioWorkletNodeInputs = createSetActiveAudioWorkletNodeInputs(activeAudioWorkletNodeInputsStore);\n\n// The AudioWorkletNode constructor is only available in a SecureContext.\nconst audioWorkletNodeConstructor: undefined | TAudioWorkletNodeConstructor = isSecureContext\n ? createAudioWorkletNodeConstructor(\n addUnrenderedAudioWorkletNode,\n audioNodeConstructor,\n createAudioParam,\n createAudioWorkletNodeRenderer,\n createNativeAudioWorkletNode,\n getAudioNodeConnections,\n getBackupOfflineAudioContext,\n getNativeContext,\n isNativeOfflineAudioContext,\n nativeAudioWorkletNodeConstructor,\n sanitizeAudioWorkletNodeOptions,\n setActiveAudioWorkletNodeInputs,\n testAudioWorkletNodeOptionsClonability,\n wrapEventListener\n )\n : undefined;\n\ntype audioWorkletNodeConstructor = undefined | IAudioWorkletNode;\n\nexport { audioWorkletNodeConstructor as AudioWorkletNode };\n\ntype biquadFilterNodeConstructor = IBiquadFilterNode;\n\nexport { biquadFilterNodeConstructor as BiquadFilterNode };\n\ntype channelMergerNodeConstructor = IAudioNode;\n\nexport { channelMergerNodeConstructor as ChannelMergerNode };\n\ntype channelSplitterNodeConstructor = IAudioNode;\n\nexport { channelSplitterNodeConstructor as ChannelSplitterNode };\n\ntype constantSourceNodeConstructor = IConstantSourceNode;\n\nexport { convolverNodeConstructor as ConvolverNode };\n\ntype convolverNodeConstructor = IConvolverNode;\n\nexport { constantSourceNodeConstructor as ConstantSourceNode };\n\ntype delayNodeConstructor = IDelayNode;\n\nexport { delayNodeConstructor as DelayNode };\n\ntype dynamicsCompressorNodeConstructor = IDynamicsCompressorNode;\n\nexport { dynamicsCompressorNodeConstructor as DynamicsCompressorNode };\n\ntype gainNodeConstructor = IGainNode;\n\nexport { gainNodeConstructor as GainNode };\n\ntype iIRFilterNodeConstructor = IIIRFilterNode;\n\nexport { iIRFilterNodeConstructor as IIRFilterNode };\n\ntype mediaElementAudioSourceNodeConstructor = IMediaElementAudioSourceNode;\n\nexport { mediaElementAudioSourceNodeConstructor as MediaElementAudioSourceNode };\n\ntype mediaStreamAudioDestinationNodeConstructor = IMediaStreamAudioDestinationNode;\n\nexport { mediaStreamAudioDestinationNodeConstructor as MediaStreamAudioDestinationNode };\n\ntype mediaStreamAudioSourceNodeConstructor = IMediaStreamAudioSourceNode;\n\nexport { mediaStreamAudioSourceNodeConstructor as MediaStreamAudioSourceNode };\n\ntype mediaStreamTrackAudioSourceNodeConstructor = IMediaStreamTrackAudioSourceNode;\n\nexport { mediaStreamTrackAudioSourceNodeConstructor as MediaStreamTrackAudioSourceNode };\n\nconst minimalAudioContextConstructor: TMinimalAudioContextConstructor = createMinimalAudioContextConstructor(\n createInvalidStateError,\n createNotSupportedError,\n createUnknownError,\n minimalBaseAudioContextConstructor,\n nativeAudioContextConstructor\n);\n\ntype minimalAudioContextConstructor = IMinimalAudioContext;\n\nexport { minimalAudioContextConstructor as MinimalAudioContext };\n\nconst createNativeOfflineAudioContext = createCreateNativeOfflineAudioContext(\n createNotSupportedError,\n nativeOfflineAudioContextConstructor\n);\nconst startRendering = createStartRendering(\n audioBufferStore,\n cacheTestResult,\n getAudioNodeRenderer,\n getUnrenderedAudioWorkletNodes,\n renderNativeOfflineAudioContext,\n testAudioBufferCopyChannelMethodsOutOfBoundsSupport,\n wrapAudioBufferCopyChannelMethods,\n wrapAudioBufferCopyChannelMethodsOutOfBounds\n);\nconst minimalOfflineAudioContextConstructor: TMinimalOfflineAudioContextConstructor = createMinimalOfflineAudioContextConstructor(\n cacheTestResult,\n createInvalidStateError,\n createNativeOfflineAudioContext,\n minimalBaseAudioContextConstructor,\n startRendering\n);\n\ntype minimalOfflineAudioContextConstructor = IMinimalOfflineAudioContext;\n\nexport { minimalOfflineAudioContextConstructor as MinimalOfflineAudioContext };\n\nconst offlineAudioContextConstructor: IOfflineAudioContextConstructor = createOfflineAudioContextConstructor(\n baseAudioContextConstructor,\n cacheTestResult,\n createInvalidStateError,\n createNativeOfflineAudioContext,\n startRendering\n);\n\ntype offlineAudioContextConstructor = IOfflineAudioContext;\n\nexport { offlineAudioContextConstructor as OfflineAudioContext };\n\ntype oscillatorNodeConstructor = IOscillatorNode;\n\nexport { oscillatorNodeConstructor as OscillatorNode };\n\ntype pannerNodeConstructor = IPannerNode;\n\nexport { pannerNodeConstructor as PannerNode };\n\ntype periodicWaveConstructor = IPeriodicWave;\n\nexport { periodicWaveConstructor as PeriodicWave };\n\ntype stereoPannerNodeConstructor = IStereoPannerNode;\n\nexport { stereoPannerNodeConstructor as StereoPannerNode };\n\ntype waveShaperNodeConstructor = IWaveShaperNode;\n\nexport { waveShaperNodeConstructor as WaveShaperNode };\n\nexport const isAnyAudioContext = createIsAnyAudioContext(CONTEXT_STORE, isNativeAudioContext);\n\nexport const isAnyAudioNode = createIsAnyAudioNode(AUDIO_NODE_STORE, isNativeAudioNode);\n\nexport const isAnyAudioParam = createIsAnyAudioParam(AUDIO_PARAM_STORE, isNativeAudioParam);\n\nexport const isAnyOfflineAudioContext = createIsAnyOfflineAudioContext(CONTEXT_STORE, isNativeOfflineAudioContext);\n\nexport const isSupported = () =>\n createIsSupportedPromise(\n cacheTestResult,\n createTestAudioBufferCopyChannelMethodsSubarraySupport(nativeOfflineAudioContextConstructor),\n createTestAudioContextCloseMethodSupport(nativeAudioContextConstructor),\n createTestAudioContextDecodeAudioDataMethodTypeErrorSupport(nativeOfflineAudioContextConstructor),\n createTestAudioContextOptionsSupport(nativeAudioContextConstructor),\n createTestAudioNodeConnectMethodSupport(nativeOfflineAudioContextConstructor),\n createTestAudioWorkletProcessorNoOutputsSupport(nativeAudioWorkletNodeConstructor, nativeOfflineAudioContextConstructor),\n createTestChannelMergerNodeChannelCountSupport(nativeOfflineAudioContextConstructor),\n createTestConstantSourceNodeAccurateSchedulingSupport(nativeOfflineAudioContextConstructor),\n createTestConvolverNodeBufferReassignabilitySupport(nativeOfflineAudioContextConstructor),\n createTestConvolverNodeChannelCountSupport(nativeOfflineAudioContextConstructor),\n testDomExceptionConstructorSupport,\n createTestIsSecureContextSupport(window),\n createTestMediaStreamAudioSourceNodeMediaStreamWithoutAudioTrackSupport(nativeAudioContextConstructor),\n createTestStereoPannerNodeDefaultValueSupport(nativeOfflineAudioContextConstructor),\n testTransferablesSupport\n );\n","import { TAddActiveInputConnectionToAudioNodeFactory } from '../types/add-active-input-connection-to-audio-node-factory';\n\nexport const createAddActiveInputConnectionToAudioNode: TAddActiveInputConnectionToAudioNodeFactory = (insertElementInSet) => {\n return (activeInputs, source, [output, input, eventListener], ignoreDuplicates) => {\n insertElementInSet(\n activeInputs[input],\n [source, output, eventListener],\n (activeInputConnection) => activeInputConnection[0] === source && activeInputConnection[1] === output,\n ignoreDuplicates\n );\n };\n};\n","import { TAddPassiveInputConnectionToAudioNodeFactory } from '../types';\n\nexport const createAddPassiveInputConnectionToAudioNode: TAddPassiveInputConnectionToAudioNodeFactory = (insertElementInSet) => {\n return (passiveInputs, input, [source, output, eventListener], ignoreDuplicates) => {\n const passiveInputConnections = passiveInputs.get(source);\n\n if (passiveInputConnections === undefined) {\n passiveInputs.set(source, new Set([[output, input, eventListener]]));\n } else {\n insertElementInSet(\n passiveInputConnections,\n [output, input, eventListener],\n (passiveInputConnection) => passiveInputConnection[0] === output && passiveInputConnection[1] === input,\n ignoreDuplicates\n );\n }\n };\n};\n","import { TDeleteActiveInputConnectionToAudioNodeFactory } from '../types';\n\nexport const createDeleteActiveInputConnectionToAudioNode: TDeleteActiveInputConnectionToAudioNodeFactory = (pickElementFromSet) => {\n return (activeInputs, source, output, input) => {\n return pickElementFromSet(\n activeInputs[input],\n (activeInputConnection) => activeInputConnection[0] === source && activeInputConnection[1] === output\n );\n };\n};\n","import { TGetAudioNodeTailTimeFactory } from '../types';\n\nexport const createGetAudioNodeTailTime: TGetAudioNodeTailTimeFactory = (audioNodeTailTimeStore) => {\n return (audioNode) => audioNodeTailTimeStore.get(audioNode) ?? 0;\n};\n","import { TWindow, TWindowFactory } from '../types';\n\nexport const createWindow: TWindowFactory = () => (typeof window === 'undefined' ? null : window);\n","import { assignNativeAudioNodeOption } from '../helpers/assign-native-audio-node-option';\nimport { assignNativeAudioNodeOptions } from '../helpers/assign-native-audio-node-options';\nimport { testAnalyserNodeGetFloatTimeDomainDataMethodSupport } from '../helpers/test-analyser-node-get-float-time-domain-data-method-support';\nimport { wrapAnalyserNodeGetFloatTimeDomainDataMethod } from '../helpers/wrap-analyser-node-get-float-time-domain-data-method';\nimport { TNativeAnalyserNodeFactoryFactory } from '../types';\n\nexport const createNativeAnalyserNodeFactory: TNativeAnalyserNodeFactoryFactory = (cacheTestResult, createIndexSizeError) => {\n return (nativeContext, options) => {\n const nativeAnalyserNode = nativeContext.createAnalyser();\n\n // Bug #37: Firefox does not create an AnalyserNode with the default properties.\n assignNativeAudioNodeOptions(nativeAnalyserNode, options);\n\n // Bug #118: Safari does not throw an error if maxDecibels is not more than minDecibels.\n if (!(options.maxDecibels > options.minDecibels)) {\n throw createIndexSizeError();\n }\n\n assignNativeAudioNodeOption(nativeAnalyserNode, options, 'fftSize');\n assignNativeAudioNodeOption(nativeAnalyserNode, options, 'maxDecibels');\n assignNativeAudioNodeOption(nativeAnalyserNode, options, 'minDecibels');\n assignNativeAudioNodeOption(nativeAnalyserNode, options, 'smoothingTimeConstant');\n\n // Bug #36: Safari does not support getFloatTimeDomainData() yet.\n if (\n !cacheTestResult(testAnalyserNodeGetFloatTimeDomainDataMethodSupport, () =>\n testAnalyserNodeGetFloatTimeDomainDataMethodSupport(nativeAnalyserNode)\n )\n ) {\n wrapAnalyserNodeGetFloatTimeDomainDataMethod(nativeAnalyserNode);\n }\n\n return nativeAnalyserNode;\n };\n};\n","import { TNativeAnalyserNode } from '../types';\n\nexport const wrapAnalyserNodeGetFloatTimeDomainDataMethod = (nativeAnalyserNode: TNativeAnalyserNode): void => {\n nativeAnalyserNode.getFloatTimeDomainData = (array: Float32Array) => {\n const byteTimeDomainData = new Uint8Array(array.length);\n\n nativeAnalyserNode.getByteTimeDomainData(byteTimeDomainData);\n\n const length = Math.max(byteTimeDomainData.length, nativeAnalyserNode.fftSize);\n\n for (let i = 0; i < length; i += 1) {\n array[i] = (byteTimeDomainData[i] - 128) * 0.0078125;\n }\n\n return array;\n };\n};\n","import { IAudioNode, IAudioNodeRenderer, IMinimalOfflineAudioContext, IOfflineAudioContext } from '../interfaces';\nimport { TGetAudioNodeRendererFactory } from '../types';\n\nexport const createGetAudioNodeRenderer: TGetAudioNodeRendererFactory = (getAudioNodeConnections) => {\n return (\n audioNode: IAudioNode\n ): IAudioNodeRenderer> => {\n const audioNodeConnections = getAudioNodeConnections(audioNode);\n\n if (audioNodeConnections.renderer === null) {\n throw new Error('Missing the renderer of the given AudioNode in the audio graph.');\n }\n\n return >>audioNodeConnections.renderer;\n };\n};\n","import { IAudioDestinationNode } from '../interfaces';\nimport { TRenderInputsOfAudioNodeFactory } from '../types';\n\nexport const createRenderInputsOfAudioNode: TRenderInputsOfAudioNodeFactory = (\n getAudioNodeConnections,\n getAudioNodeRenderer,\n isPartOfACycle\n) => {\n return async (audioNode, nativeOfflineAudioContext, nativeAudioNode) => {\n const audioNodeConnections = getAudioNodeConnections(audioNode);\n\n await Promise.all(\n audioNodeConnections.activeInputs\n .map((connections, input) =>\n Array.from(connections).map(async ([source, output]) => {\n const audioNodeRenderer = getAudioNodeRenderer(source);\n const renderedNativeAudioNode = await audioNodeRenderer.render(source, nativeOfflineAudioContext);\n const destination = >audioNode.context.destination;\n\n if (!isPartOfACycle(source) && (audioNode !== destination || !isPartOfACycle(audioNode))) {\n renderedNativeAudioNode.connect(nativeAudioNode, output, input);\n }\n })\n )\n .reduce((allRenderingPromises, renderingPromises) => [...allRenderingPromises, ...renderingPromises], [])\n );\n };\n};\n","import { isOwnedByContext } from '../helpers/is-owned-by-context';\nimport { IAnalyserNode, IMinimalOfflineAudioContext, IOfflineAudioContext } from '../interfaces';\nimport { TAnalyserNodeRendererFactoryFactory, TNativeAnalyserNode, TNativeOfflineAudioContext } from '../types';\n\nexport const createAnalyserNodeRendererFactory: TAnalyserNodeRendererFactoryFactory = (\n createNativeAnalyserNode,\n getNativeAudioNode,\n renderInputsOfAudioNode\n) => {\n return () => {\n const renderedNativeAnalyserNodes = new WeakMap();\n\n const createAnalyserNode = async (proxy: IAnalyserNode, nativeOfflineAudioContext: TNativeOfflineAudioContext) => {\n let nativeAnalyserNode = getNativeAudioNode(proxy);\n\n // If the initially used nativeAnalyserNode was not constructed on the same OfflineAudioContext it needs to be created again.\n const nativeAnalyserNodeIsOwnedByContext = isOwnedByContext(nativeAnalyserNode, nativeOfflineAudioContext);\n\n if (!nativeAnalyserNodeIsOwnedByContext) {\n const options = {\n channelCount: nativeAnalyserNode.channelCount,\n channelCountMode: nativeAnalyserNode.channelCountMode,\n channelInterpretation: nativeAnalyserNode.channelInterpretation,\n fftSize: nativeAnalyserNode.fftSize,\n maxDecibels: nativeAnalyserNode.maxDecibels,\n minDecibels: nativeAnalyserNode.minDecibels,\n smoothingTimeConstant: nativeAnalyserNode.smoothingTimeConstant\n };\n\n nativeAnalyserNode = createNativeAnalyserNode(nativeOfflineAudioContext, options);\n }\n\n renderedNativeAnalyserNodes.set(nativeOfflineAudioContext, nativeAnalyserNode);\n\n await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeAnalyserNode);\n\n return nativeAnalyserNode;\n };\n\n return {\n render(proxy: IAnalyserNode, nativeOfflineAudioContext: TNativeOfflineAudioContext): Promise {\n const renderedNativeAnalyserNode = renderedNativeAnalyserNodes.get(nativeOfflineAudioContext);\n\n if (renderedNativeAnalyserNode !== undefined) {\n return Promise.resolve(renderedNativeAnalyserNode);\n }\n\n return createAnalyserNode(proxy, nativeOfflineAudioContext);\n }\n };\n };\n};\n","import { TNativeOfflineAudioContextConstructorFactory } from '../types';\n\nexport const createNativeOfflineAudioContextConstructor: TNativeOfflineAudioContextConstructorFactory = (window) => {\n if (window === null) {\n return null;\n }\n\n if (window.hasOwnProperty('OfflineAudioContext')) {\n return window.OfflineAudioContext;\n }\n\n return window.hasOwnProperty('webkitOfflineAudioContext') ? (window).webkitOfflineAudioContext : null;\n};\n","import { TIsNativeOfflineAudioContextFactory, TNativeOfflineAudioContext } from '../types';\n\nexport const createIsNativeOfflineAudioContext: TIsNativeOfflineAudioContextFactory = (nativeOfflineAudioContextConstructor) => {\n return (anything): anything is TNativeOfflineAudioContext => {\n return nativeOfflineAudioContextConstructor !== null && anything instanceof nativeOfflineAudioContextConstructor;\n };\n};\n","import { IEventTarget } from '../interfaces';\nimport { TEventHandler, TEventTargetConstructorFactory, TNativeEventTarget } from '../types';\n\nexport const createEventTargetConstructor: TEventTargetConstructorFactory = (wrapEventListener) => {\n return class EventTarget> implements IEventTarget {\n private _listeners: WeakMap;\n\n constructor(private _nativeEventTarget: TNativeEventTarget) {\n this._listeners = new WeakMap();\n }\n\n public addEventListener(\n type: string,\n listener: null | TEventHandler | EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions\n ): void {\n if (listener !== null) {\n let wrappedEventListener = this._listeners.get(listener);\n\n if (wrappedEventListener === undefined) {\n wrappedEventListener = wrapEventListener(this, listener);\n\n if (typeof listener === 'function') {\n this._listeners.set(listener, wrappedEventListener);\n }\n }\n\n this._nativeEventTarget.addEventListener(type, wrappedEventListener, options);\n }\n }\n\n public dispatchEvent(event: Event): boolean {\n return this._nativeEventTarget.dispatchEvent(event);\n }\n\n public removeEventListener(\n type: string,\n listener: null | TEventHandler | EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions\n ): void {\n const wrappedEventListener = listener === null ? undefined : this._listeners.get(listener);\n\n this._nativeEventTarget.removeEventListener(type, wrappedEventListener === undefined ? null : wrappedEventListener, options);\n }\n };\n};\n","import { TNativeAudioContextConstructorFactory } from '../types';\n\nexport const createNativeAudioContextConstructor: TNativeAudioContextConstructorFactory = (window) => {\n if (window === null) {\n return null;\n }\n\n if (window.hasOwnProperty('AudioContext')) {\n return window.AudioContext;\n }\n\n return window.hasOwnProperty('webkitAudioContext') ? (window).webkitAudioContext : null;\n};\n","import { TIsNativeAudioContextFactory, TNativeAudioContext } from '../types';\n\nexport const createIsNativeAudioContext: TIsNativeAudioContextFactory = (nativeAudioContextConstructor) => {\n return (anything): anything is TNativeAudioContext => {\n return nativeAudioContextConstructor !== null && anything instanceof nativeAudioContextConstructor;\n };\n};\n","import { TIsNativeAudioNodeFactory, TNativeAudioNode } from '../types';\n\nexport const createIsNativeAudioNode: TIsNativeAudioNodeFactory = (window) => {\n return (anything): anything is TNativeAudioNode => {\n return window !== null && typeof window.AudioNode === 'function' && anything instanceof window.AudioNode;\n };\n};\n","import { TIsNativeAudioParamFactory, TNativeAudioParam } from '../types';\n\nexport const createIsNativeAudioParam: TIsNativeAudioParamFactory = (window) => {\n return (anything): anything is TNativeAudioParam => {\n return window !== null && typeof window.AudioParam === 'function' && anything instanceof window.AudioParam;\n };\n};\n","import { TNativeAudioWorkletNodeConstructorFactory } from '../types';\n\nexport const createNativeAudioWorkletNodeConstructor: TNativeAudioWorkletNodeConstructorFactory = (window) => {\n if (window === null) {\n return null;\n }\n\n return window.hasOwnProperty('AudioWorkletNode') ? window.AudioWorkletNode : null;\n};\n","import { deletePassiveInputConnectionToAudioNode } from '../helpers/delete-passive-input-connection-to-audio-node';\nimport { setInternalStateToActive } from '../helpers/set-internal-state-to-active';\nimport { setInternalStateToPassiveWhenNecessary } from '../helpers/set-internal-state-to-passive-when-necessary';\nimport { IAudioNode } from '../interfaces';\nimport { TAddConnectionToAudioNodeFactory, TContext, TInternalStateEventListener } from '../types';\n\nexport const createAddConnectionToAudioNode: TAddConnectionToAudioNodeFactory = (\n addActiveInputConnectionToAudioNode,\n addPassiveInputConnectionToAudioNode,\n connectNativeAudioNodeToNativeAudioNode,\n deleteActiveInputConnectionToAudioNode,\n disconnectNativeAudioNodeFromNativeAudioNode,\n getAudioNodeConnections,\n getAudioNodeTailTime,\n getEventListenersOfAudioNode,\n getNativeAudioNode,\n insertElementInSet,\n isActiveAudioNode,\n isPartOfACycle,\n isPassiveAudioNode\n) => {\n const tailTimeTimeoutIds = new WeakMap, number>();\n\n return (source, destination, output, input, isOffline) => {\n const { activeInputs, passiveInputs } = getAudioNodeConnections(destination);\n const { outputs } = getAudioNodeConnections(source);\n const eventListeners = getEventListenersOfAudioNode(source);\n\n const eventListener: TInternalStateEventListener = (isActive) => {\n const nativeDestinationAudioNode = getNativeAudioNode(destination);\n const nativeSourceAudioNode = getNativeAudioNode(source);\n\n if (isActive) {\n const partialConnection = deletePassiveInputConnectionToAudioNode(passiveInputs, source, output, input);\n\n addActiveInputConnectionToAudioNode(activeInputs, source, partialConnection, false);\n\n if (!isOffline && !isPartOfACycle(source)) {\n connectNativeAudioNodeToNativeAudioNode(nativeSourceAudioNode, nativeDestinationAudioNode, output, input);\n }\n\n if (isPassiveAudioNode(destination)) {\n setInternalStateToActive(destination);\n }\n } else {\n const partialConnection = deleteActiveInputConnectionToAudioNode(activeInputs, source, output, input);\n\n addPassiveInputConnectionToAudioNode(passiveInputs, input, partialConnection, false);\n\n if (!isOffline && !isPartOfACycle(source)) {\n disconnectNativeAudioNodeFromNativeAudioNode(nativeSourceAudioNode, nativeDestinationAudioNode, output, input);\n }\n\n const tailTime = getAudioNodeTailTime(destination);\n\n if (tailTime === 0) {\n if (isActiveAudioNode(destination)) {\n setInternalStateToPassiveWhenNecessary(destination, activeInputs);\n }\n } else {\n const tailTimeTimeoutId = tailTimeTimeoutIds.get(destination);\n\n if (tailTimeTimeoutId !== undefined) {\n clearTimeout(tailTimeTimeoutId);\n }\n\n tailTimeTimeoutIds.set(\n destination,\n setTimeout(() => {\n if (isActiveAudioNode(destination)) {\n setInternalStateToPassiveWhenNecessary(destination, activeInputs);\n }\n }, tailTime * 1000)\n );\n }\n }\n };\n\n if (\n insertElementInSet(\n outputs,\n [destination, output, input],\n (outputConnection) =>\n outputConnection[0] === destination && outputConnection[1] === output && outputConnection[2] === input,\n true\n )\n ) {\n eventListeners.add(eventListener);\n\n if (isActiveAudioNode(source)) {\n addActiveInputConnectionToAudioNode(activeInputs, source, [output, input, eventListener], true);\n } else {\n addPassiveInputConnectionToAudioNode(passiveInputs, input, [source, output, eventListener], true);\n }\n\n return true;\n }\n\n return false;\n };\n};\n","import { isAudioNodeOutputConnection } from '../guards/audio-node-output-connection';\nimport { TIncrementCycleCounterFactoryFactory } from '../types';\n\nexport const createIncrementCycleCounterFactory: TIncrementCycleCounterFactoryFactory = (\n cycleCounters,\n disconnectNativeAudioNodeFromNativeAudioNode,\n getAudioNodeConnections,\n getNativeAudioNode,\n getNativeAudioParam,\n isActiveAudioNode\n) => {\n return (isOffline) => {\n return (audioNode, count) => {\n const cycleCounter = cycleCounters.get(audioNode);\n\n if (cycleCounter === undefined) {\n if (!isOffline && isActiveAudioNode(audioNode)) {\n const nativeSourceAudioNode = getNativeAudioNode(audioNode);\n const { outputs } = getAudioNodeConnections(audioNode);\n\n for (const output of outputs) {\n if (isAudioNodeOutputConnection(output)) {\n const nativeDestinationAudioNode = getNativeAudioNode(output[0]);\n\n disconnectNativeAudioNodeFromNativeAudioNode(\n nativeSourceAudioNode,\n nativeDestinationAudioNode,\n output[1],\n output[2]\n );\n } else {\n const nativeDestinationAudioParam = getNativeAudioParam(output[0]);\n\n nativeSourceAudioNode.disconnect(nativeDestinationAudioParam, output[1]);\n }\n }\n }\n\n cycleCounters.set(audioNode, count);\n } else {\n cycleCounters.set(audioNode, cycleCounter + count);\n }\n };\n };\n};\n","import { isAudioNodeOutputConnection } from '../guards/audio-node-output-connection';\nimport { TDecrementCycleCounterFactory } from '../types';\n\nexport const createDecrementCycleCounter: TDecrementCycleCounterFactory = (\n connectNativeAudioNodeToNativeAudioNode,\n cycleCounters,\n getAudioNodeConnections,\n getNativeAudioNode,\n getNativeAudioParam,\n getNativeContext,\n isActiveAudioNode,\n isNativeOfflineAudioContext\n) => {\n return (audioNode, count) => {\n const cycleCounter = cycleCounters.get(audioNode);\n\n if (cycleCounter === undefined) {\n throw new Error('Missing the expected cycle count.');\n }\n\n const nativeContext = getNativeContext(audioNode.context);\n const isOffline = isNativeOfflineAudioContext(nativeContext);\n\n if (cycleCounter === count) {\n cycleCounters.delete(audioNode);\n\n if (!isOffline && isActiveAudioNode(audioNode)) {\n const nativeSourceAudioNode = getNativeAudioNode(audioNode);\n const { outputs } = getAudioNodeConnections(audioNode);\n\n for (const output of outputs) {\n if (isAudioNodeOutputConnection(output)) {\n const nativeDestinationAudioNode = getNativeAudioNode(output[0]);\n\n connectNativeAudioNodeToNativeAudioNode(nativeSourceAudioNode, nativeDestinationAudioNode, output[1], output[2]);\n } else {\n const nativeDestinationAudioParam = getNativeAudioParam(output[0]);\n\n nativeSourceAudioNode.connect(nativeDestinationAudioParam, output[1]);\n }\n }\n }\n } else {\n cycleCounters.set(audioNode, cycleCounter - count);\n }\n };\n};\n","import { isAudioNode } from '../guards/audio-node';\nimport { isDelayNode } from '../guards/delay-node';\nimport { IAudioNode, IAudioParam } from '../interfaces';\nimport { TContext, TDetectCyclesFactory } from '../types';\n\nexport const createDetectCycles: TDetectCyclesFactory = (audioParamAudioNodeStore, getAudioNodeConnections, getValueForKey) => {\n return function detectCycles(chain: IAudioNode[], nextLink: IAudioNode | IAudioParam): IAudioNode[][] {\n const audioNode = isAudioNode(nextLink) ? nextLink : >getValueForKey(audioParamAudioNodeStore, nextLink);\n\n if (isDelayNode(audioNode)) {\n return [];\n }\n\n if (chain[0] === audioNode) {\n return [chain];\n }\n\n if (chain.includes(audioNode)) {\n return [];\n }\n\n const { outputs } = getAudioNodeConnections(audioNode);\n\n return Array.from(outputs)\n .map((outputConnection) => detectCycles([...chain, audioNode], outputConnection[0]))\n .reduce((mergedCycles, nestedCycles) => mergedCycles.concat(nestedCycles), []);\n };\n};\n","import { IAudioNode, IDelayNode } from '../interfaces';\nimport { TContext } from '../types';\n\nexport const isDelayNode = (audioNode: IAudioNode): audioNode is IDelayNode => {\n return 'delayTime' in audioNode;\n};\n","import { TNativeAudioBufferConstructorFactory } from '../types';\n\nexport const createNativeAudioBufferConstructor: TNativeAudioBufferConstructorFactory = (window) => {\n if (window === null) {\n return null;\n }\n\n if (window.hasOwnProperty('AudioBuffer')) {\n return window.AudioBuffer;\n }\n\n return null;\n};\n","import { TNativeAudioBuffer, TWrapAudioBufferCopyChannelMethodsFactory } from '../types';\n\nexport const createWrapAudioBufferCopyChannelMethods: TWrapAudioBufferCopyChannelMethodsFactory = (\n convertNumberToUnsignedLong,\n createIndexSizeError\n) => {\n return (audioBuffer: TNativeAudioBuffer): void => {\n audioBuffer.copyFromChannel = (destination, channelNumberAsNumber, bufferOffsetAsNumber = 0) => {\n const bufferOffset = convertNumberToUnsignedLong(bufferOffsetAsNumber);\n const channelNumber = convertNumberToUnsignedLong(channelNumberAsNumber);\n\n if (channelNumber >= audioBuffer.numberOfChannels) {\n throw createIndexSizeError();\n }\n\n const audioBufferLength = audioBuffer.length;\n const channelData = audioBuffer.getChannelData(channelNumber);\n const destinationLength = destination.length;\n\n for (let i = bufferOffset < 0 ? -bufferOffset : 0; i + bufferOffset < audioBufferLength && i < destinationLength; i += 1) {\n destination[i] = channelData[i + bufferOffset];\n }\n };\n\n audioBuffer.copyToChannel = (source, channelNumberAsNumber, bufferOffsetAsNumber = 0) => {\n const bufferOffset = convertNumberToUnsignedLong(bufferOffsetAsNumber);\n const channelNumber = convertNumberToUnsignedLong(channelNumberAsNumber);\n\n if (channelNumber >= audioBuffer.numberOfChannels) {\n throw createIndexSizeError();\n }\n\n const audioBufferLength = audioBuffer.length;\n const channelData = audioBuffer.getChannelData(channelNumber);\n const sourceLength = source.length;\n\n for (let i = bufferOffset < 0 ? -bufferOffset : 0; i + bufferOffset < audioBufferLength && i < sourceLength; i += 1) {\n channelData[i + bufferOffset] = source[i];\n }\n };\n };\n};\n","import { TNativeAudioBuffer, TWrapAudioBufferCopyChannelMethodsOutOfBoundsFactory } from '../types';\n\nexport const createWrapAudioBufferCopyChannelMethodsOutOfBounds: TWrapAudioBufferCopyChannelMethodsOutOfBoundsFactory = (\n convertNumberToUnsignedLong\n) => {\n return (audioBuffer: TNativeAudioBuffer): void => {\n audioBuffer.copyFromChannel = ((copyFromChannel) => {\n return (destination: Float32Array, channelNumberAsNumber: number, bufferOffsetAsNumber = 0) => {\n const bufferOffset = convertNumberToUnsignedLong(bufferOffsetAsNumber);\n const channelNumber = convertNumberToUnsignedLong(channelNumberAsNumber);\n\n if (bufferOffset < audioBuffer.length) {\n return copyFromChannel.call(audioBuffer, destination, channelNumber, bufferOffset);\n }\n };\n })(audioBuffer.copyFromChannel);\n\n audioBuffer.copyToChannel = ((copyToChannel) => {\n return (source: Float32Array, channelNumberAsNumber: number, bufferOffsetAsNumber = 0) => {\n const bufferOffset = convertNumberToUnsignedLong(bufferOffsetAsNumber);\n const channelNumber = convertNumberToUnsignedLong(channelNumberAsNumber);\n\n if (bufferOffset < audioBuffer.length) {\n return copyToChannel.call(audioBuffer, source, channelNumber, bufferOffset);\n }\n };\n })(audioBuffer.copyToChannel);\n };\n};\n","import { TTestAudioBufferConstructorSupportFactory } from '../types';\n\n// Bug #33: Safari exposes an AudioBuffer but it can't be used as a constructor.\nexport const createTestAudioBufferConstructorSupport: TTestAudioBufferConstructorSupportFactory = (nativeAudioBufferConstructor) => {\n return () => {\n if (nativeAudioBufferConstructor === null) {\n return false;\n }\n\n try {\n new nativeAudioBufferConstructor({ length: 1, sampleRate: 44100 }); // tslint:disable-line:no-unused-expression\n } catch {\n return false;\n }\n\n return true;\n };\n};\n","import { TAddSilentConnectionFactory } from '../types';\n\nexport const createAddSilentConnection: TAddSilentConnectionFactory = (createNativeGainNode) => {\n return (nativeContext, nativeAudioScheduledSourceNode) => {\n const nativeGainNode = createNativeGainNode(nativeContext, {\n channelCount: 1,\n channelCountMode: 'explicit',\n channelInterpretation: 'discrete',\n gain: 0\n });\n\n nativeAudioScheduledSourceNode.connect(nativeGainNode).connect(nativeContext.destination);\n\n const disconnect = () => {\n nativeAudioScheduledSourceNode.removeEventListener('ended', disconnect);\n nativeAudioScheduledSourceNode.disconnect(nativeGainNode);\n nativeGainNode.disconnect();\n };\n\n nativeAudioScheduledSourceNode.addEventListener('ended', disconnect);\n };\n};\n","import { IAudioParam, IMinimalOfflineAudioContext, IOfflineAudioContext } from '../interfaces';\nimport { TNativeAudioParam, TNativeOfflineAudioContext, TRenderInputsOfAudioParamFactory } from '../types';\n\nexport const createRenderInputsOfAudioParam: TRenderInputsOfAudioParamFactory = (\n getAudioNodeRenderer,\n getAudioParamConnections,\n isPartOfACycle\n) => {\n return async (\n audioParam: IAudioParam,\n nativeOfflineAudioContext: TNativeOfflineAudioContext,\n nativeAudioParam: TNativeAudioParam\n ): Promise => {\n const audioParamConnections = getAudioParamConnections(audioParam);\n\n await Promise.all(\n Array.from(audioParamConnections.activeInputs).map(async ([source, output]) => {\n const audioNodeRenderer = getAudioNodeRenderer(source);\n const renderedNativeAudioNode = await audioNodeRenderer.render(source, nativeOfflineAudioContext);\n\n if (!isPartOfACycle(source)) {\n renderedNativeAudioNode.connect(nativeAudioParam, output);\n }\n })\n );\n };\n};\n","import { TConnectAudioParamFactory } from '../types';\n\nexport const createConnectAudioParam: TConnectAudioParamFactory = (renderInputsOfAudioParam) => {\n return (nativeOfflineAudioContext, audioParam, nativeAudioParam) => {\n return renderInputsOfAudioParam(audioParam, nativeOfflineAudioContext, nativeAudioParam);\n };\n};\n","import { assignNativeAudioNodeAudioParamValue } from '../helpers/assign-native-audio-node-audio-param-value';\nimport { assignNativeAudioNodeOption } from '../helpers/assign-native-audio-node-option';\nimport { assignNativeAudioNodeOptions } from '../helpers/assign-native-audio-node-options';\nimport { wrapAudioBufferSourceNodeStartMethodConsecutiveCalls } from '../helpers/wrap-audio-buffer-source-node-start-method-consecutive-calls';\nimport { wrapAudioScheduledSourceNodeStartMethodNegativeParameters } from '../helpers/wrap-audio-scheduled-source-node-start-method-negative-parameters';\nimport { wrapAudioScheduledSourceNodeStopMethodNegativeParameters } from '../helpers/wrap-audio-scheduled-source-node-stop-method-negative-parameters';\nimport { TNativeAudioBufferSourceNodeFactoryFactory } from '../types';\n\nexport const createNativeAudioBufferSourceNodeFactory: TNativeAudioBufferSourceNodeFactoryFactory = (\n addSilentConnection,\n cacheTestResult,\n testAudioBufferSourceNodeStartMethodConsecutiveCallsSupport,\n testAudioBufferSourceNodeStartMethodOffsetClampingSupport,\n testAudioBufferSourceNodeStopMethodNullifiedBufferSupport,\n testAudioScheduledSourceNodeStartMethodNegativeParametersSupport,\n testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport,\n testAudioScheduledSourceNodeStopMethodNegativeParametersSupport,\n wrapAudioBufferSourceNodeStartMethodOffsetClampling,\n wrapAudioBufferSourceNodeStopMethodNullifiedBuffer,\n wrapAudioScheduledSourceNodeStopMethodConsecutiveCalls\n) => {\n return (nativeContext, options) => {\n const nativeAudioBufferSourceNode = nativeContext.createBufferSource();\n\n assignNativeAudioNodeOptions(nativeAudioBufferSourceNode, options);\n\n assignNativeAudioNodeAudioParamValue(nativeAudioBufferSourceNode, options, 'playbackRate');\n\n assignNativeAudioNodeOption(nativeAudioBufferSourceNode, options, 'buffer');\n\n // Bug #149: Safari does not yet support the detune AudioParam.\n\n assignNativeAudioNodeOption(nativeAudioBufferSourceNode, options, 'loop');\n assignNativeAudioNodeOption(nativeAudioBufferSourceNode, options, 'loopEnd');\n assignNativeAudioNodeOption(nativeAudioBufferSourceNode, options, 'loopStart');\n\n // Bug #69: Safari does allow calls to start() of an already scheduled AudioBufferSourceNode.\n if (\n !cacheTestResult(testAudioBufferSourceNodeStartMethodConsecutiveCallsSupport, () =>\n testAudioBufferSourceNodeStartMethodConsecutiveCallsSupport(nativeContext)\n )\n ) {\n wrapAudioBufferSourceNodeStartMethodConsecutiveCalls(nativeAudioBufferSourceNode);\n }\n\n // Bug #154 & #155: Safari does not handle offsets which are equal to or greater than the duration of the buffer.\n if (\n !cacheTestResult(testAudioBufferSourceNodeStartMethodOffsetClampingSupport, () =>\n testAudioBufferSourceNodeStartMethodOffsetClampingSupport(nativeContext)\n )\n ) {\n wrapAudioBufferSourceNodeStartMethodOffsetClampling(nativeAudioBufferSourceNode);\n }\n\n // Bug #162: Safari does throw an error when stop() is called on an AudioBufferSourceNode which has no buffer assigned to it.\n if (\n !cacheTestResult(testAudioBufferSourceNodeStopMethodNullifiedBufferSupport, () =>\n testAudioBufferSourceNodeStopMethodNullifiedBufferSupport(nativeContext)\n )\n ) {\n wrapAudioBufferSourceNodeStopMethodNullifiedBuffer(nativeAudioBufferSourceNode, nativeContext);\n }\n\n // Bug #44: Safari does not throw a RangeError yet.\n if (\n !cacheTestResult(testAudioScheduledSourceNodeStartMethodNegativeParametersSupport, () =>\n testAudioScheduledSourceNodeStartMethodNegativeParametersSupport(nativeContext)\n )\n ) {\n wrapAudioScheduledSourceNodeStartMethodNegativeParameters(nativeAudioBufferSourceNode);\n }\n\n // Bug #19: Safari does not ignore calls to stop() of an already stopped AudioBufferSourceNode.\n if (\n !cacheTestResult(testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport, () =>\n testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport(nativeContext)\n )\n ) {\n wrapAudioScheduledSourceNodeStopMethodConsecutiveCalls(nativeAudioBufferSourceNode, nativeContext);\n }\n\n // Bug #44: Only Firefox does not throw a RangeError yet.\n if (\n !cacheTestResult(testAudioScheduledSourceNodeStopMethodNegativeParametersSupport, () =>\n testAudioScheduledSourceNodeStopMethodNegativeParametersSupport(nativeContext)\n )\n ) {\n wrapAudioScheduledSourceNodeStopMethodNegativeParameters(nativeAudioBufferSourceNode);\n }\n\n // Bug #175: Safari will not fire an ended event if the AudioBufferSourceNode is unconnected.\n addSilentConnection(nativeContext, nativeAudioBufferSourceNode);\n\n return nativeAudioBufferSourceNode;\n };\n};\n","import { createInvalidStateError } from '../factories/invalid-state-error';\nimport { TNativeAudioBufferSourceNode } from '../types';\n\nexport const wrapAudioBufferSourceNodeStartMethodConsecutiveCalls = (nativeAudioBufferSourceNode: TNativeAudioBufferSourceNode): void => {\n nativeAudioBufferSourceNode.start = ((start) => {\n let isScheduled = false;\n\n return (when = 0, offset = 0, duration?: number) => {\n if (isScheduled) {\n throw createInvalidStateError();\n }\n\n start.call(nativeAudioBufferSourceNode, when, offset, duration);\n\n isScheduled = true;\n };\n })(nativeAudioBufferSourceNode.start);\n};\n","import { TNativeContext } from '../types';\n\nexport const testAudioBufferSourceNodeStartMethodConsecutiveCallsSupport = (nativeContext: TNativeContext) => {\n const nativeAudioBufferSourceNode = nativeContext.createBufferSource();\n\n nativeAudioBufferSourceNode.start();\n\n try {\n nativeAudioBufferSourceNode.start();\n } catch {\n return true;\n }\n\n return false;\n};\n","import { TNativeContext } from '../types';\n\nexport const testAudioBufferSourceNodeStartMethodOffsetClampingSupport = (nativeContext: TNativeContext) => {\n const nativeAudioBufferSourceNode = nativeContext.createBufferSource();\n const nativeAudioBuffer = nativeContext.createBuffer(1, 1, 44100);\n\n nativeAudioBufferSourceNode.buffer = nativeAudioBuffer;\n\n try {\n nativeAudioBufferSourceNode.start(0, 1);\n } catch {\n return false;\n }\n\n return true;\n};\n","import { TNativeContext } from '../types';\n\nexport const testAudioBufferSourceNodeStopMethodNullifiedBufferSupport = (nativeContext: TNativeContext) => {\n const nativeAudioBufferSourceNode = nativeContext.createBufferSource();\n\n nativeAudioBufferSourceNode.start();\n\n try {\n nativeAudioBufferSourceNode.stop();\n } catch {\n return false;\n }\n\n return true;\n};\n","import { TNativeAudioBufferSourceNode } from '../types';\n\nexport const wrapAudioBufferSourceNodeStartMethodOffsetClamping = (nativeAudioBufferSourceNode: TNativeAudioBufferSourceNode): void => {\n nativeAudioBufferSourceNode.start = ((start) => {\n return (when = 0, offset = 0, duration?: number) => {\n const buffer = nativeAudioBufferSourceNode.buffer;\n // Bug #154: Safari does not clamp the offset if it is equal to or greater than the duration of the buffer.\n const clampedOffset = buffer === null ? offset : Math.min(buffer.duration, offset);\n\n // Bug #155: Safari does not handle the offset correctly if it would cause the buffer to be not be played at all.\n if (buffer !== null && clampedOffset > buffer.duration - 0.5 / nativeAudioBufferSourceNode.context.sampleRate) {\n start.call(nativeAudioBufferSourceNode, when, 0, 0);\n } else {\n start.call(nativeAudioBufferSourceNode, when, clampedOffset, duration);\n }\n };\n })(nativeAudioBufferSourceNode.start);\n};\n","import { TWrapAudioBufferSourceNodeStopMethodNullifiedBufferFactory } from '../types';\n\nexport const createWrapAudioBufferSourceNodeStopMethodNullifiedBuffer: TWrapAudioBufferSourceNodeStopMethodNullifiedBufferFactory = (\n overwriteAccessors\n) => {\n return (nativeAudioBufferSourceNode, nativeContext) => {\n const nullifiedBuffer = nativeContext.createBuffer(1, 1, 44100);\n\n if (nativeAudioBufferSourceNode.buffer === null) {\n nativeAudioBufferSourceNode.buffer = nullifiedBuffer;\n }\n\n overwriteAccessors(\n nativeAudioBufferSourceNode,\n 'buffer',\n (get) => () => {\n const value = get.call(nativeAudioBufferSourceNode);\n\n return value === nullifiedBuffer ? null : value;\n },\n (set) => (value) => {\n return set.call(nativeAudioBufferSourceNode, value === null ? nullifiedBuffer : value);\n }\n );\n };\n};\n","import { TRenderAutomationFactory } from '../types';\n\nexport const createRenderAutomation: TRenderAutomationFactory = (getAudioParamRenderer, renderInputsOfAudioParam) => {\n return (nativeOfflineAudioContext, audioParam, nativeAudioParam) => {\n const audioParamRenderer = getAudioParamRenderer(audioParam);\n\n audioParamRenderer.replay(nativeAudioParam);\n\n return renderInputsOfAudioParam(audioParam, nativeOfflineAudioContext, nativeAudioParam);\n };\n};\n","import { IMinimalOfflineAudioContext } from '../interfaces';\nimport { TGetAudioParamRendererFactory } from '../types';\n\nexport const createGetAudioParamRenderer: TGetAudioParamRendererFactory = (getAudioParamConnections) => {\n return (audioParam) => {\n const audioParamConnections = getAudioParamConnections(audioParam);\n\n if (audioParamConnections.renderer === null) {\n throw new Error('Missing the renderer of the given AudioParam in the audio graph.');\n }\n\n return audioParamConnections.renderer;\n };\n};\n","import { isOwnedByContext } from '../helpers/is-owned-by-context';\nimport { IAudioBufferSourceNode, IMinimalOfflineAudioContext, IOfflineAudioContext } from '../interfaces';\nimport { TAudioBufferSourceNodeRendererFactoryFactory, TNativeAudioBufferSourceNode, TNativeOfflineAudioContext } from '../types';\n\nexport const createAudioBufferSourceNodeRendererFactory: TAudioBufferSourceNodeRendererFactoryFactory = (\n connectAudioParam,\n createNativeAudioBufferSourceNode,\n getNativeAudioNode,\n renderAutomation,\n renderInputsOfAudioNode\n) => {\n return () => {\n const renderedNativeAudioBufferSourceNodes = new WeakMap();\n\n let start: null | [number, number] | [number, number, number] = null;\n let stop: null | number = null;\n\n const createAudioBufferSourceNode = async (\n proxy: IAudioBufferSourceNode,\n nativeOfflineAudioContext: TNativeOfflineAudioContext\n ) => {\n let nativeAudioBufferSourceNode = getNativeAudioNode(proxy);\n\n /*\n * If the initially used nativeAudioBufferSourceNode was not constructed on the same OfflineAudioContext it needs to be created\n * again.\n */\n const nativeAudioBufferSourceNodeIsOwnedByContext = isOwnedByContext(nativeAudioBufferSourceNode, nativeOfflineAudioContext);\n\n if (!nativeAudioBufferSourceNodeIsOwnedByContext) {\n const options = {\n buffer: nativeAudioBufferSourceNode.buffer,\n channelCount: nativeAudioBufferSourceNode.channelCount,\n channelCountMode: nativeAudioBufferSourceNode.channelCountMode,\n channelInterpretation: nativeAudioBufferSourceNode.channelInterpretation,\n // Bug #149: Safari does not yet support the detune AudioParam.\n loop: nativeAudioBufferSourceNode.loop,\n loopEnd: nativeAudioBufferSourceNode.loopEnd,\n loopStart: nativeAudioBufferSourceNode.loopStart,\n playbackRate: nativeAudioBufferSourceNode.playbackRate.value\n };\n\n nativeAudioBufferSourceNode = createNativeAudioBufferSourceNode(nativeOfflineAudioContext, options);\n\n if (start !== null) {\n nativeAudioBufferSourceNode.start(...start);\n }\n\n if (stop !== null) {\n nativeAudioBufferSourceNode.stop(stop);\n }\n }\n\n renderedNativeAudioBufferSourceNodes.set(nativeOfflineAudioContext, nativeAudioBufferSourceNode);\n\n if (!nativeAudioBufferSourceNodeIsOwnedByContext) {\n // Bug #149: Safari does not yet support the detune AudioParam.\n await renderAutomation(nativeOfflineAudioContext, proxy.playbackRate, nativeAudioBufferSourceNode.playbackRate);\n } else {\n // Bug #149: Safari does not yet support the detune AudioParam.\n await connectAudioParam(nativeOfflineAudioContext, proxy.playbackRate, nativeAudioBufferSourceNode.playbackRate);\n }\n\n await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeAudioBufferSourceNode);\n\n return nativeAudioBufferSourceNode;\n };\n\n return {\n set start(value: [number, number] | [number, number, number]) {\n start = value;\n },\n set stop(value: number) {\n stop = value;\n },\n render(\n proxy: IAudioBufferSourceNode,\n nativeOfflineAudioContext: TNativeOfflineAudioContext\n ): Promise {\n const renderedNativeAudioBufferSourceNode = renderedNativeAudioBufferSourceNodes.get(nativeOfflineAudioContext);\n\n if (renderedNativeAudioBufferSourceNode !== undefined) {\n return Promise.resolve(renderedNativeAudioBufferSourceNode);\n }\n\n return createAudioBufferSourceNode(proxy, nativeOfflineAudioContext);\n }\n };\n };\n};\n","import { AutomationEventList } from 'automation-events';\nimport { IAudioNode, IAudioParam, IAudioParamRenderer, IMinimalOfflineAudioContext, IOfflineAudioContext } from '../interfaces';\nimport { TAudioParamFactoryFactory, TContext, TNativeAudioParam } from '../types';\n\nexport const createAudioParamFactory: TAudioParamFactoryFactory = (\n addAudioParamConnections,\n audioParamAudioNodeStore,\n audioParamStore,\n createAudioParamRenderer,\n createCancelAndHoldAutomationEvent,\n createCancelScheduledValuesAutomationEvent,\n createExponentialRampToValueAutomationEvent,\n createLinearRampToValueAutomationEvent,\n createSetTargetAutomationEvent,\n createSetValueAutomationEvent,\n createSetValueCurveAutomationEvent,\n nativeAudioContextConstructor,\n setValueAtTimeUntilPossible\n) => {\n return (\n audioNode: IAudioNode,\n isAudioParamOfOfflineAudioContext: boolean,\n nativeAudioParam: TNativeAudioParam,\n maxValue: null | number = null,\n minValue: null | number = null\n ): IAudioParam => {\n const automationEventList = new AutomationEventList(nativeAudioParam.defaultValue);\n const audioParamRenderer = isAudioParamOfOfflineAudioContext ? createAudioParamRenderer(automationEventList) : null;\n const audioParam = {\n get defaultValue(): number {\n return nativeAudioParam.defaultValue;\n },\n get maxValue(): number {\n return maxValue === null ? nativeAudioParam.maxValue : maxValue;\n },\n get minValue(): number {\n return minValue === null ? nativeAudioParam.minValue : minValue;\n },\n get value(): number {\n return nativeAudioParam.value;\n },\n set value(value) {\n nativeAudioParam.value = value;\n\n // Bug #98: Firefox & Safari do not yet treat the value setter like a call to setValueAtTime().\n audioParam.setValueAtTime(value, audioNode.context.currentTime);\n },\n cancelAndHoldAtTime(cancelTime: number): IAudioParam {\n // Bug #28: Firefox & Safari do not yet implement cancelAndHoldAtTime().\n if (typeof nativeAudioParam.cancelAndHoldAtTime === 'function') {\n if (audioParamRenderer === null) {\n automationEventList.flush(audioNode.context.currentTime);\n }\n\n automationEventList.add(createCancelAndHoldAutomationEvent(cancelTime));\n nativeAudioParam.cancelAndHoldAtTime(cancelTime);\n } else {\n const previousLastEvent = Array.from(automationEventList).pop();\n\n if (audioParamRenderer === null) {\n automationEventList.flush(audioNode.context.currentTime);\n }\n\n automationEventList.add(createCancelAndHoldAutomationEvent(cancelTime));\n\n const currentLastEvent = Array.from(automationEventList).pop();\n\n nativeAudioParam.cancelScheduledValues(cancelTime);\n\n if (previousLastEvent !== currentLastEvent && currentLastEvent !== undefined) {\n if (currentLastEvent.type === 'exponentialRampToValue') {\n nativeAudioParam.exponentialRampToValueAtTime(currentLastEvent.value, currentLastEvent.endTime);\n } else if (currentLastEvent.type === 'linearRampToValue') {\n nativeAudioParam.linearRampToValueAtTime(currentLastEvent.value, currentLastEvent.endTime);\n } else if (currentLastEvent.type === 'setValue') {\n nativeAudioParam.setValueAtTime(currentLastEvent.value, currentLastEvent.startTime);\n } else if (currentLastEvent.type === 'setValueCurve') {\n nativeAudioParam.setValueCurveAtTime(\n currentLastEvent.values,\n currentLastEvent.startTime,\n currentLastEvent.duration\n );\n }\n }\n }\n\n return audioParam;\n },\n cancelScheduledValues(cancelTime: number): IAudioParam {\n if (audioParamRenderer === null) {\n automationEventList.flush(audioNode.context.currentTime);\n }\n\n automationEventList.add(createCancelScheduledValuesAutomationEvent(cancelTime));\n nativeAudioParam.cancelScheduledValues(cancelTime);\n\n return audioParam;\n },\n exponentialRampToValueAtTime(value: number, endTime: number): IAudioParam {\n // Bug #45: Safari does not throw an error yet.\n if (value === 0) {\n throw new RangeError();\n }\n\n // Bug #187: Safari does not throw an error yet.\n if (!Number.isFinite(endTime) || endTime < 0) {\n throw new RangeError();\n }\n\n if (audioParamRenderer === null) {\n automationEventList.flush(audioNode.context.currentTime);\n }\n\n automationEventList.add(createExponentialRampToValueAutomationEvent(value, endTime));\n nativeAudioParam.exponentialRampToValueAtTime(value, endTime);\n\n return audioParam;\n },\n linearRampToValueAtTime(value: number, endTime: number): IAudioParam {\n if (audioParamRenderer === null) {\n automationEventList.flush(audioNode.context.currentTime);\n }\n\n automationEventList.add(createLinearRampToValueAutomationEvent(value, endTime));\n nativeAudioParam.linearRampToValueAtTime(value, endTime);\n\n return audioParam;\n },\n setTargetAtTime(target: number, startTime: number, timeConstant: number): IAudioParam {\n if (audioParamRenderer === null) {\n automationEventList.flush(audioNode.context.currentTime);\n }\n\n automationEventList.add(createSetTargetAutomationEvent(target, startTime, timeConstant));\n nativeAudioParam.setTargetAtTime(target, startTime, timeConstant);\n\n return audioParam;\n },\n setValueAtTime(value: number, startTime: number): IAudioParam {\n if (audioParamRenderer === null) {\n automationEventList.flush(audioNode.context.currentTime);\n }\n\n automationEventList.add(createSetValueAutomationEvent(value, startTime));\n nativeAudioParam.setValueAtTime(value, startTime);\n\n return audioParam;\n },\n setValueCurveAtTime(values: Iterable, startTime: number, duration: number): IAudioParam {\n // Bug 183: Safari only accepts a Float32Array.\n const convertedValues = values instanceof Float32Array ? values : new Float32Array(values);\n /*\n * Bug #152: Safari does not correctly interpolate the values of the curve.\n * @todo Unfortunately there is no way to test for this behavior in a synchronous fashion which is why testing for the\n * existence of the webkitAudioContext is used as a workaround here.\n */\n if (nativeAudioContextConstructor !== null && nativeAudioContextConstructor.name === 'webkitAudioContext') {\n const endTime = startTime + duration;\n const sampleRate = audioNode.context.sampleRate;\n const firstSample = Math.ceil(startTime * sampleRate);\n const lastSample = Math.floor(endTime * sampleRate);\n const numberOfInterpolatedValues = lastSample - firstSample;\n const interpolatedValues = new Float32Array(numberOfInterpolatedValues);\n\n for (let i = 0; i < numberOfInterpolatedValues; i += 1) {\n const theoreticIndex = ((convertedValues.length - 1) / duration) * ((firstSample + i) / sampleRate - startTime);\n const lowerIndex = Math.floor(theoreticIndex);\n const upperIndex = Math.ceil(theoreticIndex);\n\n interpolatedValues[i] =\n lowerIndex === upperIndex\n ? convertedValues[lowerIndex]\n : (1 - (theoreticIndex - lowerIndex)) * convertedValues[lowerIndex] +\n (1 - (upperIndex - theoreticIndex)) * convertedValues[upperIndex];\n }\n\n if (audioParamRenderer === null) {\n automationEventList.flush(audioNode.context.currentTime);\n }\n\n automationEventList.add(createSetValueCurveAutomationEvent(interpolatedValues, startTime, duration));\n nativeAudioParam.setValueCurveAtTime(interpolatedValues, startTime, duration);\n\n const timeOfLastSample = lastSample / sampleRate;\n\n if (timeOfLastSample < endTime) {\n setValueAtTimeUntilPossible(audioParam, interpolatedValues[interpolatedValues.length - 1], timeOfLastSample);\n }\n\n setValueAtTimeUntilPossible(audioParam, convertedValues[convertedValues.length - 1], endTime);\n } else {\n if (audioParamRenderer === null) {\n automationEventList.flush(audioNode.context.currentTime);\n }\n\n automationEventList.add(createSetValueCurveAutomationEvent(convertedValues, startTime, duration));\n nativeAudioParam.setValueCurveAtTime(convertedValues, startTime, duration);\n }\n\n return audioParam;\n }\n };\n\n audioParamStore.set(audioParam, nativeAudioParam);\n audioParamAudioNodeStore.set(audioParam, audioNode);\n\n addAudioParamConnections(\n audioParam,\n audioParamRenderer\n );\n\n return audioParam;\n };\n};\n","import { TAudioParamRendererFactory, TNativeAudioParam } from '../types';\n\nexport const createAudioParamRenderer: TAudioParamRendererFactory = (automationEventList) => {\n return {\n replay(audioParam: TNativeAudioParam): void {\n for (const automationEvent of automationEventList) {\n if (automationEvent.type === 'exponentialRampToValue') {\n const { endTime, value } = automationEvent;\n\n audioParam.exponentialRampToValueAtTime(value, endTime);\n } else if (automationEvent.type === 'linearRampToValue') {\n const { endTime, value } = automationEvent;\n\n audioParam.linearRampToValueAtTime(value, endTime);\n } else if (automationEvent.type === 'setTarget') {\n const { startTime, target, timeConstant } = automationEvent;\n\n audioParam.setTargetAtTime(target, startTime, timeConstant);\n } else if (automationEvent.type === 'setValue') {\n const { startTime, value } = automationEvent;\n\n audioParam.setValueAtTime(value, startTime);\n } else if (automationEvent.type === 'setValueCurve') {\n const { duration, startTime, values } = automationEvent;\n\n audioParam.setValueCurveAtTime(values, startTime, duration);\n } else {\n throw new Error(\"Can't apply an unknown automation.\");\n }\n }\n }\n };\n};\n","import { TSetValueAtTimeUntilPossibleFunction } from '../types';\n\nexport const setValueAtTimeUntilPossible: TSetValueAtTimeUntilPossibleFunction = (audioParam, value, startTime) => {\n try {\n audioParam.setValueAtTime(value, startTime);\n } catch (err) {\n if (err.code !== 9) {\n throw err;\n }\n\n setValueAtTimeUntilPossible(audioParam, value, startTime + 1e-7);\n }\n};\n","import { IAudioDestinationNode } from '../interfaces';\nimport {\n TAudioDestinationNodeConstructorFactory,\n TAudioNodeRenderer,\n TChannelCountMode,\n TContext,\n TNativeAudioDestinationNode\n} from '../types';\n\nexport const createAudioDestinationNodeConstructor: TAudioDestinationNodeConstructorFactory = (\n audioNodeConstructor,\n createAudioDestinationNodeRenderer,\n createIndexSizeError,\n createInvalidStateError,\n createNativeAudioDestinationNode,\n getNativeContext,\n isNativeOfflineAudioContext,\n renderInputsOfAudioNode\n) => {\n return class AudioDestinationNode extends audioNodeConstructor implements IAudioDestinationNode {\n private _isNodeOfNativeOfflineAudioContext: boolean;\n\n private _nativeAudioDestinationNode: TNativeAudioDestinationNode;\n\n constructor(context: T, channelCount: number) {\n const nativeContext = getNativeContext(context);\n const isOffline = isNativeOfflineAudioContext(nativeContext);\n const nativeAudioDestinationNode = createNativeAudioDestinationNode(nativeContext, channelCount, isOffline);\n const audioDestinationNodeRenderer = >(\n (isOffline ? createAudioDestinationNodeRenderer(renderInputsOfAudioNode) : null)\n );\n\n super(context, false, nativeAudioDestinationNode, audioDestinationNodeRenderer);\n\n this._isNodeOfNativeOfflineAudioContext = isOffline;\n this._nativeAudioDestinationNode = nativeAudioDestinationNode;\n }\n\n get channelCount(): number {\n return this._nativeAudioDestinationNode.channelCount;\n }\n\n set channelCount(value) {\n // Bug #52: Chrome, Edge & Safari do not throw an exception at all.\n // Bug #54: Firefox does throw an IndexSizeError.\n if (this._isNodeOfNativeOfflineAudioContext) {\n throw createInvalidStateError();\n }\n\n // Bug #47: The AudioDestinationNode in Safari does not initialize the maxChannelCount property correctly.\n if (value > this._nativeAudioDestinationNode.maxChannelCount) {\n throw createIndexSizeError();\n }\n\n this._nativeAudioDestinationNode.channelCount = value;\n }\n\n get channelCountMode(): TChannelCountMode {\n return this._nativeAudioDestinationNode.channelCountMode;\n }\n\n set channelCountMode(value) {\n // Bug #53: No browser does throw an exception yet.\n if (this._isNodeOfNativeOfflineAudioContext) {\n throw createInvalidStateError();\n }\n\n this._nativeAudioDestinationNode.channelCountMode = value;\n }\n\n get maxChannelCount(): number {\n return this._nativeAudioDestinationNode.maxChannelCount;\n }\n };\n};\n","import { IAudioDestinationNode, IMinimalOfflineAudioContext, IOfflineAudioContext } from '../interfaces';\nimport {\n TAudioDestinationNodeRendererFactory,\n TNativeAudioDestinationNode,\n TNativeOfflineAudioContext,\n TRenderInputsOfAudioNodeFunction\n} from '../types';\n\nexport const createAudioDestinationNodeRenderer: TAudioDestinationNodeRendererFactory = <\n T extends IMinimalOfflineAudioContext | IOfflineAudioContext\n>(\n renderInputsOfAudioNode: TRenderInputsOfAudioNodeFunction\n) => {\n const renderedNativeAudioDestinationNodes = new WeakMap();\n\n const createAudioDestinationNode = async (proxy: IAudioDestinationNode, nativeOfflineAudioContext: TNativeOfflineAudioContext) => {\n const nativeAudioDestinationNode = nativeOfflineAudioContext.destination;\n\n renderedNativeAudioDestinationNodes.set(nativeOfflineAudioContext, nativeAudioDestinationNode);\n\n await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeAudioDestinationNode);\n\n return nativeAudioDestinationNode;\n };\n\n return {\n render(\n proxy: IAudioDestinationNode,\n nativeOfflineAudioContext: TNativeOfflineAudioContext\n ): Promise {\n const renderedNativeAudioDestinationNode = renderedNativeAudioDestinationNodes.get(nativeOfflineAudioContext);\n\n if (renderedNativeAudioDestinationNode !== undefined) {\n return Promise.resolve(renderedNativeAudioDestinationNode);\n }\n\n return createAudioDestinationNode(proxy, nativeOfflineAudioContext);\n }\n };\n};\n","import { TNativeAudioDestinationNode, TNativeAudioDestinationNodeFactoryFactory, TNativeGainNode } from '../types';\n\nexport const createNativeAudioDestinationNodeFactory: TNativeAudioDestinationNodeFactoryFactory = (\n createNativeGainNode,\n overwriteAccessors\n) => {\n return (nativeContext, channelCount, isNodeOfNativeOfflineAudioContext) => {\n const nativeAudioDestinationNode = nativeContext.destination;\n\n // Bug #132: Safari does not have the correct channelCount.\n if (nativeAudioDestinationNode.channelCount !== channelCount) {\n try {\n nativeAudioDestinationNode.channelCount = channelCount;\n } catch {\n // Bug #169: Safari throws an error on each attempt to change the channelCount.\n }\n }\n\n // Bug #83: Safari does not have the correct channelCountMode.\n if (isNodeOfNativeOfflineAudioContext && nativeAudioDestinationNode.channelCountMode !== 'explicit') {\n nativeAudioDestinationNode.channelCountMode = 'explicit';\n }\n\n // Bug #47: The AudioDestinationNode in Safari does not initialize the maxChannelCount property correctly.\n if (nativeAudioDestinationNode.maxChannelCount === 0) {\n Object.defineProperty(nativeAudioDestinationNode, 'maxChannelCount', {\n value: channelCount\n });\n }\n\n // Bug #168: No browser does yet have an AudioDestinationNode with an output.\n const gainNode = createNativeGainNode(nativeContext, {\n channelCount,\n channelCountMode: nativeAudioDestinationNode.channelCountMode,\n channelInterpretation: nativeAudioDestinationNode.channelInterpretation,\n gain: 1\n });\n\n overwriteAccessors(\n gainNode,\n 'channelCount',\n (get) => () => get.call(gainNode),\n (set) => (value) => {\n set.call(gainNode, value);\n\n try {\n nativeAudioDestinationNode.channelCount = value;\n } catch (err) {\n // Bug #169: Safari throws an error on each attempt to change the channelCount.\n if (value > nativeAudioDestinationNode.maxChannelCount) {\n throw err;\n }\n }\n }\n );\n\n overwriteAccessors(\n gainNode,\n 'channelCountMode',\n (get) => () => get.call(gainNode),\n (set) => (value) => {\n set.call(gainNode, value);\n nativeAudioDestinationNode.channelCountMode = value;\n }\n );\n\n overwriteAccessors(\n gainNode,\n 'channelInterpretation',\n (get) => () => get.call(gainNode),\n (set) => (value) => {\n set.call(gainNode, value);\n nativeAudioDestinationNode.channelInterpretation = value;\n }\n );\n\n Object.defineProperty(gainNode, 'maxChannelCount', {\n get: () => nativeAudioDestinationNode.maxChannelCount\n });\n\n // @todo This should be disconnected when the context is closed.\n gainNode.connect(nativeAudioDestinationNode);\n\n return <{ maxChannelCount: TNativeAudioDestinationNode['maxChannelCount'] } & TNativeGainNode>gainNode;\n };\n};\n","import { isOwnedByContext } from '../helpers/is-owned-by-context';\nimport { IBiquadFilterNode, IMinimalOfflineAudioContext, IOfflineAudioContext } from '../interfaces';\nimport { TBiquadFilterNodeRendererFactoryFactory, TNativeBiquadFilterNode, TNativeOfflineAudioContext } from '../types';\n\nexport const createBiquadFilterNodeRendererFactory: TBiquadFilterNodeRendererFactoryFactory = (\n connectAudioParam,\n createNativeBiquadFilterNode,\n getNativeAudioNode,\n renderAutomation,\n renderInputsOfAudioNode\n) => {\n return () => {\n const renderedNativeBiquadFilterNodes = new WeakMap();\n\n const createBiquadFilterNode = async (proxy: IBiquadFilterNode, nativeOfflineAudioContext: TNativeOfflineAudioContext) => {\n let nativeBiquadFilterNode = getNativeAudioNode(proxy);\n\n /*\n * If the initially used nativeBiquadFilterNode was not constructed on the same OfflineAudioContext it needs to be created\n * again.\n */\n const nativeBiquadFilterNodeIsOwnedByContext = isOwnedByContext(nativeBiquadFilterNode, nativeOfflineAudioContext);\n\n if (!nativeBiquadFilterNodeIsOwnedByContext) {\n const options = {\n Q: nativeBiquadFilterNode.Q.value,\n channelCount: nativeBiquadFilterNode.channelCount,\n channelCountMode: nativeBiquadFilterNode.channelCountMode,\n channelInterpretation: nativeBiquadFilterNode.channelInterpretation,\n detune: nativeBiquadFilterNode.detune.value,\n frequency: nativeBiquadFilterNode.frequency.value,\n gain: nativeBiquadFilterNode.gain.value,\n type: nativeBiquadFilterNode.type\n };\n\n nativeBiquadFilterNode = createNativeBiquadFilterNode(nativeOfflineAudioContext, options);\n }\n\n renderedNativeBiquadFilterNodes.set(nativeOfflineAudioContext, nativeBiquadFilterNode);\n\n if (!nativeBiquadFilterNodeIsOwnedByContext) {\n await renderAutomation(nativeOfflineAudioContext, proxy.Q, nativeBiquadFilterNode.Q);\n await renderAutomation(nativeOfflineAudioContext, proxy.detune, nativeBiquadFilterNode.detune);\n await renderAutomation(nativeOfflineAudioContext, proxy.frequency, nativeBiquadFilterNode.frequency);\n await renderAutomation(nativeOfflineAudioContext, proxy.gain, nativeBiquadFilterNode.gain);\n } else {\n await connectAudioParam(nativeOfflineAudioContext, proxy.Q, nativeBiquadFilterNode.Q);\n await connectAudioParam(nativeOfflineAudioContext, proxy.detune, nativeBiquadFilterNode.detune);\n await connectAudioParam(nativeOfflineAudioContext, proxy.frequency, nativeBiquadFilterNode.frequency);\n await connectAudioParam(nativeOfflineAudioContext, proxy.gain, nativeBiquadFilterNode.gain);\n }\n\n await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeBiquadFilterNode);\n\n return nativeBiquadFilterNode;\n };\n\n return {\n render(proxy: IBiquadFilterNode, nativeOfflineAudioContext: TNativeOfflineAudioContext): Promise {\n const renderedNativeBiquadFilterNode = renderedNativeBiquadFilterNodes.get(nativeOfflineAudioContext);\n\n if (renderedNativeBiquadFilterNode !== undefined) {\n return Promise.resolve(renderedNativeBiquadFilterNode);\n }\n\n return createBiquadFilterNode(proxy, nativeOfflineAudioContext);\n }\n };\n };\n};\n","import { TSetAudioNodeTailTimeFactory } from '../types';\n\nexport const createSetAudioNodeTailTime: TSetAudioNodeTailTimeFactory = (audioNodeTailTimeStore) => {\n return (audioNode, tailTime) => audioNodeTailTimeStore.set(audioNode, tailTime);\n};\n","import { TMonitorConnectionsFactory, TNativeAudioNode, TNativeAudioParam } from '../types';\n\nexport const createMonitorConnections: TMonitorConnectionsFactory = (insertElementInSet, isNativeAudioNode) => {\n return (nativeAudioNode, whenConnected, whenDisconnected) => {\n const connections = new Set<[TNativeAudioNode, number, number] | [TNativeAudioParam, number]>();\n\n nativeAudioNode.connect = ((connect) => {\n // tslint:disable-next-line:invalid-void no-inferrable-types\n return (destination: TNativeAudioNode | TNativeAudioParam, output = 0, input: number = 0): void | TNativeAudioNode => {\n const wasDisconnected = connections.size === 0;\n\n if (isNativeAudioNode(destination)) {\n // @todo TypeScript cannot infer the overloaded signature with 3 arguments yet.\n (<(destination: TNativeAudioNode, output?: number, input?: number) => TNativeAudioNode>connect).call(\n nativeAudioNode,\n destination,\n output,\n input\n );\n\n insertElementInSet(\n connections,\n [destination, output, input],\n (connection) => connection[0] === destination && connection[1] === output && connection[2] === input,\n true\n );\n\n if (wasDisconnected) {\n whenConnected();\n }\n\n return destination;\n }\n\n connect.call(nativeAudioNode, destination, output);\n\n insertElementInSet(\n connections,\n [destination, output],\n (connection) => connection[0] === destination && connection[1] === output,\n true\n );\n\n if (wasDisconnected) {\n whenConnected();\n }\n\n return;\n };\n })(nativeAudioNode.connect);\n\n nativeAudioNode.disconnect = ((disconnect) => {\n return (destinationOrOutput?: number | TNativeAudioNode | TNativeAudioParam, output?: number, input?: number): void => {\n const wasConnected = connections.size > 0;\n\n if (destinationOrOutput === undefined) {\n disconnect.apply(nativeAudioNode);\n\n connections.clear();\n } else if (typeof destinationOrOutput === 'number') {\n // @todo TypeScript cannot infer the overloaded signature with 1 argument yet.\n (<(output: number) => void>disconnect).call(nativeAudioNode, destinationOrOutput);\n\n for (const connection of connections) {\n if (connection[1] === destinationOrOutput) {\n connections.delete(connection);\n }\n }\n } else {\n if (isNativeAudioNode(destinationOrOutput)) {\n // @todo TypeScript cannot infer the overloaded signature with 3 arguments yet.\n (<(destination: TNativeAudioNode, output?: number, input?: number) => void>disconnect).call(\n nativeAudioNode,\n destinationOrOutput,\n output,\n input\n );\n } else {\n // @todo TypeScript cannot infer the overloaded signature with 2 arguments yet.\n (<(destination: TNativeAudioParam, output?: number) => void>disconnect).call(\n nativeAudioNode,\n destinationOrOutput,\n output\n );\n }\n\n for (const connection of connections) {\n if (\n connection[0] === destinationOrOutput &&\n (output === undefined || connection[1] === output) &&\n (input === undefined || connection[2] === input)\n ) {\n connections.delete(connection);\n }\n }\n }\n\n const isDisconnected = connections.size === 0;\n\n if (wasConnected && isDisconnected) {\n whenDisconnected();\n }\n };\n })(nativeAudioNode.disconnect);\n\n return nativeAudioNode;\n };\n};\n","import { TWrapChannelMergerNodeFactory } from '../types';\n\nexport const createWrapChannelMergerNode: TWrapChannelMergerNodeFactory = (createInvalidStateError, monitorConnections) => {\n return (nativeContext, channelMergerNode) => {\n // Bug #15: Safari does not return the default properties.\n channelMergerNode.channelCount = 1;\n channelMergerNode.channelCountMode = 'explicit';\n\n // Bug #16: Safari does not throw an error when setting a different channelCount or channelCountMode.\n Object.defineProperty(channelMergerNode, 'channelCount', {\n get: () => 1,\n set: () => {\n throw createInvalidStateError();\n }\n });\n\n Object.defineProperty(channelMergerNode, 'channelCountMode', {\n get: () => 'explicit',\n set: () => {\n throw createInvalidStateError();\n }\n });\n\n // Bug #20: Safari requires a connection of any kind to treat the input signal correctly.\n const audioBufferSourceNode = nativeContext.createBufferSource();\n\n const whenConnected = () => {\n const length = channelMergerNode.numberOfInputs;\n\n for (let i = 0; i < length; i += 1) {\n audioBufferSourceNode.connect(channelMergerNode, 0, i);\n }\n };\n const whenDisconnected = () => audioBufferSourceNode.disconnect(channelMergerNode);\n\n monitorConnections(channelMergerNode, whenConnected, whenDisconnected);\n };\n};\n","import { assignNativeAudioNodeOptions } from '../helpers/assign-native-audio-node-options';\nimport { TNativeChannelMergerNodeFactoryFactory } from '../types';\n\nexport const createNativeChannelMergerNodeFactory: TNativeChannelMergerNodeFactoryFactory = (\n nativeAudioContextConstructor,\n wrapChannelMergerNode\n) => {\n return (nativeContext, options) => {\n const nativeChannelMergerNode = nativeContext.createChannelMerger(options.numberOfInputs);\n\n /*\n * Bug #20: Safari requires a connection of any kind to treat the input signal correctly.\n * @todo Unfortunately there is no way to test for this behavior in a synchronous fashion which is why testing for the existence of\n * the webkitAudioContext is used as a workaround here.\n */\n if (nativeAudioContextConstructor !== null && nativeAudioContextConstructor.name === 'webkitAudioContext') {\n wrapChannelMergerNode(nativeContext, nativeChannelMergerNode);\n }\n\n assignNativeAudioNodeOptions(nativeChannelMergerNode, options);\n\n return nativeChannelMergerNode;\n };\n};\n","import { isOwnedByContext } from '../helpers/is-owned-by-context';\nimport { IAudioNode, IMinimalOfflineAudioContext, IOfflineAudioContext } from '../interfaces';\nimport { TChannelMergerNodeRendererFactoryFactory, TNativeAudioNode, TNativeOfflineAudioContext } from '../types';\n\nexport const createChannelMergerNodeRendererFactory: TChannelMergerNodeRendererFactoryFactory = (\n createNativeChannelMergerNode,\n getNativeAudioNode,\n renderInputsOfAudioNode\n) => {\n return () => {\n const renderedNativeAudioNodes = new WeakMap();\n\n const createAudioNode = async (proxy: IAudioNode, nativeOfflineAudioContext: TNativeOfflineAudioContext) => {\n let nativeAudioNode = getNativeAudioNode(proxy);\n\n // If the initially used nativeAudioNode was not constructed on the same OfflineAudioContext it needs to be created again.\n const nativeAudioNodeIsOwnedByContext = isOwnedByContext(nativeAudioNode, nativeOfflineAudioContext);\n\n if (!nativeAudioNodeIsOwnedByContext) {\n const options = {\n channelCount: nativeAudioNode.channelCount,\n channelCountMode: nativeAudioNode.channelCountMode,\n channelInterpretation: nativeAudioNode.channelInterpretation,\n numberOfInputs: nativeAudioNode.numberOfInputs\n };\n\n nativeAudioNode = createNativeChannelMergerNode(nativeOfflineAudioContext, options);\n }\n\n renderedNativeAudioNodes.set(nativeOfflineAudioContext, nativeAudioNode);\n\n await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeAudioNode);\n\n return nativeAudioNode;\n };\n\n return {\n render(proxy: IAudioNode, nativeOfflineAudioContext: TNativeOfflineAudioContext): Promise {\n const renderedNativeAudioNode = renderedNativeAudioNodes.get(nativeOfflineAudioContext);\n\n if (renderedNativeAudioNode !== undefined) {\n return Promise.resolve(renderedNativeAudioNode);\n }\n\n return createAudioNode(proxy, nativeOfflineAudioContext);\n }\n };\n };\n};\n","import { isOwnedByContext } from '../helpers/is-owned-by-context';\nimport { IAudioNode, IMinimalOfflineAudioContext, IOfflineAudioContext } from '../interfaces';\nimport { TChannelSplitterNodeRendererFactoryFactory, TNativeAudioNode, TNativeOfflineAudioContext } from '../types';\n\nexport const createChannelSplitterNodeRendererFactory: TChannelSplitterNodeRendererFactoryFactory = (\n createNativeChannelSplitterNode,\n getNativeAudioNode,\n renderInputsOfAudioNode\n) => {\n return () => {\n const renderedNativeAudioNodes = new WeakMap();\n\n const createAudioNode = async (proxy: IAudioNode, nativeOfflineAudioContext: TNativeOfflineAudioContext) => {\n let nativeAudioNode = getNativeAudioNode(proxy);\n\n // If the initially used nativeAudioNode was not constructed on the same OfflineAudioContext it needs to be created again.\n const nativeAudioNodeIsOwnedByContext = isOwnedByContext(nativeAudioNode, nativeOfflineAudioContext);\n\n if (!nativeAudioNodeIsOwnedByContext) {\n const options = {\n channelCount: nativeAudioNode.channelCount,\n channelCountMode: nativeAudioNode.channelCountMode,\n channelInterpretation: nativeAudioNode.channelInterpretation,\n numberOfOutputs: nativeAudioNode.numberOfOutputs\n };\n\n nativeAudioNode = createNativeChannelSplitterNode(nativeOfflineAudioContext, options);\n }\n\n renderedNativeAudioNodes.set(nativeOfflineAudioContext, nativeAudioNode);\n\n await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeAudioNode);\n\n return nativeAudioNode;\n };\n\n return {\n render(proxy: IAudioNode, nativeOfflineAudioContext: TNativeOfflineAudioContext): Promise {\n const renderedNativeAudioNode = renderedNativeAudioNodes.get(nativeOfflineAudioContext);\n\n if (renderedNativeAudioNode !== undefined) {\n return Promise.resolve(renderedNativeAudioNode);\n }\n\n return createAudioNode(proxy, nativeOfflineAudioContext);\n }\n };\n };\n};\n","import { TSanitizeChannelSplitterOptionsFunction } from '../types';\n\nexport const sanitizeChannelSplitterOptions: TSanitizeChannelSplitterOptionsFunction = (options) => {\n return { ...options, channelCount: options.numberOfOutputs };\n};\n","import { interceptConnections } from '../helpers/intercept-connections';\nimport {\n TNativeAudioBufferSourceNode,\n TNativeAudioNode,\n TNativeConstantSourceNode,\n TNativeConstantSourceNodeFakerFactoryFactory\n} from '../types';\n\nexport const createNativeConstantSourceNodeFakerFactory: TNativeConstantSourceNodeFakerFactoryFactory = (\n addSilentConnection,\n createNativeAudioBufferSourceNode,\n createNativeGainNode,\n monitorConnections\n) => {\n return (nativeContext, { offset, ...audioNodeOptions }) => {\n const audioBuffer = nativeContext.createBuffer(1, 2, 44100);\n const audioBufferSourceNode = createNativeAudioBufferSourceNode(nativeContext, {\n buffer: null,\n channelCount: 2,\n channelCountMode: 'max',\n channelInterpretation: 'speakers',\n loop: false,\n loopEnd: 0,\n loopStart: 0,\n playbackRate: 1\n });\n const gainNode = createNativeGainNode(nativeContext, { ...audioNodeOptions, gain: offset });\n\n // Bug #5: Safari does not support copyFromChannel() and copyToChannel().\n const channelData = audioBuffer.getChannelData(0);\n\n // Bug #95: Safari does not play or loop one sample buffers.\n channelData[0] = 1;\n channelData[1] = 1;\n\n audioBufferSourceNode.buffer = audioBuffer;\n audioBufferSourceNode.loop = true;\n\n const nativeConstantSourceNodeFaker = {\n get bufferSize(): undefined {\n return undefined;\n },\n get channelCount(): number {\n return gainNode.channelCount;\n },\n set channelCount(value) {\n gainNode.channelCount = value;\n },\n get channelCountMode(): TNativeConstantSourceNode['channelCountMode'] {\n return gainNode.channelCountMode;\n },\n set channelCountMode(value) {\n gainNode.channelCountMode = value;\n },\n get channelInterpretation(): TNativeConstantSourceNode['channelInterpretation'] {\n return gainNode.channelInterpretation;\n },\n set channelInterpretation(value) {\n gainNode.channelInterpretation = value;\n },\n get context(): TNativeConstantSourceNode['context'] {\n return gainNode.context;\n },\n get inputs(): TNativeAudioNode[] {\n return [];\n },\n get numberOfInputs(): number {\n return audioBufferSourceNode.numberOfInputs;\n },\n get numberOfOutputs(): number {\n return gainNode.numberOfOutputs;\n },\n get offset(): TNativeConstantSourceNode['offset'] {\n return gainNode.gain;\n },\n get onended(): TNativeConstantSourceNode['onended'] {\n return audioBufferSourceNode.onended;\n },\n set onended(value) {\n audioBufferSourceNode.onended = value;\n },\n addEventListener(...args: any[]): void {\n return audioBufferSourceNode.addEventListener(args[0], args[1], args[2]);\n },\n dispatchEvent(...args: any[]): boolean {\n return audioBufferSourceNode.dispatchEvent(args[0]);\n },\n removeEventListener(...args: any[]): void {\n return audioBufferSourceNode.removeEventListener(args[0], args[1], args[2]);\n },\n start(when = 0): void {\n audioBufferSourceNode.start.call(audioBufferSourceNode, when);\n },\n stop(when = 0): void {\n audioBufferSourceNode.stop.call(audioBufferSourceNode, when);\n }\n };\n\n const whenConnected = () => audioBufferSourceNode.connect(gainNode);\n const whenDisconnected = () => audioBufferSourceNode.disconnect(gainNode);\n\n // Bug #175: Safari will not fire an ended event if the AudioBufferSourceNode is unconnected.\n addSilentConnection(nativeContext, audioBufferSourceNode);\n\n return monitorConnections(interceptConnections(nativeConstantSourceNodeFaker, gainNode), whenConnected, whenDisconnected);\n };\n};\n","import { assignNativeAudioNodeAudioParamValue } from '../helpers/assign-native-audio-node-audio-param-value';\nimport { assignNativeAudioNodeOptions } from '../helpers/assign-native-audio-node-options';\nimport { wrapAudioScheduledSourceNodeStartMethodNegativeParameters } from '../helpers/wrap-audio-scheduled-source-node-start-method-negative-parameters';\nimport { wrapAudioScheduledSourceNodeStopMethodNegativeParameters } from '../helpers/wrap-audio-scheduled-source-node-stop-method-negative-parameters';\nimport { TNativeConstantSourceNodeFactoryFactory } from '../types';\n\nexport const createNativeConstantSourceNodeFactory: TNativeConstantSourceNodeFactoryFactory = (\n addSilentConnection,\n cacheTestResult,\n createNativeConstantSourceNodeFaker,\n testAudioScheduledSourceNodeStartMethodNegativeParametersSupport,\n testAudioScheduledSourceNodeStopMethodNegativeParametersSupport\n) => {\n return (nativeContext, options) => {\n // Bug #62: Safari does not support ConstantSourceNodes.\n if (nativeContext.createConstantSource === undefined) {\n return createNativeConstantSourceNodeFaker(nativeContext, options);\n }\n\n const nativeConstantSourceNode = nativeContext.createConstantSource();\n\n assignNativeAudioNodeOptions(nativeConstantSourceNode, options);\n\n assignNativeAudioNodeAudioParamValue(nativeConstantSourceNode, options, 'offset');\n\n // Bug #44: Safari does not throw a RangeError yet.\n if (\n !cacheTestResult(testAudioScheduledSourceNodeStartMethodNegativeParametersSupport, () =>\n testAudioScheduledSourceNodeStartMethodNegativeParametersSupport(nativeContext)\n )\n ) {\n wrapAudioScheduledSourceNodeStartMethodNegativeParameters(nativeConstantSourceNode);\n }\n\n // Bug #44: Only Firefox does not throw a RangeError yet.\n if (\n !cacheTestResult(testAudioScheduledSourceNodeStopMethodNegativeParametersSupport, () =>\n testAudioScheduledSourceNodeStopMethodNegativeParametersSupport(nativeContext)\n )\n ) {\n wrapAudioScheduledSourceNodeStopMethodNegativeParameters(nativeConstantSourceNode);\n }\n\n // Bug #175: Safari will not fire an ended event if the ConstantSourceNode is unconnected.\n addSilentConnection(nativeContext, nativeConstantSourceNode);\n\n return nativeConstantSourceNode;\n };\n};\n","import { isOwnedByContext } from '../helpers/is-owned-by-context';\nimport { IConstantSourceNode, IMinimalOfflineAudioContext, IOfflineAudioContext } from '../interfaces';\nimport { TConstantSourceNodeRendererFactoryFactory, TNativeConstantSourceNode, TNativeOfflineAudioContext } from '../types';\n\nexport const createConstantSourceNodeRendererFactory: TConstantSourceNodeRendererFactoryFactory = (\n connectAudioParam,\n createNativeConstantSourceNode,\n getNativeAudioNode,\n renderAutomation,\n renderInputsOfAudioNode\n) => {\n return () => {\n const renderedNativeConstantSourceNodes = new WeakMap();\n\n let start: null | number = null;\n let stop: null | number = null;\n\n const createConstantSourceNode = async (proxy: IConstantSourceNode, nativeOfflineAudioContext: TNativeOfflineAudioContext) => {\n let nativeConstantSourceNode = getNativeAudioNode(proxy);\n\n /*\n * If the initially used nativeConstantSourceNode was not constructed on the same OfflineAudioContext it needs to be created\n * again.\n */\n const nativeConstantSourceNodeIsOwnedByContext = isOwnedByContext(nativeConstantSourceNode, nativeOfflineAudioContext);\n\n if (!nativeConstantSourceNodeIsOwnedByContext) {\n const options = {\n channelCount: nativeConstantSourceNode.channelCount,\n channelCountMode: nativeConstantSourceNode.channelCountMode,\n channelInterpretation: nativeConstantSourceNode.channelInterpretation,\n offset: nativeConstantSourceNode.offset.value\n };\n\n nativeConstantSourceNode = createNativeConstantSourceNode(nativeOfflineAudioContext, options);\n\n if (start !== null) {\n nativeConstantSourceNode.start(start);\n }\n\n if (stop !== null) {\n nativeConstantSourceNode.stop(stop);\n }\n }\n\n renderedNativeConstantSourceNodes.set(nativeOfflineAudioContext, nativeConstantSourceNode);\n\n if (!nativeConstantSourceNodeIsOwnedByContext) {\n await renderAutomation(nativeOfflineAudioContext, proxy.offset, nativeConstantSourceNode.offset);\n } else {\n await connectAudioParam(nativeOfflineAudioContext, proxy.offset, nativeConstantSourceNode.offset);\n }\n\n await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeConstantSourceNode);\n\n return nativeConstantSourceNode;\n };\n\n return {\n set start(value: number) {\n start = value;\n },\n set stop(value: number) {\n stop = value;\n },\n render(\n proxy: IConstantSourceNode,\n nativeOfflineAudioContext: TNativeOfflineAudioContext\n ): Promise {\n const renderedNativeConstantSourceNode = renderedNativeConstantSourceNodes.get(nativeOfflineAudioContext);\n\n if (renderedNativeConstantSourceNode !== undefined) {\n return Promise.resolve(renderedNativeConstantSourceNode);\n }\n\n return createConstantSourceNode(proxy, nativeOfflineAudioContext);\n }\n };\n };\n};\n","import { assignNativeAudioNodeOption } from '../helpers/assign-native-audio-node-option';\nimport { assignNativeAudioNodeOptions } from '../helpers/assign-native-audio-node-options';\nimport { TNativeConvolverNodeFactoryFactory } from '../types';\n\nexport const createNativeConvolverNodeFactory: TNativeConvolverNodeFactoryFactory = (createNotSupportedError, overwriteAccessors) => {\n return (nativeContext, options) => {\n const nativeConvolverNode = nativeContext.createConvolver();\n\n assignNativeAudioNodeOptions(nativeConvolverNode, options);\n\n // The normalize property needs to be set before setting the buffer.\n if (options.disableNormalization === nativeConvolverNode.normalize) {\n nativeConvolverNode.normalize = !options.disableNormalization;\n }\n\n assignNativeAudioNodeOption(nativeConvolverNode, options, 'buffer');\n\n // Bug #113: Safari does allow to set the channelCount to a value larger than 2.\n if (options.channelCount > 2) {\n throw createNotSupportedError();\n }\n\n overwriteAccessors(\n nativeConvolverNode,\n 'channelCount',\n (get) => () => get.call(nativeConvolverNode),\n (set) => (value) => {\n if (value > 2) {\n throw createNotSupportedError();\n }\n\n return set.call(nativeConvolverNode, value);\n }\n );\n\n // Bug #114: Safari allows to set the channelCountMode to 'max'.\n if (options.channelCountMode === 'max') {\n throw createNotSupportedError();\n }\n\n overwriteAccessors(\n nativeConvolverNode,\n 'channelCountMode',\n (get) => () => get.call(nativeConvolverNode),\n (set) => (value) => {\n if (value === 'max') {\n throw createNotSupportedError();\n }\n\n return set.call(nativeConvolverNode, value);\n }\n );\n\n return nativeConvolverNode;\n };\n};\n","import { isNativeAudioNodeFaker } from '../guards/native-audio-node-faker';\nimport { isOwnedByContext } from '../helpers/is-owned-by-context';\nimport { IConvolverNode, IMinimalOfflineAudioContext, IOfflineAudioContext } from '../interfaces';\nimport { TConvolverNodeRendererFactoryFactory, TNativeConvolverNode, TNativeOfflineAudioContext } from '../types';\n\nexport const createConvolverNodeRendererFactory: TConvolverNodeRendererFactoryFactory = (\n createNativeConvolverNode,\n getNativeAudioNode,\n renderInputsOfAudioNode\n) => {\n return () => {\n const renderedNativeConvolverNodes = new WeakMap();\n\n const createConvolverNode = async (proxy: IConvolverNode, nativeOfflineAudioContext: TNativeOfflineAudioContext) => {\n let nativeConvolverNode = getNativeAudioNode(proxy);\n\n // If the initially used nativeConvolverNode was not constructed on the same OfflineAudioContext it needs to be created again.\n const nativeConvolverNodeIsOwnedByContext = isOwnedByContext(nativeConvolverNode, nativeOfflineAudioContext);\n\n if (!nativeConvolverNodeIsOwnedByContext) {\n const options = {\n buffer: nativeConvolverNode.buffer,\n channelCount: nativeConvolverNode.channelCount,\n channelCountMode: nativeConvolverNode.channelCountMode,\n channelInterpretation: nativeConvolverNode.channelInterpretation,\n disableNormalization: !nativeConvolverNode.normalize\n };\n\n nativeConvolverNode = createNativeConvolverNode(nativeOfflineAudioContext, options);\n }\n\n renderedNativeConvolverNodes.set(nativeOfflineAudioContext, nativeConvolverNode);\n\n if (isNativeAudioNodeFaker(nativeConvolverNode)) {\n await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeConvolverNode.inputs[0]);\n } else {\n await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeConvolverNode);\n }\n\n return nativeConvolverNode;\n };\n\n return {\n render(proxy: IConvolverNode, nativeOfflineAudioContext: TNativeOfflineAudioContext): Promise {\n const renderedNativeConvolverNode = renderedNativeConvolverNodes.get(nativeOfflineAudioContext);\n\n if (renderedNativeConvolverNode !== undefined) {\n return Promise.resolve(renderedNativeConvolverNode);\n }\n\n return createConvolverNode(proxy, nativeOfflineAudioContext);\n }\n };\n };\n};\n","import { isOwnedByContext } from '../helpers/is-owned-by-context';\nimport { IDelayNode, IMinimalOfflineAudioContext, IOfflineAudioContext } from '../interfaces';\nimport { TDelayNodeRendererFactoryFactory, TNativeDelayNode, TNativeOfflineAudioContext } from '../types';\n\nexport const createDelayNodeRendererFactory: TDelayNodeRendererFactoryFactory = (\n connectAudioParam,\n createNativeDelayNode,\n getNativeAudioNode,\n renderAutomation,\n renderInputsOfAudioNode\n) => {\n return (maxDelayTime: number) => {\n const renderedNativeDelayNodes = new WeakMap();\n\n const createDelayNode = async (proxy: IDelayNode, nativeOfflineAudioContext: TNativeOfflineAudioContext) => {\n let nativeDelayNode = getNativeAudioNode(proxy);\n\n // If the initially used nativeDelayNode was not constructed on the same OfflineAudioContext it needs to be created again.\n const nativeDelayNodeIsOwnedByContext = isOwnedByContext(nativeDelayNode, nativeOfflineAudioContext);\n\n if (!nativeDelayNodeIsOwnedByContext) {\n const options = {\n channelCount: nativeDelayNode.channelCount,\n channelCountMode: nativeDelayNode.channelCountMode,\n channelInterpretation: nativeDelayNode.channelInterpretation,\n delayTime: nativeDelayNode.delayTime.value,\n maxDelayTime\n };\n\n nativeDelayNode = createNativeDelayNode(nativeOfflineAudioContext, options);\n }\n\n renderedNativeDelayNodes.set(nativeOfflineAudioContext, nativeDelayNode);\n\n if (!nativeDelayNodeIsOwnedByContext) {\n await renderAutomation(nativeOfflineAudioContext, proxy.delayTime, nativeDelayNode.delayTime);\n } else {\n await connectAudioParam(nativeOfflineAudioContext, proxy.delayTime, nativeDelayNode.delayTime);\n }\n\n await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeDelayNode);\n\n return nativeDelayNode;\n };\n\n return {\n render(proxy: IDelayNode, nativeOfflineAudioContext: TNativeOfflineAudioContext): Promise {\n const renderedNativeDelayNode = renderedNativeDelayNodes.get(nativeOfflineAudioContext);\n\n if (renderedNativeDelayNode !== undefined) {\n return Promise.resolve(renderedNativeDelayNode);\n }\n\n return createDelayNode(proxy, nativeOfflineAudioContext);\n }\n };\n };\n};\n","import { assignNativeAudioNodeAudioParamValue } from '../helpers/assign-native-audio-node-audio-param-value';\nimport { assignNativeAudioNodeOptions } from '../helpers/assign-native-audio-node-options';\nimport { TNativeDynamicsCompressorNodeFactoryFactory } from '../types';\n\nexport const createNativeDynamicsCompressorNodeFactory: TNativeDynamicsCompressorNodeFactoryFactory = (createNotSupportedError) => {\n return (nativeContext, options) => {\n const nativeDynamicsCompressorNode = nativeContext.createDynamicsCompressor();\n\n assignNativeAudioNodeOptions(nativeDynamicsCompressorNode, options);\n\n // Bug #108: Safari allows a channelCount of three and above.\n if (options.channelCount > 2) {\n throw createNotSupportedError();\n }\n\n // Bug #109: Only Chrome and Firefox disallow a channelCountMode of 'max'.\n if (options.channelCountMode === 'max') {\n throw createNotSupportedError();\n }\n\n assignNativeAudioNodeAudioParamValue(nativeDynamicsCompressorNode, options, 'attack');\n assignNativeAudioNodeAudioParamValue(nativeDynamicsCompressorNode, options, 'knee');\n assignNativeAudioNodeAudioParamValue(nativeDynamicsCompressorNode, options, 'ratio');\n assignNativeAudioNodeAudioParamValue(nativeDynamicsCompressorNode, options, 'release');\n assignNativeAudioNodeAudioParamValue(nativeDynamicsCompressorNode, options, 'threshold');\n\n return nativeDynamicsCompressorNode;\n };\n};\n","import { isOwnedByContext } from '../helpers/is-owned-by-context';\nimport { IDynamicsCompressorNode, IMinimalOfflineAudioContext, IOfflineAudioContext } from '../interfaces';\nimport { TDynamicsCompressorNodeRendererFactoryFactory, TNativeDynamicsCompressorNode, TNativeOfflineAudioContext } from '../types';\n\nexport const createDynamicsCompressorNodeRendererFactory: TDynamicsCompressorNodeRendererFactoryFactory = (\n connectAudioParam,\n createNativeDynamicsCompressorNode,\n getNativeAudioNode,\n renderAutomation,\n renderInputsOfAudioNode\n) => {\n return () => {\n const renderedNativeDynamicsCompressorNodes = new WeakMap();\n\n const createDynamicsCompressorNode = async (\n proxy: IDynamicsCompressorNode,\n nativeOfflineAudioContext: TNativeOfflineAudioContext\n ) => {\n let nativeDynamicsCompressorNode = getNativeAudioNode(proxy);\n\n /*\n * If the initially used nativeDynamicsCompressorNode was not constructed on the same OfflineAudioContext it needs to be\n * created again.\n */\n const nativeDynamicsCompressorNodeIsOwnedByContext = isOwnedByContext(nativeDynamicsCompressorNode, nativeOfflineAudioContext);\n\n if (!nativeDynamicsCompressorNodeIsOwnedByContext) {\n const options = {\n attack: nativeDynamicsCompressorNode.attack.value,\n channelCount: nativeDynamicsCompressorNode.channelCount,\n channelCountMode: nativeDynamicsCompressorNode.channelCountMode,\n channelInterpretation: nativeDynamicsCompressorNode.channelInterpretation,\n knee: nativeDynamicsCompressorNode.knee.value,\n ratio: nativeDynamicsCompressorNode.ratio.value,\n release: nativeDynamicsCompressorNode.release.value,\n threshold: nativeDynamicsCompressorNode.threshold.value\n };\n\n nativeDynamicsCompressorNode = createNativeDynamicsCompressorNode(nativeOfflineAudioContext, options);\n }\n\n renderedNativeDynamicsCompressorNodes.set(nativeOfflineAudioContext, nativeDynamicsCompressorNode);\n\n if (!nativeDynamicsCompressorNodeIsOwnedByContext) {\n await renderAutomation(nativeOfflineAudioContext, proxy.attack, nativeDynamicsCompressorNode.attack);\n await renderAutomation(nativeOfflineAudioContext, proxy.knee, nativeDynamicsCompressorNode.knee);\n await renderAutomation(nativeOfflineAudioContext, proxy.ratio, nativeDynamicsCompressorNode.ratio);\n await renderAutomation(nativeOfflineAudioContext, proxy.release, nativeDynamicsCompressorNode.release);\n await renderAutomation(nativeOfflineAudioContext, proxy.threshold, nativeDynamicsCompressorNode.threshold);\n } else {\n await connectAudioParam(nativeOfflineAudioContext, proxy.attack, nativeDynamicsCompressorNode.attack);\n await connectAudioParam(nativeOfflineAudioContext, proxy.knee, nativeDynamicsCompressorNode.knee);\n await connectAudioParam(nativeOfflineAudioContext, proxy.ratio, nativeDynamicsCompressorNode.ratio);\n await connectAudioParam(nativeOfflineAudioContext, proxy.release, nativeDynamicsCompressorNode.release);\n await connectAudioParam(nativeOfflineAudioContext, proxy.threshold, nativeDynamicsCompressorNode.threshold);\n }\n\n await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeDynamicsCompressorNode);\n\n return nativeDynamicsCompressorNode;\n };\n\n return {\n render(\n proxy: IDynamicsCompressorNode,\n nativeOfflineAudioContext: TNativeOfflineAudioContext\n ): Promise {\n const renderedNativeDynamicsCompressorNode = renderedNativeDynamicsCompressorNodes.get(nativeOfflineAudioContext);\n\n if (renderedNativeDynamicsCompressorNode !== undefined) {\n return Promise.resolve(renderedNativeDynamicsCompressorNode);\n }\n\n return createDynamicsCompressorNode(proxy, nativeOfflineAudioContext);\n }\n };\n };\n};\n","import { isOwnedByContext } from '../helpers/is-owned-by-context';\nimport { IGainNode, IMinimalOfflineAudioContext, IOfflineAudioContext } from '../interfaces';\nimport { TGainNodeRendererFactoryFactory, TNativeGainNode, TNativeOfflineAudioContext } from '../types';\n\nexport const createGainNodeRendererFactory: TGainNodeRendererFactoryFactory = (\n connectAudioParam,\n createNativeGainNode,\n getNativeAudioNode,\n renderAutomation,\n renderInputsOfAudioNode\n) => {\n return () => {\n const renderedNativeGainNodes = new WeakMap();\n\n const createGainNode = async (proxy: IGainNode, nativeOfflineAudioContext: TNativeOfflineAudioContext) => {\n let nativeGainNode = getNativeAudioNode(proxy);\n\n // If the initially used nativeGainNode was not constructed on the same OfflineAudioContext it needs to be created again.\n const nativeGainNodeIsOwnedByContext = isOwnedByContext(nativeGainNode, nativeOfflineAudioContext);\n\n if (!nativeGainNodeIsOwnedByContext) {\n const options = {\n channelCount: nativeGainNode.channelCount,\n channelCountMode: nativeGainNode.channelCountMode,\n channelInterpretation: nativeGainNode.channelInterpretation,\n gain: nativeGainNode.gain.value\n };\n\n nativeGainNode = createNativeGainNode(nativeOfflineAudioContext, options);\n }\n\n renderedNativeGainNodes.set(nativeOfflineAudioContext, nativeGainNode);\n\n if (!nativeGainNodeIsOwnedByContext) {\n await renderAutomation(nativeOfflineAudioContext, proxy.gain, nativeGainNode.gain);\n } else {\n await connectAudioParam(nativeOfflineAudioContext, proxy.gain, nativeGainNode.gain);\n }\n\n await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeGainNode);\n\n return nativeGainNode;\n };\n\n return {\n render(proxy: IGainNode, nativeOfflineAudioContext: TNativeOfflineAudioContext): Promise {\n const renderedNativeGainNode = renderedNativeGainNodes.get(nativeOfflineAudioContext);\n\n if (renderedNativeGainNode !== undefined) {\n return Promise.resolve(renderedNativeGainNode);\n }\n\n return createGainNode(proxy, nativeOfflineAudioContext);\n }\n };\n };\n};\n","import { testPromiseSupport } from '../helpers/test-promise-support';\nimport { IOfflineAudioCompletionEvent } from '../interfaces';\nimport { TNativeAudioBuffer, TRenderNativeOfflineAudioContextFactory } from '../types';\n\nexport const createRenderNativeOfflineAudioContext: TRenderNativeOfflineAudioContextFactory = (\n cacheTestResult,\n createNativeGainNode,\n createNativeScriptProcessorNode,\n testOfflineAudioContextCurrentTimeSupport\n) => {\n return (nativeOfflineAudioContext) => {\n // Bug #21: Safari does not support promises yet.\n if (cacheTestResult(testPromiseSupport, () => testPromiseSupport(nativeOfflineAudioContext))) {\n // Bug #158: Chrome and Edge do not advance currentTime if it is not accessed while rendering the audio.\n return Promise.resolve(\n cacheTestResult(testOfflineAudioContextCurrentTimeSupport, testOfflineAudioContextCurrentTimeSupport)\n ).then((isOfflineAudioContextCurrentTimeSupported) => {\n if (!isOfflineAudioContextCurrentTimeSupported) {\n const scriptProcessorNode = createNativeScriptProcessorNode(nativeOfflineAudioContext, 512, 0, 1);\n\n nativeOfflineAudioContext.oncomplete = () => {\n scriptProcessorNode.onaudioprocess = null; // tslint:disable-line:deprecation\n scriptProcessorNode.disconnect();\n };\n scriptProcessorNode.onaudioprocess = () => nativeOfflineAudioContext.currentTime; // tslint:disable-line:deprecation\n\n scriptProcessorNode.connect(nativeOfflineAudioContext.destination);\n }\n\n return nativeOfflineAudioContext.startRendering();\n });\n }\n\n return new Promise((resolve) => {\n // Bug #48: Safari does not render an OfflineAudioContext without any connected node.\n const gainNode = createNativeGainNode(nativeOfflineAudioContext, {\n channelCount: 1,\n channelCountMode: 'explicit',\n channelInterpretation: 'discrete',\n gain: 0\n });\n\n nativeOfflineAudioContext.oncomplete = (event: IOfflineAudioCompletionEvent) => {\n gainNode.disconnect();\n\n resolve(event.renderedBuffer);\n };\n\n gainNode.connect(nativeOfflineAudioContext.destination);\n\n nativeOfflineAudioContext.startRendering();\n });\n };\n};\n","import { TTestOfflineAudioContextCurrentTimeSupportFactory } from '../types';\n\nexport const createTestOfflineAudioContextCurrentTimeSupport: TTestOfflineAudioContextCurrentTimeSupportFactory = (\n createNativeGainNode,\n nativeOfflineAudioContextConstructor\n) => {\n return () => {\n if (nativeOfflineAudioContextConstructor === null) {\n return Promise.resolve(false);\n }\n\n const nativeOfflineAudioContext = new nativeOfflineAudioContextConstructor(1, 1, 44100);\n\n // Bug #48: Safari does not render an OfflineAudioContext without any connected node.\n const gainNode = createNativeGainNode(nativeOfflineAudioContext, {\n channelCount: 1,\n channelCountMode: 'explicit',\n channelInterpretation: 'discrete',\n gain: 0\n });\n\n // Bug #21: Safari does not support promises yet.\n return new Promise((resolve) => {\n nativeOfflineAudioContext.oncomplete = () => {\n gainNode.disconnect();\n\n resolve(nativeOfflineAudioContext.currentTime !== 0);\n };\n nativeOfflineAudioContext.startRendering();\n });\n };\n};\n","import { assignNativeAudioNodeOptions } from '../helpers/assign-native-audio-node-options';\nimport { TNativeIIRFilterNodeFactoryFactory } from '../types';\n\nexport const createNativeIIRFilterNodeFactory: TNativeIIRFilterNodeFactoryFactory = (createNativeIIRFilterNodeFaker) => {\n return (nativeContext, baseLatency, options) => {\n // Bug #9: Safari does not support IIRFilterNodes.\n if (nativeContext.createIIRFilter === undefined) {\n return createNativeIIRFilterNodeFaker(nativeContext, baseLatency, options);\n }\n\n // @todo TypeScript defines the parameters of createIIRFilter() as arrays of numbers.\n const nativeIIRFilterNode = nativeContext.createIIRFilter(options.feedforward, options.feedback);\n\n assignNativeAudioNodeOptions(nativeIIRFilterNode, options);\n\n return nativeIIRFilterNode;\n };\n};\n","import { createInvalidAccessError } from '../factories/invalid-access-error';\nimport { TNativeIIRFilterNode } from '../types';\n\nexport const wrapIIRFilterNodeGetFrequencyResponseMethod = (nativeIIRFilterNode: TNativeIIRFilterNode): void => {\n nativeIIRFilterNode.getFrequencyResponse = ((getFrequencyResponse) => {\n return (frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array) => {\n if (frequencyHz.length !== magResponse.length || magResponse.length !== phaseResponse.length) {\n throw createInvalidAccessError();\n }\n\n return getFrequencyResponse.call(nativeIIRFilterNode, frequencyHz, magResponse, phaseResponse);\n };\n })(nativeIIRFilterNode.getFrequencyResponse);\n};\n","import { MOST_NEGATIVE_SINGLE_FLOAT, MOST_POSITIVE_SINGLE_FLOAT } from '../constants';\nimport { IAudioParam } from '../interfaces';\nimport { TAudioListenerFactoryFactory } from '../types';\n\nexport const createAudioListenerFactory: TAudioListenerFactoryFactory = (\n createAudioParam,\n createNativeChannelMergerNode,\n createNativeConstantSourceNode,\n createNativeScriptProcessorNode,\n createNotSupportedError,\n getFirstSample,\n isNativeOfflineAudioContext,\n overwriteAccessors\n) => {\n return (context, nativeContext) => {\n const nativeListener = nativeContext.listener;\n\n // Bug #117: Only Chrome & Edge support the new interface already.\n const createFakeAudioParams = () => {\n const buffer = new Float32Array(1);\n const channelMergerNode = createNativeChannelMergerNode(nativeContext, {\n channelCount: 1,\n channelCountMode: 'explicit',\n channelInterpretation: 'speakers',\n numberOfInputs: 9\n });\n const isOffline = isNativeOfflineAudioContext(nativeContext);\n\n let isScriptProcessorNodeCreated = false;\n let lastOrientation: [number, number, number, number, number, number] = [0, 0, -1, 0, 1, 0];\n let lastPosition: [number, number, number] = [0, 0, 0];\n\n const createScriptProcessorNode = () => {\n if (isScriptProcessorNodeCreated) {\n return;\n }\n\n isScriptProcessorNodeCreated = true;\n\n const scriptProcessorNode = createNativeScriptProcessorNode(nativeContext, 256, 9, 0);\n\n // tslint:disable-next-line:deprecation\n scriptProcessorNode.onaudioprocess = ({ inputBuffer }) => {\n const orientation: [number, number, number, number, number, number] = [\n getFirstSample(inputBuffer, buffer, 0),\n getFirstSample(inputBuffer, buffer, 1),\n getFirstSample(inputBuffer, buffer, 2),\n getFirstSample(inputBuffer, buffer, 3),\n getFirstSample(inputBuffer, buffer, 4),\n getFirstSample(inputBuffer, buffer, 5)\n ];\n\n if (orientation.some((value, index) => value !== lastOrientation[index])) {\n nativeListener.setOrientation(...orientation); // tslint:disable-line:deprecation\n\n lastOrientation = orientation;\n }\n\n const positon: [number, number, number] = [\n getFirstSample(inputBuffer, buffer, 6),\n getFirstSample(inputBuffer, buffer, 7),\n getFirstSample(inputBuffer, buffer, 8)\n ];\n\n if (positon.some((value, index) => value !== lastPosition[index])) {\n nativeListener.setPosition(...positon); // tslint:disable-line:deprecation\n\n lastPosition = positon;\n }\n };\n\n channelMergerNode.connect(scriptProcessorNode);\n };\n const createSetOrientation = (index: number) => (value: number) => {\n if (value !== lastOrientation[index]) {\n lastOrientation[index] = value;\n\n nativeListener.setOrientation(...lastOrientation); // tslint:disable-line:deprecation\n }\n };\n const createSetPosition = (index: number) => (value: number) => {\n if (value !== lastPosition[index]) {\n lastPosition[index] = value;\n\n nativeListener.setPosition(...lastPosition); // tslint:disable-line:deprecation\n }\n };\n const createFakeAudioParam = (input: number, initialValue: number, setValue: (value: number) => void) => {\n const constantSourceNode = createNativeConstantSourceNode(nativeContext, {\n channelCount: 1,\n channelCountMode: 'explicit',\n channelInterpretation: 'discrete',\n offset: initialValue\n });\n\n constantSourceNode.connect(channelMergerNode, 0, input);\n\n // @todo This should be stopped when the context is closed.\n constantSourceNode.start();\n\n Object.defineProperty(constantSourceNode.offset, 'defaultValue', {\n get(): number {\n return initialValue;\n }\n });\n\n /*\n * Bug #62 & #74: Safari does not support ConstantSourceNodes and does not export the correct values for maxValue and\n * minValue for GainNodes.\n */\n const audioParam = createAudioParam(\n { context },\n isOffline,\n constantSourceNode.offset,\n MOST_POSITIVE_SINGLE_FLOAT,\n MOST_NEGATIVE_SINGLE_FLOAT\n );\n\n overwriteAccessors(\n audioParam,\n 'value',\n (get) => () => get.call(audioParam),\n (set) => (value) => {\n try {\n set.call(audioParam, value);\n } catch (err) {\n if (err.code !== 9) {\n throw err;\n }\n }\n\n createScriptProcessorNode();\n\n if (isOffline) {\n // Bug #117: Using setOrientation() and setPosition() doesn't work with an OfflineAudioContext.\n setValue(value);\n }\n }\n );\n\n audioParam.cancelAndHoldAtTime = ((cancelAndHoldAtTime) => {\n if (isOffline) {\n return () => {\n throw createNotSupportedError();\n };\n }\n\n return (...args: Parameters) => {\n const value = cancelAndHoldAtTime.apply(audioParam, args);\n\n createScriptProcessorNode();\n\n return value;\n };\n })(audioParam.cancelAndHoldAtTime);\n audioParam.cancelScheduledValues = ((cancelScheduledValues) => {\n if (isOffline) {\n return () => {\n throw createNotSupportedError();\n };\n }\n\n return (...args: Parameters) => {\n const value = cancelScheduledValues.apply(audioParam, args);\n\n createScriptProcessorNode();\n\n return value;\n };\n })(audioParam.cancelScheduledValues);\n audioParam.exponentialRampToValueAtTime = ((exponentialRampToValueAtTime) => {\n if (isOffline) {\n return () => {\n throw createNotSupportedError();\n };\n }\n\n return (...args: Parameters) => {\n const value = exponentialRampToValueAtTime.apply(audioParam, args);\n\n createScriptProcessorNode();\n\n return value;\n };\n })(audioParam.exponentialRampToValueAtTime);\n audioParam.linearRampToValueAtTime = ((linearRampToValueAtTime) => {\n if (isOffline) {\n return () => {\n throw createNotSupportedError();\n };\n }\n\n return (...args: Parameters) => {\n const value = linearRampToValueAtTime.apply(audioParam, args);\n\n createScriptProcessorNode();\n\n return value;\n };\n })(audioParam.linearRampToValueAtTime);\n audioParam.setTargetAtTime = ((setTargetAtTime) => {\n if (isOffline) {\n return () => {\n throw createNotSupportedError();\n };\n }\n\n return (...args: Parameters) => {\n const value = setTargetAtTime.apply(audioParam, args);\n\n createScriptProcessorNode();\n\n return value;\n };\n })(audioParam.setTargetAtTime);\n audioParam.setValueAtTime = ((setValueAtTime) => {\n if (isOffline) {\n return () => {\n throw createNotSupportedError();\n };\n }\n\n return (...args: Parameters) => {\n const value = setValueAtTime.apply(audioParam, args);\n\n createScriptProcessorNode();\n\n return value;\n };\n })(audioParam.setValueAtTime);\n audioParam.setValueCurveAtTime = ((setValueCurveAtTime) => {\n if (isOffline) {\n return () => {\n throw createNotSupportedError();\n };\n }\n\n return (...args: Parameters) => {\n const value = setValueCurveAtTime.apply(audioParam, args);\n\n createScriptProcessorNode();\n\n return value;\n };\n })(audioParam.setValueCurveAtTime);\n\n return audioParam;\n };\n\n return {\n forwardX: createFakeAudioParam(0, 0, createSetOrientation(0)),\n forwardY: createFakeAudioParam(1, 0, createSetOrientation(1)),\n forwardZ: createFakeAudioParam(2, -1, createSetOrientation(2)),\n positionX: createFakeAudioParam(6, 0, createSetPosition(0)),\n positionY: createFakeAudioParam(7, 0, createSetPosition(1)),\n positionZ: createFakeAudioParam(8, 0, createSetPosition(2)),\n upX: createFakeAudioParam(3, 0, createSetOrientation(3)),\n upY: createFakeAudioParam(4, 1, createSetOrientation(4)),\n upZ: createFakeAudioParam(5, 0, createSetOrientation(5))\n };\n };\n\n const { forwardX, forwardY, forwardZ, positionX, positionY, positionZ, upX, upY, upZ } =\n nativeListener.forwardX === undefined ? createFakeAudioParams() : nativeListener;\n\n return {\n get forwardX(): IAudioParam {\n return forwardX;\n },\n get forwardY(): IAudioParam {\n return forwardY;\n },\n get forwardZ(): IAudioParam {\n return forwardZ;\n },\n get positionX(): IAudioParam {\n return positionX;\n },\n get positionY(): IAudioParam {\n return positionY;\n },\n get positionZ(): IAudioParam {\n return positionZ;\n },\n get upX(): IAudioParam {\n return upX;\n },\n get upY(): IAudioParam {\n return upY;\n },\n get upZ(): IAudioParam {\n return upZ;\n }\n };\n };\n};\n","import { CONTEXT_STORE } from '../globals';\nimport { IAudioDestinationNode, IAudioListener, IMinimalBaseAudioContext, IMinimalBaseAudioContextEventMap } from '../interfaces';\nimport { TAudioContextState, TContext, TEventHandler, TMinimalBaseAudioContextConstructorFactory, TNativeContext } from '../types';\n\nexport const createMinimalBaseAudioContextConstructor: TMinimalBaseAudioContextConstructorFactory = (\n audioDestinationNodeConstructor,\n createAudioListener,\n eventTargetConstructor,\n isNativeOfflineAudioContext,\n unrenderedAudioWorkletNodeStore,\n wrapEventListener\n) => {\n return class MinimalBaseAudioContext\n extends eventTargetConstructor\n implements IMinimalBaseAudioContext\n {\n private _destination: IAudioDestinationNode;\n\n private _listener: IAudioListener;\n\n private _onstatechange: null | TEventHandler;\n\n constructor(private _nativeContext: TNativeContext, numberOfChannels: number) {\n super(_nativeContext);\n\n CONTEXT_STORE.set((this), _nativeContext);\n\n if (isNativeOfflineAudioContext(_nativeContext)) {\n unrenderedAudioWorkletNodeStore.set(_nativeContext, new Set());\n }\n\n this._destination = new audioDestinationNodeConstructor((this), numberOfChannels);\n this._listener = createAudioListener((this), _nativeContext);\n this._onstatechange = null;\n }\n\n get currentTime(): number {\n return this._nativeContext.currentTime;\n }\n\n get destination(): IAudioDestinationNode {\n return this._destination;\n }\n\n get listener(): IAudioListener {\n return this._listener;\n }\n\n get onstatechange(): null | TEventHandler {\n return this._onstatechange;\n }\n\n set onstatechange(value) {\n const wrappedListener = typeof value === 'function' ? wrapEventListener(this, value) : null;\n\n this._nativeContext.onstatechange = wrappedListener;\n\n const nativeOnStateChange = this._nativeContext.onstatechange;\n\n this._onstatechange = nativeOnStateChange !== null && nativeOnStateChange === wrappedListener ? value : nativeOnStateChange;\n }\n\n get sampleRate(): number {\n return this._nativeContext.sampleRate;\n }\n\n get state(): TAudioContextState {\n return this._nativeContext.state;\n }\n };\n};\n","import { assignNativeAudioNodeAudioParamValue } from '../helpers/assign-native-audio-node-audio-param-value';\nimport { assignNativeAudioNodeOption } from '../helpers/assign-native-audio-node-option';\nimport { assignNativeAudioNodeOptions } from '../helpers/assign-native-audio-node-options';\nimport { wrapAudioScheduledSourceNodeStartMethodNegativeParameters } from '../helpers/wrap-audio-scheduled-source-node-start-method-negative-parameters';\nimport { wrapAudioScheduledSourceNodeStopMethodNegativeParameters } from '../helpers/wrap-audio-scheduled-source-node-stop-method-negative-parameters';\nimport { TNativeOscillatorNodeFactoryFactory } from '../types';\n\nexport const createNativeOscillatorNodeFactory: TNativeOscillatorNodeFactoryFactory = (\n addSilentConnection,\n cacheTestResult,\n testAudioScheduledSourceNodeStartMethodNegativeParametersSupport,\n testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport,\n testAudioScheduledSourceNodeStopMethodNegativeParametersSupport,\n wrapAudioScheduledSourceNodeStopMethodConsecutiveCalls\n) => {\n return (nativeContext, options) => {\n const nativeOscillatorNode = nativeContext.createOscillator();\n\n assignNativeAudioNodeOptions(nativeOscillatorNode, options);\n\n assignNativeAudioNodeAudioParamValue(nativeOscillatorNode, options, 'detune');\n assignNativeAudioNodeAudioParamValue(nativeOscillatorNode, options, 'frequency');\n\n if (options.periodicWave !== undefined) {\n nativeOscillatorNode.setPeriodicWave(options.periodicWave);\n } else {\n assignNativeAudioNodeOption(nativeOscillatorNode, options, 'type');\n }\n\n // Bug #44: Only Chrome & Edge throw a RangeError yet.\n if (\n !cacheTestResult(testAudioScheduledSourceNodeStartMethodNegativeParametersSupport, () =>\n testAudioScheduledSourceNodeStartMethodNegativeParametersSupport(nativeContext)\n )\n ) {\n wrapAudioScheduledSourceNodeStartMethodNegativeParameters(nativeOscillatorNode);\n }\n\n // Bug #19: Safari does not ignore calls to stop() of an already stopped AudioBufferSourceNode.\n if (\n !cacheTestResult(testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport, () =>\n testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport(nativeContext)\n )\n ) {\n wrapAudioScheduledSourceNodeStopMethodConsecutiveCalls(nativeOscillatorNode, nativeContext);\n }\n\n // Bug #44: Only Firefox does not throw a RangeError yet.\n if (\n !cacheTestResult(testAudioScheduledSourceNodeStopMethodNegativeParametersSupport, () =>\n testAudioScheduledSourceNodeStopMethodNegativeParametersSupport(nativeContext)\n )\n ) {\n wrapAudioScheduledSourceNodeStopMethodNegativeParameters(nativeOscillatorNode);\n }\n\n // Bug #175: Safari will not fire an ended event if the OscillatorNode is unconnected.\n addSilentConnection(nativeContext, nativeOscillatorNode);\n\n return nativeOscillatorNode;\n };\n};\n","import { isOwnedByContext } from '../helpers/is-owned-by-context';\nimport { IMinimalOfflineAudioContext, IOfflineAudioContext, IOscillatorNode, IPeriodicWave } from '../interfaces';\nimport { TNativeOfflineAudioContext, TNativeOscillatorNode, TOscillatorNodeRendererFactoryFactory } from '../types';\n\nexport const createOscillatorNodeRendererFactory: TOscillatorNodeRendererFactoryFactory = (\n connectAudioParam,\n createNativeOscillatorNode,\n getNativeAudioNode,\n renderAutomation,\n renderInputsOfAudioNode\n) => {\n return () => {\n const renderedNativeOscillatorNodes = new WeakMap();\n\n let periodicWave: null | IPeriodicWave = null;\n let start: null | number = null;\n let stop: null | number = null;\n\n const createOscillatorNode = async (proxy: IOscillatorNode, nativeOfflineAudioContext: TNativeOfflineAudioContext) => {\n let nativeOscillatorNode = getNativeAudioNode(proxy);\n\n // If the initially used nativeOscillatorNode was not constructed on the same OfflineAudioContext it needs to be created again.\n const nativeOscillatorNodeIsOwnedByContext = isOwnedByContext(nativeOscillatorNode, nativeOfflineAudioContext);\n\n if (!nativeOscillatorNodeIsOwnedByContext) {\n const options = {\n channelCount: nativeOscillatorNode.channelCount,\n channelCountMode: nativeOscillatorNode.channelCountMode,\n channelInterpretation: nativeOscillatorNode.channelInterpretation,\n detune: nativeOscillatorNode.detune.value,\n frequency: nativeOscillatorNode.frequency.value,\n periodicWave: periodicWave === null ? undefined : periodicWave,\n type: nativeOscillatorNode.type\n };\n\n nativeOscillatorNode = createNativeOscillatorNode(nativeOfflineAudioContext, options);\n\n if (start !== null) {\n nativeOscillatorNode.start(start);\n }\n\n if (stop !== null) {\n nativeOscillatorNode.stop(stop);\n }\n }\n\n renderedNativeOscillatorNodes.set(nativeOfflineAudioContext, nativeOscillatorNode);\n\n if (!nativeOscillatorNodeIsOwnedByContext) {\n await renderAutomation(nativeOfflineAudioContext, proxy.detune, nativeOscillatorNode.detune);\n await renderAutomation(nativeOfflineAudioContext, proxy.frequency, nativeOscillatorNode.frequency);\n } else {\n await connectAudioParam(nativeOfflineAudioContext, proxy.detune, nativeOscillatorNode.detune);\n await connectAudioParam(nativeOfflineAudioContext, proxy.frequency, nativeOscillatorNode.frequency);\n }\n\n await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeOscillatorNode);\n\n return nativeOscillatorNode;\n };\n\n return {\n set periodicWave(value: null | IPeriodicWave) {\n periodicWave = value;\n },\n set start(value: number) {\n start = value;\n },\n set stop(value: number) {\n stop = value;\n },\n render(proxy: IOscillatorNode, nativeOfflineAudioContext: TNativeOfflineAudioContext): Promise {\n const renderedNativeOscillatorNode = renderedNativeOscillatorNodes.get(nativeOfflineAudioContext);\n\n if (renderedNativeOscillatorNode !== undefined) {\n return Promise.resolve(renderedNativeOscillatorNode);\n }\n\n return createOscillatorNode(proxy, nativeOfflineAudioContext);\n }\n };\n };\n};\n","import { TConnectedNativeAudioBufferSourceNodeFactoryFactory } from '../types';\n\nexport const createConnectedNativeAudioBufferSourceNodeFactory: TConnectedNativeAudioBufferSourceNodeFactoryFactory = (\n createNativeAudioBufferSourceNode\n) => {\n return (nativeContext, nativeAudioNode) => {\n const nativeAudioBufferSourceNode = createNativeAudioBufferSourceNode(nativeContext, {\n buffer: null,\n channelCount: 2,\n channelCountMode: 'max',\n channelInterpretation: 'speakers',\n loop: false,\n loopEnd: 0,\n loopStart: 0,\n playbackRate: 1\n });\n const nativeAudioBuffer = nativeContext.createBuffer(1, 2, 44100);\n\n nativeAudioBufferSourceNode.buffer = nativeAudioBuffer;\n nativeAudioBufferSourceNode.loop = true;\n\n nativeAudioBufferSourceNode.connect(nativeAudioNode);\n nativeAudioBufferSourceNode.start();\n\n return () => {\n nativeAudioBufferSourceNode.stop();\n nativeAudioBufferSourceNode.disconnect(nativeAudioNode);\n };\n };\n};\n","import { assignNativeAudioNodeOptions } from '../helpers/assign-native-audio-node-options';\nimport { interceptConnections } from '../helpers/intercept-connections';\nimport { TNativeAudioNode, TNativeWaveShaperNode, TNativeWaveShaperNodeFakerFactoryFactory } from '../types';\n\nexport const createNativeWaveShaperNodeFakerFactory: TNativeWaveShaperNodeFakerFactoryFactory = (\n createConnectedNativeAudioBufferSourceNode,\n createInvalidStateError,\n createNativeGainNode,\n isDCCurve,\n monitorConnections\n) => {\n return (nativeContext, { curve, oversample, ...audioNodeOptions }) => {\n const negativeWaveShaperNode = nativeContext.createWaveShaper();\n const positiveWaveShaperNode = nativeContext.createWaveShaper();\n\n assignNativeAudioNodeOptions(negativeWaveShaperNode, audioNodeOptions);\n assignNativeAudioNodeOptions(positiveWaveShaperNode, audioNodeOptions);\n\n const inputGainNode = createNativeGainNode(nativeContext, { ...audioNodeOptions, gain: 1 });\n const invertGainNode = createNativeGainNode(nativeContext, { ...audioNodeOptions, gain: -1 });\n const outputGainNode = createNativeGainNode(nativeContext, { ...audioNodeOptions, gain: 1 });\n const revertGainNode = createNativeGainNode(nativeContext, { ...audioNodeOptions, gain: -1 });\n\n let disconnectNativeAudioBufferSourceNode: null | (() => void) = null;\n let isConnected = false;\n let unmodifiedCurve: null | TNativeWaveShaperNode['curve'] = null;\n\n const nativeWaveShaperNodeFaker = {\n get bufferSize(): undefined {\n return undefined;\n },\n get channelCount(): number {\n return negativeWaveShaperNode.channelCount;\n },\n set channelCount(value) {\n inputGainNode.channelCount = value;\n invertGainNode.channelCount = value;\n negativeWaveShaperNode.channelCount = value;\n outputGainNode.channelCount = value;\n positiveWaveShaperNode.channelCount = value;\n revertGainNode.channelCount = value;\n },\n get channelCountMode(): TNativeWaveShaperNode['channelCountMode'] {\n return negativeWaveShaperNode.channelCountMode;\n },\n set channelCountMode(value) {\n inputGainNode.channelCountMode = value;\n invertGainNode.channelCountMode = value;\n negativeWaveShaperNode.channelCountMode = value;\n outputGainNode.channelCountMode = value;\n positiveWaveShaperNode.channelCountMode = value;\n revertGainNode.channelCountMode = value;\n },\n get channelInterpretation(): TNativeWaveShaperNode['channelInterpretation'] {\n return negativeWaveShaperNode.channelInterpretation;\n },\n set channelInterpretation(value) {\n inputGainNode.channelInterpretation = value;\n invertGainNode.channelInterpretation = value;\n negativeWaveShaperNode.channelInterpretation = value;\n outputGainNode.channelInterpretation = value;\n positiveWaveShaperNode.channelInterpretation = value;\n revertGainNode.channelInterpretation = value;\n },\n get context(): TNativeWaveShaperNode['context'] {\n return negativeWaveShaperNode.context;\n },\n get curve(): TNativeWaveShaperNode['curve'] {\n return unmodifiedCurve;\n },\n set curve(value) {\n // Bug #102: Safari does not throw an InvalidStateError when the curve has less than two samples.\n if (value !== null && value.length < 2) {\n throw createInvalidStateError();\n }\n\n if (value === null) {\n negativeWaveShaperNode.curve = value;\n positiveWaveShaperNode.curve = value;\n } else {\n const curveLength = value.length;\n\n const negativeCurve = new Float32Array(curveLength + 2 - (curveLength % 2));\n const positiveCurve = new Float32Array(curveLength + 2 - (curveLength % 2));\n\n negativeCurve[0] = value[0];\n positiveCurve[0] = -value[curveLength - 1];\n\n const length = Math.ceil((curveLength + 1) / 2);\n const centerIndex = (curveLength + 1) / 2 - 1;\n\n for (let i = 1; i < length; i += 1) {\n const theoreticIndex = (i / length) * centerIndex;\n\n const lowerIndex = Math.floor(theoreticIndex);\n const upperIndex = Math.ceil(theoreticIndex);\n\n negativeCurve[i] =\n lowerIndex === upperIndex\n ? value[lowerIndex]\n : (1 - (theoreticIndex - lowerIndex)) * value[lowerIndex] +\n (1 - (upperIndex - theoreticIndex)) * value[upperIndex];\n positiveCurve[i] =\n lowerIndex === upperIndex\n ? -value[curveLength - 1 - lowerIndex]\n : -((1 - (theoreticIndex - lowerIndex)) * value[curveLength - 1 - lowerIndex]) -\n (1 - (upperIndex - theoreticIndex)) * value[curveLength - 1 - upperIndex];\n }\n\n negativeCurve[length] = curveLength % 2 === 1 ? value[length - 1] : (value[length - 2] + value[length - 1]) / 2;\n\n negativeWaveShaperNode.curve = negativeCurve;\n positiveWaveShaperNode.curve = positiveCurve;\n }\n\n unmodifiedCurve = value;\n\n if (isConnected) {\n if (isDCCurve(unmodifiedCurve) && disconnectNativeAudioBufferSourceNode === null) {\n disconnectNativeAudioBufferSourceNode = createConnectedNativeAudioBufferSourceNode(nativeContext, inputGainNode);\n } else if (disconnectNativeAudioBufferSourceNode !== null) {\n disconnectNativeAudioBufferSourceNode();\n disconnectNativeAudioBufferSourceNode = null;\n }\n }\n },\n get inputs(): TNativeAudioNode[] {\n return [inputGainNode];\n },\n get numberOfInputs(): number {\n return negativeWaveShaperNode.numberOfInputs;\n },\n get numberOfOutputs(): number {\n return negativeWaveShaperNode.numberOfOutputs;\n },\n get oversample(): TNativeWaveShaperNode['oversample'] {\n return negativeWaveShaperNode.oversample;\n },\n set oversample(value) {\n negativeWaveShaperNode.oversample = value;\n positiveWaveShaperNode.oversample = value;\n },\n addEventListener(...args: any[]): void {\n return inputGainNode.addEventListener(args[0], args[1], args[2]);\n },\n dispatchEvent(...args: any[]): boolean {\n return inputGainNode.dispatchEvent(args[0]);\n },\n removeEventListener(...args: any[]): void {\n return inputGainNode.removeEventListener(args[0], args[1], args[2]);\n }\n };\n\n if (curve !== null) {\n // Only values of type Float32Array can be assigned to the curve property.\n nativeWaveShaperNodeFaker.curve = curve instanceof Float32Array ? curve : new Float32Array(curve);\n }\n\n if (oversample !== nativeWaveShaperNodeFaker.oversample) {\n nativeWaveShaperNodeFaker.oversample = oversample;\n }\n\n const whenConnected = () => {\n inputGainNode.connect(negativeWaveShaperNode).connect(outputGainNode);\n\n inputGainNode.connect(invertGainNode).connect(positiveWaveShaperNode).connect(revertGainNode).connect(outputGainNode);\n\n isConnected = true;\n\n if (isDCCurve(unmodifiedCurve)) {\n disconnectNativeAudioBufferSourceNode = createConnectedNativeAudioBufferSourceNode(nativeContext, inputGainNode);\n }\n };\n const whenDisconnected = () => {\n inputGainNode.disconnect(negativeWaveShaperNode);\n negativeWaveShaperNode.disconnect(outputGainNode);\n\n inputGainNode.disconnect(invertGainNode);\n invertGainNode.disconnect(positiveWaveShaperNode);\n positiveWaveShaperNode.disconnect(revertGainNode);\n revertGainNode.disconnect(outputGainNode);\n\n isConnected = false;\n\n if (disconnectNativeAudioBufferSourceNode !== null) {\n disconnectNativeAudioBufferSourceNode();\n disconnectNativeAudioBufferSourceNode = null;\n }\n };\n\n return monitorConnections(interceptConnections(nativeWaveShaperNodeFaker, outputGainNode), whenConnected, whenDisconnected);\n };\n};\n","import { assignNativeAudioNodeOption } from '../helpers/assign-native-audio-node-option';\nimport { assignNativeAudioNodeOptions } from '../helpers/assign-native-audio-node-options';\nimport { TNativeWaveShaperNodeFactoryFactory } from '../types';\n\nexport const createNativeWaveShaperNodeFactory: TNativeWaveShaperNodeFactoryFactory = (\n createConnectedNativeAudioBufferSourceNode,\n createInvalidStateError,\n createNativeWaveShaperNodeFaker,\n isDCCurve,\n monitorConnections,\n nativeAudioContextConstructor,\n overwriteAccessors\n) => {\n return (nativeContext, options) => {\n const nativeWaveShaperNode = nativeContext.createWaveShaper();\n\n /*\n * Bug #119: Safari does not correctly map the values.\n * @todo Unfortunately there is no way to test for this behavior in a synchronous fashion which is why testing for the existence of\n * the webkitAudioContext is used as a workaround here. Testing for the automationRate property is necessary because this workaround\n * isn't necessary anymore since v14.0.2 of Safari.\n */\n if (\n nativeAudioContextConstructor !== null &&\n nativeAudioContextConstructor.name === 'webkitAudioContext' &&\n nativeContext.createGain().gain.automationRate === undefined\n ) {\n return createNativeWaveShaperNodeFaker(nativeContext, options);\n }\n\n assignNativeAudioNodeOptions(nativeWaveShaperNode, options);\n\n const curve = options.curve === null || options.curve instanceof Float32Array ? options.curve : new Float32Array(options.curve);\n\n // Bug #104: Chrome and Edge will throw an InvalidAccessError when the curve has less than two samples.\n if (curve !== null && curve.length < 2) {\n throw createInvalidStateError();\n }\n\n // Only values of type Float32Array can be assigned to the curve property.\n assignNativeAudioNodeOption(nativeWaveShaperNode, { curve }, 'curve');\n assignNativeAudioNodeOption(nativeWaveShaperNode, options, 'oversample');\n\n let disconnectNativeAudioBufferSourceNode: null | (() => void) = null;\n let isConnected = false;\n\n overwriteAccessors(\n nativeWaveShaperNode,\n 'curve',\n (get) => () => get.call(nativeWaveShaperNode),\n (set) => (value) => {\n set.call(nativeWaveShaperNode, value);\n\n if (isConnected) {\n if (isDCCurve(value) && disconnectNativeAudioBufferSourceNode === null) {\n disconnectNativeAudioBufferSourceNode = createConnectedNativeAudioBufferSourceNode(\n nativeContext,\n nativeWaveShaperNode\n );\n } else if (!isDCCurve(value) && disconnectNativeAudioBufferSourceNode !== null) {\n disconnectNativeAudioBufferSourceNode();\n disconnectNativeAudioBufferSourceNode = null;\n }\n }\n\n return value;\n }\n );\n\n const whenConnected = () => {\n isConnected = true;\n\n if (isDCCurve(nativeWaveShaperNode.curve)) {\n disconnectNativeAudioBufferSourceNode = createConnectedNativeAudioBufferSourceNode(nativeContext, nativeWaveShaperNode);\n }\n };\n const whenDisconnected = () => {\n isConnected = false;\n\n if (disconnectNativeAudioBufferSourceNode !== null) {\n disconnectNativeAudioBufferSourceNode();\n disconnectNativeAudioBufferSourceNode = null;\n }\n };\n\n return monitorConnections(nativeWaveShaperNode, whenConnected, whenDisconnected);\n };\n};\n","import { assignNativeAudioNodeOptions } from '../helpers/assign-native-audio-node-options';\nimport { interceptConnections } from '../helpers/intercept-connections';\nimport { TNativeAudioNode, TNativePannerNode, TNativePannerNodeFakerFactoryFactory } from '../types';\n\nexport const createNativePannerNodeFakerFactory: TNativePannerNodeFakerFactoryFactory = (\n connectNativeAudioNodeToNativeAudioNode,\n createInvalidStateError,\n createNativeChannelMergerNode,\n createNativeGainNode,\n createNativeScriptProcessorNode,\n createNativeWaveShaperNode,\n createNotSupportedError,\n disconnectNativeAudioNodeFromNativeAudioNode,\n getFirstSample,\n monitorConnections\n) => {\n return (\n nativeContext,\n {\n coneInnerAngle,\n coneOuterAngle,\n coneOuterGain,\n distanceModel,\n maxDistance,\n orientationX,\n orientationY,\n orientationZ,\n panningModel,\n positionX,\n positionY,\n positionZ,\n refDistance,\n rolloffFactor,\n ...audioNodeOptions\n }\n ) => {\n const pannerNode = nativeContext.createPanner();\n\n // Bug #125: Safari does not throw an error yet.\n if (audioNodeOptions.channelCount > 2) {\n throw createNotSupportedError();\n }\n\n // Bug #126: Safari does not throw an error yet.\n if (audioNodeOptions.channelCountMode === 'max') {\n throw createNotSupportedError();\n }\n\n assignNativeAudioNodeOptions(pannerNode, audioNodeOptions);\n\n const SINGLE_CHANNEL_OPTIONS = {\n channelCount: 1,\n channelCountMode: 'explicit',\n channelInterpretation: 'discrete'\n } as const;\n\n const channelMergerNode = createNativeChannelMergerNode(nativeContext, {\n ...SINGLE_CHANNEL_OPTIONS,\n channelInterpretation: 'speakers',\n numberOfInputs: 6\n });\n const inputGainNode = createNativeGainNode(nativeContext, { ...audioNodeOptions, gain: 1 });\n const orientationXGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 1 });\n const orientationYGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 0 });\n const orientationZGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 0 });\n const positionXGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 0 });\n const positionYGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 0 });\n const positionZGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 0 });\n const scriptProcessorNode = createNativeScriptProcessorNode(nativeContext, 256, 6, 1);\n const waveShaperNode = createNativeWaveShaperNode(nativeContext, {\n ...SINGLE_CHANNEL_OPTIONS,\n curve: new Float32Array([1, 1]),\n oversample: 'none'\n });\n\n let lastOrientation: [number, number, number] = [orientationX, orientationY, orientationZ];\n let lastPosition: [number, number, number] = [positionX, positionY, positionZ];\n\n const buffer = new Float32Array(1);\n\n // tslint:disable-next-line:deprecation\n scriptProcessorNode.onaudioprocess = ({ inputBuffer }) => {\n const orientation: [number, number, number] = [\n getFirstSample(inputBuffer, buffer, 0),\n getFirstSample(inputBuffer, buffer, 1),\n getFirstSample(inputBuffer, buffer, 2)\n ];\n\n if (orientation.some((value, index) => value !== lastOrientation[index])) {\n pannerNode.setOrientation(...orientation); // tslint:disable-line:deprecation\n\n lastOrientation = orientation;\n }\n\n const positon: [number, number, number] = [\n getFirstSample(inputBuffer, buffer, 3),\n getFirstSample(inputBuffer, buffer, 4),\n getFirstSample(inputBuffer, buffer, 5)\n ];\n\n if (positon.some((value, index) => value !== lastPosition[index])) {\n pannerNode.setPosition(...positon); // tslint:disable-line:deprecation\n\n lastPosition = positon;\n }\n };\n\n Object.defineProperty(orientationYGainNode.gain, 'defaultValue', { get: () => 0 });\n Object.defineProperty(orientationZGainNode.gain, 'defaultValue', { get: () => 0 });\n Object.defineProperty(positionXGainNode.gain, 'defaultValue', { get: () => 0 });\n Object.defineProperty(positionYGainNode.gain, 'defaultValue', { get: () => 0 });\n Object.defineProperty(positionZGainNode.gain, 'defaultValue', { get: () => 0 });\n\n const nativePannerNodeFaker = {\n get bufferSize(): undefined {\n return undefined;\n },\n get channelCount(): number {\n return pannerNode.channelCount;\n },\n set channelCount(value) {\n // Bug #125: Safari does not throw an error yet.\n if (value > 2) {\n throw createNotSupportedError();\n }\n\n inputGainNode.channelCount = value;\n pannerNode.channelCount = value;\n },\n get channelCountMode(): TNativePannerNode['channelCountMode'] {\n return pannerNode.channelCountMode;\n },\n set channelCountMode(value) {\n // Bug #126: Safari does not throw an error yet.\n if (value === 'max') {\n throw createNotSupportedError();\n }\n\n inputGainNode.channelCountMode = value;\n pannerNode.channelCountMode = value;\n },\n get channelInterpretation(): TNativePannerNode['channelInterpretation'] {\n return pannerNode.channelInterpretation;\n },\n set channelInterpretation(value) {\n inputGainNode.channelInterpretation = value;\n pannerNode.channelInterpretation = value;\n },\n get coneInnerAngle(): TNativePannerNode['coneInnerAngle'] {\n return pannerNode.coneInnerAngle;\n },\n set coneInnerAngle(value) {\n pannerNode.coneInnerAngle = value;\n },\n get coneOuterAngle(): TNativePannerNode['coneOuterAngle'] {\n return pannerNode.coneOuterAngle;\n },\n set coneOuterAngle(value) {\n pannerNode.coneOuterAngle = value;\n },\n get coneOuterGain(): TNativePannerNode['coneOuterGain'] {\n return pannerNode.coneOuterGain;\n },\n set coneOuterGain(value) {\n // Bug #127: Safari does not throw an InvalidStateError yet.\n if (value < 0 || value > 1) {\n throw createInvalidStateError();\n }\n\n pannerNode.coneOuterGain = value;\n },\n get context(): TNativePannerNode['context'] {\n return pannerNode.context;\n },\n get distanceModel(): TNativePannerNode['distanceModel'] {\n return pannerNode.distanceModel;\n },\n set distanceModel(value) {\n pannerNode.distanceModel = value;\n },\n get inputs(): TNativeAudioNode[] {\n return [inputGainNode];\n },\n get maxDistance(): TNativePannerNode['maxDistance'] {\n return pannerNode.maxDistance;\n },\n set maxDistance(value) {\n // Bug #128: Safari does not throw an error yet.\n if (value < 0) {\n throw new RangeError();\n }\n\n pannerNode.maxDistance = value;\n },\n get numberOfInputs(): number {\n return pannerNode.numberOfInputs;\n },\n get numberOfOutputs(): number {\n return pannerNode.numberOfOutputs;\n },\n get orientationX(): TNativePannerNode['orientationX'] {\n return orientationXGainNode.gain;\n },\n get orientationY(): TNativePannerNode['orientationY'] {\n return orientationYGainNode.gain;\n },\n get orientationZ(): TNativePannerNode['orientationZ'] {\n return orientationZGainNode.gain;\n },\n get panningModel(): TNativePannerNode['panningModel'] {\n return pannerNode.panningModel;\n },\n set panningModel(value) {\n pannerNode.panningModel = value;\n },\n get positionX(): TNativePannerNode['positionX'] {\n return positionXGainNode.gain;\n },\n get positionY(): TNativePannerNode['positionY'] {\n return positionYGainNode.gain;\n },\n get positionZ(): TNativePannerNode['positionZ'] {\n return positionZGainNode.gain;\n },\n get refDistance(): TNativePannerNode['refDistance'] {\n return pannerNode.refDistance;\n },\n set refDistance(value) {\n // Bug #129: Safari does not throw an error yet.\n if (value < 0) {\n throw new RangeError();\n }\n\n pannerNode.refDistance = value;\n },\n get rolloffFactor(): TNativePannerNode['rolloffFactor'] {\n return pannerNode.rolloffFactor;\n },\n set rolloffFactor(value) {\n // Bug #130: Safari does not throw an error yet.\n if (value < 0) {\n throw new RangeError();\n }\n\n pannerNode.rolloffFactor = value;\n },\n addEventListener(...args: any[]): void {\n return inputGainNode.addEventListener(args[0], args[1], args[2]);\n },\n dispatchEvent(...args: any[]): boolean {\n return inputGainNode.dispatchEvent(args[0]);\n },\n removeEventListener(...args: any[]): void {\n return inputGainNode.removeEventListener(args[0], args[1], args[2]);\n }\n };\n\n if (coneInnerAngle !== nativePannerNodeFaker.coneInnerAngle) {\n nativePannerNodeFaker.coneInnerAngle = coneInnerAngle;\n }\n\n if (coneOuterAngle !== nativePannerNodeFaker.coneOuterAngle) {\n nativePannerNodeFaker.coneOuterAngle = coneOuterAngle;\n }\n\n if (coneOuterGain !== nativePannerNodeFaker.coneOuterGain) {\n nativePannerNodeFaker.coneOuterGain = coneOuterGain;\n }\n\n if (distanceModel !== nativePannerNodeFaker.distanceModel) {\n nativePannerNodeFaker.distanceModel = distanceModel;\n }\n\n if (maxDistance !== nativePannerNodeFaker.maxDistance) {\n nativePannerNodeFaker.maxDistance = maxDistance;\n }\n\n if (orientationX !== nativePannerNodeFaker.orientationX.value) {\n nativePannerNodeFaker.orientationX.value = orientationX;\n }\n\n if (orientationY !== nativePannerNodeFaker.orientationY.value) {\n nativePannerNodeFaker.orientationY.value = orientationY;\n }\n\n if (orientationZ !== nativePannerNodeFaker.orientationZ.value) {\n nativePannerNodeFaker.orientationZ.value = orientationZ;\n }\n\n if (panningModel !== nativePannerNodeFaker.panningModel) {\n nativePannerNodeFaker.panningModel = panningModel;\n }\n\n if (positionX !== nativePannerNodeFaker.positionX.value) {\n nativePannerNodeFaker.positionX.value = positionX;\n }\n\n if (positionY !== nativePannerNodeFaker.positionY.value) {\n nativePannerNodeFaker.positionY.value = positionY;\n }\n\n if (positionZ !== nativePannerNodeFaker.positionZ.value) {\n nativePannerNodeFaker.positionZ.value = positionZ;\n }\n\n if (refDistance !== nativePannerNodeFaker.refDistance) {\n nativePannerNodeFaker.refDistance = refDistance;\n }\n\n if (rolloffFactor !== nativePannerNodeFaker.rolloffFactor) {\n nativePannerNodeFaker.rolloffFactor = rolloffFactor;\n }\n\n if (lastOrientation[0] !== 1 || lastOrientation[1] !== 0 || lastOrientation[2] !== 0) {\n pannerNode.setOrientation(...lastOrientation); // tslint:disable-line:deprecation\n }\n\n if (lastPosition[0] !== 0 || lastPosition[1] !== 0 || lastPosition[2] !== 0) {\n pannerNode.setPosition(...lastPosition); // tslint:disable-line:deprecation\n }\n\n const whenConnected = () => {\n inputGainNode.connect(pannerNode);\n\n // Bug #119: Safari does not fully support the WaveShaperNode.\n connectNativeAudioNodeToNativeAudioNode(inputGainNode, waveShaperNode, 0, 0);\n\n waveShaperNode.connect(orientationXGainNode).connect(channelMergerNode, 0, 0);\n waveShaperNode.connect(orientationYGainNode).connect(channelMergerNode, 0, 1);\n waveShaperNode.connect(orientationZGainNode).connect(channelMergerNode, 0, 2);\n waveShaperNode.connect(positionXGainNode).connect(channelMergerNode, 0, 3);\n waveShaperNode.connect(positionYGainNode).connect(channelMergerNode, 0, 4);\n waveShaperNode.connect(positionZGainNode).connect(channelMergerNode, 0, 5);\n\n channelMergerNode.connect(scriptProcessorNode).connect(nativeContext.destination);\n };\n const whenDisconnected = () => {\n inputGainNode.disconnect(pannerNode);\n\n // Bug #119: Safari does not fully support the WaveShaperNode.\n disconnectNativeAudioNodeFromNativeAudioNode(inputGainNode, waveShaperNode, 0, 0);\n\n waveShaperNode.disconnect(orientationXGainNode);\n orientationXGainNode.disconnect(channelMergerNode);\n waveShaperNode.disconnect(orientationYGainNode);\n orientationYGainNode.disconnect(channelMergerNode);\n waveShaperNode.disconnect(orientationZGainNode);\n orientationZGainNode.disconnect(channelMergerNode);\n waveShaperNode.disconnect(positionXGainNode);\n positionXGainNode.disconnect(channelMergerNode);\n waveShaperNode.disconnect(positionYGainNode);\n positionYGainNode.disconnect(channelMergerNode);\n waveShaperNode.disconnect(positionZGainNode);\n positionZGainNode.disconnect(channelMergerNode);\n\n channelMergerNode.disconnect(scriptProcessorNode);\n scriptProcessorNode.disconnect(nativeContext.destination);\n };\n\n return monitorConnections(interceptConnections(nativePannerNodeFaker, pannerNode), whenConnected, whenDisconnected);\n };\n};\n","import { assignNativeAudioNodeAudioParamValue } from '../helpers/assign-native-audio-node-audio-param-value';\nimport { assignNativeAudioNodeOption } from '../helpers/assign-native-audio-node-option';\nimport { assignNativeAudioNodeOptions } from '../helpers/assign-native-audio-node-options';\nimport { TNativePannerNodeFactoryFactory } from '../types';\n\nexport const createNativePannerNodeFactory: TNativePannerNodeFactoryFactory = (createNativePannerNodeFaker) => {\n return (nativeContext, options) => {\n const nativePannerNode = nativeContext.createPanner();\n\n // Bug #124: Safari does not support modifying the orientation and the position with AudioParams.\n if (nativePannerNode.orientationX === undefined) {\n return createNativePannerNodeFaker(nativeContext, options);\n }\n\n assignNativeAudioNodeOptions(nativePannerNode, options);\n\n assignNativeAudioNodeAudioParamValue(nativePannerNode, options, 'orientationX');\n assignNativeAudioNodeAudioParamValue(nativePannerNode, options, 'orientationY');\n assignNativeAudioNodeAudioParamValue(nativePannerNode, options, 'orientationZ');\n assignNativeAudioNodeAudioParamValue(nativePannerNode, options, 'positionX');\n assignNativeAudioNodeAudioParamValue(nativePannerNode, options, 'positionY');\n assignNativeAudioNodeAudioParamValue(nativePannerNode, options, 'positionZ');\n\n assignNativeAudioNodeOption(nativePannerNode, options, 'coneInnerAngle');\n assignNativeAudioNodeOption(nativePannerNode, options, 'coneOuterAngle');\n assignNativeAudioNodeOption(nativePannerNode, options, 'coneOuterGain');\n assignNativeAudioNodeOption(nativePannerNode, options, 'distanceModel');\n assignNativeAudioNodeOption(nativePannerNode, options, 'maxDistance');\n assignNativeAudioNodeOption(nativePannerNode, options, 'panningModel');\n assignNativeAudioNodeOption(nativePannerNode, options, 'refDistance');\n assignNativeAudioNodeOption(nativePannerNode, options, 'rolloffFactor');\n\n return nativePannerNode;\n };\n};\n","import { isNativeAudioNodeFaker } from '../guards/native-audio-node-faker';\nimport { isOwnedByContext } from '../helpers/is-owned-by-context';\nimport { IMinimalOfflineAudioContext, INativePannerNodeFaker, IOfflineAudioContext, IPannerNode } from '../interfaces';\nimport {\n TNativeAudioBuffer,\n TNativeGainNode,\n TNativeOfflineAudioContext,\n TNativePannerNode,\n TPannerNodeRendererFactoryFactory\n} from '../types';\n\nexport const createPannerNodeRendererFactory: TPannerNodeRendererFactoryFactory = (\n connectAudioParam,\n createNativeChannelMergerNode,\n createNativeConstantSourceNode,\n createNativeGainNode,\n createNativePannerNode,\n getNativeAudioNode,\n nativeOfflineAudioContextConstructor,\n renderAutomation,\n renderInputsOfAudioNode,\n renderNativeOfflineAudioContext\n) => {\n return () => {\n const renderedNativeAudioNodes = new WeakMap();\n\n let renderedBufferPromise: null | Promise = null;\n\n const createAudioNode = async (proxy: IPannerNode, nativeOfflineAudioContext: TNativeOfflineAudioContext) => {\n let nativeGainNode: null | TNativeGainNode = null;\n let nativePannerNode = getNativeAudioNode(proxy);\n\n const commonAudioNodeOptions = {\n channelCount: nativePannerNode.channelCount,\n channelCountMode: nativePannerNode.channelCountMode,\n channelInterpretation: nativePannerNode.channelInterpretation\n };\n const commonNativePannerNodeOptions = {\n ...commonAudioNodeOptions,\n coneInnerAngle: nativePannerNode.coneInnerAngle,\n coneOuterAngle: nativePannerNode.coneOuterAngle,\n coneOuterGain: nativePannerNode.coneOuterGain,\n distanceModel: nativePannerNode.distanceModel,\n maxDistance: nativePannerNode.maxDistance,\n panningModel: nativePannerNode.panningModel,\n refDistance: nativePannerNode.refDistance,\n rolloffFactor: nativePannerNode.rolloffFactor\n };\n\n // If the initially used nativePannerNode was not constructed on the same OfflineAudioContext it needs to be created again.\n const nativePannerNodeIsOwnedByContext = isOwnedByContext(nativePannerNode, nativeOfflineAudioContext);\n\n // Bug #124: Safari does not support modifying the orientation and the position with AudioParams.\n if ('bufferSize' in nativePannerNode) {\n nativeGainNode = createNativeGainNode(nativeOfflineAudioContext, { ...commonAudioNodeOptions, gain: 1 });\n } else if (!nativePannerNodeIsOwnedByContext) {\n const options = {\n ...commonNativePannerNodeOptions,\n orientationX: nativePannerNode.orientationX.value,\n orientationY: nativePannerNode.orientationY.value,\n orientationZ: nativePannerNode.orientationZ.value,\n positionX: nativePannerNode.positionX.value,\n positionY: nativePannerNode.positionY.value,\n positionZ: nativePannerNode.positionZ.value\n };\n\n nativePannerNode = createNativePannerNode(nativeOfflineAudioContext, options);\n }\n\n renderedNativeAudioNodes.set(nativeOfflineAudioContext, nativeGainNode === null ? nativePannerNode : nativeGainNode);\n\n if (nativeGainNode !== null) {\n if (renderedBufferPromise === null) {\n if (nativeOfflineAudioContextConstructor === null) {\n throw new Error('Missing the native OfflineAudioContext constructor.');\n }\n\n const partialOfflineAudioContext = new nativeOfflineAudioContextConstructor(\n 6,\n // Bug #17: Safari does not yet expose the length.\n proxy.context.length,\n nativeOfflineAudioContext.sampleRate\n );\n const nativeChannelMergerNode = createNativeChannelMergerNode(partialOfflineAudioContext, {\n channelCount: 1,\n channelCountMode: 'explicit',\n channelInterpretation: 'speakers',\n numberOfInputs: 6\n });\n nativeChannelMergerNode.connect(partialOfflineAudioContext.destination);\n\n renderedBufferPromise = (async () => {\n const nativeConstantSourceNodes = await Promise.all(\n [\n proxy.orientationX,\n proxy.orientationY,\n proxy.orientationZ,\n proxy.positionX,\n proxy.positionY,\n proxy.positionZ\n ].map(async (audioParam, index) => {\n const nativeConstantSourceNode = createNativeConstantSourceNode(partialOfflineAudioContext, {\n channelCount: 1,\n channelCountMode: 'explicit',\n channelInterpretation: 'discrete',\n offset: index === 0 ? 1 : 0\n });\n\n await renderAutomation(partialOfflineAudioContext, audioParam, nativeConstantSourceNode.offset);\n\n return nativeConstantSourceNode;\n })\n );\n\n for (let i = 0; i < 6; i += 1) {\n nativeConstantSourceNodes[i].connect(nativeChannelMergerNode, 0, i);\n nativeConstantSourceNodes[i].start(0);\n }\n\n return renderNativeOfflineAudioContext(partialOfflineAudioContext);\n })();\n }\n\n const renderedBuffer = await renderedBufferPromise;\n const inputGainNode = createNativeGainNode(nativeOfflineAudioContext, { ...commonAudioNodeOptions, gain: 1 });\n\n await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, inputGainNode);\n\n const channelDatas: Float32Array[] = [];\n\n for (let i = 0; i < renderedBuffer.numberOfChannels; i += 1) {\n channelDatas.push(renderedBuffer.getChannelData(i));\n }\n\n let lastOrientation = [channelDatas[0][0], channelDatas[1][0], channelDatas[2][0]];\n let lastPosition = [channelDatas[3][0], channelDatas[4][0], channelDatas[5][0]];\n let gateGainNode = createNativeGainNode(nativeOfflineAudioContext, { ...commonAudioNodeOptions, gain: 1 });\n let partialPannerNode = createNativePannerNode(nativeOfflineAudioContext, {\n ...commonNativePannerNodeOptions,\n orientationX: lastOrientation[0],\n orientationY: lastOrientation[1],\n orientationZ: lastOrientation[2],\n positionX: lastPosition[0],\n positionY: lastPosition[1],\n positionZ: lastPosition[2]\n });\n\n inputGainNode.connect(gateGainNode).connect((partialPannerNode).inputs[0]);\n partialPannerNode.connect(nativeGainNode);\n\n for (let i = 128; i < renderedBuffer.length; i += 128) {\n const orientation: [number, number, number] = [channelDatas[0][i], channelDatas[1][i], channelDatas[2][i]];\n const positon: [number, number, number] = [channelDatas[3][i], channelDatas[4][i], channelDatas[5][i]];\n\n if (\n orientation.some((value, index) => value !== lastOrientation[index]) ||\n positon.some((value, index) => value !== lastPosition[index])\n ) {\n lastOrientation = orientation;\n lastPosition = positon;\n\n const currentTime = i / nativeOfflineAudioContext.sampleRate;\n\n gateGainNode.gain.setValueAtTime(0, currentTime);\n\n gateGainNode = createNativeGainNode(nativeOfflineAudioContext, { ...commonAudioNodeOptions, gain: 0 });\n partialPannerNode = createNativePannerNode(nativeOfflineAudioContext, {\n ...commonNativePannerNodeOptions,\n orientationX: lastOrientation[0],\n orientationY: lastOrientation[1],\n orientationZ: lastOrientation[2],\n positionX: lastPosition[0],\n positionY: lastPosition[1],\n positionZ: lastPosition[2]\n });\n\n gateGainNode.gain.setValueAtTime(1, currentTime);\n\n inputGainNode.connect(gateGainNode).connect((partialPannerNode).inputs[0]);\n partialPannerNode.connect(nativeGainNode);\n }\n }\n\n return nativeGainNode;\n }\n\n if (!nativePannerNodeIsOwnedByContext) {\n await renderAutomation(nativeOfflineAudioContext, proxy.orientationX, nativePannerNode.orientationX);\n await renderAutomation(nativeOfflineAudioContext, proxy.orientationY, nativePannerNode.orientationY);\n await renderAutomation(nativeOfflineAudioContext, proxy.orientationZ, nativePannerNode.orientationZ);\n await renderAutomation(nativeOfflineAudioContext, proxy.positionX, nativePannerNode.positionX);\n await renderAutomation(nativeOfflineAudioContext, proxy.positionY, nativePannerNode.positionY);\n await renderAutomation(nativeOfflineAudioContext, proxy.positionZ, nativePannerNode.positionZ);\n } else {\n await connectAudioParam(nativeOfflineAudioContext, proxy.orientationX, nativePannerNode.orientationX);\n await connectAudioParam(nativeOfflineAudioContext, proxy.orientationY, nativePannerNode.orientationY);\n await connectAudioParam(nativeOfflineAudioContext, proxy.orientationZ, nativePannerNode.orientationZ);\n await connectAudioParam(nativeOfflineAudioContext, proxy.positionX, nativePannerNode.positionX);\n await connectAudioParam(nativeOfflineAudioContext, proxy.positionY, nativePannerNode.positionY);\n await connectAudioParam(nativeOfflineAudioContext, proxy.positionZ, nativePannerNode.positionZ);\n }\n\n if (isNativeAudioNodeFaker(nativePannerNode)) {\n await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativePannerNode.inputs[0]);\n } else {\n await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativePannerNode);\n }\n\n return nativePannerNode;\n };\n\n return {\n render(\n proxy: IPannerNode,\n nativeOfflineAudioContext: TNativeOfflineAudioContext\n ): Promise {\n const renderedNativeGainNodeOrNativePannerNode = renderedNativeAudioNodes.get(nativeOfflineAudioContext);\n\n if (renderedNativeGainNodeOrNativePannerNode !== undefined) {\n return Promise.resolve(renderedNativeGainNodeOrNativePannerNode);\n }\n\n return createAudioNode(proxy, nativeOfflineAudioContext);\n }\n };\n };\n};\n","import { TNativePeriodicWaveFactoryFactory } from '../types';\n\nexport const createNativePeriodicWaveFactory: TNativePeriodicWaveFactoryFactory = (createIndexSizeError) => {\n return (nativeContext, { disableNormalization, imag, real }) => {\n // Bug #180: Safari does not allow to use ordinary arrays.\n const convertedImag = imag instanceof Float32Array ? imag : new Float32Array(imag);\n const convertedReal = real instanceof Float32Array ? real : new Float32Array(real);\n\n const nativePeriodicWave = nativeContext.createPeriodicWave(convertedReal, convertedImag, { disableNormalization });\n\n // Bug #181: Safari does not throw an IndexSizeError so far if the given arrays have less than two values.\n if (Array.from(imag).length < 2) {\n throw createIndexSizeError();\n }\n\n return nativePeriodicWave;\n };\n};\n","import { TSanitizePeriodicWaveOptionsFunction } from '../types';\n\nexport const sanitizePeriodicWaveOptions: TSanitizePeriodicWaveOptionsFunction = (options) => {\n const { imag, real } = options;\n\n if (imag === undefined) {\n if (real === undefined) {\n return { ...options, imag: [0, 0], real: [0, 0] };\n }\n\n return { ...options, imag: Array.from(real, () => 0), real };\n }\n\n if (real === undefined) {\n return { ...options, imag, real: Array.from(imag, () => 0) };\n }\n\n return { ...options, imag, real };\n};\n","import { interceptConnections } from '../helpers/intercept-connections';\nimport { INativeWaveShaperNodeFaker } from '../interfaces';\nimport {\n TNativeAudioNode,\n TNativeChannelMergerNode,\n TNativeContext,\n TNativeGainNode,\n TNativeStereoPannerNode,\n TNativeStereoPannerNodeFakerFactoryFactory\n} from '../types';\n\nexport const createNativeStereoPannerNodeFakerFactory: TNativeStereoPannerNodeFakerFactoryFactory = (\n createNativeChannelMergerNode,\n createNativeChannelSplitterNode,\n createNativeGainNode,\n createNativeWaveShaperNode,\n createNotSupportedError,\n monitorConnections\n) => {\n // The curve has a size of 14bit plus 1 value to have an exact representation for zero. This value has been determined experimentally.\n const CURVE_SIZE = 16385;\n const DC_CURVE = new Float32Array([1, 1]);\n const HALF_PI = Math.PI / 2;\n const SINGLE_CHANNEL_OPTIONS = { channelCount: 1, channelCountMode: 'explicit', channelInterpretation: 'discrete' } as const;\n const SINGLE_CHANNEL_WAVE_SHAPER_OPTIONS = { ...SINGLE_CHANNEL_OPTIONS, oversample: 'none' } as const;\n\n const buildInternalGraphForMono = (\n nativeContext: TNativeContext,\n inputGainNode: TNativeGainNode,\n panGainNode: TNativeGainNode,\n channelMergerNode: TNativeChannelMergerNode\n ) => {\n const leftWaveShaperCurve = new Float32Array(CURVE_SIZE);\n const rightWaveShaperCurve = new Float32Array(CURVE_SIZE);\n\n for (let i = 0; i < CURVE_SIZE; i += 1) {\n const x = (i / (CURVE_SIZE - 1)) * HALF_PI;\n\n leftWaveShaperCurve[i] = Math.cos(x);\n rightWaveShaperCurve[i] = Math.sin(x);\n }\n\n const leftGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 0 });\n // Bug #119: Safari does not fully support the WaveShaperNode.\n const leftWaveShaperNode = (\n createNativeWaveShaperNode(nativeContext, { ...SINGLE_CHANNEL_WAVE_SHAPER_OPTIONS, curve: leftWaveShaperCurve })\n );\n // Bug #119: Safari does not fully support the WaveShaperNode.\n const panWaveShaperNode = (\n createNativeWaveShaperNode(nativeContext, { ...SINGLE_CHANNEL_WAVE_SHAPER_OPTIONS, curve: DC_CURVE })\n );\n const rightGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 0 });\n // Bug #119: Safari does not fully support the WaveShaperNode.\n const rightWaveShaperNode = (\n createNativeWaveShaperNode(nativeContext, { ...SINGLE_CHANNEL_WAVE_SHAPER_OPTIONS, curve: rightWaveShaperCurve })\n );\n\n return {\n connectGraph(): void {\n inputGainNode.connect(leftGainNode);\n inputGainNode.connect(panWaveShaperNode.inputs === undefined ? panWaveShaperNode : panWaveShaperNode.inputs[0]);\n inputGainNode.connect(rightGainNode);\n\n panWaveShaperNode.connect(panGainNode);\n\n panGainNode.connect(leftWaveShaperNode.inputs === undefined ? leftWaveShaperNode : leftWaveShaperNode.inputs[0]);\n panGainNode.connect(rightWaveShaperNode.inputs === undefined ? rightWaveShaperNode : rightWaveShaperNode.inputs[0]);\n\n leftWaveShaperNode.connect(leftGainNode.gain);\n rightWaveShaperNode.connect(rightGainNode.gain);\n\n leftGainNode.connect(channelMergerNode, 0, 0);\n rightGainNode.connect(channelMergerNode, 0, 1);\n },\n disconnectGraph(): void {\n inputGainNode.disconnect(leftGainNode);\n inputGainNode.disconnect(panWaveShaperNode.inputs === undefined ? panWaveShaperNode : panWaveShaperNode.inputs[0]);\n inputGainNode.disconnect(rightGainNode);\n\n panWaveShaperNode.disconnect(panGainNode);\n\n panGainNode.disconnect(leftWaveShaperNode.inputs === undefined ? leftWaveShaperNode : leftWaveShaperNode.inputs[0]);\n panGainNode.disconnect(rightWaveShaperNode.inputs === undefined ? rightWaveShaperNode : rightWaveShaperNode.inputs[0]);\n\n leftWaveShaperNode.disconnect(leftGainNode.gain);\n rightWaveShaperNode.disconnect(rightGainNode.gain);\n\n leftGainNode.disconnect(channelMergerNode, 0, 0);\n rightGainNode.disconnect(channelMergerNode, 0, 1);\n }\n };\n };\n\n const buildInternalGraphForStereo = (\n nativeContext: TNativeContext,\n inputGainNode: TNativeGainNode,\n panGainNode: TNativeGainNode,\n channelMergerNode: TNativeChannelMergerNode\n ) => {\n const leftInputForLeftOutputWaveShaperCurve = new Float32Array(CURVE_SIZE);\n const leftInputForRightOutputWaveShaperCurve = new Float32Array(CURVE_SIZE);\n const rightInputForLeftOutputWaveShaperCurve = new Float32Array(CURVE_SIZE);\n const rightInputForRightOutputWaveShaperCurve = new Float32Array(CURVE_SIZE);\n\n const centerIndex = Math.floor(CURVE_SIZE / 2);\n\n for (let i = 0; i < CURVE_SIZE; i += 1) {\n if (i > centerIndex) {\n const x = ((i - centerIndex) / (CURVE_SIZE - 1 - centerIndex)) * HALF_PI;\n\n leftInputForLeftOutputWaveShaperCurve[i] = Math.cos(x);\n leftInputForRightOutputWaveShaperCurve[i] = Math.sin(x);\n rightInputForLeftOutputWaveShaperCurve[i] = 0;\n rightInputForRightOutputWaveShaperCurve[i] = 1;\n } else {\n const x = (i / (CURVE_SIZE - 1 - centerIndex)) * HALF_PI;\n\n leftInputForLeftOutputWaveShaperCurve[i] = 1;\n leftInputForRightOutputWaveShaperCurve[i] = 0;\n rightInputForLeftOutputWaveShaperCurve[i] = Math.cos(x);\n rightInputForRightOutputWaveShaperCurve[i] = Math.sin(x);\n }\n }\n\n const channelSplitterNode = createNativeChannelSplitterNode(nativeContext, {\n channelCount: 2,\n channelCountMode: 'explicit',\n channelInterpretation: 'discrete',\n numberOfOutputs: 2\n });\n const leftInputForLeftOutputGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 0 });\n // Bug #119: Safari does not fully support the WaveShaperNode.\n const leftInputForLeftOutputWaveShaperNode = createNativeWaveShaperNode(nativeContext, {\n ...SINGLE_CHANNEL_WAVE_SHAPER_OPTIONS,\n curve: leftInputForLeftOutputWaveShaperCurve\n });\n const leftInputForRightOutputGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 0 });\n // Bug #119: Safari does not fully support the WaveShaperNode.\n const leftInputForRightOutputWaveShaperNode = createNativeWaveShaperNode(nativeContext, {\n ...SINGLE_CHANNEL_WAVE_SHAPER_OPTIONS,\n curve: leftInputForRightOutputWaveShaperCurve\n });\n // Bug #119: Safari does not fully support the WaveShaperNode.\n const panWaveShaperNode = (\n createNativeWaveShaperNode(nativeContext, { ...SINGLE_CHANNEL_WAVE_SHAPER_OPTIONS, curve: DC_CURVE })\n );\n const rightInputForLeftOutputGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 0 });\n // Bug #119: Safari does not fully support the WaveShaperNode.\n const rightInputForLeftOutputWaveShaperNode = createNativeWaveShaperNode(nativeContext, {\n ...SINGLE_CHANNEL_WAVE_SHAPER_OPTIONS,\n curve: rightInputForLeftOutputWaveShaperCurve\n });\n const rightInputForRightOutputGainNode = createNativeGainNode(nativeContext, { ...SINGLE_CHANNEL_OPTIONS, gain: 0 });\n // Bug #119: Safari does not fully support the WaveShaperNode.\n const rightInputForRightOutputWaveShaperNode = createNativeWaveShaperNode(nativeContext, {\n ...SINGLE_CHANNEL_WAVE_SHAPER_OPTIONS,\n curve: rightInputForRightOutputWaveShaperCurve\n });\n\n return {\n connectGraph(): void {\n inputGainNode.connect(channelSplitterNode);\n inputGainNode.connect(panWaveShaperNode.inputs === undefined ? panWaveShaperNode : panWaveShaperNode.inputs[0]);\n\n channelSplitterNode.connect(leftInputForLeftOutputGainNode, 0);\n channelSplitterNode.connect(leftInputForRightOutputGainNode, 0);\n channelSplitterNode.connect(rightInputForLeftOutputGainNode, 1);\n channelSplitterNode.connect(rightInputForRightOutputGainNode, 1);\n\n panWaveShaperNode.connect(panGainNode);\n\n panGainNode.connect(\n leftInputForLeftOutputWaveShaperNode.inputs === undefined\n ? leftInputForLeftOutputWaveShaperNode\n : leftInputForLeftOutputWaveShaperNode.inputs[0]\n );\n panGainNode.connect(\n leftInputForRightOutputWaveShaperNode.inputs === undefined\n ? leftInputForRightOutputWaveShaperNode\n : leftInputForRightOutputWaveShaperNode.inputs[0]\n );\n panGainNode.connect(\n rightInputForLeftOutputWaveShaperNode.inputs === undefined\n ? rightInputForLeftOutputWaveShaperNode\n : rightInputForLeftOutputWaveShaperNode.inputs[0]\n );\n panGainNode.connect(\n rightInputForRightOutputWaveShaperNode.inputs === undefined\n ? rightInputForRightOutputWaveShaperNode\n : rightInputForRightOutputWaveShaperNode.inputs[0]\n );\n\n leftInputForLeftOutputWaveShaperNode.connect(leftInputForLeftOutputGainNode.gain);\n leftInputForRightOutputWaveShaperNode.connect(leftInputForRightOutputGainNode.gain);\n rightInputForLeftOutputWaveShaperNode.connect(rightInputForLeftOutputGainNode.gain);\n rightInputForRightOutputWaveShaperNode.connect(rightInputForRightOutputGainNode.gain);\n\n leftInputForLeftOutputGainNode.connect(channelMergerNode, 0, 0);\n rightInputForLeftOutputGainNode.connect(channelMergerNode, 0, 0);\n\n leftInputForRightOutputGainNode.connect(channelMergerNode, 0, 1);\n rightInputForRightOutputGainNode.connect(channelMergerNode, 0, 1);\n },\n disconnectGraph(): void {\n inputGainNode.disconnect(channelSplitterNode);\n inputGainNode.disconnect(panWaveShaperNode.inputs === undefined ? panWaveShaperNode : panWaveShaperNode.inputs[0]);\n\n channelSplitterNode.disconnect(leftInputForLeftOutputGainNode, 0);\n channelSplitterNode.disconnect(leftInputForRightOutputGainNode, 0);\n channelSplitterNode.disconnect(rightInputForLeftOutputGainNode, 1);\n channelSplitterNode.disconnect(rightInputForRightOutputGainNode, 1);\n\n panWaveShaperNode.disconnect(panGainNode);\n\n panGainNode.disconnect(\n leftInputForLeftOutputWaveShaperNode.inputs === undefined\n ? leftInputForLeftOutputWaveShaperNode\n : leftInputForLeftOutputWaveShaperNode.inputs[0]\n );\n panGainNode.disconnect(\n leftInputForRightOutputWaveShaperNode.inputs === undefined\n ? leftInputForRightOutputWaveShaperNode\n : leftInputForRightOutputWaveShaperNode.inputs[0]\n );\n panGainNode.disconnect(\n rightInputForLeftOutputWaveShaperNode.inputs === undefined\n ? rightInputForLeftOutputWaveShaperNode\n : rightInputForLeftOutputWaveShaperNode.inputs[0]\n );\n panGainNode.disconnect(\n rightInputForRightOutputWaveShaperNode.inputs === undefined\n ? rightInputForRightOutputWaveShaperNode\n : rightInputForRightOutputWaveShaperNode.inputs[0]\n );\n\n leftInputForLeftOutputWaveShaperNode.disconnect(leftInputForLeftOutputGainNode.gain);\n leftInputForRightOutputWaveShaperNode.disconnect(leftInputForRightOutputGainNode.gain);\n rightInputForLeftOutputWaveShaperNode.disconnect(rightInputForLeftOutputGainNode.gain);\n rightInputForRightOutputWaveShaperNode.disconnect(rightInputForRightOutputGainNode.gain);\n\n leftInputForLeftOutputGainNode.disconnect(channelMergerNode, 0, 0);\n rightInputForLeftOutputGainNode.disconnect(channelMergerNode, 0, 0);\n\n leftInputForRightOutputGainNode.disconnect(channelMergerNode, 0, 1);\n rightInputForRightOutputGainNode.disconnect(channelMergerNode, 0, 1);\n }\n };\n };\n\n const buildInternalGraph = (\n nativeContext: TNativeContext,\n channelCount: number,\n inputGainNode: TNativeGainNode,\n panGainNode: TNativeGainNode,\n channelMergerNode: TNativeChannelMergerNode\n ) => {\n if (channelCount === 1) {\n return buildInternalGraphForMono(nativeContext, inputGainNode, panGainNode, channelMergerNode);\n }\n\n if (channelCount === 2) {\n return buildInternalGraphForStereo(nativeContext, inputGainNode, panGainNode, channelMergerNode);\n }\n\n throw createNotSupportedError();\n };\n\n return (nativeContext, { channelCount, channelCountMode, pan, ...audioNodeOptions }) => {\n if (channelCountMode === 'max') {\n throw createNotSupportedError();\n }\n\n const channelMergerNode = createNativeChannelMergerNode(nativeContext, {\n ...audioNodeOptions,\n channelCount: 1,\n channelCountMode,\n numberOfInputs: 2\n });\n const inputGainNode = createNativeGainNode(nativeContext, { ...audioNodeOptions, channelCount, channelCountMode, gain: 1 });\n const panGainNode = createNativeGainNode(nativeContext, {\n channelCount: 1,\n channelCountMode: 'explicit',\n channelInterpretation: 'discrete',\n gain: pan\n });\n\n let { connectGraph, disconnectGraph } = buildInternalGraph(\n nativeContext,\n channelCount,\n inputGainNode,\n panGainNode,\n channelMergerNode\n );\n\n Object.defineProperty(panGainNode.gain, 'defaultValue', { get: () => 0 });\n Object.defineProperty(panGainNode.gain, 'maxValue', { get: () => 1 });\n Object.defineProperty(panGainNode.gain, 'minValue', { get: () => -1 });\n\n const nativeStereoPannerNodeFakerFactory = {\n get bufferSize(): undefined {\n return undefined;\n },\n get channelCount(): number {\n return inputGainNode.channelCount;\n },\n set channelCount(value) {\n if (inputGainNode.channelCount !== value) {\n if (isConnected) {\n disconnectGraph();\n }\n\n ({ connectGraph, disconnectGraph } = buildInternalGraph(\n nativeContext,\n value,\n inputGainNode,\n panGainNode,\n channelMergerNode\n ));\n\n if (isConnected) {\n connectGraph();\n }\n }\n\n inputGainNode.channelCount = value;\n },\n get channelCountMode(): TNativeStereoPannerNode['channelCountMode'] {\n return inputGainNode.channelCountMode;\n },\n set channelCountMode(value) {\n if (value === 'clamped-max' || value === 'max') {\n throw createNotSupportedError();\n }\n\n inputGainNode.channelCountMode = value;\n },\n get channelInterpretation(): TNativeStereoPannerNode['channelInterpretation'] {\n return inputGainNode.channelInterpretation;\n },\n set channelInterpretation(value) {\n inputGainNode.channelInterpretation = value;\n },\n get context(): TNativeStereoPannerNode['context'] {\n return inputGainNode.context;\n },\n get inputs(): TNativeAudioNode[] {\n return [inputGainNode];\n },\n get numberOfInputs(): number {\n return inputGainNode.numberOfInputs;\n },\n get numberOfOutputs(): number {\n return inputGainNode.numberOfOutputs;\n },\n get pan(): TNativeStereoPannerNode['pan'] {\n return panGainNode.gain;\n },\n addEventListener(...args: any[]): void {\n return inputGainNode.addEventListener(args[0], args[1], args[2]);\n },\n dispatchEvent(...args: any[]): boolean {\n return inputGainNode.dispatchEvent(args[0]);\n },\n removeEventListener(...args: any[]): void {\n return inputGainNode.removeEventListener(args[0], args[1], args[2]);\n }\n };\n\n let isConnected = false;\n\n const whenConnected = () => {\n connectGraph();\n\n isConnected = true;\n };\n const whenDisconnected = () => {\n disconnectGraph();\n\n isConnected = false;\n };\n\n return monitorConnections(\n interceptConnections(nativeStereoPannerNodeFakerFactory, channelMergerNode),\n whenConnected,\n whenDisconnected\n );\n };\n};\n","import { assignNativeAudioNodeAudioParamValue } from '../helpers/assign-native-audio-node-audio-param-value';\nimport { assignNativeAudioNodeOptions } from '../helpers/assign-native-audio-node-options';\nimport { TNativeStereoPannerNodeFactoryFactory } from '../types';\n\nexport const createNativeStereoPannerNodeFactory: TNativeStereoPannerNodeFactoryFactory = (\n createNativeStereoPannerNodeFaker,\n createNotSupportedError\n) => {\n return (nativeContext, options) => {\n const channelCountMode = options.channelCountMode;\n\n /*\n * Bug #105: The channelCountMode of 'clamped-max' should be supported. However it is not possible to write a polyfill for Safari\n * which supports it and therefore it can't be supported at all.\n */\n if (channelCountMode === 'clamped-max') {\n throw createNotSupportedError();\n }\n\n // Bug #105: Safari does not support the StereoPannerNode.\n if (nativeContext.createStereoPanner === undefined) {\n return createNativeStereoPannerNodeFaker(nativeContext, options);\n }\n\n const nativeStereoPannerNode = nativeContext.createStereoPanner();\n\n assignNativeAudioNodeOptions(nativeStereoPannerNode, options);\n\n assignNativeAudioNodeAudioParamValue(nativeStereoPannerNode, options, 'pan');\n\n /*\n * Bug #105: The channelCountMode of 'clamped-max' should be supported. However it is not possible to write a polyfill for Safari\n * which supports it and therefore it can't be supported at all.\n */\n Object.defineProperty(nativeStereoPannerNode, 'channelCountMode', {\n get: () => channelCountMode,\n set: (value) => {\n if (value !== channelCountMode) {\n throw createNotSupportedError();\n }\n }\n });\n\n return nativeStereoPannerNode;\n };\n};\n","import { isNativeAudioNodeFaker } from '../guards/native-audio-node-faker';\nimport { isOwnedByContext } from '../helpers/is-owned-by-context';\nimport { IMinimalOfflineAudioContext, IOfflineAudioContext, IStereoPannerNode } from '../interfaces';\nimport { TNativeOfflineAudioContext, TNativeStereoPannerNode, TStereoPannerNodeRendererFactoryFactory } from '../types';\n\nexport const createStereoPannerNodeRendererFactory: TStereoPannerNodeRendererFactoryFactory = (\n connectAudioParam,\n createNativeStereoPannerNode,\n getNativeAudioNode,\n renderAutomation,\n renderInputsOfAudioNode\n) => {\n return () => {\n const renderedNativeStereoPannerNodes = new WeakMap();\n\n const createStereoPannerNode = async (proxy: IStereoPannerNode, nativeOfflineAudioContext: TNativeOfflineAudioContext) => {\n let nativeStereoPannerNode = getNativeAudioNode(proxy);\n\n /*\n * If the initially used nativeStereoPannerNode was not constructed on the same OfflineAudioContext it needs to be created\n * again.\n */\n const nativeStereoPannerNodeIsOwnedByContext = isOwnedByContext(nativeStereoPannerNode, nativeOfflineAudioContext);\n\n if (!nativeStereoPannerNodeIsOwnedByContext) {\n const options = {\n channelCount: nativeStereoPannerNode.channelCount,\n channelCountMode: nativeStereoPannerNode.channelCountMode,\n channelInterpretation: nativeStereoPannerNode.channelInterpretation,\n pan: nativeStereoPannerNode.pan.value\n };\n\n nativeStereoPannerNode = createNativeStereoPannerNode(nativeOfflineAudioContext, options);\n }\n\n renderedNativeStereoPannerNodes.set(nativeOfflineAudioContext, nativeStereoPannerNode);\n\n if (!nativeStereoPannerNodeIsOwnedByContext) {\n await renderAutomation(nativeOfflineAudioContext, proxy.pan, nativeStereoPannerNode.pan);\n } else {\n await connectAudioParam(nativeOfflineAudioContext, proxy.pan, nativeStereoPannerNode.pan);\n }\n\n if (isNativeAudioNodeFaker(nativeStereoPannerNode)) {\n await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeStereoPannerNode.inputs[0]);\n } else {\n await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeStereoPannerNode);\n }\n\n return nativeStereoPannerNode;\n };\n\n return {\n render(proxy: IStereoPannerNode, nativeOfflineAudioContext: TNativeOfflineAudioContext): Promise {\n const renderedNativeStereoPannerNode = renderedNativeStereoPannerNodes.get(nativeOfflineAudioContext);\n\n if (renderedNativeStereoPannerNode !== undefined) {\n return Promise.resolve(renderedNativeStereoPannerNode);\n }\n\n return createStereoPannerNode(proxy, nativeOfflineAudioContext);\n }\n };\n };\n};\n","import { isNativeAudioNodeFaker } from '../guards/native-audio-node-faker';\nimport { isOwnedByContext } from '../helpers/is-owned-by-context';\nimport { IMinimalOfflineAudioContext, IOfflineAudioContext, IWaveShaperNode } from '../interfaces';\nimport { TNativeOfflineAudioContext, TNativeWaveShaperNode, TWaveShaperNodeRendererFactoryFactory } from '../types';\n\nexport const createWaveShaperNodeRendererFactory: TWaveShaperNodeRendererFactoryFactory = (\n createNativeWaveShaperNode,\n getNativeAudioNode,\n renderInputsOfAudioNode\n) => {\n return () => {\n const renderedNativeWaveShaperNodes = new WeakMap();\n\n const createWaveShaperNode = async (proxy: IWaveShaperNode, nativeOfflineAudioContext: TNativeOfflineAudioContext) => {\n let nativeWaveShaperNode = getNativeAudioNode(proxy);\n\n // If the initially used nativeWaveShaperNode was not constructed on the same OfflineAudioContext it needs to be created again.\n const nativeWaveShaperNodeIsOwnedByContext = isOwnedByContext(nativeWaveShaperNode, nativeOfflineAudioContext);\n\n if (!nativeWaveShaperNodeIsOwnedByContext) {\n const options = {\n channelCount: nativeWaveShaperNode.channelCount,\n channelCountMode: nativeWaveShaperNode.channelCountMode,\n channelInterpretation: nativeWaveShaperNode.channelInterpretation,\n curve: nativeWaveShaperNode.curve,\n oversample: nativeWaveShaperNode.oversample\n };\n\n nativeWaveShaperNode = createNativeWaveShaperNode(nativeOfflineAudioContext, options);\n }\n\n renderedNativeWaveShaperNodes.set(nativeOfflineAudioContext, nativeWaveShaperNode);\n\n if (isNativeAudioNodeFaker(nativeWaveShaperNode)) {\n await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeWaveShaperNode.inputs[0]);\n } else {\n await renderInputsOfAudioNode(proxy, nativeOfflineAudioContext, nativeWaveShaperNode);\n }\n\n return nativeWaveShaperNode;\n };\n\n return {\n render(proxy: IWaveShaperNode, nativeOfflineAudioContext: TNativeOfflineAudioContext): Promise {\n const renderedNativeWaveShaperNode = renderedNativeWaveShaperNodes.get(nativeOfflineAudioContext);\n\n if (renderedNativeWaveShaperNode !== undefined) {\n return Promise.resolve(renderedNativeWaveShaperNode);\n }\n\n return createWaveShaperNode(proxy, nativeOfflineAudioContext);\n }\n };\n };\n};\n","import { TIsSecureContextFactory } from '../types';\n\nexport const createIsSecureContext: TIsSecureContextFactory = (window) => window !== null && window.isSecureContext;\n","import { TExposeCurrentFrameAndCurrentTimeFactory } from '../types';\n\nexport const createExposeCurrentFrameAndCurrentTime: TExposeCurrentFrameAndCurrentTimeFactory = (window) => {\n return (currentTime, sampleRate, fn) => {\n Object.defineProperties(window, {\n currentFrame: {\n configurable: true,\n get(): number {\n return Math.round(currentTime * sampleRate);\n }\n },\n currentTime: {\n configurable: true,\n get(): number {\n return currentTime;\n }\n }\n });\n\n try {\n return fn();\n } finally {\n if (window !== null) {\n delete (window).currentFrame;\n delete (window).currentTime;\n }\n }\n };\n};\n","import { TGetOrCreateBackupOfflineAudioContextFactory } from '../types';\n\nexport const createGetOrCreateBackupOfflineAudioContext: TGetOrCreateBackupOfflineAudioContextFactory = (\n backupOfflineAudioContextStore,\n nativeOfflineAudioContextConstructor\n) => {\n return (nativeContext) => {\n let backupOfflineAudioContext = backupOfflineAudioContextStore.get(nativeContext);\n\n if (backupOfflineAudioContext !== undefined) {\n return backupOfflineAudioContext;\n }\n\n if (nativeOfflineAudioContextConstructor === null) {\n throw new Error('Missing the native OfflineAudioContext constructor.');\n }\n\n // Bug #141: Safari does not support creating an OfflineAudioContext with less than 44100 Hz.\n backupOfflineAudioContext = new nativeOfflineAudioContextConstructor(1, 1, 44100);\n\n backupOfflineAudioContextStore.set(nativeContext, backupOfflineAudioContext);\n\n return backupOfflineAudioContext;\n };\n};\n","import { TEvaluateSourceFactory } from '../types';\n\nexport const createEvaluateSource: TEvaluateSourceFactory = (window) => {\n return (source) =>\n new Promise((resolve, reject) => {\n if (window === null) {\n // Bug #182 Chrome and Edge do throw an instance of a SyntaxError instead of a DOMException.\n reject(new SyntaxError());\n\n return;\n }\n\n const head = window.document.head;\n\n if (head === null) {\n // Bug #182 Chrome and Edge do throw an instance of a SyntaxError instead of a DOMException.\n reject(new SyntaxError());\n } else {\n const script = window.document.createElement('script');\n // @todo Safari doesn't like URLs with a type of 'application/javascript; charset=utf-8'.\n const blob = new Blob([source], { type: 'application/javascript' });\n const url = URL.createObjectURL(blob);\n\n const originalOnErrorHandler = window.onerror;\n\n const removeErrorEventListenerAndRevokeUrl = () => {\n window.onerror = originalOnErrorHandler;\n\n URL.revokeObjectURL(url);\n };\n\n window.onerror = (message, src, lineno, colno, error) => {\n // @todo Edge thinks the source is the one of the html document.\n if (src === url || (src === window.location.href && lineno === 1 && colno === 1)) {\n removeErrorEventListenerAndRevokeUrl();\n reject(error);\n\n return false;\n }\n\n if (originalOnErrorHandler !== null) {\n return originalOnErrorHandler(message, src, lineno, colno, error);\n }\n };\n\n script.onerror = () => {\n removeErrorEventListenerAndRevokeUrl();\n // Bug #182 Chrome and Edge do throw an instance of a SyntaxError instead of a DOMException.\n reject(new SyntaxError());\n };\n script.onload = () => {\n removeErrorEventListenerAndRevokeUrl();\n resolve();\n };\n script.src = url;\n script.type = 'module';\n\n head.appendChild(script);\n }\n });\n};\n","import { TFetchSourceFactory } from '../types';\n\nexport const createFetchSource: TFetchSourceFactory = (createAbortError) => {\n return async (url) => {\n try {\n const response = await fetch(url);\n\n if (response.ok) {\n return [await response.text(), response.url];\n }\n } catch {\n // Ignore errors.\n } // tslint:disable-line:no-empty\n\n throw createAbortError();\n };\n};\n","import { TAbortErrorFactory } from '../types';\n\nexport const createAbortError: TAbortErrorFactory = () => new DOMException('', 'AbortError');\n","import { TTestAudioWorkletProcessorPostMessageSupportFactory } from '../types';\n\n// Bug #179: Firefox does not allow to transfer any buffer which has been passed to the process() method as an argument.\nexport const createTestAudioWorkletProcessorPostMessageSupport: TTestAudioWorkletProcessorPostMessageSupportFactory = (\n nativeAudioWorkletNodeConstructor,\n nativeOfflineAudioContextConstructor\n) => {\n return async () => {\n // Bug #61: If there is no native AudioWorkletNode it gets faked and therefore it is no problem if the it doesn't exist.\n if (nativeAudioWorkletNodeConstructor === null) {\n return true;\n }\n\n if (nativeOfflineAudioContextConstructor === null) {\n return false;\n }\n\n const blob = new Blob(\n ['class A extends AudioWorkletProcessor{process(i){this.port.postMessage(i,[i[0][0].buffer])}}registerProcessor(\"a\",A)'],\n {\n type: 'application/javascript; charset=utf-8'\n }\n );\n // Bug #141: Safari does not support creating an OfflineAudioContext with less than 44100 Hz.\n const offlineAudioContext = new nativeOfflineAudioContextConstructor(1, 128, 44100);\n const url = URL.createObjectURL(blob);\n\n let isEmittingMessageEvents = false;\n let isEmittingProcessorErrorEvents = false;\n\n try {\n await offlineAudioContext.audioWorklet.addModule(url);\n\n const audioWorkletNode = new nativeAudioWorkletNodeConstructor(offlineAudioContext, 'a', { numberOfOutputs: 0 });\n const oscillator = offlineAudioContext.createOscillator();\n\n audioWorkletNode.port.onmessage = () => (isEmittingMessageEvents = true);\n audioWorkletNode.onprocessorerror = () => (isEmittingProcessorErrorEvents = true);\n\n oscillator.connect(audioWorkletNode);\n oscillator.start(0);\n\n await offlineAudioContext.startRendering();\n } catch {\n // Ignore errors.\n } finally {\n URL.revokeObjectURL(url);\n }\n\n return isEmittingMessageEvents && !isEmittingProcessorErrorEvents;\n };\n};\n","import { TIsNativeContextFactory, TNativeAudioContext } from '../types';\n\nexport const createIsNativeContext: TIsNativeContextFactory = (isNativeAudioContext, isNativeOfflineAudioContext) => {\n return (anything): anything is TNativeAudioContext => {\n return isNativeAudioContext(anything) || isNativeOfflineAudioContext(anything);\n };\n};\n","import { detachArrayBuffer } from '../helpers/detach-array-buffer';\nimport { wrapAudioBufferGetChannelDataMethod } from '../helpers/wrap-audio-buffer-get-channel-data-method';\nimport { TDecodeAudioDataFactory } from '../types';\n\nexport const createDecodeAudioData: TDecodeAudioDataFactory = (\n audioBufferStore,\n cacheTestResult,\n createDataCloneError,\n createEncodingError,\n detachedArrayBuffers,\n getNativeContext,\n isNativeContext,\n testAudioBufferCopyChannelMethodsOutOfBoundsSupport,\n testPromiseSupport,\n wrapAudioBufferCopyChannelMethods,\n wrapAudioBufferCopyChannelMethodsOutOfBounds\n) => {\n return (anyContext, audioData) => {\n const nativeContext = isNativeContext(anyContext) ? anyContext : getNativeContext(anyContext);\n\n // Bug #43: Only Chrome and Edge do throw a DataCloneError.\n if (detachedArrayBuffers.has(audioData)) {\n const err = createDataCloneError();\n\n return Promise.reject(err);\n }\n\n // The audioData parameter maybe of a type which can't be added to a WeakSet.\n try {\n detachedArrayBuffers.add(audioData);\n } catch {\n // Ignore errors.\n }\n\n // Bug #21: Safari does not support promises yet.\n if (cacheTestResult(testPromiseSupport, () => testPromiseSupport(nativeContext))) {\n return nativeContext.decodeAudioData(audioData).then((audioBuffer) => {\n // Bug #133: Safari does neuter the ArrayBuffer.\n detachArrayBuffer(audioData).catch(() => {\n // Ignore errors.\n });\n\n // Bug #157: Firefox does not allow the bufferOffset to be out-of-bounds.\n if (\n !cacheTestResult(testAudioBufferCopyChannelMethodsOutOfBoundsSupport, () =>\n testAudioBufferCopyChannelMethodsOutOfBoundsSupport(audioBuffer)\n )\n ) {\n wrapAudioBufferCopyChannelMethodsOutOfBounds(audioBuffer);\n }\n\n audioBufferStore.add(audioBuffer);\n\n return audioBuffer;\n });\n }\n\n // Bug #21: Safari does not return a Promise yet.\n return new Promise((resolve, reject) => {\n const complete = async () => {\n // Bug #133: Safari does neuter the ArrayBuffer.\n try {\n await detachArrayBuffer(audioData);\n } catch {\n // Ignore errors.\n }\n };\n\n const fail = (err: DOMException | Error) => {\n reject(err);\n complete();\n };\n\n // Bug #26: Safari throws a synchronous error.\n try {\n // Bug #1: Safari requires a successCallback.\n nativeContext.decodeAudioData(\n audioData,\n (audioBuffer) => {\n // Bug #5: Safari does not support copyFromChannel() and copyToChannel().\n // Bug #100: Safari does throw a wrong error when calling getChannelData() with an out-of-bounds value.\n if (typeof audioBuffer.copyFromChannel !== 'function') {\n wrapAudioBufferCopyChannelMethods(audioBuffer);\n wrapAudioBufferGetChannelDataMethod(audioBuffer);\n }\n\n audioBufferStore.add(audioBuffer);\n\n complete().then(() => resolve(audioBuffer));\n },\n (err: DOMException | Error) => {\n // Bug #4: Safari returns null instead of an error.\n if (err === null) {\n fail(createEncodingError());\n } else {\n fail(err);\n }\n }\n );\n } catch (err) {\n fail(err);\n }\n });\n };\n};\n","import { TDataCloneErrorFactory } from '../types';\n\nexport const createDataCloneError: TDataCloneErrorFactory = () => new DOMException('', 'DataCloneError');\n","import { TEncodingErrorFactory } from '../types';\n\nexport const createEncodingError: TEncodingErrorFactory = () => new DOMException('', 'EncodingError');\n","import {\n IAnalyserNode,\n IAudioBuffer,\n IAudioBufferSourceNode,\n IAudioNode,\n IAudioWorklet,\n IBaseAudioContext,\n IBiquadFilterNode,\n IConstantSourceNode,\n IConvolverNode,\n IDelayNode,\n IDynamicsCompressorNode,\n IGainNode,\n IIIRFilterNode,\n IOscillatorNode,\n IPannerNode,\n IPeriodicWave,\n IPeriodicWaveConstraints,\n IStereoPannerNode,\n IWaveShaperNode,\n IWorkletOptions\n} from '../interfaces';\nimport { TBaseAudioContextConstructorFactory, TContext, TDecodeErrorCallback, TDecodeSuccessCallback, TNativeContext } from '../types';\n\nexport const createBaseAudioContextConstructor: TBaseAudioContextConstructorFactory = (\n addAudioWorkletModule,\n analyserNodeConstructor,\n audioBufferConstructor,\n audioBufferSourceNodeConstructor,\n biquadFilterNodeConstructor,\n channelMergerNodeConstructor,\n channelSplitterNodeConstructor,\n constantSourceNodeConstructor,\n convolverNodeConstructor,\n decodeAudioData,\n delayNodeConstructor,\n dynamicsCompressorNodeConstructor,\n gainNodeConstructor,\n iIRFilterNodeConstructor,\n minimalBaseAudioContextConstructor,\n oscillatorNodeConstructor,\n pannerNodeConstructor,\n periodicWaveConstructor,\n stereoPannerNodeConstructor,\n waveShaperNodeConstructor\n) => {\n return class BaseAudioContext extends minimalBaseAudioContextConstructor implements IBaseAudioContext {\n private _audioWorklet: undefined | IAudioWorklet;\n\n constructor(private _nativeContext: TNativeContext, numberOfChannels: number) {\n super(_nativeContext, numberOfChannels);\n\n this._audioWorklet =\n addAudioWorkletModule === undefined\n ? undefined\n : {\n addModule: (moduleURL: string, options?: IWorkletOptions) => {\n return addAudioWorkletModule((this), moduleURL, options);\n }\n };\n }\n\n get audioWorklet(): undefined | IAudioWorklet {\n return this._audioWorklet;\n }\n\n public createAnalyser(): IAnalyserNode {\n return new analyserNodeConstructor((this));\n }\n\n public createBiquadFilter(): IBiquadFilterNode {\n return new biquadFilterNodeConstructor((this));\n }\n\n public createBuffer(numberOfChannels: number, length: number, sampleRate: number): IAudioBuffer {\n return new audioBufferConstructor({ length, numberOfChannels, sampleRate });\n }\n\n public createBufferSource(): IAudioBufferSourceNode {\n return new audioBufferSourceNodeConstructor((this));\n }\n\n public createChannelMerger(numberOfInputs = 6): IAudioNode {\n return new channelMergerNodeConstructor((this), { numberOfInputs });\n }\n\n public createChannelSplitter(numberOfOutputs = 6): IAudioNode {\n return new channelSplitterNodeConstructor((this), { numberOfOutputs });\n }\n\n public createConstantSource(): IConstantSourceNode {\n return new constantSourceNodeConstructor((this));\n }\n\n public createConvolver(): IConvolverNode {\n return new convolverNodeConstructor((this));\n }\n\n public createDelay(maxDelayTime = 1): IDelayNode {\n return new delayNodeConstructor((this), { maxDelayTime });\n }\n\n public createDynamicsCompressor(): IDynamicsCompressorNode {\n return new dynamicsCompressorNodeConstructor((this));\n }\n\n public createGain(): IGainNode {\n return new gainNodeConstructor((this));\n }\n\n public createIIRFilter(feedforward: Iterable, feedback: Iterable): IIIRFilterNode {\n return new iIRFilterNodeConstructor((this), { feedback, feedforward });\n }\n\n public createOscillator(): IOscillatorNode {\n return new oscillatorNodeConstructor((this));\n }\n\n public createPanner(): IPannerNode {\n return new pannerNodeConstructor((this));\n }\n\n public createPeriodicWave(\n real: Iterable,\n imag: Iterable,\n constraints: Partial = { disableNormalization: false }\n ): IPeriodicWave {\n return new periodicWaveConstructor((this), { ...constraints, imag, real });\n }\n\n public createStereoPanner(): IStereoPannerNode {\n return new stereoPannerNodeConstructor((this));\n }\n\n public createWaveShaper(): IWaveShaperNode {\n return new waveShaperNodeConstructor((this));\n }\n\n public decodeAudioData(\n audioData: ArrayBuffer,\n successCallback?: TDecodeSuccessCallback,\n errorCallback?: TDecodeErrorCallback\n ): Promise {\n return decodeAudioData(this._nativeContext, audioData).then(\n (audioBuffer) => {\n if (typeof successCallback === 'function') {\n successCallback(audioBuffer);\n }\n\n return audioBuffer;\n },\n (err) => {\n if (typeof errorCallback === 'function') {\n errorCallback(err);\n }\n\n throw err;\n }\n );\n }\n };\n};\n","import { IAudioContext, IMediaElementAudioSourceNode, IMediaElementAudioSourceOptions, IMinimalAudioContext } from '../interfaces';\nimport { TAudioNodeRenderer, TMediaElementAudioSourceNodeConstructorFactory, TNativeMediaElementAudioSourceNode } from '../types';\n\nexport const createMediaElementAudioSourceNodeConstructor: TMediaElementAudioSourceNodeConstructorFactory = (\n audioNodeConstructor,\n createNativeMediaElementAudioSourceNode,\n getNativeContext,\n isNativeOfflineAudioContext\n) => {\n return class MediaElementAudioSourceNode extends audioNodeConstructor\n implements IMediaElementAudioSourceNode {\n private _nativeMediaElementAudioSourceNode: TNativeMediaElementAudioSourceNode;\n\n constructor(context: T, options: IMediaElementAudioSourceOptions) {\n const nativeContext = getNativeContext(context);\n const nativeMediaElementAudioSourceNode = createNativeMediaElementAudioSourceNode(nativeContext, options);\n\n // Bug #171: Safari allows to create a MediaElementAudioSourceNode with an OfflineAudioContext.\n if (isNativeOfflineAudioContext(nativeContext)) {\n throw TypeError();\n }\n\n super(context, true, nativeMediaElementAudioSourceNode, >null);\n\n this._nativeMediaElementAudioSourceNode = nativeMediaElementAudioSourceNode;\n }\n\n get mediaElement(): HTMLMediaElement {\n return this._nativeMediaElementAudioSourceNode.mediaElement;\n }\n };\n};\n","import { TNativeMediaElementAudioSourceNodeFactory } from '../types';\n\nexport const createNativeMediaElementAudioSourceNode: TNativeMediaElementAudioSourceNodeFactory = (nativeAudioContext, options) => {\n return nativeAudioContext.createMediaElementSource(options.mediaElement);\n};\n","import { assignNativeAudioNodeOptions } from '../helpers/assign-native-audio-node-options';\nimport { TNativeMediaStreamAudioDestinationNodeFactory } from '../types';\n\nexport const createNativeMediaStreamAudioDestinationNode: TNativeMediaStreamAudioDestinationNodeFactory = (nativeAudioContext, options) => {\n const nativeMediaStreamAudioDestinationNode = nativeAudioContext.createMediaStreamDestination();\n\n assignNativeAudioNodeOptions(nativeMediaStreamAudioDestinationNode, options);\n\n // Bug #174: Safari does expose a wrong numberOfOutputs.\n if (nativeMediaStreamAudioDestinationNode.numberOfOutputs === 1) {\n Object.defineProperty(nativeMediaStreamAudioDestinationNode, 'numberOfOutputs', { get: () => 0 });\n }\n\n return nativeMediaStreamAudioDestinationNode;\n};\n","import { IAudioContext, IMediaStreamAudioSourceNode, IMediaStreamAudioSourceOptions, IMinimalAudioContext } from '../interfaces';\nimport { TAudioNodeRenderer, TMediaStreamAudioSourceNodeConstructorFactory, TNativeMediaStreamAudioSourceNode } from '../types';\n\nexport const createMediaStreamAudioSourceNodeConstructor: TMediaStreamAudioSourceNodeConstructorFactory = (\n audioNodeConstructor,\n createNativeMediaStreamAudioSourceNode,\n getNativeContext,\n isNativeOfflineAudioContext\n) => {\n return class MediaStreamAudioSourceNode extends audioNodeConstructor\n implements IMediaStreamAudioSourceNode {\n private _nativeMediaStreamAudioSourceNode: TNativeMediaStreamAudioSourceNode;\n\n constructor(context: T, options: IMediaStreamAudioSourceOptions) {\n const nativeContext = getNativeContext(context);\n const nativeMediaStreamAudioSourceNode = createNativeMediaStreamAudioSourceNode(nativeContext, options);\n\n // Bug #172: Safari allows to create a MediaStreamAudioSourceNode with an OfflineAudioContext.\n if (isNativeOfflineAudioContext(nativeContext)) {\n throw new TypeError();\n }\n\n super(context, true, nativeMediaStreamAudioSourceNode, >null);\n\n this._nativeMediaStreamAudioSourceNode = nativeMediaStreamAudioSourceNode;\n }\n\n get mediaStream(): MediaStream {\n return this._nativeMediaStreamAudioSourceNode.mediaStream;\n }\n };\n};\n","import { TNativeMediaStreamAudioSourceNodeFactory } from '../types';\n\nexport const createNativeMediaStreamAudioSourceNode: TNativeMediaStreamAudioSourceNodeFactory = (nativeAudioContext, { mediaStream }) => {\n const audioStreamTracks = mediaStream.getAudioTracks();\n /*\n * Bug #151: Safari does not use the audio track as input anymore if it gets removed from the mediaStream after construction.\n * Bug #159: Safari picks the first audio track if the MediaStream has more than one audio track.\n */\n audioStreamTracks.sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));\n\n const filteredAudioStreamTracks = audioStreamTracks.slice(0, 1);\n\n const nativeMediaStreamAudioSourceNode = nativeAudioContext.createMediaStreamSource(new MediaStream(filteredAudioStreamTracks));\n\n /*\n * Bug #151 & #159: The given mediaStream gets reconstructed before it gets passed to the native node which is why the accessor needs\n * to be overwritten as it would otherwise expose the reconstructed version.\n */\n Object.defineProperty(nativeMediaStreamAudioSourceNode, 'mediaStream', { value: mediaStream });\n\n return nativeMediaStreamAudioSourceNode;\n};\n","import { TNativeMediaStreamTrackAudioSourceNodeFactoryFactory } from '../types';\n\nexport const createNativeMediaStreamTrackAudioSourceNodeFactory: TNativeMediaStreamTrackAudioSourceNodeFactoryFactory = (\n createInvalidStateError,\n isNativeOfflineAudioContext\n) => {\n return (nativeAudioContext, { mediaStreamTrack }) => {\n // Bug #121: Only Firefox does yet support the MediaStreamTrackAudioSourceNode.\n if (typeof nativeAudioContext.createMediaStreamTrackSource === 'function') {\n return nativeAudioContext.createMediaStreamTrackSource(mediaStreamTrack);\n }\n\n const mediaStream = new MediaStream([mediaStreamTrack]);\n const nativeMediaStreamAudioSourceNode = nativeAudioContext.createMediaStreamSource(mediaStream);\n\n // Bug #120: Firefox does not throw an error if the mediaStream has no audio track.\n if (mediaStreamTrack.kind !== 'audio') {\n throw createInvalidStateError();\n }\n\n // Bug #172: Safari allows to create a MediaStreamAudioSourceNode with an OfflineAudioContext.\n if (isNativeOfflineAudioContext(nativeAudioContext)) {\n throw new TypeError();\n }\n\n return nativeMediaStreamAudioSourceNode;\n };\n};\n","import { IAudioContext, IMediaStreamTrackAudioSourceNode, IMediaStreamTrackAudioSourceOptions, IMinimalAudioContext } from '../interfaces';\nimport { TAudioNodeRenderer, TMediaStreamTrackAudioSourceNodeConstructorFactory } from '../types';\n\nexport const createMediaStreamTrackAudioSourceNodeConstructor: TMediaStreamTrackAudioSourceNodeConstructorFactory = (\n audioNodeConstructor,\n createNativeMediaStreamTrackAudioSourceNode,\n getNativeContext\n) => {\n return class MediaStreamTrackAudioSourceNode extends audioNodeConstructor\n implements IMediaStreamTrackAudioSourceNode {\n constructor(context: T, options: IMediaStreamTrackAudioSourceOptions) {\n const nativeContext = getNativeContext(context);\n const nativeMediaStreamTrackAudioSourceNode = createNativeMediaStreamTrackAudioSourceNode(nativeContext, options);\n\n super(context, true, nativeMediaStreamTrackAudioSourceNode, >null);\n }\n };\n};\n","import { deactivateAudioGraph } from '../helpers/deactivate-audio-graph';\nimport { isValidLatencyHint } from '../helpers/is-valid-latency-hint';\nimport {\n IAudioContext,\n IAudioContextOptions,\n IMediaElementAudioSourceNode,\n IMediaStreamAudioDestinationNode,\n IMediaStreamAudioSourceNode,\n IMediaStreamTrackAudioSourceNode\n} from '../interfaces';\nimport { TAudioContextConstructorFactory, TAudioContextState, TNativeAudioContext, TNativeGainNode, TNativeOscillatorNode } from '../types';\n\nexport const createAudioContextConstructor: TAudioContextConstructorFactory = (\n baseAudioContextConstructor,\n createInvalidStateError,\n createNotSupportedError,\n createUnknownError,\n mediaElementAudioSourceNodeConstructor,\n mediaStreamAudioDestinationNodeConstructor,\n mediaStreamAudioSourceNodeConstructor,\n mediaStreamTrackAudioSourceNodeConstructor,\n nativeAudioContextConstructor\n) => {\n return class AudioContext extends baseAudioContextConstructor implements IAudioContext {\n private _baseLatency: number;\n\n private _nativeAudioContext: TNativeAudioContext;\n\n private _nativeGainNode: null | TNativeGainNode;\n\n private _nativeOscillatorNode: null | TNativeOscillatorNode;\n\n private _state: null | 'suspended';\n\n constructor(options: IAudioContextOptions = {}) {\n if (nativeAudioContextConstructor === null) {\n throw new Error('Missing the native AudioContext constructor.');\n }\n\n let nativeAudioContext: TNativeAudioContext;\n\n try {\n nativeAudioContext = new nativeAudioContextConstructor(options);\n } catch (err) {\n // Bug #192 Safari does throw a SyntaxError if the sampleRate is not supported.\n if (err.code === 12 && err.message === 'sampleRate is not in range') {\n throw createNotSupportedError();\n }\n\n throw err;\n }\n\n // Bug #131 Safari returns null when there are four other AudioContexts running already.\n if (nativeAudioContext === null) {\n throw createUnknownError();\n }\n\n // Bug #51 Only Chrome and Edge throw an error if the given latencyHint is invalid.\n if (!isValidLatencyHint(options.latencyHint)) {\n throw new TypeError(\n `The provided value '${options.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`\n );\n }\n\n // Bug #150 Safari does not support setting the sampleRate.\n if (options.sampleRate !== undefined && nativeAudioContext.sampleRate !== options.sampleRate) {\n throw createNotSupportedError();\n }\n\n super(nativeAudioContext, 2);\n\n const { latencyHint } = options;\n const { sampleRate } = nativeAudioContext;\n\n // @todo The values for 'balanced', 'interactive' and 'playback' are just copied from Chrome's implementation.\n this._baseLatency =\n typeof nativeAudioContext.baseLatency === 'number'\n ? nativeAudioContext.baseLatency\n : latencyHint === 'balanced'\n ? 512 / sampleRate\n : latencyHint === 'interactive' || latencyHint === undefined\n ? 256 / sampleRate\n : latencyHint === 'playback'\n ? 1024 / sampleRate\n : /*\n * @todo The min (256) and max (16384) values are taken from the allowed bufferSize values of a\n * ScriptProcessorNode.\n */\n (Math.max(2, Math.min(128, Math.round((latencyHint * sampleRate) / 128))) * 128) / sampleRate;\n this._nativeAudioContext = nativeAudioContext;\n\n // Bug #188: Safari will set the context's state to 'interrupted' in case the user switches tabs.\n if (nativeAudioContextConstructor.name === 'webkitAudioContext') {\n this._nativeGainNode = nativeAudioContext.createGain();\n this._nativeOscillatorNode = nativeAudioContext.createOscillator();\n\n this._nativeGainNode.gain.value = 1e-37;\n\n this._nativeOscillatorNode.connect(this._nativeGainNode).connect(nativeAudioContext.destination);\n this._nativeOscillatorNode.start();\n } else {\n this._nativeGainNode = null;\n this._nativeOscillatorNode = null;\n }\n\n this._state = null;\n\n /*\n * Bug #34: Chrome and Edge pretend to be running right away, but fire an onstatechange event when the state actually changes\n * to 'running'.\n */\n if (nativeAudioContext.state === 'running') {\n this._state = 'suspended';\n\n const revokeState = () => {\n if (this._state === 'suspended') {\n this._state = null;\n }\n\n nativeAudioContext.removeEventListener('statechange', revokeState);\n };\n\n nativeAudioContext.addEventListener('statechange', revokeState);\n }\n }\n\n get baseLatency(): number {\n return this._baseLatency;\n }\n\n get state(): TAudioContextState {\n return this._state !== null ? this._state : this._nativeAudioContext.state;\n }\n\n public close(): Promise {\n // Bug #35: Firefox does not throw an error if the AudioContext was closed before.\n if (this.state === 'closed') {\n return this._nativeAudioContext.close().then(() => {\n throw createInvalidStateError();\n });\n }\n\n // Bug #34: If the state was set to suspended before it should be revoked now.\n if (this._state === 'suspended') {\n this._state = null;\n }\n\n return this._nativeAudioContext.close().then(() => {\n if (this._nativeGainNode !== null && this._nativeOscillatorNode !== null) {\n this._nativeOscillatorNode.stop();\n\n this._nativeGainNode.disconnect();\n this._nativeOscillatorNode.disconnect();\n }\n\n deactivateAudioGraph(this);\n });\n }\n\n public createMediaElementSource(mediaElement: HTMLMediaElement): IMediaElementAudioSourceNode {\n return new mediaElementAudioSourceNodeConstructor(this, { mediaElement });\n }\n\n public createMediaStreamDestination(): IMediaStreamAudioDestinationNode {\n return new mediaStreamAudioDestinationNodeConstructor(this);\n }\n\n public createMediaStreamSource(mediaStream: MediaStream): IMediaStreamAudioSourceNode {\n return new mediaStreamAudioSourceNodeConstructor(this, { mediaStream });\n }\n\n public createMediaStreamTrackSource(mediaStreamTrack: MediaStreamTrack): IMediaStreamTrackAudioSourceNode {\n return new mediaStreamTrackAudioSourceNodeConstructor(this, { mediaStreamTrack });\n }\n\n public resume(): Promise {\n if (this._state === 'suspended') {\n return new Promise((resolve, reject) => {\n const resolvePromise = () => {\n this._nativeAudioContext.removeEventListener('statechange', resolvePromise);\n\n if (this._nativeAudioContext.state === 'running') {\n resolve();\n } else {\n this.resume().then(resolve, reject);\n }\n };\n\n this._nativeAudioContext.addEventListener('statechange', resolvePromise);\n });\n }\n\n return this._nativeAudioContext.resume().catch((err) => {\n // Bug #55: Chrome and Edge do throw an InvalidAccessError instead of an InvalidStateError.\n // Bug #56: Safari invokes the catch handler but without an error.\n if (err === undefined || err.code === 15) {\n throw createInvalidStateError();\n }\n\n throw err;\n });\n }\n\n public suspend(): Promise {\n return this._nativeAudioContext.suspend().catch((err) => {\n // Bug #56: Safari invokes the catch handler but without an error.\n if (err === undefined) {\n throw createInvalidStateError();\n }\n\n throw err;\n });\n }\n };\n};\n","import { TGetUnrenderedAudioWorkletNodesFactory } from '../types';\n\nexport const createGetUnrenderedAudioWorkletNodes: TGetUnrenderedAudioWorkletNodesFactory = (unrenderedAudioWorkletNodeStore) => {\n return (nativeContext) => {\n const unrenderedAudioWorkletNodes = unrenderedAudioWorkletNodeStore.get(nativeContext);\n\n if (unrenderedAudioWorkletNodes === undefined) {\n throw new Error('The context has no set of AudioWorkletNodes.');\n }\n\n return unrenderedAudioWorkletNodes;\n };\n};\n","import { TAddUnrenderedAudioWorkletNodeFactory } from '../types';\n\nexport const createAddUnrenderedAudioWorkletNode: TAddUnrenderedAudioWorkletNodeFactory = (getUnrenderedAudioWorkletNodes) => {\n return (nativeContext, audioWorkletNode) => {\n getUnrenderedAudioWorkletNodes(nativeContext).add(audioWorkletNode);\n };\n};\n","import { isNativeAudioNode } from '../guards/native-audio-node';\nimport { TConnectMultipleOutputsFactory } from '../types';\n\nexport const createConnectMultipleOutputs: TConnectMultipleOutputsFactory = (createIndexSizeError) => {\n return (outputAudioNodes, destination, output = 0, input = 0) => {\n const outputAudioNode = outputAudioNodes[output];\n\n if (outputAudioNode === undefined) {\n throw createIndexSizeError();\n }\n\n if (isNativeAudioNode(destination)) {\n return outputAudioNode.connect(destination, 0, input);\n }\n\n return outputAudioNode.connect(destination, 0);\n };\n};\n","import { TDeleteUnrenderedAudioWorkletNodeFactory } from '../types';\n\nexport const createDeleteUnrenderedAudioWorkletNode: TDeleteUnrenderedAudioWorkletNodeFactory = (getUnrenderedAudioWorkletNodes) => {\n return (nativeContext, audioWorkletNode) => {\n getUnrenderedAudioWorkletNodes(nativeContext).delete(audioWorkletNode);\n };\n};\n","import { TActiveInputConnection, TContext, TGetActiveAudioWorkletNodeInputsFactory, TNativeAudioWorkletNode } from '../types';\n\nexport const createGetActiveAudioWorkletNodeInputs: TGetActiveAudioWorkletNodeInputsFactory = (\n activeAudioWorkletNodeInputsStore,\n getValueForKey\n) => {\n return (nativeAudioWorkletNode: TNativeAudioWorkletNode) =>\n >[]>getValueForKey(activeAudioWorkletNodeInputsStore, nativeAudioWorkletNode);\n};\n","import { MOST_NEGATIVE_SINGLE_FLOAT, MOST_POSITIVE_SINGLE_FLOAT } from '../constants';\nimport { computeBufferSize } from '../helpers/compute-buffer-size';\nimport { copyFromChannel } from '../helpers/copy-from-channel';\nimport { copyToChannel } from '../helpers/copy-to-channel';\nimport { createAudioWorkletProcessor } from '../helpers/create-audio-worklet-processor';\nimport { createNestedArrays } from '../helpers/create-nested-arrays';\nimport { IAudioWorkletProcessor } from '../interfaces';\nimport { ReadOnlyMap } from '../read-only-map';\nimport {\n TNativeAudioNode,\n TNativeAudioParam,\n TNativeAudioWorkletNode,\n TNativeAudioWorkletNodeFakerFactoryFactory,\n TNativeChannelMergerNode,\n TNativeChannelSplitterNode,\n TNativeConstantSourceNode,\n TNativeGainNode\n} from '../types';\n\nexport const createNativeAudioWorkletNodeFakerFactory: TNativeAudioWorkletNodeFakerFactoryFactory = (\n connectMultipleOutputs,\n createIndexSizeError,\n createInvalidStateError,\n createNativeChannelMergerNode,\n createNativeChannelSplitterNode,\n createNativeConstantSourceNode,\n createNativeGainNode,\n createNativeScriptProcessorNode,\n createNotSupportedError,\n disconnectMultipleOutputs,\n exposeCurrentFrameAndCurrentTime,\n getActiveAudioWorkletNodeInputs,\n monitorConnections\n) => {\n return (nativeContext, baseLatency, processorConstructor, options) => {\n if (options.numberOfInputs === 0 && options.numberOfOutputs === 0) {\n throw createNotSupportedError();\n }\n\n const outputChannelCount = Array.isArray(options.outputChannelCount)\n ? options.outputChannelCount\n : Array.from(options.outputChannelCount);\n\n // @todo Check if any of the channelCount values is greater than the implementation's maximum number of channels.\n if (outputChannelCount.some((channelCount) => channelCount < 1)) {\n throw createNotSupportedError();\n }\n\n if (outputChannelCount.length !== options.numberOfOutputs) {\n throw createIndexSizeError();\n }\n\n // Bug #61: This is not part of the standard but required for the faker to work.\n if (options.channelCountMode !== 'explicit') {\n throw createNotSupportedError();\n }\n\n const numberOfInputChannels = options.channelCount * options.numberOfInputs;\n const numberOfOutputChannels = outputChannelCount.reduce((sum, value) => sum + value, 0);\n const numberOfParameters =\n processorConstructor.parameterDescriptors === undefined ? 0 : processorConstructor.parameterDescriptors.length;\n\n // Bug #61: This is not part of the standard but required for the faker to work.\n if (numberOfInputChannels + numberOfParameters > 6 || numberOfOutputChannels > 6) {\n throw createNotSupportedError();\n }\n\n const messageChannel = new MessageChannel();\n const gainNodes: TNativeGainNode[] = [];\n const inputChannelSplitterNodes: TNativeChannelSplitterNode[] = [];\n\n for (let i = 0; i < options.numberOfInputs; i += 1) {\n gainNodes.push(\n createNativeGainNode(nativeContext, {\n channelCount: options.channelCount,\n channelCountMode: options.channelCountMode,\n channelInterpretation: options.channelInterpretation,\n gain: 1\n })\n );\n inputChannelSplitterNodes.push(\n createNativeChannelSplitterNode(nativeContext, {\n channelCount: options.channelCount,\n channelCountMode: 'explicit',\n channelInterpretation: 'discrete',\n numberOfOutputs: options.channelCount\n })\n );\n }\n\n const constantSourceNodes: TNativeConstantSourceNode[] = [];\n\n if (processorConstructor.parameterDescriptors !== undefined) {\n for (const { defaultValue, maxValue, minValue, name } of processorConstructor.parameterDescriptors) {\n const constantSourceNode = createNativeConstantSourceNode(nativeContext, {\n channelCount: 1,\n channelCountMode: 'explicit',\n channelInterpretation: 'discrete',\n offset:\n options.parameterData[name] !== undefined\n ? options.parameterData[name]\n : defaultValue === undefined\n ? 0\n : defaultValue\n });\n\n Object.defineProperties(constantSourceNode.offset, {\n defaultValue: {\n get: () => (defaultValue === undefined ? 0 : defaultValue)\n },\n maxValue: {\n get: () => (maxValue === undefined ? MOST_POSITIVE_SINGLE_FLOAT : maxValue)\n },\n minValue: {\n get: () => (minValue === undefined ? MOST_NEGATIVE_SINGLE_FLOAT : minValue)\n }\n });\n\n constantSourceNodes.push(constantSourceNode);\n }\n }\n\n const inputChannelMergerNode = createNativeChannelMergerNode(nativeContext, {\n channelCount: 1,\n channelCountMode: 'explicit',\n channelInterpretation: 'speakers',\n numberOfInputs: Math.max(1, numberOfInputChannels + numberOfParameters)\n });\n const bufferSize = computeBufferSize(baseLatency, nativeContext.sampleRate);\n const scriptProcessorNode = createNativeScriptProcessorNode(\n nativeContext,\n bufferSize,\n numberOfInputChannels + numberOfParameters,\n // Bug #87: Only Firefox will fire an AudioProcessingEvent if there is no connected output.\n Math.max(1, numberOfOutputChannels)\n );\n const outputChannelSplitterNode = createNativeChannelSplitterNode(nativeContext, {\n channelCount: Math.max(1, numberOfOutputChannels),\n channelCountMode: 'explicit',\n channelInterpretation: 'discrete',\n numberOfOutputs: Math.max(1, numberOfOutputChannels)\n });\n const outputChannelMergerNodes: TNativeChannelMergerNode[] = [];\n\n for (let i = 0; i < options.numberOfOutputs; i += 1) {\n outputChannelMergerNodes.push(\n createNativeChannelMergerNode(nativeContext, {\n channelCount: 1,\n channelCountMode: 'explicit',\n channelInterpretation: 'speakers',\n numberOfInputs: outputChannelCount[i]\n })\n );\n }\n\n for (let i = 0; i < options.numberOfInputs; i += 1) {\n gainNodes[i].connect(inputChannelSplitterNodes[i]);\n\n for (let j = 0; j < options.channelCount; j += 1) {\n inputChannelSplitterNodes[i].connect(inputChannelMergerNode, j, i * options.channelCount + j);\n }\n }\n\n const parameterMap = new ReadOnlyMap(\n processorConstructor.parameterDescriptors === undefined\n ? []\n : processorConstructor.parameterDescriptors.map(({ name }, index) => {\n const constantSourceNode = constantSourceNodes[index];\n\n constantSourceNode.connect(inputChannelMergerNode, 0, numberOfInputChannels + index);\n constantSourceNode.start(0);\n\n return <[string, TNativeAudioParam]>[name, constantSourceNode.offset];\n })\n );\n\n inputChannelMergerNode.connect(scriptProcessorNode);\n\n let channelInterpretation = options.channelInterpretation;\n let onprocessorerror: TNativeAudioWorkletNode['onprocessorerror'] = null;\n\n // Bug #87: Expose at least one output to make this node connectable.\n const outputAudioNodes = options.numberOfOutputs === 0 ? [scriptProcessorNode] : outputChannelMergerNodes;\n const nativeAudioWorkletNodeFaker = {\n get bufferSize(): number {\n return bufferSize;\n },\n get channelCount(): number {\n return options.channelCount;\n },\n set channelCount(_) {\n // Bug #61: This is not part of the standard but required for the faker to work.\n throw createInvalidStateError();\n },\n get channelCountMode(): TNativeAudioWorkletNode['channelCountMode'] {\n return options.channelCountMode;\n },\n set channelCountMode(_) {\n // Bug #61: This is not part of the standard but required for the faker to work.\n throw createInvalidStateError();\n },\n get channelInterpretation(): TNativeAudioWorkletNode['channelInterpretation'] {\n return channelInterpretation;\n },\n set channelInterpretation(value) {\n for (const gainNode of gainNodes) {\n gainNode.channelInterpretation = value;\n }\n\n channelInterpretation = value;\n },\n get context(): TNativeAudioWorkletNode['context'] {\n return scriptProcessorNode.context;\n },\n get inputs(): TNativeAudioNode[] {\n return gainNodes;\n },\n get numberOfInputs(): number {\n return options.numberOfInputs;\n },\n get numberOfOutputs(): number {\n return options.numberOfOutputs;\n },\n get onprocessorerror(): TNativeAudioWorkletNode['onprocessorerror'] {\n return onprocessorerror;\n },\n set onprocessorerror(value) {\n if (typeof onprocessorerror === 'function') {\n nativeAudioWorkletNodeFaker.removeEventListener('processorerror', onprocessorerror);\n }\n\n onprocessorerror = typeof value === 'function' ? value : null;\n\n if (typeof onprocessorerror === 'function') {\n nativeAudioWorkletNodeFaker.addEventListener('processorerror', onprocessorerror);\n }\n },\n get parameters(): TNativeAudioWorkletNode['parameters'] {\n return parameterMap;\n },\n get port(): TNativeAudioWorkletNode['port'] {\n return messageChannel.port2;\n },\n addEventListener(...args: any[]): void {\n return scriptProcessorNode.addEventListener(args[0], args[1], args[2]);\n },\n connect: connectMultipleOutputs.bind(null, outputAudioNodes),\n disconnect: disconnectMultipleOutputs.bind(null, outputAudioNodes),\n dispatchEvent(...args: any[]): boolean {\n return scriptProcessorNode.dispatchEvent(args[0]);\n },\n removeEventListener(...args: any[]): void {\n return scriptProcessorNode.removeEventListener(args[0], args[1], args[2]);\n }\n };\n\n const patchedEventListeners: Map> = new Map();\n\n messageChannel.port1.addEventListener = ((addEventListener) => {\n return (...args: [string, EventListenerOrEventListenerObject, (boolean | AddEventListenerOptions)?]): void => {\n if (args[0] === 'message') {\n const unpatchedEventListener =\n typeof args[1] === 'function'\n ? args[1]\n : typeof args[1] === 'object' && args[1] !== null && typeof args[1].handleEvent === 'function'\n ? args[1].handleEvent\n : null;\n\n if (unpatchedEventListener !== null) {\n const patchedEventListener = patchedEventListeners.get(args[1]);\n\n if (patchedEventListener !== undefined) {\n args[1] = patchedEventListener;\n } else {\n args[1] = (event: Event) => {\n exposeCurrentFrameAndCurrentTime(nativeContext.currentTime, nativeContext.sampleRate, () =>\n unpatchedEventListener(event)\n );\n };\n\n patchedEventListeners.set(unpatchedEventListener, args[1]);\n }\n }\n }\n\n return addEventListener.call(messageChannel.port1, args[0], args[1], args[2]);\n };\n })(messageChannel.port1.addEventListener);\n\n messageChannel.port1.removeEventListener = ((removeEventListener) => {\n return (...args: any[]): void => {\n if (args[0] === 'message') {\n const patchedEventListener = patchedEventListeners.get(args[1]);\n\n if (patchedEventListener !== undefined) {\n patchedEventListeners.delete(args[1]);\n\n args[1] = patchedEventListener;\n }\n }\n\n return removeEventListener.call(messageChannel.port1, args[0], args[1], args[2]);\n };\n })(messageChannel.port1.removeEventListener);\n\n let onmessage: MessagePort['onmessage'] = null;\n\n Object.defineProperty(messageChannel.port1, 'onmessage', {\n get: () => onmessage,\n set: (value) => {\n if (typeof onmessage === 'function') {\n messageChannel.port1.removeEventListener('message', onmessage);\n }\n\n onmessage = typeof value === 'function' ? value : null;\n\n if (typeof onmessage === 'function') {\n messageChannel.port1.addEventListener('message', onmessage);\n messageChannel.port1.start();\n }\n }\n });\n\n processorConstructor.prototype.port = messageChannel.port1;\n\n let audioWorkletProcessor: null | IAudioWorkletProcessor = null;\n\n const audioWorkletProcessorPromise = createAudioWorkletProcessor(\n nativeContext,\n nativeAudioWorkletNodeFaker,\n processorConstructor,\n options\n );\n\n audioWorkletProcessorPromise.then((dWrkltPrcssr) => (audioWorkletProcessor = dWrkltPrcssr));\n\n const inputs = createNestedArrays(options.numberOfInputs, options.channelCount);\n const outputs = createNestedArrays(options.numberOfOutputs, outputChannelCount);\n const parameters: { [name: string]: Float32Array } =\n processorConstructor.parameterDescriptors === undefined\n ? []\n : processorConstructor.parameterDescriptors.reduce(\n (prmtrs, { name }) => ({ ...prmtrs, [name]: new Float32Array(128) }),\n {}\n );\n\n let isActive = true;\n\n const disconnectOutputsGraph = () => {\n if (options.numberOfOutputs > 0) {\n scriptProcessorNode.disconnect(outputChannelSplitterNode);\n }\n\n for (let i = 0, outputChannelSplitterNodeOutput = 0; i < options.numberOfOutputs; i += 1) {\n const outputChannelMergerNode = outputChannelMergerNodes[i];\n\n for (let j = 0; j < outputChannelCount[i]; j += 1) {\n outputChannelSplitterNode.disconnect(outputChannelMergerNode, outputChannelSplitterNodeOutput + j, j);\n }\n\n outputChannelSplitterNodeOutput += outputChannelCount[i];\n }\n };\n\n const activeInputIndexes = new Map();\n\n // tslint:disable-next-line:deprecation\n scriptProcessorNode.onaudioprocess = ({ inputBuffer, outputBuffer }: AudioProcessingEvent) => {\n if (audioWorkletProcessor !== null) {\n const activeInputs = getActiveAudioWorkletNodeInputs(nativeAudioWorkletNodeFaker);\n\n for (let i = 0; i < bufferSize; i += 128) {\n for (let j = 0; j < options.numberOfInputs; j += 1) {\n for (let k = 0; k < options.channelCount; k += 1) {\n copyFromChannel(inputBuffer, inputs[j], k, k, i);\n }\n }\n\n if (processorConstructor.parameterDescriptors !== undefined) {\n processorConstructor.parameterDescriptors.forEach(({ name }, index) => {\n copyFromChannel(inputBuffer, parameters, name, numberOfInputChannels + index, i);\n });\n }\n\n for (let j = 0; j < options.numberOfInputs; j += 1) {\n for (let k = 0; k < outputChannelCount[j]; k += 1) {\n // The byteLength will be 0 when the ArrayBuffer was transferred.\n if (outputs[j][k].byteLength === 0) {\n outputs[j][k] = new Float32Array(128);\n }\n }\n }\n\n try {\n const potentiallyEmptyInputs = inputs.map((input, index) => {\n const activeInput = activeInputs[index];\n\n if (activeInput.size > 0) {\n activeInputIndexes.set(index, bufferSize / 128);\n\n return input;\n }\n\n const count = activeInputIndexes.get(index);\n\n if (count === undefined) {\n return [];\n }\n\n if (input.every((channelData) => channelData.every((sample) => sample === 0))) {\n if (count === 1) {\n activeInputIndexes.delete(index);\n } else {\n activeInputIndexes.set(index, count - 1);\n }\n }\n\n return input;\n });\n\n const activeSourceFlag = exposeCurrentFrameAndCurrentTime(\n nativeContext.currentTime + i / nativeContext.sampleRate,\n nativeContext.sampleRate,\n () => (audioWorkletProcessor).process(potentiallyEmptyInputs, outputs, parameters)\n );\n\n isActive = activeSourceFlag;\n\n for (let j = 0, outputChannelSplitterNodeOutput = 0; j < options.numberOfOutputs; j += 1) {\n for (let k = 0; k < outputChannelCount[j]; k += 1) {\n copyToChannel(outputBuffer, outputs[j], k, outputChannelSplitterNodeOutput + k, i);\n }\n\n outputChannelSplitterNodeOutput += outputChannelCount[j];\n }\n } catch (error) {\n isActive = false;\n\n nativeAudioWorkletNodeFaker.dispatchEvent(\n new ErrorEvent('processorerror', {\n colno: error.colno,\n filename: error.filename,\n lineno: error.lineno,\n message: error.message\n })\n );\n }\n\n if (!isActive) {\n for (let j = 0; j < options.numberOfInputs; j += 1) {\n gainNodes[j].disconnect(inputChannelSplitterNodes[j]);\n\n for (let k = 0; k < options.channelCount; k += 1) {\n inputChannelSplitterNodes[i].disconnect(inputChannelMergerNode, k, j * options.channelCount + k);\n }\n }\n\n if (processorConstructor.parameterDescriptors !== undefined) {\n const length = processorConstructor.parameterDescriptors.length;\n\n for (let j = 0; j < length; j += 1) {\n const constantSourceNode = constantSourceNodes[j];\n\n constantSourceNode.disconnect(inputChannelMergerNode, 0, numberOfInputChannels + j);\n constantSourceNode.stop();\n }\n }\n\n inputChannelMergerNode.disconnect(scriptProcessorNode);\n\n scriptProcessorNode.onaudioprocess = null; // tslint:disable-line:deprecation\n\n if (isConnected) {\n disconnectOutputsGraph();\n } else {\n disconnectFakeGraph();\n }\n\n break;\n }\n }\n }\n };\n\n let isConnected = false;\n\n // Bug #87: Only Firefox will fire an AudioProcessingEvent if there is no connected output.\n const nativeGainNode = createNativeGainNode(nativeContext, {\n channelCount: 1,\n channelCountMode: 'explicit',\n channelInterpretation: 'discrete',\n gain: 0\n });\n\n const connectFakeGraph = () => scriptProcessorNode.connect(nativeGainNode).connect(nativeContext.destination);\n const disconnectFakeGraph = () => {\n scriptProcessorNode.disconnect(nativeGainNode);\n nativeGainNode.disconnect();\n };\n const whenConnected = () => {\n if (isActive) {\n disconnectFakeGraph();\n\n if (options.numberOfOutputs > 0) {\n scriptProcessorNode.connect(outputChannelSplitterNode);\n }\n\n for (let i = 0, outputChannelSplitterNodeOutput = 0; i < options.numberOfOutputs; i += 1) {\n const outputChannelMergerNode = outputChannelMergerNodes[i];\n\n for (let j = 0; j < outputChannelCount[i]; j += 1) {\n outputChannelSplitterNode.connect(outputChannelMergerNode, outputChannelSplitterNodeOutput + j, j);\n }\n\n outputChannelSplitterNodeOutput += outputChannelCount[i];\n }\n }\n\n isConnected = true;\n };\n const whenDisconnected = () => {\n if (isActive) {\n connectFakeGraph();\n disconnectOutputsGraph();\n }\n\n isConnected = false;\n };\n\n connectFakeGraph();\n\n return monitorConnections(nativeAudioWorkletNodeFaker, whenConnected, whenDisconnected);\n };\n};\n","import { NODE_TO_PROCESSOR_MAPS } from '../globals';\nimport { IAudioWorkletNodeOptions, IAudioWorkletProcessor, IAudioWorkletProcessorConstructor } from '../interfaces';\nimport { TNativeAudioWorkletNode, TNativeContext } from '../types';\nimport { createAudioWorkletProcessorPromise } from './create-audio-worklet-processor-promise';\n\nexport const createAudioWorkletProcessor = (\n nativeContext: TNativeContext,\n nativeAudioWorkletNode: TNativeAudioWorkletNode,\n processorConstructor: IAudioWorkletProcessorConstructor,\n audioWorkletNodeOptions: IAudioWorkletNodeOptions\n): Promise => {\n let nodeToProcessorMap = NODE_TO_PROCESSOR_MAPS.get(nativeContext);\n\n if (nodeToProcessorMap === undefined) {\n nodeToProcessorMap = new WeakMap();\n\n NODE_TO_PROCESSOR_MAPS.set(nativeContext, nodeToProcessorMap);\n }\n\n const audioWorkletProcessorPromise = createAudioWorkletProcessorPromise(processorConstructor, audioWorkletNodeOptions);\n\n nodeToProcessorMap.set(nativeAudioWorkletNode, audioWorkletProcessorPromise);\n\n return audioWorkletProcessorPromise;\n};\n","import { testClonabilityOfAudioWorkletNodeOptions } from '../helpers/test-clonability-of-audio-worklet-node-options';\nimport { TNativeAudioWorkletNode, TNativeAudioWorkletNodeFactoryFactory, TNativeAudioWorkletNodeOptions } from '../types';\n\nexport const createNativeAudioWorkletNodeFactory: TNativeAudioWorkletNodeFactoryFactory = (\n createInvalidStateError,\n createNativeAudioWorkletNodeFaker,\n createNativeGainNode,\n createNotSupportedError,\n monitorConnections\n) => {\n return (nativeContext, baseLatency, nativeAudioWorkletNodeConstructor, name, processorConstructor, options) => {\n if (nativeAudioWorkletNodeConstructor !== null) {\n try {\n const nativeAudioWorkletNode = new nativeAudioWorkletNodeConstructor(\n nativeContext,\n name,\n options\n );\n const patchedEventListeners: Map<\n EventListenerOrEventListenerObject,\n NonNullable\n > = new Map();\n\n let onprocessorerror: TNativeAudioWorkletNode['onprocessorerror'] = null;\n\n Object.defineProperties(nativeAudioWorkletNode, {\n /*\n * Bug #61: Overwriting the property accessors for channelCount and channelCountMode is necessary as long as some\n * browsers have no native implementation to achieve a consistent behavior.\n */\n channelCount: {\n get: () => options.channelCount,\n set: () => {\n throw createInvalidStateError();\n }\n },\n channelCountMode: {\n get: () => 'explicit',\n set: () => {\n throw createInvalidStateError();\n }\n },\n // Bug #156: Chrome and Edge do not yet fire an ErrorEvent.\n onprocessorerror: {\n get: () => onprocessorerror,\n set: (value) => {\n if (typeof onprocessorerror === 'function') {\n nativeAudioWorkletNode.removeEventListener('processorerror', onprocessorerror);\n }\n\n onprocessorerror = typeof value === 'function' ? value : null;\n\n if (typeof onprocessorerror === 'function') {\n nativeAudioWorkletNode.addEventListener('processorerror', onprocessorerror);\n }\n }\n }\n });\n\n nativeAudioWorkletNode.addEventListener = ((addEventListener) => {\n return (...args: [string, EventListenerOrEventListenerObject, (boolean | AddEventListenerOptions)?]): void => {\n if (args[0] === 'processorerror') {\n const unpatchedEventListener =\n typeof args[1] === 'function'\n ? args[1]\n : typeof args[1] === 'object' && args[1] !== null && typeof args[1].handleEvent === 'function'\n ? args[1].handleEvent\n : null;\n\n if (unpatchedEventListener !== null) {\n const patchedEventListener = patchedEventListeners.get(args[1]);\n\n if (patchedEventListener !== undefined) {\n args[1] = patchedEventListener;\n } else {\n args[1] = (event: Event) => {\n // Bug #178: Chrome and Edge do fire an event of type error.\n if (event.type === 'error') {\n Object.defineProperties(event, {\n type: { value: 'processorerror' }\n });\n\n unpatchedEventListener(event);\n } else {\n unpatchedEventListener(new ErrorEvent(args[0], { ...event }));\n }\n };\n\n patchedEventListeners.set(unpatchedEventListener, args[1]);\n }\n }\n }\n\n // Bug #178: Chrome and Edge do fire an event of type error.\n addEventListener.call(nativeAudioWorkletNode, 'error', args[1], args[2]);\n\n return addEventListener.call(nativeAudioWorkletNode, ...args);\n };\n })(nativeAudioWorkletNode.addEventListener);\n\n nativeAudioWorkletNode.removeEventListener = ((removeEventListener) => {\n return (...args: any[]): void => {\n if (args[0] === 'processorerror') {\n const patchedEventListener = patchedEventListeners.get(args[1]);\n\n if (patchedEventListener !== undefined) {\n patchedEventListeners.delete(args[1]);\n\n args[1] = patchedEventListener;\n }\n }\n\n // Bug #178: Chrome and Edge do fire an event of type error.\n removeEventListener.call(nativeAudioWorkletNode, 'error', args[1], args[2]);\n\n return removeEventListener.call(nativeAudioWorkletNode, args[0], args[1], args[2]);\n };\n })(nativeAudioWorkletNode.removeEventListener);\n\n /*\n * Bug #86: Chrome and Edge do not invoke the process() function if the corresponding AudioWorkletNode is unconnected but\n * has an output.\n */\n if (options.numberOfOutputs !== 0) {\n const nativeGainNode = createNativeGainNode(nativeContext, {\n channelCount: 1,\n channelCountMode: 'explicit',\n channelInterpretation: 'discrete',\n gain: 0\n });\n\n nativeAudioWorkletNode.connect(nativeGainNode).connect(nativeContext.destination);\n\n const whenConnected = () => nativeGainNode.disconnect();\n const whenDisconnected = () => nativeGainNode.connect(nativeContext.destination);\n\n // @todo Disconnect the connection when the process() function of the AudioWorkletNode returns false.\n return monitorConnections(nativeAudioWorkletNode, whenConnected, whenDisconnected);\n }\n\n return nativeAudioWorkletNode;\n } catch (err) {\n // Bug #60: Chrome & Edge throw an InvalidStateError instead of a NotSupportedError.\n if (err.code === 11) {\n throw createNotSupportedError();\n }\n\n throw err;\n }\n }\n\n // Bug #61: Only Chrome & Edge have an implementation of the AudioWorkletNode yet.\n if (processorConstructor === undefined) {\n throw createNotSupportedError();\n }\n\n testClonabilityOfAudioWorkletNodeOptions(options);\n\n return createNativeAudioWorkletNodeFaker(nativeContext, baseLatency, processorConstructor, options);\n };\n};\n","import { IAudioWorkletNodeOptions } from '../interfaces';\n\nexport const testClonabilityOfAudioWorkletNodeOptions = (audioWorkletNodeOptions: IAudioWorkletNodeOptions): void => {\n const { port1 } = new MessageChannel();\n\n try {\n // This will throw an error if the audioWorkletNodeOptions are not clonable.\n port1.postMessage(audioWorkletNodeOptions);\n } finally {\n port1.close();\n }\n};\n","import { TGetBackupOfflineAudioContextFactory } from '../types';\n\nexport const createGetBackupOfflineAudioContext: TGetBackupOfflineAudioContextFactory = (backupOfflineAudioContextStore) => {\n return (nativeContext) => {\n return backupOfflineAudioContextStore.get(nativeContext);\n };\n};\n","import { TSetActiveAudioWorkletNodeInputsFactory } from '../types';\n\nexport const createSetActiveAudioWorkletNodeInputs: TSetActiveAudioWorkletNodeInputsFactory = (activeAudioWorkletNodeInputsStore) => {\n return (nativeAudioWorkletNode, activeInputs) => {\n activeAudioWorkletNodeInputsStore.set(nativeAudioWorkletNode, activeInputs);\n };\n};\n","import { TSanitizeAudioWorkletNodeOptionsFunction } from '../types';\n\nexport const sanitizeAudioWorkletNodeOptions: TSanitizeAudioWorkletNodeOptionsFunction = (options) => {\n return {\n ...options,\n outputChannelCount:\n options.outputChannelCount !== undefined\n ? options.outputChannelCount\n : options.numberOfInputs === 1 && options.numberOfOutputs === 1\n ? /*\n * Bug #61: This should be the computedNumberOfChannels, but unfortunately that is almost impossible to fake. That's why\n * the channelCountMode is required to be 'explicit' as long as there is not a native implementation in every browser. That\n * makes sure the computedNumberOfChannels is equivilant to the channelCount which makes it much easier to compute.\n */\n [options.channelCount]\n : Array.from({ length: options.numberOfOutputs }, () => 1)\n };\n};\n","import { TTestAudioWorkletNodeOptionsClonabilityFunction } from '../types';\n\nexport const testAudioWorkletNodeOptionsClonability: TTestAudioWorkletNodeOptionsClonabilityFunction = (audioWorkletNodeOptions) => {\n const { port1, port2 } = new MessageChannel();\n\n try {\n // This will throw an error if the audioWorkletNodeOptions are not clonable.\n port1.postMessage(audioWorkletNodeOptions);\n } finally {\n port1.close();\n port2.close();\n }\n};\n","import { deactivateAudioGraph } from '../helpers/deactivate-audio-graph';\nimport { isValidLatencyHint } from '../helpers/is-valid-latency-hint';\nimport { IAudioContextOptions, IMinimalAudioContext } from '../interfaces';\nimport {\n TAudioContextState,\n TMinimalAudioContextConstructorFactory,\n TNativeAudioContext,\n TNativeGainNode,\n TNativeOscillatorNode\n} from '../types';\n\nexport const createMinimalAudioContextConstructor: TMinimalAudioContextConstructorFactory = (\n createInvalidStateError,\n createNotSupportedError,\n createUnknownError,\n minimalBaseAudioContextConstructor,\n nativeAudioContextConstructor\n) => {\n return class MinimalAudioContext extends minimalBaseAudioContextConstructor implements IMinimalAudioContext {\n private _baseLatency: number;\n\n private _nativeAudioContext: TNativeAudioContext;\n\n private _nativeGainNode: null | TNativeGainNode;\n\n private _nativeOscillatorNode: null | TNativeOscillatorNode;\n\n private _state: null | 'suspended';\n\n constructor(options: IAudioContextOptions = {}) {\n if (nativeAudioContextConstructor === null) {\n throw new Error('Missing the native AudioContext constructor.');\n }\n\n let nativeAudioContext: TNativeAudioContext;\n\n try {\n nativeAudioContext = new nativeAudioContextConstructor(options);\n } catch (err) {\n // Bug #192 Safari does throw a SyntaxError if the sampleRate is not supported.\n if (err.code === 12 && err.message === 'sampleRate is not in range') {\n throw createNotSupportedError();\n }\n\n throw err;\n }\n\n // Bug #131 Safari returns null when there are four other AudioContexts running already.\n if (nativeAudioContext === null) {\n throw createUnknownError();\n }\n\n // Bug #51 Only Chrome and Edge throw an error if the given latencyHint is invalid.\n if (!isValidLatencyHint(options.latencyHint)) {\n throw new TypeError(\n `The provided value '${options.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`\n );\n }\n\n // Bug #150 Safari does not support setting the sampleRate.\n if (options.sampleRate !== undefined && nativeAudioContext.sampleRate !== options.sampleRate) {\n throw createNotSupportedError();\n }\n\n super(nativeAudioContext, 2);\n\n const { latencyHint } = options;\n const { sampleRate } = nativeAudioContext;\n\n // @todo The values for 'balanced', 'interactive' and 'playback' are just copied from Chrome's implementation.\n this._baseLatency =\n typeof nativeAudioContext.baseLatency === 'number'\n ? nativeAudioContext.baseLatency\n : latencyHint === 'balanced'\n ? 512 / sampleRate\n : latencyHint === 'interactive' || latencyHint === undefined\n ? 256 / sampleRate\n : latencyHint === 'playback'\n ? 1024 / sampleRate\n : /*\n * @todo The min (256) and max (16384) values are taken from the allowed bufferSize values of a\n * ScriptProcessorNode.\n */\n (Math.max(2, Math.min(128, Math.round((latencyHint * sampleRate) / 128))) * 128) / sampleRate;\n this._nativeAudioContext = nativeAudioContext;\n\n // Bug #188: Safari will set the context's state to 'interrupted' in case the user switches tabs.\n if (nativeAudioContextConstructor.name === 'webkitAudioContext') {\n this._nativeGainNode = nativeAudioContext.createGain();\n this._nativeOscillatorNode = nativeAudioContext.createOscillator();\n\n this._nativeGainNode.gain.value = 1e-37;\n\n this._nativeOscillatorNode.connect(this._nativeGainNode).connect(nativeAudioContext.destination);\n this._nativeOscillatorNode.start();\n } else {\n this._nativeGainNode = null;\n this._nativeOscillatorNode = null;\n }\n\n this._state = null;\n\n /*\n * Bug #34: Chrome and Edge pretend to be running right away, but fire an onstatechange event when the state actually changes\n * to 'running'.\n */\n if (nativeAudioContext.state === 'running') {\n this._state = 'suspended';\n\n const revokeState = () => {\n if (this._state === 'suspended') {\n this._state = null;\n }\n\n nativeAudioContext.removeEventListener('statechange', revokeState);\n };\n\n nativeAudioContext.addEventListener('statechange', revokeState);\n }\n }\n\n get baseLatency(): number {\n return this._baseLatency;\n }\n\n get state(): TAudioContextState {\n return this._state !== null ? this._state : this._nativeAudioContext.state;\n }\n\n public close(): Promise {\n // Bug #35: Firefox does not throw an error if the AudioContext was closed before.\n if (this.state === 'closed') {\n return this._nativeAudioContext.close().then(() => {\n throw createInvalidStateError();\n });\n }\n\n // Bug #34: If the state was set to suspended before it should be revoked now.\n if (this._state === 'suspended') {\n this._state = null;\n }\n\n return this._nativeAudioContext.close().then(() => {\n if (this._nativeGainNode !== null && this._nativeOscillatorNode !== null) {\n this._nativeOscillatorNode.stop();\n\n this._nativeGainNode.disconnect();\n this._nativeOscillatorNode.disconnect();\n }\n\n deactivateAudioGraph(this);\n });\n }\n\n public resume(): Promise {\n if (this._state === 'suspended') {\n return new Promise((resolve, reject) => {\n const resolvePromise = () => {\n this._nativeAudioContext.removeEventListener('statechange', resolvePromise);\n\n if (this._nativeAudioContext.state === 'running') {\n resolve();\n } else {\n this.resume().then(resolve, reject);\n }\n };\n\n this._nativeAudioContext.addEventListener('statechange', resolvePromise);\n });\n }\n\n return this._nativeAudioContext.resume().catch((err) => {\n // Bug #55: Chrome and Edge do throw an InvalidAccessError instead of an InvalidStateError.\n // Bug #56: Safari invokes the catch handler but without an error.\n if (err === undefined || err.code === 15) {\n throw createInvalidStateError();\n }\n\n throw err;\n });\n }\n\n public suspend(): Promise {\n return this._nativeAudioContext.suspend().catch((err) => {\n // Bug #56: Safari invokes the catch handler but without an error.\n if (err === undefined) {\n throw createInvalidStateError();\n }\n\n throw err;\n });\n }\n };\n};\n","import { TCreateNativeOfflineAudioContextFactory } from '../types';\n\nexport const createCreateNativeOfflineAudioContext: TCreateNativeOfflineAudioContextFactory = (\n createNotSupportedError,\n nativeOfflineAudioContextConstructor\n) => {\n return (numberOfChannels, length, sampleRate) => {\n if (nativeOfflineAudioContextConstructor === null) {\n throw new Error('Missing the native OfflineAudioContext constructor.');\n }\n\n try {\n return new nativeOfflineAudioContextConstructor(numberOfChannels, length, sampleRate);\n } catch (err) {\n // Bug #143, #144 & #146: Safari throws a SyntaxError when numberOfChannels, length or sampleRate are invalid.\n if (err.name === 'SyntaxError') {\n throw createNotSupportedError();\n }\n\n throw err;\n }\n };\n};\n","import { wrapAudioBufferGetChannelDataMethod } from '../helpers/wrap-audio-buffer-get-channel-data-method';\nimport { TStartRenderingFactory } from '../types';\n\nexport const createStartRendering: TStartRenderingFactory = (\n audioBufferStore,\n cacheTestResult,\n getAudioNodeRenderer,\n getUnrenderedAudioWorkletNodes,\n renderNativeOfflineAudioContext,\n testAudioBufferCopyChannelMethodsOutOfBoundsSupport,\n wrapAudioBufferCopyChannelMethods,\n wrapAudioBufferCopyChannelMethodsOutOfBounds\n) => {\n return (destination, nativeOfflineAudioContext) =>\n getAudioNodeRenderer(destination)\n .render(destination, nativeOfflineAudioContext)\n /*\n * Bug #86 & #87: Invoking the renderer of an AudioWorkletNode might be necessary if it has no direct or indirect connection to the\n * destination.\n */\n .then(() =>\n Promise.all(\n Array.from(getUnrenderedAudioWorkletNodes(nativeOfflineAudioContext)).map((audioWorkletNode) =>\n getAudioNodeRenderer(audioWorkletNode).render(audioWorkletNode, nativeOfflineAudioContext)\n )\n )\n )\n .then(() => renderNativeOfflineAudioContext(nativeOfflineAudioContext))\n .then((audioBuffer) => {\n // Bug #5: Safari does not support copyFromChannel() and copyToChannel().\n // Bug #100: Safari does throw a wrong error when calling getChannelData() with an out-of-bounds value.\n if (typeof audioBuffer.copyFromChannel !== 'function') {\n wrapAudioBufferCopyChannelMethods(audioBuffer);\n wrapAudioBufferGetChannelDataMethod(audioBuffer);\n // Bug #157: Firefox does not allow the bufferOffset to be out-of-bounds.\n } else if (\n !cacheTestResult(testAudioBufferCopyChannelMethodsOutOfBoundsSupport, () =>\n testAudioBufferCopyChannelMethodsOutOfBoundsSupport(audioBuffer)\n )\n ) {\n wrapAudioBufferCopyChannelMethodsOutOfBounds(audioBuffer);\n }\n\n audioBufferStore.add(audioBuffer);\n\n return audioBuffer;\n });\n};\n"],"names":["ACTIVE_AUDIO_NODE_STORE","WeakSet","AUDIO_NODE_CONNECTIONS_STORE","WeakMap","AUDIO_NODE_STORE","AUDIO_PARAM_CONNECTIONS_STORE","AUDIO_PARAM_STORE","CONTEXT_STORE","EVENT_LISTENERS","CYCLE_COUNTERS","NODE_NAME_TO_PROCESSOR_CONSTRUCTOR_MAPS","NODE_TO_PROCESSOR_MAPS","handler","construct","IMPORT_STATEMENT_REGEX","splitImportStatements","source","url","importStatements","sourceWithoutImportStatements","replace","result","match","unresolvedUrl","slice","importStatementWithResolvedUrl","URL","toString","push","length","join","verifyParameterDescriptors","parameterDescriptors","undefined","Array","isArray","TypeError","verifyProcessorCtor","processorCtor","constructible","Proxy","_unused","isConstructible","prototype","getValueForKey","map","key","value","get","Error","pickElementFromSet","set","predicate","matchingElements","from","filter","matchingElement","_slicedToArray","delete","deletePassiveInputConnectionToAudioNode","passiveInputs","output","input","passiveInputConnections","matchingConnection","passiveInputConnection","size","getEventListenersOfAudioNode","audioNode","setInternalStateToActive","has","add","forEach","eventListener","isAudioWorkletNode","setInternalStateToPassive","setInternalStateToPassiveWhenNecessary","activeInputs","every","connections","DEFAULT_OPTIONS","channelCount","channelCountMode","channelInterpretation","fftSize","maxDecibels","minDecibels","smoothingTimeConstant","isOwnedByContext","nativeAudioNode","nativeContext","context","testAudioBufferCopyChannelMethodsOutOfBoundsSupport","nativeAudioBuffer","copyToChannel","Float32Array","createIndexSizeError","DOMException","wrapAudioBufferGetChannelDataMethod","audioBuffer","getChannelData","channel","call","err","code","numberOfChannels","MOST_NEGATIVE_SINGLE_FLOAT","MOST_POSITIVE_SINGLE_FLOAT","isActiveAudioNode","buffer","loop","loopEnd","loopStart","playbackRate","getAudioNodeConnections","getAudioParamConnections","audioParam","deactivateActiveAudioNodeInputConnections","trace","_ref","includes","concat","_toConsumableArray","_step","audioParams","isAudioBufferSourceNode","parameters","values","isBiquadFilterNode","Q","detune","frequency","gain","isConstantSourceNode","offset","isGainNode","isOscillatorNode","isStereoPannerNode","pan","_iterator","_createForOfIteratorHelper","s","n","done","audioParamConnections","_ref3","e","f","deactivateAudioGraph","destination","isValidLatencyHint","latencyHint","isAudioNode","audioNodeOrAudioParam","isAudioNodeOutputConnection","outputConnection","insertElementInSet","element","ignoreDuplicates","addActiveInputConnectionToAudioParam","_ref2","activeInputConnection","addPassiveInputConnectionToAudioParam","Set","isNativeAudioNodeFaker","nativeAudioNodeOrNativeAudioNodeFaker","connectNativeAudioNodeToNativeAudioNode","nativeSourceAudioNode","nativeDestinationAudioNode","fakeNativeDestinationAudioNode","inputs","connect","deleteActiveInputConnection","activeInputConnections","deleteEventListenerOfAudioNode","deletePassiveInputConnectionToAudioParam","disconnectNativeAudioNodeFromNativeAudioNode","disconnect","getNativeAudioNode","getNativeAudioParam","isPartOfACycle","isPassiveAudioNode","testAudioNodeDisconnectMethodSupport","nativeAudioContext","nativeAudioWorkletNodeConstructor","Promise","resolve","analyzer","createScriptProcessor","dummy","createGain","ones","createBuffer","channelData","createBufferSource","onaudioprocess","event","chnnlDt","inputBuffer","some","sample","stop","start","visitEachAudioNodeOnce","cycles","visitor","counts","Map","_step2","cycle","_iterator2","count","isNativeAudioNode","nativeAudioNodeOrAudioParam","wrapAudioNodeDisconnectMethod","bind","arguments","returnValue","connectionsToDestination","connection","destinationOrOutput","apply","clear","_step$value","filteredConnections","_loop","_step2$value","addConnectionToAudioParamOfAudioContext","isOffline","_getAudioParamConnect","outputs","eventListeners","isActive","nativeAudioParam","partialConnection","deleteActiveInputConnectionToAudioParam","deleteInputsOfAudioNode","_deleteInputConnectio","_getAudioNodeConnecti2","deleteInputConnectionOfAudioNode","_deleteInputConnectio2","listener","deleteInputsOfAudioParam","_deleteInputConnectio3","_getAudioParamConnect2","deleteInputConnectionOfAudioParam","_deleteInputConnectio4","ReadOnlyMap","_classCallCheck","this","_map","_createClass","entries","callback","_this","thisArg","name","keys","numberOfInputs","numberOfOutputs","parameterData","processorOptions","copyFromChannel","parent","channelNumber","bufferOffset","byteLength","slicedInput","BYTES_PER_ELEMENT","createNestedArrays","x","y","arrays","i","array","j","getAudioWorkletProcessor","nativeOfflineAudioContext","proxy","nodeToProcessorMap","nativeAudioWorkletNode","processBuffer","_asyncToGenerator","_regeneratorRuntime","mark","_callee","renderedBuffer","options","outputChannelCount","processorConstructor","exposeCurrentFrameAndCurrentTime","numberOfInputChannels","numberOfOutputChannels","processedBuffer","audioNodeConnections","audioWorkletProcessor","wrap","_context2","prev","next","Math","ceil","reduce","sum","sampleRate","sent","prmtrs","_objectSpread","_defineProperty","k","_j","_k","potentiallyEmptyInputs","activeSourceFlag","_j2","outputChannelSplitterNodeOutput","_k2","_context","index","process","abrupt","t0","dispatchEvent","ErrorEvent","colno","filename","lineno","message","delegateYield","_x","_x2","_x3","_x4","_x5","_x6","_x7","type","disableNormalization","detachArrayBuffer","arrayBuffer","_MessageChannel","MessageChannel","port1","port2","closeAndResolve","onmessage","close","postMessage","delayTime","maxDelayTime","getOutputAudioNodeAtIndex","outputAudioNodes","outputAudioNode","attack","knee","ratio","release","threshold","createInvalidStateError","createInvalidAccessError","filterBuffer","feedback","feedbackLength","feedforward","feedforwardLength","minLength","xBuffer","yBuffer","bufferIndex","bufferLength","inputLength","filterFullBuffer","convertedFeedback","Float64Array","convertedFeedforward","min","filteredBuffer","fill","testPromiseSupport","uint32Array","Uint32Array","promise","decodeAudioData","catch","assignNativeAudioNodeOption","option","assignNativeAudioNodeOptions","testAnalyserNodeGetFloatTimeDomainDataMethodSupport","nativeAnalyserNode","getFloatTimeDomainData","assignNativeAudioNodeAudioParamValue","wrapAudioScheduledSourceNodeStartMethodNegativeParameters","nativeAudioScheduledSourceNode","when","duration","RangeError","wrapAudioScheduledSourceNodeStopMethodNegativeParameters","computeBufferSize","baseLatency","max","pow","round","log2","cloneAudioWorkletNodeOptions","audioWorkletNodeOptions","reject","data","onmessageerror","createAudioWorkletProcessorPromise","clonedAudioWorkletNodeOptions","createNativeBiquadFilterNode","nativeBiquadFilterNode","createBiquadFilter","createNativeChannelSplitterNode","nativeChannelSplitterNode","createChannelSplitter","channelSplitterNode","Object","defineProperty","wrapChannelSplitterNode","interceptConnections","original","interceptor","createNativeDelayNode","nativeDelayNode","createDelay","createNativeGainNode","nativeGainNode","divide","a","b","denominator","evaluatePolynomial","coefficient","z","ongoingTests","testResults","contextStore","audioNodeConnectionsStore","unit32Array","audioParamConnectionsStore","createNativeScriptProcessorNode","bufferSize","createNotSupportedError","periodicWave","coneInnerAngle","coneOuterAngle","coneOuterGain","distanceModel","maxDistance","orientationX","orientationY","orientationZ","panningModel","positionX","positionY","positionZ","refDistance","rolloffFactor","createUnknownError","curve","oversample","getFirstSample","isDCCurve","floor","overwriteAccessors","object","property","createGetter","createSetter","hasOwnProperty","getPrototypeOf","_Object$getOwnPropert","getOwnPropertyDescriptor","testAudioScheduledSourceNodeStartMethodNegativeParametersSupport","nativeAudioBufferSourceNode","createOscillator","testAudioScheduledSourceNodeStopMethodConsecutiveCallsSupport","testAudioScheduledSourceNodeStopMethodNegativeParametersSupport","wrapAudioScheduledSourceNodeStopMethodConsecutiveCalls","disconnectGainNode","removeEventListener","addEventListener","isStopped","setValueAtTime","wrapEventListener","target","descriptor","defineProperties","currentTarget","handleEvent","addActiveInputConnectionToAudioNode","createAddActiveInputConnectionToAudioNode","addPassiveInputConnectionToAudioNode","createAddPassiveInputConnectionToAudioNode","deleteActiveInputConnectionToAudioNode","createDeleteActiveInputConnectionToAudioNode","audioNodeTailTimeStore","getAudioNodeTailTime","_a","createGetAudioNodeTailTime","cacheTestResult","tester","test","cachedTestResult","ongoingTest","synchronousTestResult","then","finalTestResult","window","createNativeAnalyserNode","createAnalyser","byteTimeDomainData","Uint8Array","getByteTimeDomainData","wrapAnalyserNodeGetFloatTimeDomainDataMethod","createNativeAnalyserNodeFactory","getAudioNodeRenderer","renderer","createGetAudioNodeRenderer","renderInputsOfAudioNode","_callee2","all","_ref4","audioNodeRenderer","renderedNativeAudioNode","render","allRenderingPromises","renderingPromises","createRenderInputsOfAudioNode","createAnalyserNodeRenderer","renderedNativeAnalyserNodes","createAnalyserNode","renderedNativeAnalyserNode","createAnalyserNodeRendererFactory","getNativeContext","nativeOfflineAudioContextConstructor","OfflineAudioContext","webkitOfflineAudioContext","createNativeOfflineAudioContextConstructor","isNativeOfflineAudioContext","anything","createIsNativeOfflineAudioContext","audioParamAudioNodeStore","eventTargetConstructor","EventTarget","_nativeEventTarget","_listeners","wrappedEventListener","createEventTargetConstructor","nativeAudioContextConstructor","AudioContext","webkitAudioContext","createNativeAudioContextConstructor","isNativeAudioContext","createIsNativeAudioContext","AudioNode","createIsNativeAudioNode","isNativeAudioParam","AudioParam","createIsNativeAudioParam","AudioWorkletNode","createNativeAudioWorkletNodeConstructor","audioNodeConstructor","addAudioNodeConnections","addConnectionToAudioNode","createIncrementCycleCounter","decrementCycleCounter","detectCycles","_eventTargetConstruct","_inherits","_super","_createSuper","_nativeAudioNode","_assertThisInitialized","state","_this$_nativeAudioNod","isPassive","maxValue","destinations","audioNodeConnectionsOfSource","deleteAnyConnection","deleteConnectionAtOutput","deleteConnectionToDestination","_step3","_iterator3","createAudioNodeConstructor","tailTimeTimeoutIds","_getAudioNodeConnecti","tailTime","tailTimeTimeoutId","clearTimeout","setTimeout","createAddConnectionToAudioNode","cycleCounters","cycleCounter","nativeDestinationAudioParam","createIncrementCycleCounterFactory","createDecrementCycleCounter","chain","nextLink","isDelayNode","mergedCycles","nestedCycles","createDetectCycles","analyserNodeConstructor","audionNodeConstructor","_audionNodeConstructo","AnalyserNode","mergedOptions","analyserNodeRenderer","_nativeAnalyserNode","frequencyBinCount","getByteFrequencyData","getFloatFrequencyData","createAnalyserNodeConstructor","audioBufferStore","nativeAudioBufferConstructor","AudioBuffer","createNativeAudioBufferConstructor","convertNumberToUnsignedLong","wrapAudioBufferCopyChannelMethods","channelNumberAsNumber","audioBufferLength","destinationLength","sourceLength","createWrapAudioBufferCopyChannelMethods","wrapAudioBufferCopyChannelMethodsOutOfBounds","createWrapAudioBufferCopyChannelMethodsOutOfBounds","audioBufferConstructor","testNativeAudioBufferConstructorSupport","_Symbol$hasInstance","_DEFAULT_OPTIONS$opti","instance","Symbol","hasInstance","createAudioBufferConstructor","createTestAudioBufferConstructorSupport","addSilentConnection","createAddSilentConnection","renderInputsOfAudioParam","createRenderInputsOfAudioParam","connectAudioParam","createConnectAudioParam","createNativeAudioBufferSourceNode","testAudioBufferSourceNodeStartMethodConsecutiveCallsSupport","testAudioBufferSourceNodeStartMethodOffsetClampingSupport","testAudioBufferSourceNodeStopMethodNullifiedBufferSupport","wrapAudioBufferSourceNodeStartMethodOffsetClampling","wrapAudioBufferSourceNodeStopMethodNullifiedBuffer","isScheduled","wrapAudioBufferSourceNodeStartMethodConsecutiveCalls","createNativeAudioBufferSourceNodeFactory","clampedOffset","nullifiedBuffer","createWrapAudioBufferSourceNodeStopMethodNullifiedBuffer","renderAutomation","getAudioParamRenderer","replay","createRenderAutomation","createGetAudioParamRenderer","createAudioBufferSourceNodeRenderer","renderedNativeAudioBufferSourceNodes","createAudioBufferSourceNode","nativeAudioBufferSourceNodeIsOwnedByContext","_nativeAudioBufferSou","renderedNativeAudioBufferSourceNode","createAudioBufferSourceNodeRendererFactory","createAudioParam","addAudioParamConnections","audioParamStore","createAudioParamRenderer","createCancelAndHoldAutomationEvent","createCancelScheduledValuesAutomationEvent","createExponentialRampToValueAutomationEvent","createLinearRampToValueAutomationEvent","createSetTargetAutomationEvent","createSetValueAutomationEvent","createSetValueCurveAutomationEvent","setValueAtTimeUntilPossible","isAudioParamOfOfflineAudioContext","minValue","automationEventList","AutomationEventList","defaultValue","audioParamRenderer","currentTime","cancelAndHoldAtTime","cancelTime","flush","previousLastEvent","pop","currentLastEvent","cancelScheduledValues","exponentialRampToValueAtTime","endTime","linearRampToValueAtTime","startTime","setValueCurveAtTime","Number","isFinite","setTargetAtTime","timeConstant","convertedValues","firstSample","lastSample","numberOfInterpolatedValues","interpolatedValues","theoreticIndex","lowerIndex","upperIndex","timeOfLastSample","createAudioParamFactory","automationEvent","audioBufferSourceNodeConstructor","_audioNodeConstructor","AudioBufferSourceNode","audioBufferSourceNodeRenderer","_audioBufferSourceNodeRenderer","_isBufferNullified","_isBufferSet","_nativeAudioBufferSourceNode","_onended","_playbackRate","wrappedListener","onended","nativeOnEnded","_this2","resetInternalStateToPassive","createAudioBufferSourceNodeConstructor","audioDestinationNodeConstructor","createAudioDestinationNodeRenderer","createNativeAudioDestinationNode","AudioDestinationNode","nativeAudioDestinationNode","audioDestinationNodeRenderer","_isNodeOfNativeOfflineAudioContext","_nativeAudioDestinationNode","maxChannelCount","createAudioDestinationNodeConstructor","renderedNativeAudioDestinationNodes","createAudioDestinationNode","renderedNativeAudioDestinationNode","isNodeOfNativeOfflineAudioContext","gainNode","createNativeAudioDestinationNodeFactory","createBiquadFilterNodeRenderer","renderedNativeBiquadFilterNodes","createBiquadFilterNode","nativeBiquadFilterNodeIsOwnedByContext","renderedNativeBiquadFilterNode","createBiquadFilterNodeRendererFactory","setAudioNodeTailTime","createSetAudioNodeTailTime","biquadFilterNodeConstructor","BiquadFilterNode","biquadFilterNodeRenderer","_Q","_detune","_frequency","_gain","log10","_nativeBiquadFilterNode","frequencyHz","magResponse","phaseResponse","getFrequencyResponse","createBiquadFilterNodeConstructor","monitorConnections","whenConnected","whenDisconnected","wasDisconnected","wasConnected","isDisconnected","createMonitorConnections","wrapChannelMergerNode","channelMergerNode","audioBufferSourceNode","createWrapChannelMergerNode","createNativeChannelMergerNode","nativeChannelMergerNode","createChannelMerger","createNativeChannelMergerNodeFactory","createChannelMergerNodeRenderer","renderedNativeAudioNodes","createAudioNode","createChannelMergerNodeRendererFactory","channelMergerNodeConstructor","ChannelMergerNode","channelMergerNodeRenderer","createChannelMergerNodeConstructor","createChannelSplitterNodeRenderer","createChannelSplitterNodeRendererFactory","channelSplitterNodeConstructor","sanitizeChannelSplitterOptions","ChannelSplitterNode","channelSplitterNodeRenderer","createChannelSplitterNodeConstructor","createNativeConstantSourceNodeFaker","audioNodeOptions","_objectWithoutProperties","_excluded","nativeConstantSourceNodeFaker","createNativeConstantSourceNodeFakerFactory","createNativeConstantSourceNode","createConstantSource","nativeConstantSourceNode","createNativeConstantSourceNodeFactory","createConstantSourceNodeRenderer","renderedNativeConstantSourceNodes","createConstantSourceNode","nativeConstantSourceNodeIsOwnedByContext","renderedNativeConstantSourceNode","createConstantSourceNodeRendererFactory","constantSourceNodeConstructor","ConstantSourceNode","constantSourceNodeRenderer","_constantSourceNodeRenderer","_nativeConstantSourceNode","_offset","createConstantSourceNodeConstructor","createNativeConvolverNode","nativeConvolverNode","createConvolver","normalize","createNativeConvolverNodeFactory","createConvolverNodeRenderer","renderedNativeConvolverNodes","createConvolverNode","renderedNativeConvolverNode","createConvolverNodeRendererFactory","convolverNodeConstructor","ConvolverNode","convolverNodeRenderer","_nativeConvolverNode","createConvolverNodeConstructor","createDelayNodeRenderer","renderedNativeDelayNodes","createDelayNode","nativeDelayNodeIsOwnedByContext","renderedNativeDelayNode","createDelayNodeRendererFactory","delayNodeConstructor","DelayNode","delayNodeRenderer","_delayTime","createDelayNodeConstructor","createNativeDynamicsCompressorNode","nativeDynamicsCompressorNode","createDynamicsCompressor","createNativeDynamicsCompressorNodeFactory","createDynamicsCompressorNodeRenderer","renderedNativeDynamicsCompressorNodes","createDynamicsCompressorNode","nativeDynamicsCompressorNodeIsOwnedByContext","renderedNativeDynamicsCompressorNode","createDynamicsCompressorNodeRendererFactory","dynamicsCompressorNodeConstructor","DynamicsCompressorNode","dynamicsCompressorNodeRenderer","_attack","_knee","_nativeDynamicsCompressorNode","_ratio","_release","_threshold","previousChannelCount","reduction","createDynamicsCompressorNodeConstructor","createGainNodeRenderer","renderedNativeGainNodes","createGainNode","nativeGainNodeIsOwnedByContext","renderedNativeGainNode","createGainNodeRendererFactory","gainNodeConstructor","GainNode","gainNodeRenderer","createGainNodeConstructor","createNativeIIRFilterNodeFaker","scriptProcessorNode","bufferIndexes","xBuffers","yBuffers","outputBuffer","nyquist","nativeIIRFilterNodeFaker","omega","PI","cos","sin","response","sqrt","atan2","createNativeIIRFilterNodeFakerFactory","renderNativeOfflineAudioContext","testOfflineAudioContextCurrentTimeSupport","isOfflineAudioContextCurrentTimeSupported","oncomplete","startRendering","createRenderNativeOfflineAudioContext","createTestOfflineAudioContextCurrentTimeSupport","createIIRFilterNodeRenderer","filteredBufferPromise","nativeIIRFilterNode","nativeIIRFilterNodeIsOwnedByContext","partialOfflineAudioContext","createIIRFilter","createIIRFilterNodeRendererFactory","createNativeIIRFilterNode","createNativeIIRFilterNodeFactory","iIRFilterNodeConstructor","IIRFilterNode","iirFilterNodeRenderer","wrapIIRFilterNodeGetFrequencyResponseMethod","_nativeIIRFilterNode","createIIRFilterNodeConstructor","createAudioListener","nativeListener","forwardX","isScriptProcessorNodeCreated","lastOrientation","lastPosition","createScriptProcessorNode","orientation","setOrientation","positon","setPosition","createSetOrientation","createSetPosition","createFakeAudioParam","initialValue","setValue","constantSourceNode","_len","args","_key","_len2","_key2","_len3","_key3","_len4","_key4","_len5","_key5","_len6","_key6","_len7","_key7","forwardY","forwardZ","upX","upY","upZ","createFakeAudioParams","createAudioListenerFactory","unrenderedAudioWorkletNodeStore","minimalBaseAudioContextConstructor","MinimalBaseAudioContext","_nativeContext","_destination","_listener","_onstatechange","onstatechange","nativeOnStateChange","createMinimalBaseAudioContextConstructor","createNativeOscillatorNode","nativeOscillatorNode","setPeriodicWave","createNativeOscillatorNodeFactory","createOscillatorNodeRenderer","renderedNativeOscillatorNodes","createOscillatorNode","nativeOscillatorNodeIsOwnedByContext","renderedNativeOscillatorNode","createOscillatorNodeRendererFactory","oscillatorNodeConstructor","OscillatorNode","oscillatorNodeRenderer","_nativeOscillatorNode","_oscillatorNodeRenderer","createOscillatorNodeConstructor","createConnectedNativeAudioBufferSourceNode","createConnectedNativeAudioBufferSourceNodeFactory","createNativeWaveShaperNodeFaker","negativeWaveShaperNode","createWaveShaper","positiveWaveShaperNode","inputGainNode","invertGainNode","outputGainNode","revertGainNode","disconnectNativeAudioBufferSourceNode","isConnected","unmodifiedCurve","nativeWaveShaperNodeFaker","curveLength","negativeCurve","positiveCurve","centerIndex","createNativeWaveShaperNodeFakerFactory","createNativeWaveShaperNode","nativeWaveShaperNode","automationRate","createNativeWaveShaperNodeFactory","createNativePannerNodeFaker","pannerNode","createPanner","SINGLE_CHANNEL_OPTIONS","orientationXGainNode","orientationYGainNode","orientationZGainNode","positionXGainNode","positionYGainNode","positionZGainNode","waveShaperNode","nativePannerNodeFaker","createNativePannerNodeFakerFactory","createNativePannerNode","nativePannerNode","createNativePannerNodeFactory","createPannerNodeRenderer","renderedBufferPromise","_callee3","commonAudioNodeOptions","commonNativePannerNodeOptions","nativePannerNodeIsOwnedByContext","channelDatas","gateGainNode","partialPannerNode","_i","_context3","nativeConstantSourceNodes","renderedNativeGainNodeOrNativePannerNode","createPannerNodeRendererFactory","pannerNodeConstructor","PannerNode","pannerNodeRenderer","_nativePannerNode","_orientationX","_orientationY","_orientationZ","_positionX","_positionY","_positionZ","createPannerNodeConstructor","createNativePeriodicWave","imag","real","convertedImag","convertedReal","nativePeriodicWave","createPeriodicWave","createNativePeriodicWaveFactory","periodicWaveConstructor","periodicWaveStore","sanitizePeriodicWaveOptions","PeriodicWave","createPeriodicWaveConstructor","nativeStereoPannerNodeFakerFactory","CURVE_SIZE","DC_CURVE","HALF_PI","SINGLE_CHANNEL_WAVE_SHAPER_OPTIONS","buildInternalGraph","panGainNode","leftWaveShaperCurve","rightWaveShaperCurve","leftGainNode","leftWaveShaperNode","panWaveShaperNode","rightGainNode","rightWaveShaperNode","connectGraph","disconnectGraph","buildInternalGraphForMono","leftInputForLeftOutputWaveShaperCurve","leftInputForRightOutputWaveShaperCurve","rightInputForLeftOutputWaveShaperCurve","rightInputForRightOutputWaveShaperCurve","leftInputForLeftOutputGainNode","leftInputForLeftOutputWaveShaperNode","leftInputForRightOutputGainNode","leftInputForRightOutputWaveShaperNode","rightInputForLeftOutputGainNode","rightInputForLeftOutputWaveShaperNode","rightInputForRightOutputGainNode","rightInputForRightOutputWaveShaperNode","buildInternalGraphForStereo","_buildInternalGraph","_buildInternalGraph2","createNativeStereoPannerNodeFakerFactory","createNativeStereoPannerNode","createNativeStereoPannerNodeFaker","createStereoPanner","nativeStereoPannerNode","createNativeStereoPannerNodeFactory","createStereoPannerNodeRenderer","renderedNativeStereoPannerNodes","createStereoPannerNode","nativeStereoPannerNodeIsOwnedByContext","renderedNativeStereoPannerNode","createStereoPannerNodeRendererFactory","stereoPannerNodeConstructor","StereoPannerNode","stereoPannerNodeRenderer","_pan","createStereoPannerNodeConstructor","createWaveShaperNodeRenderer","renderedNativeWaveShaperNodes","createWaveShaperNode","renderedNativeWaveShaperNode","createWaveShaperNodeRendererFactory","waveShaperNodeConstructor","WaveShaperNode","waveShaperNodeRenderer","_isCurveNullified","_nativeWaveShaperNode","createWaveShaperNodeConstructor","isSecureContext","createIsSecureContext","fn","currentFrame","configurable","createExposeCurrentFrameAndCurrentTime","backupOfflineAudioContextStore","getOrCreateBackupOfflineAudioContext","backupOfflineAudioContext","createGetOrCreateBackupOfflineAudioContext","addAudioWorkletModule","evaluateSource","fetchSource","ongoingRequests","resolvedRequests","testAudioWorkletProcessorPostMessageSupport","moduleURL","credentials","resolvedRequestsOfContext","ongoingRequestsOfContext","promiseOfOngoingRequest","audioWorklet","absoluteUrl","_splitImportStatement","_splitImportStatement2","wrappedSource","evaluateAudioWorkletGlobalScope","_AWGS","SyntaxError","AudioWorkletProcessor","trim","nodeNameToProcessorConstructorMap","_ref4$","isSupportingPostMessage","currentIndex","_splitImportStatement3","_splitImportStatement4","patchedAudioWorkletProcessor","memberDefinition","bufferRegistration","blob","Blob","createObjectURL","addModule","nativeContextOrBackupOfflineAudioContext","finally","revokeObjectURL","updatedResolvedRequestsOfContext","updatedOngoingRequestsOfContext","createAddAudioWorkletModule","head","document","script","createElement","originalOnErrorHandler","onerror","removeErrorEventListenerAndRevokeUrl","src","error","location","href","onload","appendChild","createEvaluateSource","createAbortError","fetch","ok","text","t1","t2","createFetchSource","offlineAudioContext","isEmittingMessageEvents","isEmittingProcessorErrorEvents","audioWorkletNode","oscillator","port","onprocessorerror","finish","createTestAudioWorkletProcessorPostMessageSupport","isNativeContext","createIsNativeContext","createDataCloneError","createEncodingError","detachedArrayBuffers","anyContext","audioData","complete","fail","createDecodeAudioData","baseAudioContextConstructor","_minimalBaseAudioCont","BaseAudioContext","_audioWorklet","constraints","successCallback","errorCallback","createBaseAudioContextConstructor","mediaElementAudioSourceNodeConstructor","createNativeMediaElementAudioSourceNode","MediaElementAudioSourceNode","nativeMediaElementAudioSourceNode","_nativeMediaElementAudioSourceNode","mediaElement","createMediaElementAudioSourceNodeConstructor","createMediaElementSource","mediaStreamAudioDestinationNodeConstructor","createNativeMediaStreamAudioDestinationNode","MediaStreamAudioDestinationNode","nativeMediaStreamAudioDestinationNode","_nativeMediaStreamAudioDestinationNode","stream","createMediaStreamAudioDestinationNodeConstructor","createMediaStreamDestination","mediaStreamAudioSourceNodeConstructor","createNativeMediaStreamAudioSourceNode","MediaStreamAudioSourceNode","nativeMediaStreamAudioSourceNode","_nativeMediaStreamAudioSourceNode","mediaStream","createMediaStreamAudioSourceNodeConstructor","audioStreamTracks","getAudioTracks","sort","id","filteredAudioStreamTracks","createMediaStreamSource","MediaStream","createNativeMediaStreamTrackAudioSourceNode","mediaStreamTrack","createMediaStreamTrackSource","kind","createNativeMediaStreamTrackAudioSourceNodeFactory","mediaStreamTrackAudioSourceNodeConstructor","MediaStreamTrackAudioSourceNode","nativeMediaStreamTrackAudioSourceNode","createMediaStreamTrackAudioSourceNodeConstructor","audioContextConstructor","_baseAudioContextCons","_baseLatency","_nativeAudioContext","_nativeGainNode","_state","revokeState","_this3","resolvePromise","resume","suspend","createAudioContextConstructor","getUnrenderedAudioWorkletNodes","unrenderedAudioWorkletNodes","createGetUnrenderedAudioWorkletNodes","addUnrenderedAudioWorkletNode","createAddUnrenderedAudioWorkletNode","connectMultipleOutputs","createConnectMultipleOutputs","deleteUnrenderedAudioWorkletNode","createDeleteUnrenderedAudioWorkletNode","disconnectMultipleOutputs","createDisconnectMultipleOutputs","activeAudioWorkletNodeInputsStore","getActiveAudioWorkletNodeInputs","createGetActiveAudioWorkletNodeInputs","createNativeAudioWorkletNodeFaker","numberOfParameters","messageChannel","gainNodes","inputChannelSplitterNodes","constantSourceNodes","inputChannelMergerNode","outputChannelSplitterNode","outputChannelMergerNodes","parameterMap","nativeAudioWorkletNodeFaker","_","_i3","_gainNodes","patchedEventListeners","unpatchedEventListener","patchedEventListener","audioWorkletProcessorPromise","createAudioWorkletProcessor","dWrkltPrcssr","disconnectOutputsGraph","outputChannelMergerNode","activeInputIndexes","_loop2","_i5","disconnectFakeGraph","connectFakeGraph","createNativeAudioWorkletNodeFakerFactory","createNativeAudioWorkletNode","testClonabilityOfAudioWorkletNodeOptions","createNativeAudioWorkletNodeFactory","createAudioWorkletNodeRenderer","processedBufferPromise","_callee4","nativeOutputNodes","nativeAudioWorkletNodeIsOwnedByContext","renderBuffer","_nativeOutputNodes","_nativeOutputNodes2","_outputChannelSplitterNode","_outputChannelMergerNodes","_outputGainNode","nm","_step3$value","_nm","_audioParam","_context5","_i2","_context4","_ref5","_x10","t3","t4","t5","t6","t7","t8","t9","t10","_x8","_x9","renderedNativeAudioWorkletNodeOrGainNode","createAudioWorkletNodeRendererFactory","getBackupOfflineAudioContext","createGetBackupOfflineAudioContext","setActiveAudioWorkletNodeInputs","createSetActiveAudioWorkletNodeInputs","createNativeOfflineAudioContext","sanitizeAudioWorkletNodeOptions","testAudioWorkletNodeOptionsClonability","createAudioWorkletNodeConstructor","createMinimalAudioContextConstructor","createCreateNativeOfflineAudioContext","createStartRendering"],"sourceRoot":""}