mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Add types for pseudo-audio-param
This commit is contained in:
committed by
Drew Petersen
parent
9b5a2a9750
commit
6861e7fbd0
47
types/pseudo-audio-param/index.d.ts
vendored
Normal file
47
types/pseudo-audio-param/index.d.ts
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
// Type definitions for pseudo-audio-param 1.3
|
||||
// Project: https://github.com/mohayonao/pseudo-audio-param/
|
||||
// Definitions by: Drew Petersen <https://github.com/kirbysayshi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "pseudo-audio-param" {
|
||||
export = PseudoAudioParam;
|
||||
}
|
||||
|
||||
interface PseudoAudioParamEvent {
|
||||
type: string;
|
||||
time: number;
|
||||
}
|
||||
|
||||
/** Simulate scheduled AudioParam values */
|
||||
declare class PseudoAudioParam {
|
||||
events: PseudoAudioParamEvent[];
|
||||
|
||||
constructor(defaultValue: number);
|
||||
|
||||
/**
|
||||
* Return scheduled value at time
|
||||
*/
|
||||
getValueAtTime(time: number): number;
|
||||
|
||||
/**
|
||||
* Apply scheduled methods to the provided audioParam. If reset is `true`,
|
||||
* cancel all events of AudioParam before applying
|
||||
*/
|
||||
applyTo(audioParam: AudioParam, reset: boolean): PseudoAudioParam;
|
||||
|
||||
setValueAtTime(value: number, time: number): PseudoAudioParam;
|
||||
linearRampToValueAtTime(value: number, time: number): PseudoAudioParam;
|
||||
exponentialRampToValueAtTime(value: number, time: number): PseudoAudioParam;
|
||||
setTargetAtTime(
|
||||
value: number,
|
||||
time: number,
|
||||
timeConstant: number
|
||||
): PseudoAudioParam;
|
||||
setValueCurveAtTime(
|
||||
values: number[],
|
||||
time: number,
|
||||
duration: number
|
||||
): PseudoAudioParam;
|
||||
cancelScheduledValues(time: number): PseudoAudioParam;
|
||||
cancelAndHoldAtTime(time: number): PseudoAudioParam;
|
||||
}
|
||||
9
types/pseudo-audio-param/pseudo-audio-param-tests.ts
Normal file
9
types/pseudo-audio-param/pseudo-audio-param-tests.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import PseudoAudioParam = require('pseudo-audio-param');
|
||||
const p = new PseudoAudioParam(1);
|
||||
const v: number = p.getValueAtTime(0.1);
|
||||
|
||||
const ctx = new AudioContext();
|
||||
const gain = new GainNode(ctx);
|
||||
p.applyTo(gain.gain, false);
|
||||
|
||||
p.setValueAtTime(0, 1);
|
||||
23
types/pseudo-audio-param/tsconfig.json
Normal file
23
types/pseudo-audio-param/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6", "dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"pseudo-audio-param-tests.ts"
|
||||
]
|
||||
}
|
||||
7
types/pseudo-audio-param/tslint.json
Normal file
7
types/pseudo-audio-param/tslint.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-single-declare-module": false,
|
||||
"no-declare-current-package": false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user