react-native-audio-api 0.1.0 → 0.3.0-rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -8
- package/RNAudioAPI.podspec +5 -0
- package/android/CMakeLists.txt +21 -10
- package/android/libs/fftw3/arm64-v8a/libfftw3.a +0 -0
- package/android/libs/fftw3/armeabi-v7a/libfftw3.a +0 -0
- package/android/libs/fftw3/x86/libfftw3.a +0 -0
- package/android/libs/fftw3/x86_64/libfftw3.a +0 -0
- package/android/libs/include/fftw3/fftw3.h +413 -0
- package/android/src/main/cpp/AudioPlayer/AudioPlayer.cpp +32 -2
- package/android/src/main/cpp/AudioPlayer/AudioPlayer.h +6 -2
- package/common/cpp/AudioAPIInstaller/AudioAPIInstallerHostObject.cpp +5 -3
- package/common/cpp/AudioAPIInstaller/AudioAPIInstallerHostObject.h +5 -1
- package/common/cpp/HostObjects/AudioBufferHostObject.cpp +6 -0
- package/common/cpp/HostObjects/AudioBufferSourceNodeHostObject.cpp +13 -1
- package/common/cpp/HostObjects/AudioContextHostObject.cpp +12 -149
- package/common/cpp/HostObjects/AudioContextHostObject.h +8 -14
- package/common/cpp/HostObjects/AudioNodeHostObject.cpp +0 -6
- package/common/cpp/HostObjects/BaseAudioContextHostObject.cpp +240 -0
- package/common/cpp/HostObjects/BaseAudioContextHostObject.h +41 -0
- package/common/cpp/HostObjects/BiquadFilterNodeHostObject.cpp +44 -0
- package/common/cpp/HostObjects/OscillatorNodeHostObject.cpp +21 -0
- package/common/cpp/HostObjects/OscillatorNodeHostObject.h +1 -0
- package/common/cpp/HostObjects/PeriodicWaveHostObject.cpp +33 -0
- package/common/cpp/HostObjects/PeriodicWaveHostObject.h +33 -0
- package/common/cpp/core/AudioArray.cpp +117 -0
- package/common/cpp/core/AudioArray.h +48 -0
- package/common/cpp/core/AudioBuffer.cpp +23 -80
- package/common/cpp/core/AudioBuffer.h +12 -13
- package/common/cpp/core/AudioBufferSourceNode.cpp +112 -25
- package/common/cpp/core/AudioBufferSourceNode.h +10 -6
- package/common/cpp/core/AudioBus.cpp +518 -0
- package/common/cpp/core/AudioBus.h +83 -0
- package/common/cpp/core/AudioContext.cpp +7 -77
- package/common/cpp/core/AudioContext.h +3 -60
- package/common/cpp/core/AudioDestinationNode.cpp +27 -15
- package/common/cpp/core/AudioDestinationNode.h +13 -5
- package/common/cpp/core/AudioNode.cpp +184 -22
- package/common/cpp/core/AudioNode.h +37 -37
- package/common/cpp/core/AudioNodeManager.cpp +75 -0
- package/common/cpp/core/AudioNodeManager.h +42 -0
- package/common/cpp/core/AudioParam.cpp +8 -11
- package/common/cpp/core/AudioParam.h +8 -8
- package/common/cpp/core/AudioScheduledSourceNode.cpp +19 -5
- package/common/cpp/core/AudioScheduledSourceNode.h +6 -2
- package/common/cpp/core/BaseAudioContext.cpp +191 -0
- package/common/cpp/core/BaseAudioContext.h +87 -0
- package/common/cpp/core/BiquadFilterNode.cpp +92 -69
- package/common/cpp/core/BiquadFilterNode.h +53 -57
- package/common/cpp/core/GainNode.cpp +12 -12
- package/common/cpp/core/GainNode.h +5 -3
- package/common/cpp/core/OscillatorNode.cpp +38 -29
- package/common/cpp/core/OscillatorNode.h +29 -69
- package/common/cpp/core/ParamChange.h +6 -6
- package/common/cpp/core/PeriodicWave.cpp +362 -0
- package/common/cpp/core/PeriodicWave.h +119 -0
- package/common/cpp/core/StereoPannerNode.cpp +31 -30
- package/common/cpp/core/StereoPannerNode.h +6 -6
- package/common/cpp/types/BiquadFilterType.h +19 -0
- package/common/cpp/types/ChannelCountMode.h +10 -0
- package/common/cpp/types/ChannelInterpretation.h +10 -0
- package/common/cpp/types/ContextState.h +10 -0
- package/common/cpp/types/OscillatorType.h +11 -0
- package/common/cpp/utils/FFTFrame.h +67 -0
- package/common/cpp/utils/JsiPromise.cpp +59 -0
- package/common/cpp/utils/JsiPromise.h +42 -0
- package/common/cpp/utils/Locker.h +49 -0
- package/common/cpp/utils/VectorMath.cpp +88 -3
- package/common/cpp/utils/VectorMath.h +7 -1
- package/common/cpp/utils/android/FFTFrame.cpp +23 -0
- package/common/cpp/utils/ios/FFTFrame.cpp +29 -0
- package/common/cpp/wrappers/AudioBufferSourceNodeWrapper.cpp +10 -0
- package/common/cpp/wrappers/AudioBufferSourceNodeWrapper.h +3 -2
- package/common/cpp/wrappers/AudioBufferWrapper.h +5 -5
- package/common/cpp/wrappers/AudioContextWrapper.cpp +7 -60
- package/common/cpp/wrappers/AudioContextWrapper.h +5 -26
- package/common/cpp/wrappers/AudioNodeWrapper.h +5 -5
- package/common/cpp/wrappers/AudioParamWrapper.h +4 -4
- package/common/cpp/wrappers/BaseAudioContextWrapper.cpp +83 -0
- package/common/cpp/wrappers/BaseAudioContextWrapper.h +50 -0
- package/common/cpp/wrappers/BiquadFilterNodeWrapper.cpp +9 -0
- package/common/cpp/wrappers/BiquadFilterNodeWrapper.h +9 -4
- package/common/cpp/wrappers/GainNodeWrapper.h +1 -1
- package/common/cpp/wrappers/OscillatorNodeWrapper.cpp +6 -0
- package/common/cpp/wrappers/OscillatorNodeWrapper.h +5 -2
- package/common/cpp/wrappers/PeriodicWaveWrapper.h +17 -0
- package/common/cpp/wrappers/StereoPannerNodeWrapper.h +1 -1
- package/ios/AudioAPIModule.h +20 -1
- package/ios/AudioAPIModule.mm +6 -4
- package/ios/AudioDecoder/AudioDecoder.h +17 -0
- package/ios/AudioDecoder/AudioDecoder.m +167 -0
- package/ios/AudioDecoder/IOSAudioDecoder.h +26 -0
- package/ios/AudioDecoder/IOSAudioDecoder.mm +40 -0
- package/ios/AudioPlayer/AudioPlayer.h +3 -2
- package/ios/AudioPlayer/AudioPlayer.m +14 -17
- package/ios/AudioPlayer/IOSAudioPlayer.h +7 -3
- package/ios/AudioPlayer/IOSAudioPlayer.mm +31 -7
- package/lib/module/core/AudioBuffer.js +37 -0
- package/lib/module/core/AudioBuffer.js.map +1 -0
- package/lib/module/core/AudioBufferSourceNode.js +28 -0
- package/lib/module/core/AudioBufferSourceNode.js.map +1 -0
- package/lib/module/core/AudioContext.js +10 -0
- package/lib/module/core/AudioContext.js.map +1 -0
- package/lib/module/core/AudioDestinationNode.js +7 -0
- package/lib/module/core/AudioDestinationNode.js.map +1 -0
- package/lib/module/core/AudioNode.js +22 -0
- package/lib/module/core/AudioNode.js.map +1 -0
- package/lib/module/core/AudioParam.js +35 -0
- package/lib/module/core/AudioParam.js.map +1 -0
- package/lib/module/core/AudioScheduledSourceNode.js +28 -0
- package/lib/module/core/AudioScheduledSourceNode.js.map +1 -0
- package/lib/module/core/BaseAudioContext.js +62 -0
- package/lib/module/core/BaseAudioContext.js.map +1 -0
- package/lib/module/core/BiquadFilterNode.js +25 -0
- package/lib/module/core/BiquadFilterNode.js.map +1 -0
- package/lib/module/core/GainNode.js +9 -0
- package/lib/module/core/GainNode.js.map +1 -0
- package/lib/module/core/OscillatorNode.js +24 -0
- package/lib/module/core/OscillatorNode.js.map +1 -0
- package/lib/module/core/PeriodicWave.js +8 -0
- package/lib/module/core/PeriodicWave.js.map +1 -0
- package/lib/module/core/StereoPannerNode.js +9 -0
- package/lib/module/core/StereoPannerNode.js.map +1 -0
- package/lib/module/core/types.js.map +1 -0
- package/lib/module/errors/IndexSizeError.js +8 -0
- package/lib/module/errors/IndexSizeError.js.map +1 -0
- package/lib/module/errors/InvalidAccessError.js +8 -0
- package/lib/module/errors/InvalidAccessError.js.map +1 -0
- package/lib/module/errors/InvalidStateError.js +8 -0
- package/lib/module/errors/InvalidStateError.js.map +1 -0
- package/lib/module/errors/RangeError.js +8 -0
- package/lib/module/errors/RangeError.js.map +1 -0
- package/lib/module/errors/index.js +5 -0
- package/lib/module/errors/index.js.map +1 -0
- package/lib/module/index.js +212 -15
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.native.js +18 -0
- package/lib/module/index.native.js.map +1 -0
- package/lib/module/interfaces.js +2 -0
- package/lib/module/interfaces.js.map +1 -0
- package/lib/module/utils/resolveAudioSource.js +10 -0
- package/lib/module/utils/resolveAudioSource.js.map +1 -0
- package/lib/typescript/core/AudioBuffer.d.ts +12 -0
- package/lib/typescript/core/AudioBuffer.d.ts.map +1 -0
- package/lib/typescript/core/AudioBufferSourceNode.d.ts +12 -0
- package/lib/typescript/core/AudioBufferSourceNode.d.ts.map +1 -0
- package/lib/typescript/core/AudioContext.d.ts +6 -0
- package/lib/typescript/core/AudioContext.d.ts.map +1 -0
- package/lib/typescript/core/AudioDestinationNode.d.ts +7 -0
- package/lib/typescript/core/AudioDestinationNode.d.ts.map +1 -0
- package/lib/typescript/core/AudioNode.d.ts +16 -0
- package/lib/typescript/core/AudioNode.d.ts.map +1 -0
- package/lib/typescript/core/AudioParam.d.ts +14 -0
- package/lib/typescript/core/AudioParam.d.ts.map +1 -0
- package/lib/typescript/core/AudioScheduledSourceNode.d.ts +10 -0
- package/lib/typescript/core/AudioScheduledSourceNode.d.ts.map +1 -0
- package/lib/typescript/core/BaseAudioContext.d.ts +27 -0
- package/lib/typescript/core/BaseAudioContext.d.ts.map +1 -0
- package/lib/typescript/core/BiquadFilterNode.d.ts +16 -0
- package/lib/typescript/core/BiquadFilterNode.d.ts.map +1 -0
- package/lib/typescript/core/GainNode.d.ts +9 -0
- package/lib/typescript/core/GainNode.d.ts.map +1 -0
- package/lib/typescript/core/OscillatorNode.d.ts +15 -0
- package/lib/typescript/core/OscillatorNode.d.ts.map +1 -0
- package/lib/typescript/core/PeriodicWave.d.ts +5 -0
- package/lib/typescript/core/PeriodicWave.d.ts.map +1 -0
- package/lib/typescript/core/StereoPannerNode.d.ts +9 -0
- package/lib/typescript/core/StereoPannerNode.d.ts.map +1 -0
- package/lib/typescript/core/types.d.ts +15 -0
- package/lib/typescript/core/types.d.ts.map +1 -0
- package/lib/typescript/errors/IndexSizeError.d.ts +5 -0
- package/lib/typescript/errors/IndexSizeError.d.ts.map +1 -0
- package/lib/typescript/errors/InvalidAccessError.d.ts +5 -0
- package/lib/typescript/errors/InvalidAccessError.d.ts.map +1 -0
- package/lib/typescript/errors/InvalidStateError.d.ts +5 -0
- package/lib/typescript/errors/InvalidStateError.d.ts.map +1 -0
- package/lib/typescript/errors/RangeError.d.ts +5 -0
- package/lib/typescript/errors/RangeError.d.ts.map +1 -0
- package/lib/typescript/errors/index.d.ts +5 -0
- package/lib/typescript/errors/index.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +88 -5
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/index.native.d.ts +14 -0
- package/lib/typescript/index.native.d.ts.map +1 -0
- package/lib/typescript/interfaces.d.ts +79 -0
- package/lib/typescript/interfaces.d.ts.map +1 -0
- package/lib/typescript/utils/resolveAudioSource.d.ts +3 -0
- package/lib/typescript/utils/resolveAudioSource.d.ts.map +1 -0
- package/package.json +4 -2
- package/src/core/AudioBuffer.ts +68 -0
- package/src/core/AudioBufferSourceNode.ts +35 -0
- package/src/core/AudioContext.ts +12 -0
- package/src/core/AudioDestinationNode.ts +9 -0
- package/src/core/AudioNode.ts +38 -0
- package/src/core/AudioParam.ts +55 -0
- package/src/core/AudioScheduledSourceNode.ts +43 -0
- package/src/core/BaseAudioContext.ts +108 -0
- package/src/core/BiquadFilterNode.ts +49 -0
- package/src/core/GainNode.ts +13 -0
- package/src/core/OscillatorNode.ts +37 -0
- package/src/core/PeriodicWave.ts +10 -0
- package/src/core/StereoPannerNode.ts +13 -0
- package/src/core/types.ts +33 -0
- package/src/errors/IndexSizeError.ts +8 -0
- package/src/errors/InvalidAccessError.ts +8 -0
- package/src/errors/InvalidStateError.ts +8 -0
- package/src/errors/RangeError.ts +8 -0
- package/src/errors/index.ts +4 -0
- package/src/index.native.ts +25 -0
- package/src/index.ts +380 -40
- package/src/interfaces.ts +121 -0
- package/src/modules/global.d.ts +3 -3
- package/src/utils/resolveAudioSource.ts +14 -0
- package/lib/module/types.js.map +0 -1
- package/lib/typescript/types.d.ts +0 -76
- package/lib/typescript/types.d.ts.map +0 -1
- package/src/types.ts +0 -108
- /package/lib/module/{types.js → core/types.js} +0 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ContextState,
|
|
3
|
+
BiquadFilterType,
|
|
4
|
+
OscillatorType,
|
|
5
|
+
ChannelCountMode,
|
|
6
|
+
ChannelInterpretation,
|
|
7
|
+
} from './core/types';
|
|
8
|
+
|
|
9
|
+
export interface IBaseAudioContext {
|
|
10
|
+
readonly destination: IAudioDestinationNode;
|
|
11
|
+
readonly state: ContextState;
|
|
12
|
+
readonly sampleRate: number;
|
|
13
|
+
readonly currentTime: number;
|
|
14
|
+
|
|
15
|
+
createOscillator(): IOscillatorNode;
|
|
16
|
+
createGain(): IGainNode;
|
|
17
|
+
createStereoPanner(): IStereoPannerNode;
|
|
18
|
+
createBiquadFilter: () => IBiquadFilterNode;
|
|
19
|
+
createBufferSource: () => IAudioBufferSourceNode;
|
|
20
|
+
createBuffer: (
|
|
21
|
+
channels: number,
|
|
22
|
+
length: number,
|
|
23
|
+
sampleRate: number
|
|
24
|
+
) => IAudioBuffer;
|
|
25
|
+
createPeriodicWave: (
|
|
26
|
+
real: number[],
|
|
27
|
+
imag: number[],
|
|
28
|
+
disableNormalization: boolean
|
|
29
|
+
) => IPeriodicWave;
|
|
30
|
+
decodeAudioDataSource: (source: string) => Promise<IAudioBuffer>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface IAudioContext extends IBaseAudioContext {
|
|
34
|
+
close(): void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface IAudioNode {
|
|
38
|
+
readonly context: BaseAudioContext;
|
|
39
|
+
readonly numberOfInputs: number;
|
|
40
|
+
readonly numberOfOutputs: number;
|
|
41
|
+
readonly channelCount: number;
|
|
42
|
+
readonly channelCountMode: ChannelCountMode;
|
|
43
|
+
readonly channelInterpretation: ChannelInterpretation;
|
|
44
|
+
|
|
45
|
+
connect: (node: IAudioNode) => void;
|
|
46
|
+
disconnect: (node: IAudioNode) => void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface IGainNode extends IAudioNode {
|
|
50
|
+
readonly gain: IAudioParam;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface IStereoPannerNode extends IAudioNode {
|
|
54
|
+
readonly pan: IAudioParam;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface IBiquadFilterNode extends IAudioNode {
|
|
58
|
+
readonly frequency: AudioParam;
|
|
59
|
+
readonly detune: AudioParam;
|
|
60
|
+
readonly Q: AudioParam;
|
|
61
|
+
readonly gain: AudioParam;
|
|
62
|
+
type: BiquadFilterType;
|
|
63
|
+
|
|
64
|
+
getFrequencyResponse(
|
|
65
|
+
frequencyArray: number[],
|
|
66
|
+
magResponseOutput: number[],
|
|
67
|
+
phaseResponseOutput: number[]
|
|
68
|
+
): void;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface IAudioDestinationNode extends IAudioNode {}
|
|
72
|
+
|
|
73
|
+
export interface IAudioScheduledSourceNode extends IAudioNode {
|
|
74
|
+
start: (time: number) => void;
|
|
75
|
+
stop: (time: number) => void;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface IOscillatorNode extends IAudioScheduledSourceNode {
|
|
79
|
+
readonly frequency: IAudioParam;
|
|
80
|
+
readonly detune: IAudioParam;
|
|
81
|
+
type: OscillatorType;
|
|
82
|
+
|
|
83
|
+
setPeriodicWave(periodicWave: IPeriodicWave): void;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface IAudioBufferSourceNode extends IAudioScheduledSourceNode {
|
|
87
|
+
buffer: IAudioBuffer | null;
|
|
88
|
+
loop: boolean;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface IAudioBuffer {
|
|
92
|
+
readonly length: number;
|
|
93
|
+
readonly duration: number;
|
|
94
|
+
readonly sampleRate: number;
|
|
95
|
+
readonly numberOfChannels: number;
|
|
96
|
+
|
|
97
|
+
getChannelData(channel: number): number[];
|
|
98
|
+
copyFromChannel(
|
|
99
|
+
destination: number[],
|
|
100
|
+
channelNumber: number,
|
|
101
|
+
startInChannel: number
|
|
102
|
+
): void;
|
|
103
|
+
copyToChannel(
|
|
104
|
+
source: number[],
|
|
105
|
+
channelNumber: number,
|
|
106
|
+
startInChannel: number
|
|
107
|
+
): void;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface IAudioParam {
|
|
111
|
+
value: number;
|
|
112
|
+
defaultValue: number;
|
|
113
|
+
minValue: number;
|
|
114
|
+
maxValue: number;
|
|
115
|
+
|
|
116
|
+
setValueAtTime: (value: number, startTime: number) => void;
|
|
117
|
+
linearRampToValueAtTime: (value: number, endTime: number) => void;
|
|
118
|
+
exponentialRampToValueAtTime: (value: number, endTime: number) => void;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface IPeriodicWave {}
|
package/src/modules/global.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IAudioContext } from '../interfaces';
|
|
2
2
|
|
|
3
3
|
type AudioAPIInstaller = {
|
|
4
|
-
createAudioContext: () =>
|
|
4
|
+
createAudioContext: () => IAudioContext;
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
declare global {
|
|
8
8
|
function nativeCallSyncHook(): unknown;
|
|
9
|
-
var __AudioAPIInstaller:
|
|
9
|
+
var __AudioAPIInstaller: AudioAPIInstaller;
|
|
10
10
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AudioSource } from '../core/types';
|
|
2
|
+
// not sure if it works
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource';
|
|
5
|
+
|
|
6
|
+
export function resolveAudioSource(
|
|
7
|
+
source: AudioSource | string | number
|
|
8
|
+
): AudioSource {
|
|
9
|
+
if (typeof source === 'number') {
|
|
10
|
+
return resolveAssetSource(source);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return source;
|
|
14
|
+
}
|
package/lib/module/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
export interface BaseAudioContext {
|
|
2
|
-
readonly destination: AudioDestinationNode;
|
|
3
|
-
readonly state: ContextState;
|
|
4
|
-
readonly sampleRate: number;
|
|
5
|
-
readonly currentTime: number;
|
|
6
|
-
createOscillator(): OscillatorNode;
|
|
7
|
-
createGain(): GainNode;
|
|
8
|
-
createStereoPanner(): StereoPannerNode;
|
|
9
|
-
createBiquadFilter: () => BiquadFilterNode;
|
|
10
|
-
createBufferSource: () => AudioBufferSourceNode;
|
|
11
|
-
createBuffer: (channels: number, length: number, sampleRate: number) => AudioBuffer;
|
|
12
|
-
close(): void;
|
|
13
|
-
}
|
|
14
|
-
type channelCountMode = 'max' | 'clamped-max' | 'explicit';
|
|
15
|
-
type channelInterpretation = 'speakers' | 'discrete';
|
|
16
|
-
export interface AudioNode {
|
|
17
|
-
readonly context: BaseAudioContext;
|
|
18
|
-
readonly numberOfInputs: number;
|
|
19
|
-
readonly numberOfOutputs: number;
|
|
20
|
-
readonly channelCount: number;
|
|
21
|
-
readonly channelCountMode: channelCountMode;
|
|
22
|
-
readonly channelInterpretation: channelInterpretation;
|
|
23
|
-
connect: (node: AudioNode) => void;
|
|
24
|
-
disconnect: (node: AudioNode) => void;
|
|
25
|
-
}
|
|
26
|
-
export interface AudioParam {
|
|
27
|
-
value: number;
|
|
28
|
-
defaultValue: number;
|
|
29
|
-
minValue: number;
|
|
30
|
-
maxValue: number;
|
|
31
|
-
setValueAtTime: (value: number, startTime: number) => void;
|
|
32
|
-
linearRampToValueAtTime: (value: number, endTime: number) => void;
|
|
33
|
-
exponentialRampToValueAtTime: (value: number, endTime: number) => void;
|
|
34
|
-
}
|
|
35
|
-
export interface AudioDestinationNode extends AudioNode {
|
|
36
|
-
}
|
|
37
|
-
export interface AudioScheduledSourceNode extends AudioNode {
|
|
38
|
-
start: (time: number) => void;
|
|
39
|
-
stop: (time: number) => void;
|
|
40
|
-
}
|
|
41
|
-
export type WaveType = 'sine' | 'square' | 'sawtooth' | 'triangle';
|
|
42
|
-
export interface OscillatorNode extends AudioScheduledSourceNode {
|
|
43
|
-
frequency: AudioParam;
|
|
44
|
-
type: WaveType;
|
|
45
|
-
detune: AudioParam;
|
|
46
|
-
}
|
|
47
|
-
export interface GainNode extends AudioNode {
|
|
48
|
-
gain: AudioParam;
|
|
49
|
-
}
|
|
50
|
-
export interface StereoPannerNode extends AudioNode {
|
|
51
|
-
pan: AudioParam;
|
|
52
|
-
}
|
|
53
|
-
type FilterType = 'lowpass' | 'highpass' | 'bandpass' | 'lowshelf' | 'highshelf' | 'peaking' | 'notch' | 'allpass';
|
|
54
|
-
export interface BiquadFilterNode extends AudioNode {
|
|
55
|
-
frequency: AudioParam;
|
|
56
|
-
detune: AudioParam;
|
|
57
|
-
Q: AudioParam;
|
|
58
|
-
gain: AudioParam;
|
|
59
|
-
type: FilterType;
|
|
60
|
-
}
|
|
61
|
-
export type ContextState = 'running' | 'closed' | 'suspended';
|
|
62
|
-
export interface AudioBuffer {
|
|
63
|
-
readonly length: number;
|
|
64
|
-
readonly duration: number;
|
|
65
|
-
readonly sampleRate: number;
|
|
66
|
-
readonly numberOfChannels: number;
|
|
67
|
-
getChannelData(channel: number): number[];
|
|
68
|
-
copyFromChannel(destination: number[], channelNumber: number, startInChannel: number): void;
|
|
69
|
-
copyToChannel(source: number[], channelNumber: number, startInChannel: number): void;
|
|
70
|
-
}
|
|
71
|
-
export interface AudioBufferSourceNode extends AudioScheduledSourceNode {
|
|
72
|
-
buffer: AudioBuffer;
|
|
73
|
-
loop: boolean;
|
|
74
|
-
}
|
|
75
|
-
export {};
|
|
76
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/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AW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1C,eAAe,CACb,WAAW,EAAE,MAAM,EAAE,EACrB,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,GACrB,IAAI,CAAC;IACR,aAAa,CACX,MAAM,EAAE,MAAM,EAAE,EAChB,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,GACrB,IAAI,CAAC;CACT;AAED,MAAM,WAAW,qBAAsB,SAAQ,wBAAwB;IACrE,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;CACf"}
|
package/src/types.ts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
export interface BaseAudioContext {
|
|
2
|
-
readonly destination: AudioDestinationNode;
|
|
3
|
-
readonly state: ContextState;
|
|
4
|
-
readonly sampleRate: number;
|
|
5
|
-
readonly currentTime: number;
|
|
6
|
-
createOscillator(): OscillatorNode;
|
|
7
|
-
createGain(): GainNode;
|
|
8
|
-
createStereoPanner(): StereoPannerNode;
|
|
9
|
-
createBiquadFilter: () => BiquadFilterNode;
|
|
10
|
-
createBufferSource: () => AudioBufferSourceNode;
|
|
11
|
-
createBuffer: (
|
|
12
|
-
channels: number,
|
|
13
|
-
length: number,
|
|
14
|
-
sampleRate: number
|
|
15
|
-
) => AudioBuffer;
|
|
16
|
-
close(): void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
type channelCountMode = 'max' | 'clamped-max' | 'explicit';
|
|
20
|
-
|
|
21
|
-
type channelInterpretation = 'speakers' | 'discrete';
|
|
22
|
-
|
|
23
|
-
export interface AudioNode {
|
|
24
|
-
readonly context: BaseAudioContext;
|
|
25
|
-
readonly numberOfInputs: number;
|
|
26
|
-
readonly numberOfOutputs: number;
|
|
27
|
-
readonly channelCount: number;
|
|
28
|
-
readonly channelCountMode: channelCountMode;
|
|
29
|
-
readonly channelInterpretation: channelInterpretation;
|
|
30
|
-
connect: (node: AudioNode) => void;
|
|
31
|
-
disconnect: (node: AudioNode) => void;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface AudioParam {
|
|
35
|
-
value: number;
|
|
36
|
-
defaultValue: number;
|
|
37
|
-
minValue: number;
|
|
38
|
-
maxValue: number;
|
|
39
|
-
setValueAtTime: (value: number, startTime: number) => void;
|
|
40
|
-
linearRampToValueAtTime: (value: number, endTime: number) => void;
|
|
41
|
-
exponentialRampToValueAtTime: (value: number, endTime: number) => void;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface AudioDestinationNode extends AudioNode {}
|
|
45
|
-
|
|
46
|
-
export interface AudioScheduledSourceNode extends AudioNode {
|
|
47
|
-
start: (time: number) => void;
|
|
48
|
-
stop: (time: number) => void;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export type WaveType = 'sine' | 'square' | 'sawtooth' | 'triangle';
|
|
52
|
-
|
|
53
|
-
export interface OscillatorNode extends AudioScheduledSourceNode {
|
|
54
|
-
frequency: AudioParam;
|
|
55
|
-
type: WaveType;
|
|
56
|
-
detune: AudioParam;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export interface GainNode extends AudioNode {
|
|
60
|
-
gain: AudioParam;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface StereoPannerNode extends AudioNode {
|
|
64
|
-
pan: AudioParam;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
type FilterType =
|
|
68
|
-
| 'lowpass'
|
|
69
|
-
| 'highpass'
|
|
70
|
-
| 'bandpass'
|
|
71
|
-
| 'lowshelf'
|
|
72
|
-
| 'highshelf'
|
|
73
|
-
| 'peaking'
|
|
74
|
-
| 'notch'
|
|
75
|
-
| 'allpass';
|
|
76
|
-
|
|
77
|
-
export interface BiquadFilterNode extends AudioNode {
|
|
78
|
-
frequency: AudioParam;
|
|
79
|
-
detune: AudioParam;
|
|
80
|
-
Q: AudioParam;
|
|
81
|
-
gain: AudioParam;
|
|
82
|
-
type: FilterType;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export type ContextState = 'running' | 'closed' | 'suspended';
|
|
86
|
-
|
|
87
|
-
export interface AudioBuffer {
|
|
88
|
-
readonly length: number;
|
|
89
|
-
readonly duration: number;
|
|
90
|
-
readonly sampleRate: number;
|
|
91
|
-
readonly numberOfChannels: number;
|
|
92
|
-
getChannelData(channel: number): number[];
|
|
93
|
-
copyFromChannel(
|
|
94
|
-
destination: number[],
|
|
95
|
-
channelNumber: number,
|
|
96
|
-
startInChannel: number
|
|
97
|
-
): void;
|
|
98
|
-
copyToChannel(
|
|
99
|
-
source: number[],
|
|
100
|
-
channelNumber: number,
|
|
101
|
-
startInChannel: number
|
|
102
|
-
): void;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export interface AudioBufferSourceNode extends AudioScheduledSourceNode {
|
|
106
|
-
buffer: AudioBuffer;
|
|
107
|
-
loop: boolean;
|
|
108
|
-
}
|
|
File without changes
|