@ng-web-apis/audio
Advanced tools
Comparing version 3.0.0 to 3.0.1
{ | ||
"name": "@ng-web-apis/audio", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "This is a library for declarative use of Web Audio API with Angular", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
117
README.md
@@ -1,2 +0,2 @@ | ||
# ![ng-web-apis logo](logo.svg) Web Audio API for Angular | ||
# ![ng-web-apis logo](https://raw.githubusercontent.com/Tinkoff/ng-web-apis/main/libs/audio/logo.svg) Web Audio API for Angular | ||
@@ -134,13 +134,13 @@ [![npm version](https://img.shields.io/npm/v/@ng-web-apis/audio.svg)](https://npmjs.com/package/@ng-web-apis/audio) | ||
```cs | ||
```ts | ||
@NgModule({ | ||
bootstrap: [AppComponent], | ||
declarations: [AppComponent], | ||
providers: [ | ||
{ | ||
provide: AUDIO_WORKLET_PROCESSORS, | ||
useValue: 'assets/my-processor.js', | ||
multi: true, | ||
}, | ||
], | ||
bootstrap: [AppComponent], | ||
declarations: [AppComponent], | ||
providers: [ | ||
{ | ||
provide: AUDIO_WORKLET_PROCESSORS, | ||
useValue: 'assets/my-processor.js', | ||
multi: true, | ||
}, | ||
], | ||
}) | ||
@@ -150,15 +150,12 @@ export class AppModule {} | ||
```cs | ||
```ts | ||
@Component({ | ||
selector: 'app', | ||
templateUrl: './app.component.html', | ||
selector: 'app', | ||
templateUrl: './app.component.html', | ||
}) | ||
export class AppComponent { | ||
constructor( | ||
@Inject(AUDIO_WORKLET_PROCESSORS_READY) readonly processorsReady: Promise<boolean>, | ||
) {} | ||
constructor(@Inject(AUDIO_WORKLET_PROCESSORS_READY) readonly processorsReady: Promise<boolean>) {} | ||
// ... | ||
// ... | ||
} | ||
``` | ||
@@ -178,19 +175,19 @@ | ||
```cs | ||
```ts | ||
@Directive({ | ||
selector: '[my-worklet-node]', | ||
exportAs: 'AudioNode', | ||
providers: [asAudioNode(MyWorklet)], | ||
selector: '[my-worklet-node]', | ||
exportAs: 'AudioNode', | ||
providers: [asAudioNode(MyWorklet)], | ||
}) | ||
export class MyWorklet extends WebAudioWorklet { | ||
@Input() | ||
@audioParam() | ||
customParam?: AudioParamInput; | ||
@Input() | ||
@audioParam() | ||
customParam?: AudioParamInput; | ||
constructor( | ||
@Inject(AUDIO_CONTEXT) context: BaseAudioContext, | ||
@SkipSelf() @Inject(AUDIO_NODE) node: AudioNode | null, | ||
) { | ||
super(context, node, 'my-processor'); | ||
} | ||
constructor( | ||
@Inject(AUDIO_CONTEXT) context: BaseAudioContext, | ||
@SkipSelf() @Inject(AUDIO_NODE) node: AudioNode | null, | ||
) { | ||
super(context, node, 'my-processor'); | ||
} | ||
} | ||
@@ -248,33 +245,33 @@ ``` | ||
![Envelope](envelope.png) | ||
![Envelope](https://raw.githubusercontent.com/Tinkoff/ng-web-apis/main/libs/audio/envelope.png) | ||
You would need to pass the following array of `AudioParamAutomation` items: | ||
```cs | ||
envelope = [ | ||
{ | ||
value: 0, | ||
duration: 0, | ||
mode: 'instant', | ||
}, | ||
{ | ||
value: 1, | ||
duration: ATTACK_TIME, | ||
mode: 'linear', | ||
}, | ||
{ | ||
value: SUS, | ||
duration: DECAY_TIME, | ||
mode: 'linear', | ||
}, | ||
{ | ||
value: SUS, | ||
duration: SUSTAIN_TIME, | ||
mode: 'instant', | ||
}, | ||
{ | ||
value: 0, | ||
duration: RELEASE_TIME, | ||
mode: 'exponential', | ||
}, | ||
```ts | ||
const envelope = [ | ||
{ | ||
value: 0, | ||
duration: 0, | ||
mode: 'instant', | ||
}, | ||
{ | ||
value: 1, | ||
duration: ATTACK_TIME, | ||
mode: 'linear', | ||
}, | ||
{ | ||
value: SUS, | ||
duration: DECAY_TIME, | ||
mode: 'linear', | ||
}, | ||
{ | ||
value: SUS, | ||
duration: SUSTAIN_TIME, | ||
mode: 'instant', | ||
}, | ||
{ | ||
value: 0, | ||
duration: RELEASE_TIME, | ||
mode: 'exponential', | ||
}, | ||
]; | ||
@@ -281,0 +278,0 @@ ``` |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
898974
374