From 95cfca9f222182f14337ebd770aa703147b262c0 Mon Sep 17 00:00:00 2001 From: James Prevett Date: Sat, 16 Nov 2024 14:29:50 -0600 Subject: [PATCH] Embed DSP types --- src/devices/audioworklet.d.ts | 32 -------------------------------- src/devices/dsp.ts | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 33 deletions(-) delete mode 100644 src/devices/audioworklet.d.ts diff --git a/src/devices/audioworklet.d.ts b/src/devices/audioworklet.d.ts deleted file mode 100644 index dfbb0eb..0000000 --- a/src/devices/audioworklet.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* Types pulled from @types/audioworklet */ - -/* eslint-disable no-var, @typescript-eslint/no-explicit-any */ - -/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletProcessor) */ -interface AudioWorkletProcessor { - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletProcessor/port) */ - readonly port: MessagePort; - - process(inputs: Float32Array[][], outputs: Float32Array[][], parameters: Record): boolean; -} - -declare var AudioWorkletProcessor: { - prototype: AudioWorkletProcessor; - new (): AudioWorkletProcessor; -}; - -interface AudioWorkletProcessorConstructor { - new (options: any): AudioWorkletProcessor; -} - -/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletGlobalScope/currentFrame) */ -declare var currentFrame: number; - -/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletGlobalScope/currentTime) */ -declare var currentTime: number; - -/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletGlobalScope/sampleRate) */ -declare var sampleRate: number; - -/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletGlobalScope/registerProcessor) */ -declare function registerProcessor(name: string, processor: AudioWorkletProcessorConstructor): void; diff --git a/src/devices/dsp.ts b/src/devices/dsp.ts index 79b62aa..14d31e6 100644 --- a/src/devices/dsp.ts +++ b/src/devices/dsp.ts @@ -1,6 +1,38 @@ /* Credit: David Konsumer */ import type { DeviceDriver, DeviceFile } from '@zenfs/core'; -import './audioworklet.d.ts'; + +/* Types pulled from @types/audioworklet */ + +/* eslint-disable no-var, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */ + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletProcessor) */ +interface AudioWorkletProcessor { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletProcessor/port) */ + readonly port: MessagePort; + + process(inputs: Float32Array[][], outputs: Float32Array[][], parameters: Record): boolean; +} + +declare var AudioWorkletProcessor: { + prototype: AudioWorkletProcessor; + new (): AudioWorkletProcessor; +}; + +interface AudioWorkletProcessorConstructor { + new (options: any): AudioWorkletProcessor; +} + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletGlobalScope/currentFrame) */ +declare var currentFrame: number; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletGlobalScope/currentTime) */ +declare var currentTime: number; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletGlobalScope/sampleRate) */ +declare var sampleRate: number; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletGlobalScope/registerProcessor) */ +declare function registerProcessor(name: string, processor: AudioWorkletProcessorConstructor): void; if ('AudioWorkletProcessor' in globalThis) { class Dsp extends AudioWorkletProcessor {