react-native-audio-api 0.6.0-rc.0 → 0.6.0-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.
Files changed (152) hide show
  1. package/android/CMakeLists.txt +6 -3
  2. package/android/build.gradle +1 -0
  3. package/android/src/main/java/com/swmansion/audioapi/AudioManagerModule.kt +15 -12
  4. package/android/src/main/java/com/swmansion/audioapi/system/AudioFocusListener.kt +60 -0
  5. package/android/src/main/java/com/swmansion/audioapi/system/LockScreenManager.kt +294 -0
  6. package/android/src/main/java/com/swmansion/audioapi/system/MediaNotificationManager.kt +279 -0
  7. package/android/src/main/java/com/swmansion/audioapi/system/MediaReceiver.kt +46 -0
  8. package/android/src/main/java/com/swmansion/audioapi/system/MediaSessionCallback.kt +39 -0
  9. package/android/src/main/java/com/swmansion/audioapi/system/MediaSessionEventEmitter.kt +84 -0
  10. package/android/src/main/java/com/swmansion/audioapi/system/MediaSessionManager.kt +144 -0
  11. package/android/src/main/res/drawable/next.xml +9 -0
  12. package/android/src/main/res/drawable/pause.xml +9 -0
  13. package/android/src/main/res/drawable/play.xml +9 -0
  14. package/android/src/main/res/drawable/previous.xml +9 -0
  15. package/android/src/main/res/drawable/skip_backward_5.xml +9 -0
  16. package/android/src/main/res/drawable/skip_forward_5.xml +9 -0
  17. package/android/src/main/res/drawable/stop.xml +9 -0
  18. package/app.plugin.js +1 -0
  19. package/common/cpp/audioapi/core/sources/AudioBufferSourceNode.cpp +1 -6
  20. package/common/cpp/audioapi/core/sources/AudioScheduledSourceNode.cpp +8 -4
  21. package/common/cpp/audioapi/core/sources/AudioScheduledSourceNode.h +1 -0
  22. package/common/cpp/audioapi/core/utils/AudioNodeDestructor.cpp +3 -3
  23. package/ios/audioapi/ios/AudioManagerModule.mm +9 -7
  24. package/ios/audioapi/ios/system/LockScreenManager.mm +4 -8
  25. package/ios/audioapi/ios/system/NotificationManager.h +7 -1
  26. package/ios/audioapi/ios/system/NotificationManager.mm +66 -44
  27. package/lib/commonjs/api.js +197 -0
  28. package/lib/commonjs/api.js.map +1 -0
  29. package/lib/commonjs/api.web.js +219 -0
  30. package/lib/commonjs/api.web.js.map +1 -0
  31. package/lib/commonjs/core/AnalyserNode.js +71 -0
  32. package/lib/commonjs/core/AnalyserNode.js.map +1 -0
  33. package/lib/commonjs/core/AudioBuffer.js +44 -0
  34. package/lib/commonjs/core/AudioBuffer.js.map +1 -0
  35. package/lib/commonjs/core/AudioBufferSourceNode.js +68 -0
  36. package/lib/commonjs/core/AudioBufferSourceNode.js.map +1 -0
  37. package/lib/commonjs/core/AudioContext.js +29 -0
  38. package/lib/commonjs/core/AudioContext.js.map +1 -0
  39. package/lib/commonjs/core/AudioDestinationNode.js +11 -0
  40. package/lib/commonjs/core/AudioDestinationNode.js.map +1 -0
  41. package/lib/commonjs/core/AudioNode.js +30 -0
  42. package/lib/commonjs/core/AudioNode.js.map +1 -0
  43. package/lib/commonjs/core/AudioParam.js +82 -0
  44. package/lib/commonjs/core/AudioParam.js.map +1 -0
  45. package/lib/commonjs/core/AudioScheduledSourceNode.js +38 -0
  46. package/lib/commonjs/core/AudioScheduledSourceNode.js.map +1 -0
  47. package/lib/commonjs/core/BaseAudioContext.js +80 -0
  48. package/lib/commonjs/core/BaseAudioContext.js.map +1 -0
  49. package/lib/commonjs/core/BiquadFilterNode.js +33 -0
  50. package/lib/commonjs/core/BiquadFilterNode.js.map +1 -0
  51. package/lib/commonjs/core/GainNode.js +17 -0
  52. package/lib/commonjs/core/GainNode.js.map +1 -0
  53. package/lib/commonjs/core/OfflineAudioContext.js +63 -0
  54. package/lib/commonjs/core/OfflineAudioContext.js.map +1 -0
  55. package/lib/commonjs/core/OscillatorNode.js +32 -0
  56. package/lib/commonjs/core/OscillatorNode.js.map +1 -0
  57. package/lib/commonjs/core/PeriodicWave.js +15 -0
  58. package/lib/commonjs/core/PeriodicWave.js.map +1 -0
  59. package/lib/commonjs/core/StereoPannerNode.js +17 -0
  60. package/lib/commonjs/core/StereoPannerNode.js.map +1 -0
  61. package/lib/commonjs/errors/IndexSizeError.js +14 -0
  62. package/lib/commonjs/errors/IndexSizeError.js.map +1 -0
  63. package/lib/commonjs/errors/InvalidAccessError.js +14 -0
  64. package/lib/commonjs/errors/InvalidAccessError.js.map +1 -0
  65. package/lib/commonjs/errors/InvalidStateError.js +14 -0
  66. package/lib/commonjs/errors/InvalidStateError.js.map +1 -0
  67. package/lib/commonjs/errors/NotSupportedError.js +14 -0
  68. package/lib/commonjs/errors/NotSupportedError.js.map +1 -0
  69. package/lib/commonjs/errors/RangeError.js +14 -0
  70. package/lib/commonjs/errors/RangeError.js.map +1 -0
  71. package/lib/commonjs/errors/index.js +42 -0
  72. package/lib/commonjs/errors/index.js.map +1 -0
  73. package/lib/commonjs/index.js +17 -0
  74. package/lib/commonjs/index.js.map +1 -0
  75. package/lib/commonjs/interfaces.js +6 -0
  76. package/lib/commonjs/interfaces.js.map +1 -0
  77. package/lib/commonjs/package.json +1 -0
  78. package/lib/commonjs/plugin/withAudioAPI.js +62 -0
  79. package/lib/commonjs/plugin/withAudioAPI.js.map +1 -0
  80. package/lib/commonjs/specs/NativeAudioAPIModule.js +9 -0
  81. package/lib/commonjs/specs/NativeAudioAPIModule.js.map +1 -0
  82. package/lib/commonjs/specs/NativeAudioManagerModule.js +33 -0
  83. package/lib/commonjs/specs/NativeAudioManagerModule.js.map +1 -0
  84. package/lib/commonjs/specs/index.js +27 -0
  85. package/lib/commonjs/specs/index.js.map +1 -0
  86. package/lib/commonjs/system/AudioManager.js +79 -0
  87. package/lib/commonjs/system/AudioManager.js.map +1 -0
  88. package/lib/commonjs/system/index.js +14 -0
  89. package/lib/commonjs/system/index.js.map +1 -0
  90. package/lib/commonjs/system/types.js +2 -0
  91. package/lib/commonjs/system/types.js.map +1 -0
  92. package/lib/commonjs/types.js +2 -0
  93. package/lib/commonjs/types.js.map +1 -0
  94. package/lib/commonjs/utils/index.js +10 -0
  95. package/lib/commonjs/utils/index.js.map +1 -0
  96. package/lib/commonjs/web-core/AnalyserNode.js +38 -0
  97. package/lib/commonjs/web-core/AnalyserNode.js.map +1 -0
  98. package/lib/commonjs/web-core/AudioBuffer.js +44 -0
  99. package/lib/commonjs/web-core/AudioBuffer.js.map +1 -0
  100. package/lib/commonjs/web-core/AudioBufferSourceNode.js +214 -0
  101. package/lib/commonjs/web-core/AudioBufferSourceNode.js.map +1 -0
  102. package/lib/commonjs/web-core/AudioContext.js +93 -0
  103. package/lib/commonjs/web-core/AudioContext.js.map +1 -0
  104. package/lib/commonjs/web-core/AudioDestinationNode.js +11 -0
  105. package/lib/commonjs/web-core/AudioDestinationNode.js.map +1 -0
  106. package/lib/commonjs/web-core/AudioNode.js +33 -0
  107. package/lib/commonjs/web-core/AudioNode.js.map +1 -0
  108. package/lib/commonjs/web-core/AudioParam.js +81 -0
  109. package/lib/commonjs/web-core/AudioParam.js.map +1 -0
  110. package/lib/commonjs/web-core/AudioScheduledSourceNode.js +41 -0
  111. package/lib/commonjs/web-core/AudioScheduledSourceNode.js.map +1 -0
  112. package/lib/commonjs/web-core/BaseAudioContext.js +2 -0
  113. package/lib/commonjs/web-core/BaseAudioContext.js.map +1 -0
  114. package/lib/commonjs/web-core/BiquadFilterNode.js +33 -0
  115. package/lib/commonjs/web-core/BiquadFilterNode.js.map +1 -0
  116. package/lib/commonjs/web-core/GainNode.js +17 -0
  117. package/lib/commonjs/web-core/GainNode.js.map +1 -0
  118. package/lib/commonjs/web-core/OfflineAudioContext.js +96 -0
  119. package/lib/commonjs/web-core/OfflineAudioContext.js.map +1 -0
  120. package/lib/commonjs/web-core/OscillatorNode.js +31 -0
  121. package/lib/commonjs/web-core/OscillatorNode.js.map +1 -0
  122. package/lib/commonjs/web-core/PeriodicWave.js +15 -0
  123. package/lib/commonjs/web-core/PeriodicWave.js.map +1 -0
  124. package/lib/commonjs/web-core/StereoPannerNode.js +17 -0
  125. package/lib/commonjs/web-core/StereoPannerNode.js.map +1 -0
  126. package/lib/commonjs/web-core/custom/LoadCustomWasm.js +37 -0
  127. package/lib/commonjs/web-core/custom/LoadCustomWasm.js.map +1 -0
  128. package/lib/commonjs/web-core/custom/index.js +14 -0
  129. package/lib/commonjs/web-core/custom/index.js.map +1 -0
  130. package/lib/commonjs/web-core/custom/signalsmithStretch/LICENSE.txt +21 -0
  131. package/lib/commonjs/web-core/custom/signalsmithStretch/README.md +46 -0
  132. package/lib/commonjs/web-core/custom/signalsmithStretch/SignalsmithStretch.mjs +826 -0
  133. package/lib/commonjs/web-core/custom/signalsmithStretch/SignalsmithStretch.mjs.map +1 -0
  134. package/lib/module/plugin/withAudioAPI.js +58 -0
  135. package/lib/module/plugin/withAudioAPI.js.map +1 -0
  136. package/lib/module/specs/NativeAudioManagerModule.js +5 -6
  137. package/lib/module/specs/NativeAudioManagerModule.js.map +1 -1
  138. package/lib/module/system/AudioManager.js +9 -0
  139. package/lib/module/system/AudioManager.js.map +1 -1
  140. package/lib/typescript/plugin/withAudioAPI.d.ts +9 -0
  141. package/lib/typescript/plugin/withAudioAPI.d.ts.map +1 -0
  142. package/lib/typescript/specs/NativeAudioManagerModule.d.ts +2 -1
  143. package/lib/typescript/specs/NativeAudioManagerModule.d.ts.map +1 -1
  144. package/lib/typescript/system/AudioManager.d.ts +4 -2
  145. package/lib/typescript/system/AudioManager.d.ts.map +1 -1
  146. package/lib/typescript/system/types.d.ts +16 -4
  147. package/lib/typescript/system/types.d.ts.map +1 -1
  148. package/package.json +6 -3
  149. package/src/plugin/withAudioAPI.ts +90 -0
  150. package/src/specs/NativeAudioManagerModule.ts +8 -11
  151. package/src/system/AudioManager.ts +42 -15
  152. package/src/system/types.ts +20 -4
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _AudioDestinationNode = _interopRequireDefault(require("./AudioDestinationNode"));
8
+ var _OscillatorNode = _interopRequireDefault(require("./OscillatorNode"));
9
+ var _GainNode = _interopRequireDefault(require("./GainNode"));
10
+ var _StereoPannerNode = _interopRequireDefault(require("./StereoPannerNode"));
11
+ var _BiquadFilterNode = _interopRequireDefault(require("./BiquadFilterNode"));
12
+ var _AudioBufferSourceNode = _interopRequireDefault(require("./AudioBufferSourceNode"));
13
+ var _AudioBuffer = _interopRequireDefault(require("./AudioBuffer"));
14
+ var _PeriodicWave = _interopRequireDefault(require("./PeriodicWave"));
15
+ var _AnalyserNode = _interopRequireDefault(require("./AnalyserNode"));
16
+ var _errors = require("../errors");
17
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
+ class BaseAudioContext {
19
+ constructor(context) {
20
+ this.context = context;
21
+ this.destination = new _AudioDestinationNode.default(this, context.destination);
22
+ this.sampleRate = context.sampleRate;
23
+ }
24
+ get currentTime() {
25
+ return this.context.currentTime;
26
+ }
27
+ get state() {
28
+ return this.context.state;
29
+ }
30
+ createOscillator() {
31
+ return new _OscillatorNode.default(this, this.context.createOscillator());
32
+ }
33
+ createGain() {
34
+ return new _GainNode.default(this, this.context.createGain());
35
+ }
36
+ createStereoPanner() {
37
+ return new _StereoPannerNode.default(this, this.context.createStereoPanner());
38
+ }
39
+ createBiquadFilter() {
40
+ return new _BiquadFilterNode.default(this, this.context.createBiquadFilter());
41
+ }
42
+ createBufferSource(options) {
43
+ const pitchCorrection = options?.pitchCorrection ?? false;
44
+ return new _AudioBufferSourceNode.default(this, this.context.createBufferSource(pitchCorrection));
45
+ }
46
+ createBuffer(numOfChannels, length, sampleRate) {
47
+ if (numOfChannels < 1 || numOfChannels >= 32) {
48
+ throw new _errors.NotSupportedError(`The number of channels provided (${numOfChannels}) is outside the range [1, 32]`);
49
+ }
50
+ if (length <= 0) {
51
+ throw new _errors.NotSupportedError(`The number of frames provided (${length}) is less than or equal to the minimum bound (0)`);
52
+ }
53
+ if (sampleRate < 8000 || sampleRate > 96000) {
54
+ throw new _errors.NotSupportedError(`The sample rate provided (${sampleRate}) is outside the range [8000, 96000]`);
55
+ }
56
+ return new _AudioBuffer.default(this.context.createBuffer(numOfChannels, length, sampleRate));
57
+ }
58
+ createPeriodicWave(real, imag, constraints) {
59
+ if (real.length !== imag.length) {
60
+ throw new _errors.InvalidAccessError(`The lengths of the real (${real.length}) and imaginary (${imag.length}) arrays must match.`);
61
+ }
62
+ const disableNormalization = constraints?.disableNormalization ?? false;
63
+ return new _PeriodicWave.default(this.context.createPeriodicWave(real, imag, disableNormalization));
64
+ }
65
+ createAnalyser() {
66
+ return new _AnalyserNode.default(this, this.context.createAnalyser());
67
+ }
68
+ async decodeAudioDataSource(sourcePath) {
69
+ // Remove the file:// prefix if it exists
70
+ if (sourcePath.startsWith('file://')) {
71
+ sourcePath = sourcePath.replace('file://', '');
72
+ }
73
+ return new _AudioBuffer.default(await this.context.decodeAudioDataSource(sourcePath));
74
+ }
75
+ async decodeAudioData(arrayBuffer) {
76
+ return new _AudioBuffer.default(await this.context.decodeAudioData(new Uint8Array(arrayBuffer)));
77
+ }
78
+ }
79
+ exports.default = BaseAudioContext;
80
+ //# sourceMappingURL=BaseAudioContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_AudioDestinationNode","_interopRequireDefault","require","_OscillatorNode","_GainNode","_StereoPannerNode","_BiquadFilterNode","_AudioBufferSourceNode","_AudioBuffer","_PeriodicWave","_AnalyserNode","_errors","e","__esModule","default","BaseAudioContext","constructor","context","destination","AudioDestinationNode","sampleRate","currentTime","state","createOscillator","OscillatorNode","createGain","GainNode","createStereoPanner","StereoPannerNode","createBiquadFilter","BiquadFilterNode","createBufferSource","options","pitchCorrection","AudioBufferSourceNode","createBuffer","numOfChannels","length","NotSupportedError","AudioBuffer","createPeriodicWave","real","imag","constraints","InvalidAccessError","disableNormalization","PeriodicWave","createAnalyser","AnalyserNode","decodeAudioDataSource","sourcePath","startsWith","replace","decodeAudioData","arrayBuffer","Uint8Array","exports"],"sourceRoot":"../../../src","sources":["core/BaseAudioContext.ts"],"mappings":";;;;;;AAMA,IAA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M,sBACxE,CAAC;IACH;IAEA,MAAMQ,oBAAoB,GAAGF,WAAW,EAAEE,oBAAoB,IAAI,KAAK;IAEvE,OAAO,IAAIC,qBAAY,CACrB,IAAI,CAAC7B,OAAO,CAACuB,kBAAkB,CAACC,IAAI,EAAEC,IAAI,EAAEG,oBAAoB,CAClE,CAAC;EACH;EAEAE,cAAcA,CAAA,EAAiB;IAC7B,OAAO,IAAIC,qBAAY,CAAC,IAAI,EAAE,IAAI,CAAC/B,OAAO,CAAC8B,cAAc,CAAC,CAAC,CAAC;EAC9D;EAEA,MAAME,qBAAqBA,CAACC,UAAkB,EAAwB;IACpE;IACA,IAAIA,UAAU,CAACC,UAAU,CAAC,SAAS,CAAC,EAAE;MACpCD,UAAU,GAAGA,UAAU,CAACE,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;IAChD;IAEA,OAAO,IAAIb,oBAAW,CACpB,MAAM,IAAI,CAACtB,OAAO,CAACgC,qBAAqB,CAACC,UAAU,CACrD,CAAC;EACH;EAEA,MAAMG,eAAeA,CAACC,WAAwB,EAAwB;IACpE,OAAO,IAAIf,oBAAW,CACpB,MAAM,IAAI,CAACtB,OAAO,CAACoC,eAAe,CAAC,IAAIE,UAAU,CAACD,WAAW,CAAC,CAChE,CAAC;EACH;AACF;AAACE,OAAA,CAAA1C,OAAA,GAAAC,gBAAA","ignoreList":[]}
@@ -0,0 +1,33 @@
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
+ var _AudioParam = _interopRequireDefault(require("./AudioParam"));
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ class BiquadFilterNode extends _AudioNode.default {
12
+ constructor(context, biquadFilter) {
13
+ super(context, biquadFilter);
14
+ this.frequency = new _AudioParam.default(biquadFilter.frequency);
15
+ this.detune = new _AudioParam.default(biquadFilter.detune);
16
+ this.Q = new _AudioParam.default(biquadFilter.Q);
17
+ this.gain = new _AudioParam.default(biquadFilter.gain);
18
+ }
19
+ get type() {
20
+ return this.node.type;
21
+ }
22
+ set type(value) {
23
+ this.node.type = value;
24
+ }
25
+ getFrequencyResponse(frequencyArray, magResponseOutput, phaseResponseOutput) {
26
+ if (frequencyArray.length !== magResponseOutput.length || frequencyArray.length !== phaseResponseOutput.length) {
27
+ throw new _errors.InvalidAccessError(`The lengths of the arrays are not the same frequencyArray: ${frequencyArray.length}, magResponseOutput: ${magResponseOutput.length}, phaseResponseOutput: ${phaseResponseOutput.length}`);
28
+ }
29
+ this.node.getFrequencyResponse(frequencyArray, magResponseOutput, phaseResponseOutput);
30
+ }
31
+ }
32
+ exports.default = BiquadFilterNode;
33
+ //# sourceMappingURL=BiquadFilterNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_errors","require","_AudioNode","_interopRequireDefault","_AudioParam","e","__esModule","default","BiquadFilterNode","AudioNode","constructor","context","biquadFilter","frequency","AudioParam","detune","Q","gain","type","node","value","getFrequencyResponse","frequencyArray","magResponseOutput","phaseResponseOutput","length","InvalidAccessError","exports"],"sourceRoot":"../../../src","sources":["core/BiquadFilterNode.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AAAsC,SAAAE,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAIvB,MAAMG,gBAAgB,SAASC,kBAAS,CAAC;EAMtDC,WAAWA,CAACC,OAAyB,EAAEC,YAA+B,EAAE;IACtE,KAAK,CAACD,OAAO,EAAEC,YAAY,CAAC;IAC5B,IAAI,CAACC,SAAS,GAAG,IAAIC,mBAAU,CAACF,YAAY,CAACC,SAAS,CAAC;IACvD,IAAI,CAACE,MAAM,GAAG,IAAID,mBAAU,CAACF,YAAY,CAACG,MAAM,CAAC;IACjD,IAAI,CAACC,CAAC,GAAG,IAAIF,mBAAU,CAACF,YAAY,CAACI,CAAC,CAAC;IACvC,IAAI,CAACC,IAAI,GAAG,IAAIH,mBAAU,CAACF,YAAY,CAACK,IAAI,CAAC;EAC/C;EAEA,IAAWC,IAAIA,CAAA,EAAqB;IAClC,OAAQ,IAAI,CAACC,IAAI,CAAuBD,IAAI;EAC9C;EAEA,IAAWA,IAAIA,CAACE,KAAuB,EAAE;IACtC,IAAI,CAACD,IAAI,CAAuBD,IAAI,GAAGE,KAAK;EAC/C;EAEOC,oBAAoBA,CACzBC,cAA4B,EAC5BC,iBAA+B,EAC/BC,mBAAiC,EACjC;IACA,IACEF,cAAc,CAACG,MAAM,KAAKF,iBAAiB,CAACE,MAAM,IAClDH,cAAc,CAACG,MAAM,KAAKD,mBAAmB,CAACC,MAAM,EACpD;MACA,MAAM,IAAIC,0BAAkB,CAC1B,8DAA8DJ,cAAc,CAACG,MAAM,wBAAwBF,iBAAiB,CAACE,MAAM,0BAA0BD,mBAAmB,CAACC,MAAM,EACzL,CAAC;IACH;IACC,IAAI,CAACN,IAAI,CAAuBE,oBAAoB,CACnDC,cAAc,EACdC,iBAAiB,EACjBC,mBACF,CAAC;EACH;AACF;AAACG,OAAA,CAAApB,OAAA,GAAAC,gBAAA","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _AudioNode = _interopRequireDefault(require("./AudioNode"));
8
+ var _AudioParam = _interopRequireDefault(require("./AudioParam"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ class GainNode extends _AudioNode.default {
11
+ constructor(context, gain) {
12
+ super(context, gain);
13
+ this.gain = new _AudioParam.default(gain.gain);
14
+ }
15
+ }
16
+ exports.default = GainNode;
17
+ //# sourceMappingURL=GainNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_AudioNode","_interopRequireDefault","require","_AudioParam","e","__esModule","default","GainNode","AudioNode","constructor","context","gain","AudioParam","exports"],"sourceRoot":"../../../src","sources":["core/GainNode.ts"],"mappings":";;;;;;AACA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAsC,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGvB,MAAMG,QAAQ,SAASC,kBAAS,CAAC;EAG9CC,WAAWA,CAACC,OAAyB,EAAEC,IAAe,EAAE;IACtD,KAAK,CAACD,OAAO,EAAEC,IAAI,CAAC;IACpB,IAAI,CAACA,IAAI,GAAG,IAAIC,mBAAU,CAACD,IAAI,CAACA,IAAI,CAAC;EACvC;AACF;AAACE,OAAA,CAAAP,OAAA,GAAAC,QAAA","ignoreList":[]}
@@ -0,0 +1,63 @@
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 _errors = require("../errors");
9
+ var _AudioBuffer = _interopRequireDefault(require("./AudioBuffer"));
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ class OfflineAudioContext extends _BaseAudioContext.default {
12
+ constructor(arg0, arg1, arg2) {
13
+ if (typeof arg0 === 'object') {
14
+ const {
15
+ numberOfChannels,
16
+ length,
17
+ sampleRate
18
+ } = arg0;
19
+ super(global.createOfflineAudioContext(numberOfChannels, length, sampleRate));
20
+ this.duration = length / sampleRate;
21
+ } else if (typeof arg0 === 'number' && typeof arg1 === 'number' && typeof arg2 === 'number') {
22
+ super(global.createOfflineAudioContext(arg0, arg1, arg2));
23
+ this.duration = arg1 / arg2;
24
+ } else {
25
+ throw new _errors.NotSupportedError('Invalid constructor arguments');
26
+ }
27
+ this.isSuspended = false;
28
+ this.isRendering = false;
29
+ }
30
+ async resume() {
31
+ if (!this.isRendering) {
32
+ throw new _errors.InvalidStateError('Cannot resume an OfflineAudioContext while rendering');
33
+ }
34
+ if (!this.isSuspended) {
35
+ throw new _errors.InvalidStateError('Cannot resume an OfflineAudioContext that is not suspended');
36
+ }
37
+ this.isSuspended = false;
38
+ await this.context.resume();
39
+ }
40
+ async suspend(suspendTime) {
41
+ if (suspendTime < 0) {
42
+ throw new _errors.InvalidStateError('suspendTime must be a non-negative number');
43
+ }
44
+ if (suspendTime < this.context.currentTime) {
45
+ throw new _errors.InvalidStateError(`suspendTime must be greater than the current time: ${suspendTime}`);
46
+ }
47
+ if (suspendTime > this.duration) {
48
+ throw new _errors.InvalidStateError(`suspendTime must be less than the duration of the context: ${suspendTime}`);
49
+ }
50
+ this.isSuspended = true;
51
+ await this.context.suspend(suspendTime);
52
+ }
53
+ async startRendering() {
54
+ if (this.isRendering) {
55
+ throw new _errors.InvalidStateError('OfflineAudioContext is already rendering');
56
+ }
57
+ this.isRendering = true;
58
+ const audioBuffer = await this.context.startRendering();
59
+ return new _AudioBuffer.default(audioBuffer);
60
+ }
61
+ }
62
+ exports.default = OfflineAudioContext;
63
+ //# sourceMappingURL=OfflineAudioContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_BaseAudioContext","_interopRequireDefault","require","_errors","_AudioBuffer","e","__esModule","default","OfflineAudioContext","BaseAudioContext","constructor","arg0","arg1","arg2","numberOfChannels","length","sampleRate","global","createOfflineAudioContext","duration","NotSupportedError","isSuspended","isRendering","resume","InvalidStateError","context","suspend","suspendTime","currentTime","startRendering","audioBuffer","AudioBuffer","exports"],"sourceRoot":"../../../src","sources":["core/OfflineAudioContext.ts"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD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MAAM,CAAC,CAAC;EACvD;EAEA,MAAMG,OAAOA,CAACC,WAAmB,EAAsB;IACrD,IAAIA,WAAW,GAAG,CAAC,EAAE;MACnB,MAAM,IAAIH,yBAAiB,CAAC,2CAA2C,CAAC;IAC1E;IAEA,IAAIG,WAAW,GAAG,IAAI,CAACF,OAAO,CAACG,WAAW,EAAE;MAC1C,MAAM,IAAIJ,yBAAiB,CACzB,sDAAsDG,WAAW,EACnE,CAAC;IACH;IAEA,IAAIA,WAAW,GAAG,IAAI,CAACR,QAAQ,EAAE;MAC/B,MAAM,IAAIK,yBAAiB,CACzB,8DAA8DG,WAAW,EAC3E,CAAC;IACH;IAEA,IAAI,CAACN,WAAW,GAAG,IAAI;IAEvB,MAAO,IAAI,CAACI,OAAO,CAA0BC,OAAO,CAACC,WAAW,CAAC;EACnE;EAEA,MAAME,cAAcA,CAAA,EAAyB;IAC3C,IAAI,IAAI,CAACP,WAAW,EAAE;MACpB,MAAM,IAAIE,yBAAiB,CAAC,0CAA0C,CAAC;IACzE;IAEA,IAAI,CAACF,WAAW,GAAG,IAAI;IAEvB,MAAMQ,WAAW,GAAG,MAClB,IAAI,CAACL,OAAO,CACZI,cAAc,CAAC,CAAC;IAElB,OAAO,IAAIE,oBAAW,CAACD,WAAW,CAAC;EACrC;AACF;AAACE,OAAA,CAAAzB,OAAA,GAAAC,mBAAA","ignoreList":[]}
@@ -0,0 +1,32 @@
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 _AudioParam = _interopRequireDefault(require("./AudioParam"));
9
+ var _errors = require("../errors");
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ class OscillatorNode extends _AudioScheduledSourceNode.default {
12
+ constructor(context, node) {
13
+ super(context, node);
14
+ this.frequency = new _AudioParam.default(node.frequency);
15
+ this.detune = new _AudioParam.default(node.detune);
16
+ this.type = node.type;
17
+ }
18
+ get type() {
19
+ return this.node.type;
20
+ }
21
+ set type(value) {
22
+ if (value === 'custom') {
23
+ throw new _errors.InvalidStateError("'type' cannot be set directly to 'custom'. Use setPeriodicWave() to create a custom Oscillator type.");
24
+ }
25
+ this.node.type = value;
26
+ }
27
+ setPeriodicWave(wave) {
28
+ this.node.setPeriodicWave(wave.periodicWave);
29
+ }
30
+ }
31
+ exports.default = OscillatorNode;
32
+ //# sourceMappingURL=OscillatorNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_AudioScheduledSourceNode","_interopRequireDefault","require","_AudioParam","_errors","e","__esModule","default","OscillatorNode","AudioScheduledSourceNode","constructor","context","node","frequency","AudioParam","detune","type","value","InvalidStateError","setPeriodicWave","wave","periodicWave","exports"],"sourceRoot":"../../../src","sources":["core/OscillatorNode.ts"],"mappings":";;;;;;AAEA,IAAAA,yBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AAGA,IAAAE,OAAA,GAAAF,OAAA;AAA8C,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE/B,MAAMG,cAAc,SAASC,iCAAwB,CAAC;EAInEC,WAAWA,CAACC,OAAyB,EAAEC,IAAqB,EAAE;IAC5D,KAAK,CAACD,OAAO,EAAEC,IAAI,CAAC;IACpB,IAAI,CAACC,SAAS,GAAG,IAAIC,mBAAU,CAACF,IAAI,CAACC,SAAS,CAAC;IAC/C,IAAI,CAACE,MAAM,GAAG,IAAID,mBAAU,CAACF,IAAI,CAACG,MAAM,CAAC;IACzC,IAAI,CAACC,IAAI,GAAGJ,IAAI,CAACI,IAAI;EACvB;EAEA,IAAWA,IAAIA,CAAA,EAAmB;IAChC,OAAQ,IAAI,CAACJ,IAAI,CAAqBI,IAAI;EAC5C;EAEA,IAAWA,IAAIA,CAACC,KAAqB,EAAE;IACrC,IAAIA,KAAK,KAAK,QAAQ,EAAE;MACtB,MAAM,IAAIC,yBAAiB,CACzB,uGACF,CAAC;IACH;IAEC,IAAI,CAACN,IAAI,CAAqBI,IAAI,GAAGC,KAAK;EAC7C;EAEOE,eAAeA,CAACC,IAAkB,EAAQ;IAC9C,IAAI,CAACR,IAAI,CAAqBO,eAAe,CAACC,IAAI,CAACC,YAAY,CAAC;EACnE;AACF;AAACC,OAAA,CAAAf,OAAA,GAAAC,cAAA","ignoreList":[]}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ class PeriodicWave {
8
+ /** @internal */
9
+
10
+ constructor(periodicWave) {
11
+ this.periodicWave = periodicWave;
12
+ }
13
+ }
14
+ exports.default = PeriodicWave;
15
+ //# sourceMappingURL=PeriodicWave.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["PeriodicWave","constructor","periodicWave","exports","default"],"sourceRoot":"../../../src","sources":["core/PeriodicWave.ts"],"mappings":";;;;;;AAEe,MAAMA,YAAY,CAAC;EAChC;;EAGAC,WAAWA,CAACC,YAA2B,EAAE;IACvC,IAAI,CAACA,YAAY,GAAGA,YAAY;EAClC;AACF;AAACC,OAAA,CAAAC,OAAA,GAAAJ,YAAA","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _AudioNode = _interopRequireDefault(require("./AudioNode"));
8
+ var _AudioParam = _interopRequireDefault(require("./AudioParam"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ class StereoPannerNode extends _AudioNode.default {
11
+ constructor(context, pan) {
12
+ super(context, pan);
13
+ this.pan = new _AudioParam.default(pan.pan);
14
+ }
15
+ }
16
+ exports.default = StereoPannerNode;
17
+ //# sourceMappingURL=StereoPannerNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_AudioNode","_interopRequireDefault","require","_AudioParam","e","__esModule","default","StereoPannerNode","AudioNode","constructor","context","pan","AudioParam","exports"],"sourceRoot":"../../../src","sources":["core/StereoPannerNode.ts"],"mappings":";;;;;;AACA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAsC,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGvB,MAAMG,gBAAgB,SAASC,kBAAS,CAAC;EAGtDC,WAAWA,CAACC,OAAyB,EAAEC,GAAsB,EAAE;IAC7D,KAAK,CAACD,OAAO,EAAEC,GAAG,CAAC;IACnB,IAAI,CAACA,GAAG,GAAG,IAAIC,mBAAU,CAACD,GAAG,CAACA,GAAG,CAAC;EACpC;AACF;AAACE,OAAA,CAAAP,OAAA,GAAAC,gBAAA","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ class IndexSizeError extends Error {
8
+ constructor(message) {
9
+ super(message);
10
+ this.name = 'IndexSizeError';
11
+ }
12
+ }
13
+ var _default = exports.default = IndexSizeError;
14
+ //# sourceMappingURL=IndexSizeError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["IndexSizeError","Error","constructor","message","name","_default","exports","default"],"sourceRoot":"../../../src","sources":["errors/IndexSizeError.ts"],"mappings":";;;;;;AAAA,MAAMA,cAAc,SAASC,KAAK,CAAC;EACjCC,WAAWA,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,gBAAgB;EAC9B;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcP,cAAc","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ class InvalidAccessError extends Error {
8
+ constructor(message) {
9
+ super(message);
10
+ this.name = 'InvalidAccessError';
11
+ }
12
+ }
13
+ var _default = exports.default = InvalidAccessError;
14
+ //# sourceMappingURL=InvalidAccessError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["InvalidAccessError","Error","constructor","message","name","_default","exports","default"],"sourceRoot":"../../../src","sources":["errors/InvalidAccessError.ts"],"mappings":";;;;;;AAAA,MAAMA,kBAAkB,SAASC,KAAK,CAAC;EACrCC,WAAWA,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,oBAAoB;EAClC;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcP,kBAAkB","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ class InvalidStateError extends Error {
8
+ constructor(message) {
9
+ super(message);
10
+ this.name = 'InvalidStateError';
11
+ }
12
+ }
13
+ var _default = exports.default = InvalidStateError;
14
+ //# sourceMappingURL=InvalidStateError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["InvalidStateError","Error","constructor","message","name","_default","exports","default"],"sourceRoot":"../../../src","sources":["errors/InvalidStateError.ts"],"mappings":";;;;;;AAAA,MAAMA,iBAAiB,SAASC,KAAK,CAAC;EACpCC,WAAWA,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,mBAAmB;EACjC;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcP,iBAAiB","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ class NotSupportedError extends Error {
8
+ constructor(message) {
9
+ super(message);
10
+ this.name = 'NotSupportedError';
11
+ }
12
+ }
13
+ var _default = exports.default = NotSupportedError;
14
+ //# sourceMappingURL=NotSupportedError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NotSupportedError","Error","constructor","message","name","_default","exports","default"],"sourceRoot":"../../../src","sources":["errors/NotSupportedError.tsx"],"mappings":";;;;;;AAAA,MAAMA,iBAAiB,SAASC,KAAK,CAAC;EACpCC,WAAWA,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,mBAAmB;EACjC;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcP,iBAAiB","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ class RangeError extends Error {
8
+ constructor(message) {
9
+ super(message);
10
+ this.name = 'RangeError';
11
+ }
12
+ }
13
+ var _default = exports.default = RangeError;
14
+ //# sourceMappingURL=RangeError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["RangeError","Error","constructor","message","name","_default","exports","default"],"sourceRoot":"../../../src","sources":["errors/RangeError.ts"],"mappings":";;;;;;AAAA,MAAMA,UAAU,SAASC,KAAK,CAAC;EAC7BC,WAAWA,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,YAAY;EAC1B;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcP,UAAU","ignoreList":[]}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "IndexSizeError", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _IndexSizeError.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "InvalidAccessError", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _InvalidAccessError.default;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "InvalidStateError", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _InvalidStateError.default;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "NotSupportedError", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _NotSupportedError.default;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "RangeError", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _RangeError.default;
34
+ }
35
+ });
36
+ var _IndexSizeError = _interopRequireDefault(require("./IndexSizeError"));
37
+ var _InvalidAccessError = _interopRequireDefault(require("./InvalidAccessError"));
38
+ var _InvalidStateError = _interopRequireDefault(require("./InvalidStateError"));
39
+ var _RangeError = _interopRequireDefault(require("./RangeError"));
40
+ var _NotSupportedError = _interopRequireDefault(require("./NotSupportedError"));
41
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
42
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_IndexSizeError","_interopRequireDefault","require","_InvalidAccessError","_InvalidStateError","_RangeError","_NotSupportedError","e","__esModule","default"],"sourceRoot":"../../../src","sources":["errors/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,kBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,kBAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAmE,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _api = require("./api");
7
+ Object.keys(_api).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _api[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _api[key];
14
+ }
15
+ });
16
+ });
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_api","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,IAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,IAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,IAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["interfaces.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _configPlugins = require("@expo/config-plugins");
8
+ const pkg = require('react-native-audio-api/package.json');
9
+ const withBackgroundAudio = config => {
10
+ return (0, _configPlugins.withInfoPlist)(config, iosConfig => {
11
+ iosConfig.modResults.UIBackgroundModes = [...Array.from(new Set([...(iosConfig.modResults.UIBackgroundModes ?? []), 'audio']))];
12
+ return iosConfig;
13
+ });
14
+ };
15
+ const withAndroidPermissions = (config, {
16
+ androidFSPermissions
17
+ }) => {
18
+ return _configPlugins.AndroidConfig.Permissions.withPermissions(config, androidFSPermissions);
19
+ };
20
+ const withForegroundService = (config, {
21
+ androidFSTypes
22
+ }) => {
23
+ return (0, _configPlugins.withAndroidManifest)(config, mod => {
24
+ const manifest = mod.modResults;
25
+ const mainApplication = _configPlugins.AndroidConfig.Manifest.getMainApplicationOrThrow(manifest);
26
+ const SFTypes = androidFSTypes.join('|');
27
+ const serviceElement = {
28
+ $: {
29
+ 'android:name': 'system.MediaNotificationManager$NotificationService',
30
+ 'android:stopWithTask': 'true',
31
+ 'android:foregroundServiceType': SFTypes
32
+ },
33
+ intentFilter: []
34
+ };
35
+ if (!mainApplication.service) {
36
+ mainApplication.service = [];
37
+ }
38
+ mainApplication.service.push(serviceElement);
39
+ return mod;
40
+ });
41
+ };
42
+ const withAudioAPI = (config, {
43
+ iosBackgroundMode = true,
44
+ androidForegroundService = true,
45
+ androidFSPermissions = [],
46
+ androidFSTypes = []
47
+ }) => {
48
+ if (iosBackgroundMode) {
49
+ config = withBackgroundAudio(config);
50
+ }
51
+ if (androidForegroundService) {
52
+ config = withAndroidPermissions(config, {
53
+ androidFSPermissions
54
+ });
55
+ config = withForegroundService(config, {
56
+ androidFSTypes
57
+ });
58
+ }
59
+ return config;
60
+ };
61
+ var _default = exports.default = (0, _configPlugins.createRunOncePlugin)(withAudioAPI, pkg.name, pkg.version);
62
+ //# sourceMappingURL=withAudioAPI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_configPlugins","require","pkg","withBackgroundAudio","config","withInfoPlist","iosConfig","modResults","UIBackgroundModes","Array","from","Set","withAndroidPermissions","androidFSPermissions","AndroidConfig","Permissions","withPermissions","withForegroundService","androidFSTypes","withAndroidManifest","mod","manifest","mainApplication","Manifest","getMainApplicationOrThrow","SFTypes","join","serviceElement","$","intentFilter","service","push","withAudioAPI","iosBackgroundMode","androidForegroundService","_default","exports","default","createRunOncePlugin","name","version"],"sourceRoot":"../../../src","sources":["plugin/withAudioAPI.ts"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAQA,MAAMC,GAAG,GAAGD,OAAO,CAAC,qCAAqC,CAAC;AAE1D,MAAME,mBAAiC,GAAIC,MAAM,IAAK;EACpD,OAAO,IAAAC,4BAAa,EAACD,MAAM,EAAGE,SAAS,IAAK;IAC1CA,SAAS,CAACC,UAAU,CAACC,iBAAiB,GAAG,CACvC,GAAGC,KAAK,CAACC,IAAI,CACX,IAAIC,GAAG,CAAC,CAAC,IAAIL,SAAS,CAACC,UAAU,CAACC,iBAAiB,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,CACtE,CAAC,CACF;IAED,OAAOF,SAAS;EAClB,CAAC,CAAC;AACJ,CAAC;AAED,MAAMM,sBAEJ,GAAGA,CAACR,MAAM,EAAE;EAAES;AAAqB,CAAC,KAAK;EACzC,OAAOC,4BAAa,CAACC,WAAW,CAACC,eAAe,CAC9CZ,MAAM,EACNS,oBACF,CAAC;AACH,CAAC;AAED,MAAMI,qBAEJ,GAAGA,CAACb,MAAM,EAAE;EAAEc;AAAe,CAAC,KAAK;EACnC,OAAO,IAAAC,kCAAmB,EAACf,MAAM,EAAGgB,GAAG,IAAK;IAC1C,MAAMC,QAAQ,GAAGD,GAAG,CAACb,UAAU;IAC/B,MAAMe,eAAe,GACnBR,4BAAa,CAACS,QAAQ,CAACC,yBAAyB,CAACH,QAAQ,CAAC;IAE5D,MAAMI,OAAO,GAAGP,cAAc,CAACQ,IAAI,CAAC,GAAG,CAAC;IAExC,MAAMC,cAAc,GAAG;MACrBC,CAAC,EAAE;QACD,cAAc,EAAE,qDAAqD;QACrE,sBAAsB,EAAE,MAAM;QAC9B,+BAA+B,EAAEH;MACnC,CAAC;MACDI,YAAY,EAAE;IAChB,CAAC;IAED,IAAI,CAACP,eAAe,CAACQ,OAAO,EAAE;MAC5BR,eAAe,CAACQ,OAAO,GAAG,EAAE;IAC9B;IAEAR,eAAe,CAACQ,OAAO,CAACC,IAAI,CAACJ,cAAc,CAAC;IAE5C,OAAOP,GAAG;EACZ,CAAC,CAAC;AACJ,CAAC;AAED,MAAMY,YAKJ,GAAGA,CACH5B,MAAM,EACN;EACE6B,iBAAiB,GAAG,IAAI;EACxBC,wBAAwB,GAAG,IAAI;EAC/BrB,oBAAoB,GAAG,EAAE;EACzBK,cAAc,GAAG;AACnB,CAAC,KACE;EACH,IAAIe,iBAAiB,EAAE;IACrB7B,MAAM,GAAGD,mBAAmB,CAACC,MAAM,CAAC;EACtC;EACA,IAAI8B,wBAAwB,EAAE;IAC5B9B,MAAM,GAAGQ,sBAAsB,CAACR,MAAM,EAAE;MACtCS;IACF,CAAC,CAAC;IACFT,MAAM,GAAGa,qBAAqB,CAACb,MAAM,EAAE;MACrCc;IACF,CAAC,CAAC;EACJ;EAEA,OAAOd,MAAM;AACf,CAAC;AAAC,IAAA+B,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa,IAAAC,kCAAmB,EAACN,YAAY,EAAE9B,GAAG,CAACqC,IAAI,EAAErC,GAAG,CAACsC,OAAO,CAAC","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _reactNative = require("react-native");
8
+ var _default = exports.default = _reactNative.TurboModuleRegistry.get('AudioAPIModule');
9
+ //# sourceMappingURL=NativeAudioAPIModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeAudioAPIModule.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAgE,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAMjDC,gCAAmB,CAACC,GAAG,CAAO,gBAAgB,CAAC","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.eventEmitter = exports.AudioManagerModule = void 0;
7
+ var _reactNative = require("react-native");
8
+ const NativeAudioManagerModule = _reactNative.NativeModules.AudioManagerModule;
9
+ const eventEmitter = exports.eventEmitter = _reactNative.Platform.OS === 'android' ? new _reactNative.NativeEventEmitter() : new _reactNative.NativeEventEmitter(_reactNative.NativeModules.AudioManagerModule);
10
+ if (!NativeAudioManagerModule || !eventEmitter) {
11
+ throw new Error(`Failed to install react-native-audio-api: The native module could not be found.`);
12
+ }
13
+ const AudioManagerModule = exports.AudioManagerModule = {
14
+ setLockScreenInfo(info) {
15
+ NativeAudioManagerModule.setLockScreenInfo(info);
16
+ },
17
+ resetLockScreenInfo() {
18
+ NativeAudioManagerModule.resetLockScreenInfo();
19
+ },
20
+ enableRemoteCommand(name, enabled) {
21
+ NativeAudioManagerModule.enableRemoteCommand(name, enabled);
22
+ },
23
+ setAudioSessionOptions(category, mode, options, active) {
24
+ NativeAudioManagerModule.setAudioSessionOptions(category, mode, options, active);
25
+ },
26
+ getDevicePreferredSampleRate() {
27
+ return NativeAudioManagerModule.getDevicePreferredSampleRate();
28
+ },
29
+ observeAudioInterruptions(enabled) {
30
+ NativeAudioManagerModule.observeAudioInterruptions(enabled);
31
+ }
32
+ };
33
+ //# sourceMappingURL=NativeAudioManagerModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","NativeAudioManagerModule","NativeModules","AudioManagerModule","eventEmitter","exports","Platform","OS","NativeEventEmitter","Error","setLockScreenInfo","info","resetLockScreenInfo","enableRemoteCommand","name","enabled","setAudioSessionOptions","category","mode","options","active","getDevicePreferredSampleRate","observeAudioInterruptions"],"sourceRoot":"../../../src","sources":["specs/NativeAudioManagerModule.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,wBAAwB,GAAGC,0BAAa,CAACC,kBAAkB;AACjE,MAAMC,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAChBE,qBAAQ,CAACC,EAAE,KAAK,SAAS,GACrB,IAAIC,+BAAkB,CAAC,CAAC,GACxB,IAAIA,+BAAkB,CAACN,0BAAa,CAACC,kBAAkB,CAAC;AAE9D,IAAI,CAACF,wBAAwB,IAAI,CAACG,YAAY,EAAE;EAC9C,MAAM,IAAIK,KAAK,CACb,iFACF,CAAC;AACH;AAEA,MAAMN,kBAAkB,GAAAE,OAAA,CAAAF,kBAAA,GAAG;EACzBO,iBAAiBA,CAACC,IAEjB,EAAQ;IACPV,wBAAwB,CAACS,iBAAiB,CAACC,IAAI,CAAC;EAClD,CAAC;EACDC,mBAAmBA,CAAA,EAAS;IAC1BX,wBAAwB,CAACW,mBAAmB,CAAC,CAAC;EAChD,CAAC;EACDC,mBAAmBA,CAACC,IAAY,EAAEC,OAAgB,EAAQ;IACxDd,wBAAwB,CAACY,mBAAmB,CAACC,IAAI,EAAEC,OAAO,CAAC;EAC7D,CAAC;EACDC,sBAAsBA,CACpBC,QAAgB,EAChBC,IAAY,EACZC,OAAsB,EACtBC,MAAe,EACT;IACNnB,wBAAwB,CAACe,sBAAsB,CAC7CC,QAAQ,EACRC,IAAI,EACJC,OAAO,EACPC,MACF,CAAC;EACH,CAAC;EACDC,4BAA4BA,CAAA,EAAW;IACrC,OAAOpB,wBAAwB,CAACoB,4BAA4B,CAAC,CAAC;EAChE,CAAC;EACDC,yBAAyBA,CAACP,OAAgB,EAAQ;IAChDd,wBAAwB,CAACqB,yBAAyB,CAACP,OAAO,CAAC;EAC7D;AACF,CAAC","ignoreList":[]}