-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
65 changed files
with
531 additions
and
165 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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 |
---|---|---|
@@ -1,9 +1,14 @@ | ||
import {InjectionToken} from '@angular/core'; | ||
|
||
export const AUDIO_CONTEXT = new InjectionToken<BaseAudioContext>( | ||
'[AUDIO_CONTEXT]: Web Audio API context', | ||
export const WA_AUDIO_CONTEXT = new InjectionToken<BaseAudioContext>( | ||
'[WA_AUDIO_CONTEXT]: Web Audio API context', | ||
{ | ||
providedIn: 'root', | ||
factory: () => new AudioContext(), | ||
}, | ||
); | ||
|
||
/** | ||
* @deprecated: drop in v5.0 | ||
*/ | ||
export const AUDIO_CONTEXT = WA_AUDIO_CONTEXT; |
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,16 +1,26 @@ | ||
import type {ExistingProvider, Type} from '@angular/core'; | ||
import {InjectionToken} from '@angular/core'; | ||
|
||
export const AUDIO_NODE = new InjectionToken<AudioNode | null>( | ||
'[AUDIO_NODE]: Web Audio API audio node', | ||
export const WA_AUDIO_NODE = new InjectionToken<AudioNode | null>( | ||
'[WA_AUDIO_NODE]: Web Audio API audio node', | ||
{ | ||
factory: () => null, | ||
}, | ||
); | ||
|
||
export function asAudioNode(useExisting: Type<AudioNode>): ExistingProvider { | ||
export function waAsAudioNode(useExisting: Type<AudioNode>): ExistingProvider { | ||
return { | ||
provide: AUDIO_NODE, | ||
provide: WA_AUDIO_NODE, | ||
useExisting, | ||
}; | ||
} | ||
|
||
/** | ||
* @deprecated: drop in v5.0 | ||
*/ | ||
export const asAudioNode = waAsAudioNode; | ||
|
||
/** | ||
* @deprecated: drop in v5.0 | ||
*/ | ||
export const AUDIO_NODE = WA_AUDIO_NODE; |
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,9 +1,14 @@ | ||
import {InjectionToken} from '@angular/core'; | ||
|
||
export const AUDIO_WORKLET_PROCESSORS = new InjectionToken<readonly string[]>( | ||
'[AUDIO_WORKLET_PROCESSORS]: Web Audio API worklet processors paths', | ||
export const WA_AUDIO_WORKLET_PROCESSORS = new InjectionToken<readonly string[]>( | ||
'[WA_AUDIO_WORKLET_PROCESSORS]: Web Audio API worklet processors paths', | ||
{ | ||
providedIn: 'root', | ||
factory: () => [], | ||
}, | ||
); | ||
|
||
/** | ||
* @deprecated: drop in v5.0 | ||
*/ | ||
export const AUDIO_WORKLET_PROCESSORS = WA_AUDIO_WORKLET_PROCESSORS; |
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,10 +1,15 @@ | ||
import {inject, InjectionToken} from '@angular/core'; | ||
|
||
import {AUDIO_CONTEXT} from './audio-context'; | ||
import {WA_AUDIO_CONTEXT} from './audio-context'; | ||
|
||
export const AUDIO_WORKLET_SUPPORT = new InjectionToken<boolean>( | ||
'[AUDIO_WORKLET_SUPPORT]: AudioWorklet browser support', | ||
export const WA_AUDIO_WORKLET_SUPPORT = new InjectionToken<boolean>( | ||
'[WA_AUDIO_WORKLET_SUPPORT]: AudioWorklet browser support', | ||
{ | ||
factory: () => !!inject(AUDIO_CONTEXT).audioWorklet, | ||
factory: () => !!inject(WA_AUDIO_CONTEXT).audioWorklet, | ||
}, | ||
); | ||
|
||
/** | ||
* @deprecated: drop in v5.0 | ||
*/ | ||
export const AUDIO_WORKLET_SUPPORT = WA_AUDIO_WORKLET_SUPPORT; |
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,20 +1,25 @@ | ||
import {inject, InjectionToken} from '@angular/core'; | ||
|
||
import {AUDIO_CONTEXT} from './audio-context'; | ||
import {WA_AUDIO_CONTEXT} from './audio-context'; | ||
|
||
/** | ||
* This is mostly for internal use only | ||
*/ | ||
export const CONSTRUCTOR_SUPPORT = new InjectionToken<boolean>( | ||
'[CONSTRUCTOR_SUPPORT]: Tests if constructor mode of node creation is supported or a fallback to factory method is needed', | ||
export const WA_CONSTRUCTOR_SUPPORT = new InjectionToken<boolean>( | ||
'[WA_CONSTRUCTOR_SUPPORT]: Tests if constructor mode of node creation is supported or a fallback to factory method is needed', | ||
{ | ||
providedIn: 'root', | ||
factory: () => { | ||
try { | ||
return !!new GainNode(inject(AUDIO_CONTEXT)); | ||
return !!new GainNode(inject(WA_AUDIO_CONTEXT)); | ||
} catch (_) { | ||
return false; | ||
} | ||
}, | ||
}, | ||
); | ||
|
||
/** | ||
* @deprecated: drop in v5.0 | ||
*/ | ||
export const CONSTRUCTOR_SUPPORT = WA_CONSTRUCTOR_SUPPORT; |
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,5 +1,10 @@ | ||
import {InjectionToken} from '@angular/core'; | ||
|
||
export const FEEDBACK_COEFFICIENTS = new InjectionToken<number[]>( | ||
'[FEEDBACK_COEFFICIENTS]: A sequence of feedback coefficients for IIRFilterNode', | ||
export const WA_FEEDBACK_COEFFICIENTS = new InjectionToken<number[]>( | ||
'[WA_FEEDBACK_COEFFICIENTS]: A sequence of feedback coefficients for IIRFilterNode', | ||
); | ||
|
||
/** | ||
* @deprecated: drop in v5.0 | ||
*/ | ||
export const FEEDBACK_COEFFICIENTS = WA_FEEDBACK_COEFFICIENTS; |
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,5 +1,10 @@ | ||
import {InjectionToken} from '@angular/core'; | ||
|
||
export const FEEDFORWARD_COEFFICIENTS = new InjectionToken<number[]>( | ||
'[FEEDFORWARD_COEFFICIENTS]: A sequence of feedforward coefficients for IIRFilterNode', | ||
export const WA_FEEDFORWARD_COEFFICIENTS = new InjectionToken<number[]>( | ||
'[WA_FEEDFORWARD_COEFFICIENTS]: A sequence of feedforward coefficients for IIRFilterNode', | ||
); | ||
|
||
/** | ||
* @deprecated: drop in v5.0 | ||
*/ | ||
export const FEEDFORWARD_COEFFICIENTS = WA_FEEDFORWARD_COEFFICIENTS; |
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,5 +1,10 @@ | ||
import {InjectionToken} from '@angular/core'; | ||
|
||
export const MEDIA_STREAM = new InjectionToken<MediaStream>( | ||
'[MEDIA_STREAM]: MediaStream for MediaStreamAudioSourceNode', | ||
export const WA_MEDIA_STREAM = new InjectionToken<MediaStream>( | ||
'[WA_MEDIA_STREAM]: MediaStream for MediaStreamAudioSourceNode', | ||
); | ||
|
||
/** | ||
* @deprecated: drop in v5.0 | ||
*/ | ||
export const MEDIA_STREAM = WA_MEDIA_STREAM; |
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,9 +1,14 @@ | ||
import {InjectionToken} from '@angular/core'; | ||
|
||
export const WEB_AUDIO_SUPPORT = new InjectionToken<boolean>( | ||
'[WEB_AUDIO_SUPPORT]: Web Audio API support', | ||
export const WA_WEB_AUDIO_SUPPORT = new InjectionToken<boolean>( | ||
'[WA_WEB_AUDIO_SUPPORT]: Web Audio API support', | ||
{ | ||
providedIn: 'root', | ||
factory: () => !!AudioContext, | ||
}, | ||
); | ||
|
||
/** | ||
* @deprecated: drop in v5.0 | ||
*/ | ||
export const WEB_AUDIO_SUPPORT = WA_WEB_AUDIO_SUPPORT; |
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,5 +1,10 @@ | ||
import {InjectionToken} from '@angular/core'; | ||
|
||
export const CANVAS_2D_CONTEXT = new InjectionToken<CanvasRenderingContext2D>( | ||
'[CANVAS_2D_CONTEXT]: Canvas 2D rendering context', | ||
export const WA_CANVAS_2D_CONTEXT = new InjectionToken<CanvasRenderingContext2D>( | ||
'[WA_CANVAS_2D_CONTEXT]: Canvas 2D rendering context', | ||
); | ||
|
||
/** | ||
* @deprecated: drop in v5.0 | ||
*/ | ||
export const CANVAS_2D_CONTEXT = WA_CANVAS_2D_CONTEXT; |
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
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
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
Oops, something went wrong.