react-native-audio-api 0.6.0-rc.0 → 0.6.0-rc.2

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.
Files changed (207) hide show
  1. package/README.md +35 -22
  2. package/android/CMakeLists.txt +6 -3
  3. package/android/build.gradle +1 -0
  4. package/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.cpp +73 -0
  5. package/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.h +37 -0
  6. package/android/src/main/cpp/audioapi/android/core/AudioPlayer.cpp +6 -10
  7. package/android/src/main/cpp/audioapi/android/core/AudioPlayer.h +2 -3
  8. package/android/src/main/java/com/swmansion/audioapi/AudioManagerModule.kt +19 -14
  9. package/android/src/main/java/com/swmansion/audioapi/system/AudioFocusListener.kt +60 -0
  10. package/android/src/main/java/com/swmansion/audioapi/system/LockScreenManager.kt +294 -0
  11. package/android/src/main/java/com/swmansion/audioapi/system/MediaNotificationManager.kt +279 -0
  12. package/android/src/main/java/com/swmansion/audioapi/system/MediaReceiver.kt +46 -0
  13. package/android/src/main/java/com/swmansion/audioapi/system/MediaSessionCallback.kt +39 -0
  14. package/android/src/main/java/com/swmansion/audioapi/system/MediaSessionEventEmitter.kt +88 -0
  15. package/android/src/main/java/com/swmansion/audioapi/system/MediaSessionManager.kt +162 -0
  16. package/android/src/main/java/com/swmansion/audioapi/system/VolumeChangeListener.kt +27 -0
  17. package/android/src/main/res/drawable/next.xml +9 -0
  18. package/android/src/main/res/drawable/pause.xml +9 -0
  19. package/android/src/main/res/drawable/play.xml +9 -0
  20. package/android/src/main/res/drawable/previous.xml +9 -0
  21. package/android/src/main/res/drawable/skip_backward_5.xml +9 -0
  22. package/android/src/main/res/drawable/skip_forward_5.xml +9 -0
  23. package/android/src/main/res/drawable/stop.xml +9 -0
  24. package/app.plugin.js +1 -0
  25. package/common/cpp/audioapi/AudioAPIModuleInstaller.h +29 -5
  26. package/common/cpp/audioapi/HostObjects/AnalyserNodeHostObject.h +1 -0
  27. package/common/cpp/audioapi/HostObjects/AudioRecorderHostObject.h +149 -0
  28. package/common/cpp/audioapi/core/AudioContext.cpp +4 -3
  29. package/common/cpp/audioapi/core/BaseAudioContext.cpp +6 -6
  30. package/common/cpp/audioapi/core/inputs/AudioRecorder.h +38 -0
  31. package/common/cpp/audioapi/core/sources/AudioBufferSourceNode.cpp +1 -6
  32. package/common/cpp/audioapi/core/sources/AudioScheduledSourceNode.cpp +8 -4
  33. package/common/cpp/audioapi/core/sources/AudioScheduledSourceNode.h +6 -0
  34. package/common/cpp/audioapi/core/sources/OscillatorNode.cpp +1 -1
  35. package/common/cpp/audioapi/core/utils/AudioNodeDestructor.cpp +3 -3
  36. package/common/cpp/audioapi/core/utils/AudioNodeManager.cpp +45 -11
  37. package/common/cpp/audioapi/core/utils/AudioNodeManager.h +6 -2
  38. package/ios/audioapi/ios/AudioManagerModule.mm +16 -15
  39. package/ios/audioapi/ios/core/IOSAudioPlayer.h +11 -12
  40. package/ios/audioapi/ios/core/IOSAudioPlayer.mm +22 -16
  41. package/ios/audioapi/ios/core/IOSAudioRecorder.h +36 -0
  42. package/ios/audioapi/ios/core/IOSAudioRecorder.mm +62 -0
  43. package/ios/audioapi/ios/core/{AudioPlayer.h → NativeAudioPlayer.h} +1 -8
  44. package/ios/audioapi/ios/core/{AudioPlayer.m → NativeAudioPlayer.m} +4 -33
  45. package/ios/audioapi/ios/core/NativeAudioRecorder.h +25 -0
  46. package/ios/audioapi/ios/core/NativeAudioRecorder.m +47 -0
  47. package/ios/audioapi/ios/system/AudioEngine.h +7 -1
  48. package/ios/audioapi/ios/system/AudioEngine.mm +64 -20
  49. package/ios/audioapi/ios/system/AudioSessionManager.h +3 -1
  50. package/ios/audioapi/ios/system/AudioSessionManager.mm +37 -25
  51. package/ios/audioapi/ios/system/LockScreenManager.mm +4 -8
  52. package/ios/audioapi/ios/system/NotificationManager.h +13 -1
  53. package/ios/audioapi/ios/system/NotificationManager.mm +96 -44
  54. package/lib/commonjs/api.js +211 -0
  55. package/lib/commonjs/api.js.map +1 -0
  56. package/lib/commonjs/api.web.js +219 -0
  57. package/lib/commonjs/api.web.js.map +1 -0
  58. package/lib/commonjs/core/AnalyserNode.js +71 -0
  59. package/lib/commonjs/core/AnalyserNode.js.map +1 -0
  60. package/lib/commonjs/core/AudioBuffer.js +44 -0
  61. package/lib/commonjs/core/AudioBuffer.js.map +1 -0
  62. package/lib/commonjs/core/AudioBufferSourceNode.js +68 -0
  63. package/lib/commonjs/core/AudioBufferSourceNode.js.map +1 -0
  64. package/lib/commonjs/core/AudioContext.js +29 -0
  65. package/lib/commonjs/core/AudioContext.js.map +1 -0
  66. package/lib/commonjs/core/AudioDestinationNode.js +11 -0
  67. package/lib/commonjs/core/AudioDestinationNode.js.map +1 -0
  68. package/lib/commonjs/core/AudioNode.js +30 -0
  69. package/lib/commonjs/core/AudioNode.js.map +1 -0
  70. package/lib/commonjs/core/AudioParam.js +82 -0
  71. package/lib/commonjs/core/AudioParam.js.map +1 -0
  72. package/lib/commonjs/core/AudioRecorder.js +51 -0
  73. package/lib/commonjs/core/AudioRecorder.js.map +1 -0
  74. package/lib/commonjs/core/AudioScheduledSourceNode.js +38 -0
  75. package/lib/commonjs/core/AudioScheduledSourceNode.js.map +1 -0
  76. package/lib/commonjs/core/BaseAudioContext.js +80 -0
  77. package/lib/commonjs/core/BaseAudioContext.js.map +1 -0
  78. package/lib/commonjs/core/BiquadFilterNode.js +33 -0
  79. package/lib/commonjs/core/BiquadFilterNode.js.map +1 -0
  80. package/lib/commonjs/core/GainNode.js +17 -0
  81. package/lib/commonjs/core/GainNode.js.map +1 -0
  82. package/lib/commonjs/core/OfflineAudioContext.js +63 -0
  83. package/lib/commonjs/core/OfflineAudioContext.js.map +1 -0
  84. package/lib/commonjs/core/OscillatorNode.js +32 -0
  85. package/lib/commonjs/core/OscillatorNode.js.map +1 -0
  86. package/lib/commonjs/core/PeriodicWave.js +15 -0
  87. package/lib/commonjs/core/PeriodicWave.js.map +1 -0
  88. package/lib/commonjs/core/StereoPannerNode.js +17 -0
  89. package/lib/commonjs/core/StereoPannerNode.js.map +1 -0
  90. package/lib/commonjs/errors/IndexSizeError.js +14 -0
  91. package/lib/commonjs/errors/IndexSizeError.js.map +1 -0
  92. package/lib/commonjs/errors/InvalidAccessError.js +14 -0
  93. package/lib/commonjs/errors/InvalidAccessError.js.map +1 -0
  94. package/lib/commonjs/errors/InvalidStateError.js +14 -0
  95. package/lib/commonjs/errors/InvalidStateError.js.map +1 -0
  96. package/lib/commonjs/errors/NotSupportedError.js +14 -0
  97. package/lib/commonjs/errors/NotSupportedError.js.map +1 -0
  98. package/lib/commonjs/errors/RangeError.js +14 -0
  99. package/lib/commonjs/errors/RangeError.js.map +1 -0
  100. package/lib/commonjs/errors/index.js +42 -0
  101. package/lib/commonjs/errors/index.js.map +1 -0
  102. package/lib/commonjs/hooks/useSytemVolume.js +24 -0
  103. package/lib/commonjs/hooks/useSytemVolume.js.map +1 -0
  104. package/lib/commonjs/index.js +17 -0
  105. package/lib/commonjs/index.js.map +1 -0
  106. package/lib/commonjs/interfaces.js +6 -0
  107. package/lib/commonjs/interfaces.js.map +1 -0
  108. package/lib/commonjs/package.json +1 -0
  109. package/lib/commonjs/plugin/withAudioAPI.js +62 -0
  110. package/lib/commonjs/plugin/withAudioAPI.js.map +1 -0
  111. package/lib/commonjs/specs/NativeAudioAPIModule.js +9 -0
  112. package/lib/commonjs/specs/NativeAudioAPIModule.js.map +1 -0
  113. package/lib/commonjs/specs/NativeAudioManagerModule.js +36 -0
  114. package/lib/commonjs/specs/NativeAudioManagerModule.js.map +1 -0
  115. package/lib/commonjs/specs/index.js +27 -0
  116. package/lib/commonjs/specs/index.js.map +1 -0
  117. package/lib/commonjs/system/AudioManager.js +52 -0
  118. package/lib/commonjs/system/AudioManager.js.map +1 -0
  119. package/lib/commonjs/system/index.js +14 -0
  120. package/lib/commonjs/system/index.js.map +1 -0
  121. package/lib/commonjs/system/types.js +2 -0
  122. package/lib/commonjs/system/types.js.map +1 -0
  123. package/lib/commonjs/types.js +2 -0
  124. package/lib/commonjs/types.js.map +1 -0
  125. package/lib/commonjs/utils/index.js +10 -0
  126. package/lib/commonjs/utils/index.js.map +1 -0
  127. package/lib/commonjs/web-core/AnalyserNode.js +38 -0
  128. package/lib/commonjs/web-core/AnalyserNode.js.map +1 -0
  129. package/lib/commonjs/web-core/AudioBuffer.js +44 -0
  130. package/lib/commonjs/web-core/AudioBuffer.js.map +1 -0
  131. package/lib/commonjs/web-core/AudioBufferSourceNode.js +214 -0
  132. package/lib/commonjs/web-core/AudioBufferSourceNode.js.map +1 -0
  133. package/lib/commonjs/web-core/AudioContext.js +93 -0
  134. package/lib/commonjs/web-core/AudioContext.js.map +1 -0
  135. package/lib/commonjs/web-core/AudioDestinationNode.js +11 -0
  136. package/lib/commonjs/web-core/AudioDestinationNode.js.map +1 -0
  137. package/lib/commonjs/web-core/AudioNode.js +33 -0
  138. package/lib/commonjs/web-core/AudioNode.js.map +1 -0
  139. package/lib/commonjs/web-core/AudioParam.js +81 -0
  140. package/lib/commonjs/web-core/AudioParam.js.map +1 -0
  141. package/lib/commonjs/web-core/AudioScheduledSourceNode.js +41 -0
  142. package/lib/commonjs/web-core/AudioScheduledSourceNode.js.map +1 -0
  143. package/lib/commonjs/web-core/BaseAudioContext.js +2 -0
  144. package/lib/commonjs/web-core/BaseAudioContext.js.map +1 -0
  145. package/lib/commonjs/web-core/BiquadFilterNode.js +33 -0
  146. package/lib/commonjs/web-core/BiquadFilterNode.js.map +1 -0
  147. package/lib/commonjs/web-core/GainNode.js +17 -0
  148. package/lib/commonjs/web-core/GainNode.js.map +1 -0
  149. package/lib/commonjs/web-core/OfflineAudioContext.js +96 -0
  150. package/lib/commonjs/web-core/OfflineAudioContext.js.map +1 -0
  151. package/lib/commonjs/web-core/OscillatorNode.js +31 -0
  152. package/lib/commonjs/web-core/OscillatorNode.js.map +1 -0
  153. package/lib/commonjs/web-core/PeriodicWave.js +15 -0
  154. package/lib/commonjs/web-core/PeriodicWave.js.map +1 -0
  155. package/lib/commonjs/web-core/StereoPannerNode.js +17 -0
  156. package/lib/commonjs/web-core/StereoPannerNode.js.map +1 -0
  157. package/lib/commonjs/web-core/custom/LoadCustomWasm.js +37 -0
  158. package/lib/commonjs/web-core/custom/LoadCustomWasm.js.map +1 -0
  159. package/lib/commonjs/web-core/custom/index.js +14 -0
  160. package/lib/commonjs/web-core/custom/index.js.map +1 -0
  161. package/lib/commonjs/web-core/custom/signalsmithStretch/LICENSE.txt +21 -0
  162. package/lib/commonjs/web-core/custom/signalsmithStretch/README.md +46 -0
  163. package/lib/commonjs/web-core/custom/signalsmithStretch/SignalsmithStretch.mjs +826 -0
  164. package/lib/commonjs/web-core/custom/signalsmithStretch/SignalsmithStretch.mjs.map +1 -0
  165. package/lib/module/api.js +3 -1
  166. package/lib/module/api.js.map +1 -1
  167. package/lib/module/core/AudioRecorder.js +45 -0
  168. package/lib/module/core/AudioRecorder.js.map +1 -0
  169. package/lib/module/errors/NotSupportedError.js.map +1 -1
  170. package/lib/module/hooks/useSytemVolume.js +19 -0
  171. package/lib/module/hooks/useSytemVolume.js.map +1 -0
  172. package/lib/module/plugin/withAudioAPI.js +58 -0
  173. package/lib/module/plugin/withAudioAPI.js.map +1 -0
  174. package/lib/module/specs/NativeAudioManagerModule.js +10 -8
  175. package/lib/module/specs/NativeAudioManagerModule.js.map +1 -1
  176. package/lib/module/system/AudioManager.js +26 -44
  177. package/lib/module/system/AudioManager.js.map +1 -1
  178. package/lib/typescript/api.d.ts +5 -1
  179. package/lib/typescript/api.d.ts.map +1 -1
  180. package/lib/typescript/core/AudioRecorder.d.ts +22 -0
  181. package/lib/typescript/core/AudioRecorder.d.ts.map +1 -0
  182. package/lib/typescript/errors/NotSupportedError.d.ts.map +1 -1
  183. package/lib/typescript/hooks/useSytemVolume.d.ts +2 -0
  184. package/lib/typescript/hooks/useSytemVolume.d.ts.map +1 -0
  185. package/lib/typescript/interfaces.d.ts +11 -5
  186. package/lib/typescript/interfaces.d.ts.map +1 -1
  187. package/lib/typescript/plugin/withAudioAPI.d.ts +9 -0
  188. package/lib/typescript/plugin/withAudioAPI.d.ts.map +1 -0
  189. package/lib/typescript/specs/NativeAudioManagerModule.d.ts +4 -2
  190. package/lib/typescript/specs/NativeAudioManagerModule.d.ts.map +1 -1
  191. package/lib/typescript/system/AudioManager.d.ts +5 -2
  192. package/lib/typescript/system/AudioManager.d.ts.map +1 -1
  193. package/lib/typescript/system/types.d.ts +36 -5
  194. package/lib/typescript/system/types.d.ts.map +1 -1
  195. package/lib/typescript/types.d.ts +5 -0
  196. package/lib/typescript/types.d.ts.map +1 -1
  197. package/package.json +7 -3
  198. package/src/api.ts +13 -2
  199. package/src/core/AudioRecorder.ts +81 -0
  200. package/src/hooks/useSytemVolume.ts +19 -0
  201. package/src/interfaces.ts +25 -11
  202. package/src/plugin/withAudioAPI.ts +91 -0
  203. package/src/specs/NativeAudioManagerModule.ts +13 -19
  204. package/src/system/AudioManager.ts +37 -87
  205. package/src/system/types.ts +43 -17
  206. package/src/types.ts +13 -0
  207. /package/src/errors/{NotSupportedError.tsx → NotSupportedError.ts} +0 -0
