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.
- package/README.md +35 -22
- package/android/CMakeLists.txt +6 -3
- package/android/build.gradle +1 -0
- package/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.cpp +73 -0
- package/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.h +37 -0
- package/android/src/main/cpp/audioapi/android/core/AudioPlayer.cpp +6 -10
- package/android/src/main/cpp/audioapi/android/core/AudioPlayer.h +2 -3
- package/android/src/main/java/com/swmansion/audioapi/AudioManagerModule.kt +19 -14
- package/android/src/main/java/com/swmansion/audioapi/system/AudioFocusListener.kt +60 -0
- package/android/src/main/java/com/swmansion/audioapi/system/LockScreenManager.kt +294 -0
- package/android/src/main/java/com/swmansion/audioapi/system/MediaNotificationManager.kt +279 -0
- package/android/src/main/java/com/swmansion/audioapi/system/MediaReceiver.kt +46 -0
- package/android/src/main/java/com/swmansion/audioapi/system/MediaSessionCallback.kt +39 -0
- package/android/src/main/java/com/swmansion/audioapi/system/MediaSessionEventEmitter.kt +88 -0
- package/android/src/main/java/com/swmansion/audioapi/system/MediaSessionManager.kt +162 -0
- package/android/src/main/java/com/swmansion/audioapi/system/VolumeChangeListener.kt +27 -0
- package/android/src/main/res/drawable/next.xml +9 -0
- package/android/src/main/res/drawable/pause.xml +9 -0
- package/android/src/main/res/drawable/play.xml +9 -0
- package/android/src/main/res/drawable/previous.xml +9 -0
- package/android/src/main/res/drawable/skip_backward_5.xml +9 -0
- package/android/src/main/res/drawable/skip_forward_5.xml +9 -0
- package/android/src/main/res/drawable/stop.xml +9 -0
- package/app.plugin.js +1 -0
- package/common/cpp/audioapi/AudioAPIModuleInstaller.h +29 -5
- package/common/cpp/audioapi/HostObjects/AnalyserNodeHostObject.h +1 -0
- package/common/cpp/audioapi/HostObjects/AudioRecorderHostObject.h +149 -0
- package/common/cpp/audioapi/core/AudioContext.cpp +4 -3
- package/common/cpp/audioapi/core/BaseAudioContext.cpp +6 -6
- package/common/cpp/audioapi/core/inputs/AudioRecorder.h +38 -0
- package/common/cpp/audioapi/core/sources/AudioBufferSourceNode.cpp +1 -6
- package/common/cpp/audioapi/core/sources/AudioScheduledSourceNode.cpp +8 -4
- package/common/cpp/audioapi/core/sources/AudioScheduledSourceNode.h +6 -0
- package/common/cpp/audioapi/core/sources/OscillatorNode.cpp +1 -1
- package/common/cpp/audioapi/core/utils/AudioNodeDestructor.cpp +3 -3
- package/common/cpp/audioapi/core/utils/AudioNodeManager.cpp +45 -11
- package/common/cpp/audioapi/core/utils/AudioNodeManager.h +6 -2
- package/ios/audioapi/ios/AudioManagerModule.mm +16 -15
- package/ios/audioapi/ios/core/IOSAudioPlayer.h +11 -12
- package/ios/audioapi/ios/core/IOSAudioPlayer.mm +22 -16
- package/ios/audioapi/ios/core/IOSAudioRecorder.h +36 -0
- package/ios/audioapi/ios/core/IOSAudioRecorder.mm +62 -0
- package/ios/audioapi/ios/core/{AudioPlayer.h → NativeAudioPlayer.h} +1 -8
- package/ios/audioapi/ios/core/{AudioPlayer.m → NativeAudioPlayer.m} +4 -33
- package/ios/audioapi/ios/core/NativeAudioRecorder.h +25 -0
- package/ios/audioapi/ios/core/NativeAudioRecorder.m +47 -0
- package/ios/audioapi/ios/system/AudioEngine.h +7 -1
- package/ios/audioapi/ios/system/AudioEngine.mm +64 -20
- package/ios/audioapi/ios/system/AudioSessionManager.h +3 -1
- package/ios/audioapi/ios/system/AudioSessionManager.mm +37 -25
- package/ios/audioapi/ios/system/LockScreenManager.mm +4 -8
- package/ios/audioapi/ios/system/NotificationManager.h +13 -1
- package/ios/audioapi/ios/system/NotificationManager.mm +96 -44
- package/lib/commonjs/api.js +211 -0
- package/lib/commonjs/api.js.map +1 -0
- package/lib/commonjs/api.web.js +219 -0
- package/lib/commonjs/api.web.js.map +1 -0
- package/lib/commonjs/core/AnalyserNode.js +71 -0
- package/lib/commonjs/core/AnalyserNode.js.map +1 -0
- package/lib/commonjs/core/AudioBuffer.js +44 -0
- package/lib/commonjs/core/AudioBuffer.js.map +1 -0
- package/lib/commonjs/core/AudioBufferSourceNode.js +68 -0
- package/lib/commonjs/core/AudioBufferSourceNode.js.map +1 -0
- package/lib/commonjs/core/AudioContext.js +29 -0
- package/lib/commonjs/core/AudioContext.js.map +1 -0
- package/lib/commonjs/core/AudioDestinationNode.js +11 -0
- package/lib/commonjs/core/AudioDestinationNode.js.map +1 -0
- package/lib/commonjs/core/AudioNode.js +30 -0
- package/lib/commonjs/core/AudioNode.js.map +1 -0
- package/lib/commonjs/core/AudioParam.js +82 -0
- package/lib/commonjs/core/AudioParam.js.map +1 -0
- package/lib/commonjs/core/AudioRecorder.js +51 -0
- package/lib/commonjs/core/AudioRecorder.js.map +1 -0
- package/lib/commonjs/core/AudioScheduledSourceNode.js +38 -0
- package/lib/commonjs/core/AudioScheduledSourceNode.js.map +1 -0
- package/lib/commonjs/core/BaseAudioContext.js +80 -0
- package/lib/commonjs/core/BaseAudioContext.js.map +1 -0
- package/lib/commonjs/core/BiquadFilterNode.js +33 -0
- package/lib/commonjs/core/BiquadFilterNode.js.map +1 -0
- package/lib/commonjs/core/GainNode.js +17 -0
- package/lib/commonjs/core/GainNode.js.map +1 -0
- package/lib/commonjs/core/OfflineAudioContext.js +63 -0
- package/lib/commonjs/core/OfflineAudioContext.js.map +1 -0
- package/lib/commonjs/core/OscillatorNode.js +32 -0
- package/lib/commonjs/core/OscillatorNode.js.map +1 -0
- package/lib/commonjs/core/PeriodicWave.js +15 -0
- package/lib/commonjs/core/PeriodicWave.js.map +1 -0
- package/lib/commonjs/core/StereoPannerNode.js +17 -0
- package/lib/commonjs/core/StereoPannerNode.js.map +1 -0
- package/lib/commonjs/errors/IndexSizeError.js +14 -0
- package/lib/commonjs/errors/IndexSizeError.js.map +1 -0
- package/lib/commonjs/errors/InvalidAccessError.js +14 -0
- package/lib/commonjs/errors/InvalidAccessError.js.map +1 -0
- package/lib/commonjs/errors/InvalidStateError.js +14 -0
- package/lib/commonjs/errors/InvalidStateError.js.map +1 -0
- package/lib/commonjs/errors/NotSupportedError.js +14 -0
- package/lib/commonjs/errors/NotSupportedError.js.map +1 -0
- package/lib/commonjs/errors/RangeError.js +14 -0
- package/lib/commonjs/errors/RangeError.js.map +1 -0
- package/lib/commonjs/errors/index.js +42 -0
- package/lib/commonjs/errors/index.js.map +1 -0
- package/lib/commonjs/hooks/useSytemVolume.js +24 -0
- package/lib/commonjs/hooks/useSytemVolume.js.map +1 -0
- package/lib/commonjs/index.js +17 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/interfaces.js +6 -0
- package/lib/commonjs/interfaces.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/plugin/withAudioAPI.js +62 -0
- package/lib/commonjs/plugin/withAudioAPI.js.map +1 -0
- package/lib/commonjs/specs/NativeAudioAPIModule.js +9 -0
- package/lib/commonjs/specs/NativeAudioAPIModule.js.map +1 -0
- package/lib/commonjs/specs/NativeAudioManagerModule.js +36 -0
- package/lib/commonjs/specs/NativeAudioManagerModule.js.map +1 -0
- package/lib/commonjs/specs/index.js +27 -0
- package/lib/commonjs/specs/index.js.map +1 -0
- package/lib/commonjs/system/AudioManager.js +52 -0
- package/lib/commonjs/system/AudioManager.js.map +1 -0
- package/lib/commonjs/system/index.js +14 -0
- package/lib/commonjs/system/index.js.map +1 -0
- package/lib/commonjs/system/types.js +2 -0
- package/lib/commonjs/system/types.js.map +1 -0
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils/index.js +10 -0
- package/lib/commonjs/utils/index.js.map +1 -0
- package/lib/commonjs/web-core/AnalyserNode.js +38 -0
- package/lib/commonjs/web-core/AnalyserNode.js.map +1 -0
- package/lib/commonjs/web-core/AudioBuffer.js +44 -0
- package/lib/commonjs/web-core/AudioBuffer.js.map +1 -0
- package/lib/commonjs/web-core/AudioBufferSourceNode.js +214 -0
- package/lib/commonjs/web-core/AudioBufferSourceNode.js.map +1 -0
- package/lib/commonjs/web-core/AudioContext.js +93 -0
- package/lib/commonjs/web-core/AudioContext.js.map +1 -0
- package/lib/commonjs/web-core/AudioDestinationNode.js +11 -0
- package/lib/commonjs/web-core/AudioDestinationNode.js.map +1 -0
- package/lib/commonjs/web-core/AudioNode.js +33 -0
- package/lib/commonjs/web-core/AudioNode.js.map +1 -0
- package/lib/commonjs/web-core/AudioParam.js +81 -0
- package/lib/commonjs/web-core/AudioParam.js.map +1 -0
- package/lib/commonjs/web-core/AudioScheduledSourceNode.js +41 -0
- package/lib/commonjs/web-core/AudioScheduledSourceNode.js.map +1 -0
- package/lib/commonjs/web-core/BaseAudioContext.js +2 -0
- package/lib/commonjs/web-core/BaseAudioContext.js.map +1 -0
- package/lib/commonjs/web-core/BiquadFilterNode.js +33 -0
- package/lib/commonjs/web-core/BiquadFilterNode.js.map +1 -0
- package/lib/commonjs/web-core/GainNode.js +17 -0
- package/lib/commonjs/web-core/GainNode.js.map +1 -0
- package/lib/commonjs/web-core/OfflineAudioContext.js +96 -0
- package/lib/commonjs/web-core/OfflineAudioContext.js.map +1 -0
- package/lib/commonjs/web-core/OscillatorNode.js +31 -0
- package/lib/commonjs/web-core/OscillatorNode.js.map +1 -0
- package/lib/commonjs/web-core/PeriodicWave.js +15 -0
- package/lib/commonjs/web-core/PeriodicWave.js.map +1 -0
- package/lib/commonjs/web-core/StereoPannerNode.js +17 -0
- package/lib/commonjs/web-core/StereoPannerNode.js.map +1 -0
- package/lib/commonjs/web-core/custom/LoadCustomWasm.js +37 -0
- package/lib/commonjs/web-core/custom/LoadCustomWasm.js.map +1 -0
- package/lib/commonjs/web-core/custom/index.js +14 -0
- package/lib/commonjs/web-core/custom/index.js.map +1 -0
- package/lib/commonjs/web-core/custom/signalsmithStretch/LICENSE.txt +21 -0
- package/lib/commonjs/web-core/custom/signalsmithStretch/README.md +46 -0
- package/lib/commonjs/web-core/custom/signalsmithStretch/SignalsmithStretch.mjs +826 -0
- package/lib/commonjs/web-core/custom/signalsmithStretch/SignalsmithStretch.mjs.map +1 -0
- package/lib/module/api.js +3 -1
- package/lib/module/api.js.map +1 -1
- package/lib/module/core/AudioRecorder.js +45 -0
- package/lib/module/core/AudioRecorder.js.map +1 -0
- package/lib/module/errors/NotSupportedError.js.map +1 -1
- package/lib/module/hooks/useSytemVolume.js +19 -0
- package/lib/module/hooks/useSytemVolume.js.map +1 -0
- package/lib/module/plugin/withAudioAPI.js +58 -0
- package/lib/module/plugin/withAudioAPI.js.map +1 -0
- package/lib/module/specs/NativeAudioManagerModule.js +10 -8
- package/lib/module/specs/NativeAudioManagerModule.js.map +1 -1
- package/lib/module/system/AudioManager.js +26 -44
- package/lib/module/system/AudioManager.js.map +1 -1
- package/lib/typescript/api.d.ts +5 -1
- package/lib/typescript/api.d.ts.map +1 -1
- package/lib/typescript/core/AudioRecorder.d.ts +22 -0
- package/lib/typescript/core/AudioRecorder.d.ts.map +1 -0
- package/lib/typescript/errors/NotSupportedError.d.ts.map +1 -1
- package/lib/typescript/hooks/useSytemVolume.d.ts +2 -0
- package/lib/typescript/hooks/useSytemVolume.d.ts.map +1 -0
- package/lib/typescript/interfaces.d.ts +11 -5
- package/lib/typescript/interfaces.d.ts.map +1 -1
- package/lib/typescript/plugin/withAudioAPI.d.ts +9 -0
- package/lib/typescript/plugin/withAudioAPI.d.ts.map +1 -0
- package/lib/typescript/specs/NativeAudioManagerModule.d.ts +4 -2
- package/lib/typescript/specs/NativeAudioManagerModule.d.ts.map +1 -1
- package/lib/typescript/system/AudioManager.d.ts +5 -2
- package/lib/typescript/system/AudioManager.d.ts.map +1 -1
- package/lib/typescript/system/types.d.ts +36 -5
- package/lib/typescript/system/types.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +5 -0
- package/lib/typescript/types.d.ts.map +1 -1
- package/package.json +7 -3
- package/src/api.ts +13 -2
- package/src/core/AudioRecorder.ts +81 -0
- package/src/hooks/useSytemVolume.ts +19 -0
- package/src/interfaces.ts +25 -11
- package/src/plugin/withAudioAPI.ts +91 -0
- package/src/specs/NativeAudioManagerModule.ts +13 -19
- package/src/system/AudioManager.ts +37 -87
- package/src/system/types.ts +43 -17
- package/src/types.ts +13 -0
- /package/src/errors/{NotSupportedError.tsx → NotSupportedError.ts} +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
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 _AnalyserNode = _interopRequireDefault(require("./AnalyserNode"));
|
|
9
|
+
var _AudioDestinationNode = _interopRequireDefault(require("./AudioDestinationNode"));
|
|
10
|
+
var _AudioBuffer = _interopRequireDefault(require("./AudioBuffer"));
|
|
11
|
+
var _AudioBufferSourceNode = _interopRequireDefault(require("./AudioBufferSourceNode"));
|
|
12
|
+
var _BiquadFilterNode = _interopRequireDefault(require("./BiquadFilterNode"));
|
|
13
|
+
var _GainNode = _interopRequireDefault(require("./GainNode"));
|
|
14
|
+
var _OscillatorNode = _interopRequireDefault(require("./OscillatorNode"));
|
|
15
|
+
var _PeriodicWave = _interopRequireDefault(require("./PeriodicWave"));
|
|
16
|
+
var _StereoPannerNode = _interopRequireDefault(require("./StereoPannerNode"));
|
|
17
|
+
var _LoadCustomWasm = require("./custom/LoadCustomWasm");
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
+
class OfflineAudioContext {
|
|
20
|
+
constructor(arg0, arg1, arg2) {
|
|
21
|
+
if (typeof arg0 === 'object') {
|
|
22
|
+
this.context = new window.OfflineAudioContext(arg0);
|
|
23
|
+
} else if (typeof arg0 === 'number' && typeof arg1 === 'number' && typeof arg2 === 'number') {
|
|
24
|
+
this.context = new window.OfflineAudioContext(arg0, arg1, arg2);
|
|
25
|
+
} else {
|
|
26
|
+
throw new _errors.NotSupportedError('Invalid constructor arguments');
|
|
27
|
+
}
|
|
28
|
+
this.sampleRate = this.context.sampleRate;
|
|
29
|
+
this.destination = new _AudioDestinationNode.default(this, this.context.destination);
|
|
30
|
+
}
|
|
31
|
+
get currentTime() {
|
|
32
|
+
return this.context.currentTime;
|
|
33
|
+
}
|
|
34
|
+
get state() {
|
|
35
|
+
return this.context.state;
|
|
36
|
+
}
|
|
37
|
+
createOscillator() {
|
|
38
|
+
return new _OscillatorNode.default(this, this.context.createOscillator());
|
|
39
|
+
}
|
|
40
|
+
createGain() {
|
|
41
|
+
return new _GainNode.default(this, this.context.createGain());
|
|
42
|
+
}
|
|
43
|
+
createStereoPanner() {
|
|
44
|
+
return new _StereoPannerNode.default(this, this.context.createStereoPanner());
|
|
45
|
+
}
|
|
46
|
+
createBiquadFilter() {
|
|
47
|
+
return new _BiquadFilterNode.default(this, this.context.createBiquadFilter());
|
|
48
|
+
}
|
|
49
|
+
async createBufferSource(options) {
|
|
50
|
+
if (!options || !options.pitchCorrection) {
|
|
51
|
+
return new _AudioBufferSourceNode.default(this, this.context.createBufferSource(), false);
|
|
52
|
+
}
|
|
53
|
+
await _LoadCustomWasm.globalWasmPromise;
|
|
54
|
+
const wasmStretch = await window[_LoadCustomWasm.globalTag](this.context);
|
|
55
|
+
return new _AudioBufferSourceNode.default(this, wasmStretch, true);
|
|
56
|
+
}
|
|
57
|
+
createBuffer(numOfChannels, length, sampleRate) {
|
|
58
|
+
if (numOfChannels < 1 || numOfChannels >= 32) {
|
|
59
|
+
throw new _errors.NotSupportedError(`The number of channels provided (${numOfChannels}) is outside the range [1, 32]`);
|
|
60
|
+
}
|
|
61
|
+
if (length <= 0) {
|
|
62
|
+
throw new _errors.NotSupportedError(`The number of frames provided (${length}) is less than or equal to the minimum bound (0)`);
|
|
63
|
+
}
|
|
64
|
+
if (sampleRate < 8000 || sampleRate > 96000) {
|
|
65
|
+
throw new _errors.NotSupportedError(`The sample rate provided (${sampleRate}) is outside the range [8000, 96000]`);
|
|
66
|
+
}
|
|
67
|
+
return new _AudioBuffer.default(this.context.createBuffer(numOfChannels, length, sampleRate));
|
|
68
|
+
}
|
|
69
|
+
createPeriodicWave(real, imag, constraints) {
|
|
70
|
+
if (real.length !== imag.length) {
|
|
71
|
+
throw new _errors.InvalidAccessError(`The lengths of the real (${real.length}) and imaginary (${imag.length}) arrays must match.`);
|
|
72
|
+
}
|
|
73
|
+
return new _PeriodicWave.default(this.context.createPeriodicWave(real, imag, constraints));
|
|
74
|
+
}
|
|
75
|
+
createAnalyser() {
|
|
76
|
+
return new _AnalyserNode.default(this, this.context.createAnalyser());
|
|
77
|
+
}
|
|
78
|
+
async decodeAudioDataSource(source) {
|
|
79
|
+
const arrayBuffer = await fetch(source).then(response => response.arrayBuffer());
|
|
80
|
+
return this.decodeAudioData(arrayBuffer);
|
|
81
|
+
}
|
|
82
|
+
async decodeAudioData(arrayBuffer) {
|
|
83
|
+
return new _AudioBuffer.default(await this.context.decodeAudioData(arrayBuffer));
|
|
84
|
+
}
|
|
85
|
+
async startRendering() {
|
|
86
|
+
return new _AudioBuffer.default(await this.context.startRendering());
|
|
87
|
+
}
|
|
88
|
+
async resume() {
|
|
89
|
+
await this.context.resume();
|
|
90
|
+
}
|
|
91
|
+
async suspend(suspendTime) {
|
|
92
|
+
await this.context.suspend(suspendTime);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.default = OfflineAudioContext;
|
|
96
|
+
//# sourceMappingURL=OfflineAudioContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_errors","require","_AnalyserNode","_interopRequireDefault","_AudioDestinationNode","_AudioBuffer","_AudioBufferSourceNode","_BiquadFilterNode","_GainNode","_OscillatorNode","_PeriodicWave","_StereoPannerNode","_LoadCustomWasm","e","__esModule","default","OfflineAudioContext","constructor","arg0","arg1","arg2","context","window","NotSupportedError","sampleRate","destination","AudioDestinationNode","currentTime","state","createOscillator","OscillatorNode","createGain","GainNode","createStereoPanner","StereoPannerNode","createBiquadFilter","BiquadFilterNode","createBufferSource","options","pitchCorrection","AudioBufferSourceNode","globalWasmPromise","wasmStretch","globalTag","createBuffer","numOfChannels","length","AudioBuffer","createPeriodicWave","real","imag","constraints","InvalidAccessError","PeriodicWave","createAnalyser","AnalyserNode","decodeAudioDataSource","source","arrayBuffer","fetch","then","response","decodeAudioData","startRendering","resume","suspend","suspendTime","exports"],"sourceRoot":"../../../src","sources":["web-core/OfflineAudioContext.tsx"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
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 _AudioScheduledSourceNode = _interopRequireDefault(require("./AudioScheduledSourceNode"));
|
|
9
|
+
var _AudioParam = _interopRequireDefault(require("./AudioParam"));
|
|
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.detune = new _AudioParam.default(node.detune);
|
|
15
|
+
this.frequency = new _AudioParam.default(node.frequency);
|
|
16
|
+
}
|
|
17
|
+
get type() {
|
|
18
|
+
return this.node.type;
|
|
19
|
+
}
|
|
20
|
+
set type(value) {
|
|
21
|
+
if (value === 'custom') {
|
|
22
|
+
throw new _errors.InvalidStateError("'type' cannot be set directly to 'custom'. Use setPeriodicWave() to create a custom Oscillator type.");
|
|
23
|
+
}
|
|
24
|
+
this.node.type = value;
|
|
25
|
+
}
|
|
26
|
+
setPeriodicWave(wave) {
|
|
27
|
+
this.node.setPeriodicWave(wave.periodicWave);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.default = OscillatorNode;
|
|
31
|
+
//# sourceMappingURL=OscillatorNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_errors","require","_AudioScheduledSourceNode","_interopRequireDefault","_AudioParam","e","__esModule","default","OscillatorNode","AudioScheduledSourceNode","constructor","context","node","detune","AudioParam","frequency","type","value","InvalidStateError","setPeriodicWave","wave","periodicWave","exports"],"sourceRoot":"../../../src","sources":["web-core/OscillatorNode.tsx"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,yBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AAAsC,SAAAE,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGvB,MAAMG,cAAc,SAASC,iCAAwB,CAAC;EAInEC,WAAWA,CAACC,OAAyB,EAAEC,IAA+B,EAAE;IACtE,KAAK,CAACD,OAAO,EAAEC,IAAI,CAAC;IAEpB,IAAI,CAACC,MAAM,GAAG,IAAIC,mBAAU,CAACF,IAAI,CAACC,MAAM,CAAC;IACzC,IAAI,CAACE,SAAS,GAAG,IAAID,mBAAU,CAACF,IAAI,CAACG,SAAS,CAAC;EACjD;EAEA,IAAWC,IAAIA,CAAA,EAAmB;IAChC,OAAQ,IAAI,CAACJ,IAAI,CAA+BI,IAAI;EACtD;EAEA,IAAWA,IAAIA,CAACC,KAAqB,EAAE;IACrC,IAAIA,KAAK,KAAK,QAAQ,EAAE;MACtB,MAAM,IAAIC,yBAAiB,CACzB,uGACF,CAAC;IACH;IAEC,IAAI,CAACN,IAAI,CAA+BI,IAAI,GAAGC,KAAK;EACvD;EAEOE,eAAeA,CAACC,IAAkB,EAAQ;IAC9C,IAAI,CAACR,IAAI,CAA+BO,eAAe,CAACC,IAAI,CAACC,YAAY,CAAC;EAC7E;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":["web-core/PeriodicWave.tsx"],"mappings":";;;;;;AAAe,MAAMA,YAAY,CAAC;EAChC;;EAGAC,WAAWA,CAACC,YAAqC,EAAE;IACjD,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":["web-core/StereoPannerNode.tsx"],"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;AAEvB,MAAMG,gBAAgB,SAASC,kBAAS,CAAC;EAGtDC,WAAWA,CAACC,OAAyB,EAAEC,GAAgC,EAAE;IACvE,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,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.globalWasmPromise = exports.globalTag = exports.default = void 0;
|
|
7
|
+
const globalTag = exports.globalTag = '__rnaaCstStretch';
|
|
8
|
+
const eventTitle = 'rnaaCstStretchLoaded';
|
|
9
|
+
let globalWasmPromise = exports.globalWasmPromise = null;
|
|
10
|
+
const LoadCustomWasm = async () => {
|
|
11
|
+
if (typeof window === 'undefined') {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
if (globalWasmPromise) {
|
|
15
|
+
return globalWasmPromise;
|
|
16
|
+
}
|
|
17
|
+
exports.globalWasmPromise = globalWasmPromise = new Promise(resolve => {
|
|
18
|
+
const loadScript = document.createElement('script');
|
|
19
|
+
document.head.appendChild(loadScript);
|
|
20
|
+
loadScript.type = 'module';
|
|
21
|
+
loadScript.textContent = `
|
|
22
|
+
import SignalsmithStretch from '/signalsmithStretch.mjs';
|
|
23
|
+
window.${globalTag} = SignalsmithStretch;
|
|
24
|
+
window.postMessage('${eventTitle}');
|
|
25
|
+
`;
|
|
26
|
+
function onScriptLoaded(event) {
|
|
27
|
+
if (event.data !== eventTitle) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
resolve();
|
|
31
|
+
window.removeEventListener('message', onScriptLoaded);
|
|
32
|
+
}
|
|
33
|
+
window.addEventListener('message', onScriptLoaded);
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
var _default = exports.default = LoadCustomWasm;
|
|
37
|
+
//# sourceMappingURL=LoadCustomWasm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["globalTag","exports","eventTitle","globalWasmPromise","LoadCustomWasm","window","Promise","resolve","loadScript","document","createElement","head","appendChild","type","textContent","onScriptLoaded","event","data","removeEventListener","addEventListener","_default","default"],"sourceRoot":"../../../../src","sources":["web-core/custom/LoadCustomWasm.ts"],"mappings":";;;;;;AAAO,MAAMA,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG,kBAAkB;AAC3C,MAAME,UAAU,GAAG,sBAAsB;AAElC,IAAIC,iBAAuC,GAAAF,OAAA,CAAAE,iBAAA,GAAG,IAAI;AAEzD,MAAMC,cAAc,GAAG,MAAAA,CAAA,KAAY;EACjC,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;IACjC,OAAO,IAAI;EACb;EAEA,IAAIF,iBAAiB,EAAE;IACrB,OAAOA,iBAAiB;EAC1B;EAEAF,OAAA,CAAAE,iBAAA,GAAAA,iBAAiB,GAAG,IAAIG,OAAO,CAAQC,OAAO,IAAK;IACjD,MAAMC,UAAU,GAAGC,QAAQ,CAACC,aAAa,CAAC,QAAQ,CAAC;IACnDD,QAAQ,CAACE,IAAI,CAACC,WAAW,CAACJ,UAAU,CAAC;IACrCA,UAAU,CAACK,IAAI,GAAG,QAAQ;IAE1BL,UAAU,CAACM,WAAW,GAAG;AAC7B;AACA,eAAed,SAAS;AACxB,4BAA4BE,UAAU;AACtC,KAAK;IAED,SAASa,cAAcA,CAACC,KAA2B,EAAE;MACnD,IAAIA,KAAK,CAACC,IAAI,KAAKf,UAAU,EAAE;QAC7B;MACF;MAEAK,OAAO,CAAC,CAAC;MACTF,MAAM,CAACa,mBAAmB,CAAC,SAAS,EAAEH,cAAc,CAAC;IACvD;IAEAV,MAAM,CAACc,gBAAgB,CAAC,SAAS,EAAEJ,cAAc,CAAC;EACpD,CAAC,CAAC;AACJ,CAAC;AAAC,IAAAK,QAAA,GAAAnB,OAAA,CAAAoB,OAAA,GAEajB,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "LoadCustomWasm", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _LoadCustomWasm.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _LoadCustomWasm = _interopRequireDefault(require("./LoadCustomWasm"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_LoadCustomWasm","_interopRequireDefault","require","e","__esModule","default"],"sourceRoot":"../../../../src","sources":["web-core/custom/index.ts"],"mappings":";;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA6D,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Geraint Luff / Signalsmith Audio Ltd.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Signalsmith Stretch Web
|
|
2
|
+
|
|
3
|
+
This is an official release of the Signalsmith Stretch library for Web Audio, using WASM/AudioWorklet. It includes both plain `.js` (UMD), and ES6 `.mjs` versions.
|
|
4
|
+
|
|
5
|
+
## How to use it
|
|
6
|
+
|
|
7
|
+
Call `SignalsmithStretch(audioContext, ?channelOptions)` from the main thread. This returns a Promise which resolves to an `AudioNode`, with extra methods attached to it.
|
|
8
|
+
|
|
9
|
+
It can operate either on live/streaming input, or on a sample buffer you load into it.
|
|
10
|
+
|
|
11
|
+
### `stretch.inputTime`
|
|
12
|
+
|
|
13
|
+
The current input time, within the sample buffer. You can change how often this is updated, with an optional callback function, using `stretch.setUpdateInterval(seconds, ?callback)`.
|
|
14
|
+
|
|
15
|
+
### `stretch.schedule({...})`
|
|
16
|
+
|
|
17
|
+
This adds a scheduled change, removing any scheduled changes occurring after this one. The object properties are:
|
|
18
|
+
|
|
19
|
+
- `output` (seconds): audio context time for this change. The node compensates for its own latency, but this means you might want to schedule some things ahead of time, otherwise you'll have a softer transition as it catches up.
|
|
20
|
+
- `active` (bool): processing audio
|
|
21
|
+
- `input` (seconds): position in input buffer
|
|
22
|
+
- `rate` (number): playback rate, e.g. 0.5 == half speed
|
|
23
|
+
- `semitones` (number): pitch shift
|
|
24
|
+
- `loopStart` / `loopEnd`: sets a section of the input to auto-loop. Disabled if both are set to the same value.
|
|
25
|
+
|
|
26
|
+
### `stretch.start(?when)` / `stretch.stop(?when)`
|
|
27
|
+
|
|
28
|
+
Starts/stops playback or processing, immediately or at some future time. These are convenience methods which call `.schedule(...)` under the hood.
|
|
29
|
+
|
|
30
|
+
`.start()` actually has more parameters, presenting a similar interface to [AudioBufferSourceNode](https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode/start).
|
|
31
|
+
|
|
32
|
+
### `stretch.addBuffers([...])`
|
|
33
|
+
|
|
34
|
+
This adds buffers to the end of the current input. Buffers should be typed arrays of equal length, one per channel.
|
|
35
|
+
|
|
36
|
+
It can be called multiple times, and the new buffers are inserted after the existing ones, which lets you start playback before the entire audio is loaded. It returns (as a Promise) the new end time for the stored input, in seconds.
|
|
37
|
+
|
|
38
|
+
### `stretch.dropBuffers()`
|
|
39
|
+
|
|
40
|
+
This drops all input buffers, and resets the input buffer start time to 0.
|
|
41
|
+
|
|
42
|
+
### `stretch.dropBuffers(toSeconds)`
|
|
43
|
+
|
|
44
|
+
This drops all input buffers before the given time. It returns (as a Promise) the an object with the current input buffer extent: `{start: ..., end: ...}`.
|
|
45
|
+
|
|
46
|
+
This can be useful when processing streams or very long audio files, letting the Stretch node release old buffers once that section of the input will no longer be played back.
|