Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement AudioWorkletNode's onprocessorerror
- Loading branch information
1 parent
49ae34b
commit 49a68e0
Showing
12 changed files
with
165 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
import { TAudioParamMap, TAudioWorkletProcessorState, TProcessorStateChangeEventHandler } from '../types'; | ||
import { TAudioParamMap, TProcessorErrorEventHandler } from '../types'; | ||
import { IAudioNode } from './audio-node'; | ||
|
||
export interface IAudioWorkletNode extends IAudioNode { | ||
|
||
onprocessorstatechange: null | TProcessorStateChangeEventHandler; | ||
onprocessorerror: null | TProcessorErrorEventHandler; | ||
|
||
readonly parameters: TAudioParamMap; | ||
|
||
readonly port: MessagePort; | ||
|
||
readonly processorState: TAudioWorkletProcessorState; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
import { TNativeAudioNode, TNativeAudioParamMap, TNativeAudioWorkletProcessorState } from '../types'; | ||
import { TNativeAudioNode, TNativeAudioParamMap } from '../types'; | ||
|
||
// @todo Since there are no native types yet they need to be crafted. | ||
export interface INativeAudioWorkletNode extends TNativeAudioNode { | ||
|
||
onprocessorstatechange: null | ((this: INativeAudioWorkletNode, event: Event) => any); | ||
onprocessorerror: null | ((this: INativeAudioWorkletNode, event: Event) => any); | ||
|
||
readonly parameters: TNativeAudioParamMap; | ||
|
||
readonly port: MessagePort; | ||
|
||
readonly processorState: TNativeAudioWorkletProcessorState; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { IAudioWorkletNode } from '../interfaces'; | ||
|
||
export type TProcessorErrorEventHandler = (this: IAudioWorkletNode, event: Event) => any; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class FailingProcessor extends AudioWorkletProcessor { // eslint-disable-line no-undef | ||
|
||
constructor () { | ||
super(); | ||
} | ||
|
||
process () { // eslint-disable-line class-methods-use-this | ||
throw new Error('This is an error thrown inside the process() method.'); | ||
|
||
return true; | ||
} | ||
|
||
} | ||
|
||
FailingProcessor.parameterDescriptors = [ ]; | ||
|
||
registerProcessor('failing-processor', FailingProcessor); // eslint-disable-line no-undef |
Oops, something went wrong.