@@ -0,0 +1,211 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "AnalyserNode", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _AnalyserNode.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "AudioBuffer", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _AudioBuffer.default;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "AudioBufferSourceNode", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _AudioBufferSourceNode.default;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "AudioContext", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _AudioContext.default;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "AudioDestinationNode", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _AudioDestinationNode.default;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "AudioManager", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _system.default;
40
+ }
41
+ });
42
+ Object.defineProperty(exports, "AudioNode", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return _AudioNode.default;
46
+ }
47
+ });
48
+ Object.defineProperty(exports, "AudioParam", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _AudioParam.default;
52
+ }
53
+ });
54
+ Object.defineProperty(exports, "AudioRecorder", {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _AudioRecorder.default;
58
+ }
59
+ });
60
+ Object.defineProperty(exports, "AudioScheduledSourceNode", {
61
+ enumerable: true,
62
+ get: function () {
63
+ return _AudioScheduledSourceNode.default;
64
+ }
65
+ });
66
+ Object.defineProperty(exports, "BaseAudioContext", {
67
+ enumerable: true,
68
+ get: function () {
69
+ return _BaseAudioContext.default;
70
+ }
71
+ });
72
+ Object.defineProperty(exports, "BiquadFilterNode", {
73
+ enumerable: true,
74
+ get: function () {
75
+ return _BiquadFilterNode.default;
76
+ }
77
+ });
78
+ Object.defineProperty(exports, "BiquadFilterType", {
79
+ enumerable: true,
80
+ get: function () {
81
+ return _types.BiquadFilterType;
82
+ }
83
+ });
84
+ Object.defineProperty(exports, "ChannelCountMode", {
85
+ enumerable: true,
86
+ get: function () {
87
+ return _types.ChannelCountMode;
88
+ }
89
+ });
90
+ Object.defineProperty(exports, "ChannelInterpretation", {
91
+ enumerable: true,
92
+ get: function () {
93
+ return _types.ChannelInterpretation;
94
+ }
95
+ });
96
+ Object.defineProperty(exports, "ContextState", {
97
+ enumerable: true,
98
+ get: function () {
99
+ return _types.ContextState;
100
+ }
101
+ });
102
+ Object.defineProperty(exports, "GainNode", {
103
+ enumerable: true,
104
+ get: function () {
105
+ return _GainNode.default;
106
+ }
107
+ });
108
+ Object.defineProperty(exports, "IndexSizeError", {
109
+ enumerable: true,
110
+ get: function () {
111
+ return _errors.IndexSizeError;
112
+ }
113
+ });
114
+ Object.defineProperty(exports, "InvalidAccessError", {
115
+ enumerable: true,
116
+ get: function () {
117
+ return _errors.InvalidAccessError;
118
+ }
119
+ });
120
+ Object.defineProperty(exports, "InvalidStateError", {
121
+ enumerable: true,
122
+ get: function () {
123
+ return _errors.InvalidStateError;
124
+ }
125
+ });
126
+ Object.defineProperty(exports, "NotSupportedError", {
127
+ enumerable: true,
128
+ get: function () {
129
+ return _errors.NotSupportedError;
130
+ }
131
+ });
132
+ Object.defineProperty(exports, "OfflineAudioContext", {
133
+ enumerable: true,
134
+ get: function () {
135
+ return _OfflineAudioContext.default;
136
+ }
137
+ });
138
+ Object.defineProperty(exports, "OscillatorNode", {
139
+ enumerable: true,
140
+ get: function () {
141
+ return _OscillatorNode.default;
142
+ }
143
+ });
144
+ Object.defineProperty(exports, "OscillatorType", {
145
+ enumerable: true,
146
+ get: function () {
147
+ return _types.OscillatorType;
148
+ }
149
+ });
150
+ Object.defineProperty(exports, "PeriodicWaveConstraints", {
151
+ enumerable: true,
152
+ get: function () {
153
+ return _types.PeriodicWaveConstraints;
154
+ }
155
+ });
156
+ Object.defineProperty(exports, "RangeError", {
157
+ enumerable: true,
158
+ get: function () {
159
+ return _errors.RangeError;
160
+ }
161
+ });
162
+ Object.defineProperty(exports, "StereoPannerNode", {
163
+ enumerable: true,
164
+ get: function () {
165
+ return _StereoPannerNode.default;
166
+ }
167
+ });
168
+ Object.defineProperty(exports, "WindowType", {
169
+ enumerable: true,
170
+ get: function () {
171
+ return _types.WindowType;
172
+ }
173
+ });
174
+ Object.defineProperty(exports, "useSystemVolume", {
175
+ enumerable: true,
176
+ get: function () {
177
+ return _useSytemVolume.default;
178
+ }
179
+ });
180
+ var _NativeAudioAPIModule = _interopRequireDefault(require("./specs/NativeAudioAPIModule"));
181
+ var _AudioBuffer = _interopRequireDefault(require("./core/AudioBuffer"));
182
+ var _AudioBufferSourceNode = _interopRequireDefault(require("./core/AudioBufferSourceNode"));
183
+ var _AudioContext = _interopRequireDefault(require("./core/AudioContext"));
184
+ var _OfflineAudioContext = _interopRequireDefault(require("./core/OfflineAudioContext"));
185
+ var _AudioDestinationNode = _interopRequireDefault(require("./core/AudioDestinationNode"));
186
+ var _AudioNode = _interopRequireDefault(require("./core/AudioNode"));
187
+ var _AnalyserNode = _interopRequireDefault(require("./core/AnalyserNode"));
188
+ var _AudioParam = _interopRequireDefault(require("./core/AudioParam"));
189
+ var _AudioScheduledSourceNode = _interopRequireDefault(require("./core/AudioScheduledSourceNode"));
190
+ var _BaseAudioContext = _interopRequireDefault(require("./core/BaseAudioContext"));
191
+ var _BiquadFilterNode = _interopRequireDefault(require("./core/BiquadFilterNode"));
192
+ var _GainNode = _interopRequireDefault(require("./core/GainNode"));
193
+ var _OscillatorNode = _interopRequireDefault(require("./core/OscillatorNode"));
194
+ var _StereoPannerNode = _interopRequireDefault(require("./core/StereoPannerNode"));
195
+ var _AudioRecorder = _interopRequireDefault(require("./core/AudioRecorder"));
196
+ var _system = _interopRequireDefault(require("./system"));
197
+ var _useSytemVolume = _interopRequireDefault(require("./hooks/useSytemVolume"));
198
+ var _types = require("./types");
199
+ var _errors = require("./errors");
200
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
201
+ /* eslint-disable no-var */
202
+
203
+ /* eslint-disable no-var */
204
+
205
+ if (global.createAudioContext == null || global.createOfflineAudioContext == null || global.createAudioRecorder == null) {
206
+ if (!_NativeAudioAPIModule.default) {
207
+ throw new Error(`Failed to install react-native-audio-api: The native module could not be found.`);
208
+ }
209
+ _NativeAudioAPIModule.default.install();
210
+ }
211
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_NativeAudioAPIModule","_interopRequireDefault","require","_AudioBuffer","_AudioBufferSourceNode","_AudioContext","_OfflineAudioContext","_AudioDestinationNode","_AudioNode","_AnalyserNode","_AudioParam","_AudioScheduledSourceNode","_BaseAudioContext","_BiquadFilterNode","_GainNode","_OscillatorNode","_StereoPannerNode","_AudioRecorder","_system","_useSytemVolume","_types","_errors","e","__esModule","default","global","createAudioContext","createOfflineAudioContext","createAudioRecorder","NativeAudioAPIModule","Error","install"],"sourceRoot":"../../src","sources":["api.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAoCA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,sBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,aAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,oBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,qBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,UAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,aAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,WAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,yBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,iBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,iBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,SAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,eAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,iBAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,cAAA,GAAAhB,sBAAA,CAAAC,OAAA;AACA,IAAAgB,OAAA,GAAAjB,sBAAA,CAAAC,OAAA;AACA,IAAAiB,eAAA,GAAAlB,sBAAA,CAAAC,OAAA;AAEA,IAAAkB,MAAA,GAAAlB,OAAA;AAUA,IAAAmB,OAAA,GAAAnB,OAAA;AAMkB,SAAAD,uBAAAqB,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AA9DlB;;AAYA;;AAEA,IACEG,MAAM,CAACC,kBAAkB,IAAI,IAAI,IACjCD,MAAM,CAACE,yBAAyB,IAAI,IAAI,IACxCF,MAAM,CAACG,mBAAmB,IAAI,IAAI,EAClC;EACA,IAAI,CAACC,6BAAoB,EAAE;IACzB,MAAM,IAAIC,KAAK,CACb,iFACF,CAAC;EACH;EAEAD,6BAAoB,CAACE,OAAO,CAAC,CAAC;AAChC","ignoreList":[]}
@@ -0,0 +1,219 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _exportNames = {
7
+ AudioBuffer: true,
8
+ AudioBufferSourceNode: true,
9
+ AudioContext: true,
10
+ OfflineAudioContext: true,
11
+ AudioDestinationNode: true,
12
+ AudioNode: true,
13
+ AnalyserNode: true,
14
+ AudioParam: true,
15
+ AudioScheduledSourceNode: true,
16
+ BaseAudioContext: true,
17
+ BiquadFilterNode: true,
18
+ GainNode: true,
19
+ OscillatorNode: true,
20
+ StereoPannerNode: true,
21
+ OscillatorType: true,
22
+ BiquadFilterType: true,
23
+ ChannelCountMode: true,
24
+ ChannelInterpretation: true,
25
+ ContextState: true,
26
+ WindowType: true,
27
+ PeriodicWaveConstraints: true,
28
+ IndexSizeError: true,
29
+ InvalidAccessError: true,
30
+ InvalidStateError: true,
31
+ RangeError: true,
32
+ NotSupportedError: true
33
+ };
34
+ Object.defineProperty(exports, "AnalyserNode", {
35
+ enumerable: true,
36
+ get: function () {
37
+ return _AnalyserNode.default;
38
+ }
39
+ });
40
+ Object.defineProperty(exports, "AudioBuffer", {
41
+ enumerable: true,
42
+ get: function () {
43
+ return _AudioBuffer.default;
44
+ }
45
+ });
46
+ Object.defineProperty(exports, "AudioBufferSourceNode", {
47
+ enumerable: true,
48
+ get: function () {
49
+ return _AudioBufferSourceNode.default;
50
+ }
51
+ });
52
+ Object.defineProperty(exports, "AudioContext", {
53
+ enumerable: true,
54
+ get: function () {
55
+ return _AudioContext.default;
56
+ }
57
+ });
58
+ Object.defineProperty(exports, "AudioDestinationNode", {
59
+ enumerable: true,
60
+ get: function () {
61
+ return _AudioDestinationNode.default;
62
+ }
63
+ });
64
+ Object.defineProperty(exports, "AudioNode", {
65
+ enumerable: true,
66
+ get: function () {
67
+ return _AudioNode.default;
68
+ }
69
+ });
70
+ Object.defineProperty(exports, "AudioParam", {
71
+ enumerable: true,
72
+ get: function () {
73
+ return _AudioParam.default;
74
+ }
75
+ });
76
+ Object.defineProperty(exports, "AudioScheduledSourceNode", {
77
+ enumerable: true,
78
+ get: function () {
79
+ return _AudioScheduledSourceNode.default;
80
+ }
81
+ });
82
+ Object.defineProperty(exports, "BaseAudioContext", {
83
+ enumerable: true,
84
+ get: function () {
85
+ return _BaseAudioContext.default;
86
+ }
87
+ });
88
+ Object.defineProperty(exports, "BiquadFilterNode", {
89
+ enumerable: true,
90
+ get: function () {
91
+ return _BiquadFilterNode.default;
92
+ }
93
+ });
94
+ Object.defineProperty(exports, "BiquadFilterType", {
95
+ enumerable: true,
96
+ get: function () {
97
+ return _types.BiquadFilterType;
98
+ }
99
+ });
100
+ Object.defineProperty(exports, "ChannelCountMode", {
101
+ enumerable: true,
102
+ get: function () {
103
+ return _types.ChannelCountMode;
104
+ }
105
+ });
106
+ Object.defineProperty(exports, "ChannelInterpretation", {
107
+ enumerable: true,
108
+ get: function () {
109
+ return _types.ChannelInterpretation;
110
+ }
111
+ });
112
+ Object.defineProperty(exports, "ContextState", {
113
+ enumerable: true,
114
+ get: function () {
115
+ return _types.ContextState;
116
+ }
117
+ });
118
+ Object.defineProperty(exports, "GainNode", {
119
+ enumerable: true,
120
+ get: function () {
121
+ return _GainNode.default;
122
+ }
123
+ });
124
+ Object.defineProperty(exports, "IndexSizeError", {
125
+ enumerable: true,
126
+ get: function () {
127
+ return _errors.IndexSizeError;
128
+ }
129
+ });
130
+ Object.defineProperty(exports, "InvalidAccessError", {
131
+ enumerable: true,
132
+ get: function () {
133
+ return _errors.InvalidAccessError;
134
+ }
135
+ });
136
+ Object.defineProperty(exports, "InvalidStateError", {
137
+ enumerable: true,
138
+ get: function () {
139
+ return _errors.InvalidStateError;
140
+ }
141
+ });
142
+ Object.defineProperty(exports, "NotSupportedError", {
143
+ enumerable: true,
144
+ get: function () {
145
+ return _errors.NotSupportedError;
146
+ }
147
+ });
148
+ Object.defineProperty(exports, "OfflineAudioContext", {
149
+ enumerable: true,
150
+ get: function () {
151
+ return _OfflineAudioContext.default;
152
+ }
153
+ });
154
+ Object.defineProperty(exports, "OscillatorNode", {
155
+ enumerable: true,
156
+ get: function () {
157
+ return _OscillatorNode.default;
158
+ }
159
+ });
160
+ Object.defineProperty(exports, "OscillatorType", {
161
+ enumerable: true,
162
+ get: function () {
163
+ return _types.OscillatorType;
164
+ }
165
+ });
166
+ Object.defineProperty(exports, "PeriodicWaveConstraints", {
167
+ enumerable: true,
168
+ get: function () {
169
+ return _types.PeriodicWaveConstraints;
170
+ }
171
+ });
172
+ Object.defineProperty(exports, "RangeError", {
173
+ enumerable: true,
174
+ get: function () {
175
+ return _errors.RangeError;
176
+ }
177
+ });
178
+ Object.defineProperty(exports, "StereoPannerNode", {
179
+ enumerable: true,
180
+ get: function () {
181
+ return _StereoPannerNode.default;
182
+ }
183
+ });
184
+ Object.defineProperty(exports, "WindowType", {
185
+ enumerable: true,
186
+ get: function () {
187
+ return _types.WindowType;
188
+ }
189
+ });
190
+ var _AudioBuffer = _interopRequireDefault(require("./web-core/AudioBuffer"));
191
+ var _AudioBufferSourceNode = _interopRequireDefault(require("./web-core/AudioBufferSourceNode"));
192
+ var _AudioContext = _interopRequireDefault(require("./web-core/AudioContext"));
193
+ var _OfflineAudioContext = _interopRequireDefault(require("./web-core/OfflineAudioContext"));
194
+ var _AudioDestinationNode = _interopRequireDefault(require("./web-core/AudioDestinationNode"));
195
+ var _AudioNode = _interopRequireDefault(require("./web-core/AudioNode"));
196
+ var _AnalyserNode = _interopRequireDefault(require("./web-core/AnalyserNode"));
197
+ var _AudioParam = _interopRequireDefault(require("./web-core/AudioParam"));
198
+ var _AudioScheduledSourceNode = _interopRequireDefault(require("./web-core/AudioScheduledSourceNode"));
199
+ var _BaseAudioContext = _interopRequireDefault(require("./web-core/BaseAudioContext"));
200
+ var _BiquadFilterNode = _interopRequireDefault(require("./web-core/BiquadFilterNode"));
201
+ var _GainNode = _interopRequireDefault(require("./web-core/GainNode"));
202
+ var _OscillatorNode = _interopRequireDefault(require("./web-core/OscillatorNode"));
203
+ var _StereoPannerNode = _interopRequireDefault(require("./web-core/StereoPannerNode"));
204
+ var _custom = require("./web-core/custom");
205
+ Object.keys(_custom).forEach(function (key) {
206
+ if (key === "default" || key === "__esModule") return;
207
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
208
+ if (key in exports && exports[key] === _custom[key]) return;
209
+ Object.defineProperty(exports, key, {
210
+ enumerable: true,
211
+ get: function () {
212
+ return _custom[key];
213
+ }
214
+ });
215
+ });
216
+ var _types = require("./types");
217
+ var _errors = require("./errors");
218
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
219
+ //# sourceMappingURL=api.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_AudioBuffer","_interopRequireDefault","require","_AudioBufferSourceNode","_AudioContext","_OfflineAudioContext","_AudioDestinationNode","_AudioNode","_AnalyserNode","_AudioParam","_AudioScheduledSourceNode","_BaseAudioContext","_BiquadFilterNode","_GainNode","_OscillatorNode","_StereoPannerNode","_custom","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_types","_errors","e","__esModule","default"],"sourceRoot":"../../src","sources":["api.web.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;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AC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,OAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAEA,IAAAS,MAAA,GAAA3B,OAAA;AAUA,IAAA4B,OAAA,GAAA5B,OAAA;AAMkB,SAAAD,uBAAA8B,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _errors = require("../errors");
8
+ var _AudioNode = _interopRequireDefault(require("./AudioNode"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ class AnalyserNode extends _AudioNode.default {
11
+ static allowedFFTSize = [32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768];
12
+ get fftSize() {
13
+ return this.node.fftSize;
14
+ }
15
+ set fftSize(value) {
16
+ if (!AnalyserNode.allowedFFTSize.includes(value)) {
17
+ throw new _errors.IndexSizeError(`Provided value (${value}) must be a power of 2 between 32 and 32768`);
18
+ }
19
+ this.node.fftSize = value;
20
+ }
21
+ get minDecibels() {
22
+ return this.node.minDecibels;
23
+ }
24
+ set minDecibels(value) {
25
+ if (value >= this.maxDecibels) {
26
+ throw new _errors.IndexSizeError(`The minDecibels value (${value}) must be less than maxDecibels`);
27
+ }
28
+ this.node.minDecibels = value;
29
+ }
30
+ get maxDecibels() {
31
+ return this.node.maxDecibels;
32
+ }
33
+ set maxDecibels(value) {
34
+ if (value <= this.minDecibels) {
35
+ throw new _errors.IndexSizeError(`The maxDecibels value (${value}) must be greater than minDecibels`);
36
+ }
37
+ this.node.maxDecibels = value;
38
+ }
39
+ get smoothingTimeConstant() {
40
+ return this.node.smoothingTimeConstant;
41
+ }
42
+ set smoothingTimeConstant(value) {
43
+ if (value < 0 || value > 1) {
44
+ throw new _errors.IndexSizeError(`The smoothingTimeConstant value (${value}) must be between 0 and 1`);
45
+ }
46
+ this.node.smoothingTimeConstant = value;
47
+ }
48
+ get window() {
49
+ return this.node.window;
50
+ }
51
+ set window(value) {
52
+ this.node.window = value;
53
+ }
54
+ get frequencyBinCount() {
55
+ return this.node.frequencyBinCount;
56
+ }
57
+ getFloatFrequencyData(array) {
58
+ this.node.getFloatFrequencyData(array);
59
+ }
60
+ getByteFrequencyData(array) {
61
+ this.node.getByteFrequencyData(array);
62
+ }
63
+ getFloatTimeDomainData(array) {
64
+ this.node.getFloatTimeDomainData(array);
65
+ }
66
+ getByteTimeDomainData(array) {
67
+ this.node.getByteTimeDomainData(array);
68
+ }
69
+ }
70
+ exports.default = AnalyserNode;
71
+ //# sourceMappingURL=AnalyserNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_errors","require","_AudioNode","_interopRequireDefault","e","__esModule","default","AnalyserNode","AudioNode","allowedFFTSize","fftSize","node","value","includes","IndexSizeError","minDecibels","maxDecibels","smoothingTimeConstant","window","frequencyBinCount","getFloatFrequencyData","array","getByteFrequencyData","getFloatTimeDomainData","getByteTimeDomainData","exports"],"sourceRoot":"../../../src","sources":["core/AnalyserNode.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAGA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAoC,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAErB,MAAMG,YAAY,SAASC,kBAAS,CAAC;EAClD,OAAeC,cAAc,GAAa,CACxC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAC5D;EAED,IAAWC,OAAOA,CAAA,EAAW;IAC3B,OAAQ,IAAI,CAACC,IAAI,CAAmBD,OAAO;EAC7C;EA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,MAAM;EAC5C;EAEA,IAAWA,MAAMA,CAACN,KAAiB,EAAE;IAClC,IAAI,CAACD,IAAI,CAAmBO,MAAM,GAAGN,KAAK;EAC7C;EAEA,IAAWO,iBAAiBA,CAAA,EAAW;IACrC,OAAQ,IAAI,CAACR,IAAI,CAAmBQ,iBAAiB;EACvD;EAEOC,qBAAqBA,CAACC,KAAmB,EAAQ;IACrD,IAAI,CAACV,IAAI,CAAmBS,qBAAqB,CAACC,KAAK,CAAC;EAC3D;EAEOC,oBAAoBA,CAACD,KAAiB,EAAQ;IAClD,IAAI,CAACV,IAAI,CAAmBW,oBAAoB,CAACD,KAAK,CAAC;EAC1D;EAEOE,sBAAsBA,CAACF,KAAmB,EAAQ;IACtD,IAAI,CAACV,IAAI,CAAmBY,sBAAsB,CAACF,KAAK,CAAC;EAC5D;EAEOG,qBAAqBA,CAACH,KAAiB,EAAQ;IACnD,IAAI,CAACV,IAAI,CAAmBa,qBAAqB,CAACH,KAAK,CAAC;EAC3D;AACF;AAACI,OAAA,CAAAnB,OAAA,GAAAC,YAAA","ignoreList":[]}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _errors = require("../errors");
8
+ class AudioBuffer {
9
+ /** @internal */
10
+
11
+ constructor(buffer) {
12
+ this.buffer = buffer;
13
+ this.length = buffer.length;
14
+ this.duration = buffer.duration;
15
+ this.sampleRate = buffer.sampleRate;
16
+ this.numberOfChannels = buffer.numberOfChannels;
17
+ }
18
+ getChannelData(channel) {
19
+ if (channel < 0 || channel >= this.numberOfChannels) {
20
+ throw new _errors.IndexSizeError(`The channel number provided (${channel}) is outside the range [0, ${this.numberOfChannels - 1}]`);
21
+ }
22
+ return this.buffer.getChannelData(channel);
23
+ }
24
+ copyFromChannel(destination, channelNumber, startInChannel = 0) {
25
+ if (channelNumber < 0 || channelNumber >= this.numberOfChannels) {
26
+ throw new _errors.IndexSizeError(`The channel number provided (${channelNumber}) is outside the range [0, ${this.numberOfChannels - 1}]`);
27
+ }
28
+ if (startInChannel < 0 || startInChannel >= this.length) {
29
+ throw new _errors.IndexSizeError(`The startInChannel number provided (${startInChannel}) is outside the range [0, ${this.length - 1}]`);
30
+ }
31
+ this.buffer.copyFromChannel(destination, channelNumber, startInChannel);
32
+ }
33
+ copyToChannel(source, channelNumber, startInChannel = 0) {
34
+ if (channelNumber < 0 || channelNumber >= this.numberOfChannels) {
35
+ throw new _errors.IndexSizeError(`The channel number provided (${channelNumber}) is outside the range [0, ${this.numberOfChannels - 1}]`);
36
+ }
37
+ if (startInChannel < 0 || startInChannel >= this.length) {
38
+ throw new _errors.IndexSizeError(`The startInChannel number provided (${startInChannel}) is outside the range [0, ${this.length - 1}]`);
39
+ }
40
+ this.buffer.copyToChannel(source, channelNumber, startInChannel);
41
+ }
42
+ }
43
+ exports.default = AudioBuffer;
44
+ //# sourceMappingURL=AudioBuffer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_errors","require","AudioBuffer","constructor","buffer","length","duration","sampleRate","numberOfChannels","getChannelData","channel","IndexSizeError","copyFromChannel","destination","channelNumber","startInChannel","copyToChannel","source","exports","default"],"sourceRoot":"../../../src","sources":["core/AudioBuffer.ts"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AAEe,MAAMC,WAAW,CAAC;EAK/B;;EAGAC,WAAWA,CAACC,MAAoB,EAAE;IAChC,IAAI,CAACA,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,MAAM,GAAGD,MAAM,CAACC,MAAM;IAC3B,IAAI,CAACC,QAAQ,GAAGF,MAAM,CAACE,QAAQ;IAC/B,IAAI,CAACC,UAAU,GAAGH,MAAM,CAACG,UAAU;IACnC,IAAI,CAACC,gBAAgB,GAAGJ,MAAM,CAACI,gBAAgB;EACjD;EAEOC,cAAcA,CAACC,OAAe,EAAgB;IACnD,IAAIA,OAAO,GAAG,CAAC,IAAIA,OAAO,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,cAAc,CAAC;EAClE;AACF;AAACG,OAAA,CAAAC,OAAA,GAAAjB,WAAA","ignoreList":[]}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _AudioScheduledSourceNode = _interopRequireDefault(require("./AudioScheduledSourceNode"));
8
+ var _AudioBuffer = _interopRequireDefault(require("./AudioBuffer"));
9
+ var _AudioParam = _interopRequireDefault(require("./AudioParam"));
10
+ var _errors = require("../errors");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ class AudioBufferSourceNode extends _AudioScheduledSourceNode.default {
13
+ constructor(context, node) {
14
+ super(context, node);
15
+ this.detune = new _AudioParam.default(node.detune);
16
+ this.playbackRate = new _AudioParam.default(node.playbackRate);
17
+ }
18
+ get buffer() {
19
+ const buffer = this.node.buffer;
20
+ if (!buffer) {
21
+ return null;
22
+ }
23
+ return new _AudioBuffer.default(buffer);
24
+ }
25
+ set buffer(buffer) {
26
+ if (!buffer) {
27
+ this.node.buffer = null;
28
+ return;
29
+ }
30
+ this.node.buffer = buffer.buffer;
31
+ }
32
+ get loop() {
33
+ return this.node.loop;
34
+ }
35
+ set loop(value) {
36
+ this.node.loop = value;
37
+ }
38
+ get loopStart() {
39
+ return this.node.loopStart;
40
+ }
41
+ set loopStart(value) {
42
+ this.node.loopStart = value;
43
+ }
44
+ get loopEnd() {
45
+ return this.node.loopEnd;
46
+ }
47
+ set loopEnd(value) {
48
+ this.node.loopEnd = value;
49
+ }
50
+ start(when = 0, offset = 0, duration) {
51
+ if (when < 0) {
52
+ throw new _errors.RangeError(`when must be a finite non-negative number: ${when}`);
53
+ }
54
+ if (offset < 0) {
55
+ throw new _errors.RangeError(`offset must be a finite non-negative number: ${offset}`);
56
+ }
57
+ if (duration && duration < 0) {
58
+ throw new _errors.RangeError(`duration must be a finite non-negative number: ${duration}`);
59
+ }
60
+ if (this.hasBeenStarted) {
61
+ throw new _errors.InvalidStateError('Cannot call start more than once');
62
+ }
63
+ this.hasBeenStarted = true;
64
+ this.node.start(when, offset, duration);
65
+ }
66
+ }
67
+ exports.default = AudioBufferSourceNode;
68
+ //# sourceMappingURL=AudioBufferSourceNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_AudioScheduledSourceNode","_interopRequireDefault","require","_AudioBuffer","_AudioParam","_errors","e","__esModule","default","AudioBufferSourceNode","AudioScheduledSourceNode","constructor","context","node","detune","AudioParam","playbackRate","buffer","AudioBuffer","loop","value","loopStart","loopEnd","start","when","offset","duration","RangeError","hasBeenStarted","InvalidStateError","exports"],"sourceRoot":"../../../src","sources":["core/AudioBufferSourceNode.ts"],"mappings":";;;;;;AACA,IAAAA,yBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,WAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAA0D,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE3C,MAAMG,qBAAqB,SAASC,iCAAwB,CAAC;EAI1EC,WAAWA,CAACC,OAAyB,EAAEC,IAA4B,EAAE;IACnE,KAAK,CAACD,OAAO,EAAEC,IAAI,CAAC;IAEpB,IAAI,CAACC,MAAM,GAAG,IAAIC,mBAAU,CAACF,IAAI,CAACC,MAAM,CAAC;IACzC,IAAI,CAACE,YAAY,GAAG,IAAID,mBAAU,CAACF,IAAI,CAACG,YAAY,CAAC;EACvD;EAEA,IAAWC,MAAMA,CAAA,EAAuB;IACtC,MAAMA,MAAM,GAAI,IAAI,CAACJ,IAAI,CAA4BI,MAAM;IAC3D,IAAI,CAACA,MAAM,EAAE;MACX,OAAO,IAAI;IACb;IACA,OAAO,IAAIC,oBAAW,CAACD,MAAM,CAAC;EAChC;EAEA,IAA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AAC;IACjE;IAEA,IAAI,CAACD,cAAc,GAAG,IAAI;IACzB,IAAI,CAACf,IAAI,CAA4BU,KAAK,CAACC,IAAI,EAAEC,MAAM,EAAEC,QAAQ,CAAC;EACrE;AACF;AAACI,OAAA,CAAAtB,OAAA,GAAAC,qBAAA","ignoreList":[]}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _BaseAudioContext = _interopRequireDefault(require("./BaseAudioContext"));
8
+ var _system = _interopRequireDefault(require("../system"));
9
+ var _errors = require("../errors");
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ class AudioContext extends _BaseAudioContext.default {
12
+ constructor(options) {
13
+ if (options && (options.sampleRate < 8000 || options.sampleRate > 96000)) {
14
+ throw new _errors.NotSupportedError(`The provided sampleRate is not supported: ${options.sampleRate}`);
15
+ }
16
+ super(global.createAudioContext(options?.sampleRate || _system.default.getDevicePreferredSampleRate()));
17
+ }
18
+ async close() {
19
+ await this.context.close();
20
+ }
21
+ async resume() {
22
+ await this.context.resume();
23
+ }
24
+ async suspend() {
25
+ await this.context.suspend();
26
+ }
27
+ }
28
+ exports.default = AudioContext;
29
+ //# sourceMappingURL=AudioContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_BaseAudioContext","_interopRequireDefault","require","_system","_errors","e","__esModule","default","AudioContext","BaseAudioContext","constructor","options","sampleRate","NotSupportedError","global","createAudioContext","AudioManager","getDevicePreferredSampleRate","close","context","resume","suspend","exports"],"sourceRoot":"../../../src","sources":["core/AudioContext.ts"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAA8C,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE/B,MAAMG,YAAY,SAASC,yBAAgB,CAAC;EACzDC,WAAWA,CAACC,OAA6B,EAAE;IACzC,IAAIA,OAAO,KAAKA,OAAO,CAACC,UAAU,GAAG,IAAI,IAAID,OAAO,CAACC,UAAU,GAAG,KAAK,CAAC,EAAE;MACxE,MAAM,IAAIC,yBAAiB,CACzB,6CAA6CF,OAAO,CAACC,UAAU,EACjE,CAAC;IACH;IAEA,KAAK,CACHE,MAAM,CAACC,kBAAkB,CACvBJ,OAAO,EAAEC,UAAU,IAAII,eAAY,CAACC,4BAA4B,CAAC,CACnE,CACF,CAAC;EACH;EAEA,MAAMC,KAAKA,CAAA,EAAuB;IAChC,MAAO,IAAI,CAACC,OAAO,CAAmBD,KAAK,CAAC,CAAC;EAC/C;EAEA,MAAME,MAAMA,CAAA,EAAuB;IACjC,MAAO,IAAI,CAACD,OAAO,CAAmBC,MAAM,CAAC,CAAC;EAChD;EAEA,MAAMC,OAAOA,CAAA,EAAuB;IAClC,MAAO,IAAI,CAACF,OAAO,CAAmBE,OAAO,CAAC,CAAC;EACjD;AACF;AAACC,OAAA,CAAAf,OAAA,GAAAC,YAAA","ignoreList":[]}