react-native-audio-api 0.4.9 → 0.4.10-rc.1
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/common/cpp/HostObjects/AudioContextHostObject.h +13 -3
- package/common/cpp/core/AudioBufferSourceNode.cpp +12 -0
- package/common/cpp/core/AudioBufferSourceNode.h +2 -0
- package/lib/module/core/AudioContext.js +8 -4
- package/lib/module/core/AudioContext.js.map +1 -1
- package/lib/module/core/AudioNode.js +1 -0
- package/lib/module/core/AudioNode.js.map +1 -1
- package/lib/module/core/AudioParam.js +24 -8
- package/lib/module/core/AudioParam.js.map +1 -1
- package/lib/module/core/BaseAudioContext.js +6 -13
- package/lib/module/core/BaseAudioContext.js.map +1 -1
- package/lib/module/errors/NotSupportedError.js +10 -0
- package/lib/module/errors/NotSupportedError.js.map +1 -0
- package/lib/module/errors/index.js +1 -0
- package/lib/module/errors/index.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/web-core/AudioContext.js +10 -7
- package/lib/module/web-core/AudioContext.js.map +1 -1
- package/lib/module/web-core/AudioNode.js +1 -0
- package/lib/module/web-core/AudioNode.js.map +1 -1
- package/lib/module/web-core/AudioParam.js +24 -8
- package/lib/module/web-core/AudioParam.js.map +1 -1
- package/lib/typescript/core/AudioContext.d.ts +3 -2
- package/lib/typescript/core/AudioContext.d.ts.map +1 -1
- package/lib/typescript/core/AudioNode.d.ts +1 -1
- package/lib/typescript/core/AudioNode.d.ts.map +1 -1
- package/lib/typescript/core/AudioParam.d.ts +7 -7
- package/lib/typescript/core/AudioParam.d.ts.map +1 -1
- package/lib/typescript/core/BaseAudioContext.d.ts.map +1 -1
- package/lib/typescript/errors/NotSupportedError.d.ts +5 -0
- package/lib/typescript/errors/NotSupportedError.d.ts.map +1 -0
- package/lib/typescript/errors/index.d.ts +1 -0
- package/lib/typescript/errors/index.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/interfaces.d.ts +1 -1
- package/lib/typescript/interfaces.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +4 -1
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/web-core/AudioContext.d.ts +3 -3
- package/lib/typescript/web-core/AudioContext.d.ts.map +1 -1
- package/lib/typescript/web-core/AudioNode.d.ts +1 -1
- package/lib/typescript/web-core/AudioNode.d.ts.map +1 -1
- package/lib/typescript/web-core/AudioParam.d.ts +7 -7
- package/lib/typescript/web-core/AudioParam.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/AudioContext.ts +12 -4
- package/src/core/AudioNode.ts +3 -1
- package/src/core/AudioParam.ts +48 -15
- package/src/core/BaseAudioContext.ts +9 -16
- package/src/errors/NotSupportedError.tsx +8 -0
- package/src/errors/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/interfaces.ts +1 -1
- package/src/types.ts +5 -1
- package/src/web-core/AudioContext.tsx +20 -10
- package/src/web-core/AudioNode.tsx +3 -1
- package/src/web-core/AudioParam.tsx +48 -15
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RangeError } from '../errors';
|
|
1
|
+
import { RangeError, InvalidStateError } from '../errors';
|
|
2
2
|
|
|
3
3
|
export default class AudioParam {
|
|
4
4
|
readonly defaultValue: number;
|
|
@@ -22,85 +22,118 @@ export default class AudioParam {
|
|
|
22
22
|
this.param.value = value;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
public setValueAtTime(value: number, startTime: number):
|
|
25
|
+
public setValueAtTime(value: number, startTime: number): AudioParam {
|
|
26
26
|
if (startTime < 0) {
|
|
27
27
|
throw new RangeError(
|
|
28
|
-
`
|
|
28
|
+
`startTime must be a finite non-negative number: ${startTime}`
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
this.param.setValueAtTime(value, startTime);
|
|
33
|
+
|
|
34
|
+
return this;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
|
-
public linearRampToValueAtTime(value: number, endTime: number):
|
|
37
|
+
public linearRampToValueAtTime(value: number, endTime: number): AudioParam {
|
|
36
38
|
if (endTime < 0) {
|
|
37
39
|
throw new RangeError(
|
|
38
|
-
`
|
|
40
|
+
`endTime must be a finite non-negative number: ${endTime}`
|
|
39
41
|
);
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
this.param.linearRampToValueAtTime(value, endTime);
|
|
45
|
+
|
|
46
|
+
return this;
|
|
43
47
|
}
|
|
44
48
|
|
|
45
|
-
public exponentialRampToValueAtTime(
|
|
49
|
+
public exponentialRampToValueAtTime(
|
|
50
|
+
value: number,
|
|
51
|
+
endTime: number
|
|
52
|
+
): AudioParam {
|
|
46
53
|
if (endTime < 0) {
|
|
47
54
|
throw new RangeError(
|
|
48
|
-
`
|
|
55
|
+
`endTime must be a finite non-negative number: ${endTime}`
|
|
49
56
|
);
|
|
50
57
|
}
|
|
51
58
|
|
|
52
59
|
this.param.exponentialRampToValueAtTime(value, endTime);
|
|
60
|
+
|
|
61
|
+
return this;
|
|
53
62
|
}
|
|
54
63
|
|
|
55
64
|
public setTargetAtTime(
|
|
56
65
|
target: number,
|
|
57
66
|
startTime: number,
|
|
58
67
|
timeConstant: number
|
|
59
|
-
):
|
|
68
|
+
): AudioParam {
|
|
60
69
|
if (startTime < 0) {
|
|
61
70
|
throw new RangeError(
|
|
62
|
-
`
|
|
71
|
+
`startTime must be a finite non-negative number: ${startTime}`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (timeConstant < 0) {
|
|
76
|
+
throw new RangeError(
|
|
77
|
+
`timeConstant must be a finite non-negative number: ${startTime}`
|
|
63
78
|
);
|
|
64
79
|
}
|
|
65
80
|
|
|
66
81
|
this.param.setTargetAtTime(target, startTime, timeConstant);
|
|
82
|
+
|
|
83
|
+
return this;
|
|
67
84
|
}
|
|
68
85
|
|
|
69
86
|
public setValueCurveAtTime(
|
|
70
87
|
values: number[],
|
|
71
88
|
startTime: number,
|
|
72
89
|
duration: number
|
|
73
|
-
):
|
|
90
|
+
): AudioParam {
|
|
74
91
|
if (startTime < 0) {
|
|
75
92
|
throw new RangeError(
|
|
76
|
-
`
|
|
93
|
+
`startTime must be a finite non-negative number: ${startTime}`
|
|
77
94
|
);
|
|
78
95
|
}
|
|
79
96
|
|
|
97
|
+
if (duration < 0) {
|
|
98
|
+
throw new RangeError(
|
|
99
|
+
`duration must be a finite non-negative number: ${startTime}`
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (values.length < 2) {
|
|
104
|
+
throw new InvalidStateError(`values must contain at least two values`);
|
|
105
|
+
}
|
|
106
|
+
|
|
80
107
|
this.param.setValueCurveAtTime(
|
|
81
108
|
new Float32Array(values),
|
|
82
109
|
startTime,
|
|
83
110
|
duration
|
|
84
111
|
);
|
|
112
|
+
|
|
113
|
+
return this;
|
|
85
114
|
}
|
|
86
115
|
|
|
87
|
-
public cancelScheduledValues(cancelTime: number):
|
|
116
|
+
public cancelScheduledValues(cancelTime: number): AudioParam {
|
|
88
117
|
if (cancelTime < 0) {
|
|
89
118
|
throw new RangeError(
|
|
90
|
-
`
|
|
119
|
+
`cancelTime must be a finite non-negative number: ${cancelTime}`
|
|
91
120
|
);
|
|
92
121
|
}
|
|
93
122
|
|
|
94
123
|
this.param.cancelScheduledValues(cancelTime);
|
|
124
|
+
|
|
125
|
+
return this;
|
|
95
126
|
}
|
|
96
127
|
|
|
97
|
-
public cancelAndHoldAtTime(cancelTime: number):
|
|
128
|
+
public cancelAndHoldAtTime(cancelTime: number): AudioParam {
|
|
98
129
|
if (cancelTime < 0) {
|
|
99
130
|
throw new RangeError(
|
|
100
|
-
`
|
|
131
|
+
`cancelTime must be a finite non-negative number: ${cancelTime}`
|
|
101
132
|
);
|
|
102
133
|
}
|
|
103
134
|
|
|
104
135
|
this.param.cancelAndHoldAtTime(cancelTime);
|
|
136
|
+
|
|
137
|
+
return this;
|
|
105
138
|
}
|
|
106
139
|
}
|