react-native-audio-api 0.7.0-nightly-a21e1f4-20250728 → 0.7.0-nightly-a914864-20250729
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 +3 -4
- package/common/cpp/audioapi/HostObjects/AudioNodeHostObject.cpp +9 -0
- package/common/cpp/audioapi/HostObjects/AudioNodeHostObject.h +2 -0
- package/common/cpp/audioapi/HostObjects/BaseAudioContextHostObject.cpp +9 -0
- package/common/cpp/audioapi/HostObjects/BaseAudioContextHostObject.h +10 -16
- package/common/cpp/audioapi/core/BaseAudioContext.cpp +2 -10
- package/common/cpp/audioapi/core/BaseAudioContext.h +0 -2
- package/lib/commonjs/api.js +0 -7
- package/lib/commonjs/api.js.map +1 -1
- package/lib/commonjs/core/BaseAudioContext.js +0 -4
- package/lib/commonjs/core/BaseAudioContext.js.map +1 -1
- package/lib/module/api.js +0 -1
- package/lib/module/api.js.map +1 -1
- package/lib/module/core/BaseAudioContext.js +0 -4
- package/lib/module/core/BaseAudioContext.js.map +1 -1
- package/lib/typescript/api.d.ts +0 -1
- package/lib/typescript/api.d.ts.map +1 -1
- package/lib/typescript/core/BaseAudioContext.d.ts +1 -3
- package/lib/typescript/core/BaseAudioContext.d.ts.map +1 -1
- package/lib/typescript/interfaces.d.ts +1 -6
- package/lib/typescript/interfaces.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api.ts +0 -1
- package/src/core/BaseAudioContext.ts +1 -9
- package/src/interfaces.ts +0 -7
- package/common/cpp/audioapi/HostObjects/CustomProcessorNodeHostObject.h +0 -54
- package/common/cpp/audioapi/core/effects/CustomProcessorNode.cpp +0 -173
- package/common/cpp/audioapi/core/effects/CustomProcessorNode.h +0 -186
- package/lib/commonjs/core/CustomProcessorNode.js +0 -23
- package/lib/commonjs/core/CustomProcessorNode.js.map +0 -1
- package/lib/module/core/CustomProcessorNode.js +0 -17
- package/lib/module/core/CustomProcessorNode.js.map +0 -1
- package/lib/typescript/core/CustomProcessorNode.d.ts +0 -12
- package/lib/typescript/core/CustomProcessorNode.d.ts.map +0 -1
- package/src/core/CustomProcessorNode.ts +0 -28
package/README.md
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
### High-performance audio engine for React Native based on web audio api specification
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/react-native-audio-api)
|
|
6
|
-
[](https://www.npmjs.com/package/react-native-audio-api?activeTab=versions)
|
|
7
6
|
[](https://www.npmjs.com/package/react-native-audio-api?activeTab=versions)
|
|
8
7
|
[](https://github.com/software-mansion/react-native-audio-api/actions/workflows/ci.yml)
|
|
9
8
|
[](https://github.com/software-mansion/react-native-audio-api/actions/workflows/npm-publish-nightly.yml)
|
|
@@ -40,12 +39,12 @@ check out the [Getting Started](https://docs.swmansion.com/react-native-audio-ap
|
|
|
40
39
|
- <sub>[](https://github.com/software-mansion/react-native-audio-api/releases/tag/0.6.0)</sub> **System configuration** 🛠️ <br />
|
|
41
40
|
Full control of system audio settings, remote controls, lock screen integration and most importantly configurable background modes <br />
|
|
42
41
|
|
|
42
|
+
- <sub>[](https://github.com/software-mansion/react-native-audio-api/releases/tag/0.6.0)</sub> **Connect audio param** 🤞 <br />
|
|
43
|
+
Ability to connect Audio nodes to audio params, which will allow for powerful and efficient modulation of audio parameters, creating effects like tremolo, vibrato or complex envelope followers. <br />
|
|
44
|
+
|
|
43
45
|
- **Microphone support** 🎙️ <br />
|
|
44
46
|
Grab audio data from device microphone or connected device, connect it to the audio graph or stream through the internet <br />
|
|
45
47
|
|
|
46
|
-
- **Connect audio param** 🤞 <br />
|
|
47
|
-
Ability to connect Audio nodes to audio params, which will allow for powerful and efficient modulation of audio parameters, creating effects like tremolo, vibrato or complex envelope followers. <br />
|
|
48
|
-
|
|
49
48
|
- **JS Audio Worklets** 🐎 <br />
|
|
50
49
|
Ability to run JS functions connected to the audio graph running on audio thread allowing for full customization of what happens to the audio signal.
|
|
51
50
|
<br />
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#include <audioapi/HostObjects/AudioNodeHostObject.h>
|
|
2
|
+
|
|
3
|
+
// Explicitly define destructors here, as they to exist in order to act as a
|
|
4
|
+
// "key function" for the audio classes - this allow for RTTI to work
|
|
5
|
+
// properly across dynamic library boundaries (i.e. dynamic_cast that is used by
|
|
6
|
+
// isHostObject method), android specific issue
|
|
7
|
+
namespace audioapi {
|
|
8
|
+
AudioNodeHostObject::~AudioNodeHostObject() = default;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#include <audioapi/HostObjects/BaseAudioContextHostObject.h>
|
|
2
|
+
|
|
3
|
+
// Explicitly define destructors here, as they to exist in order to act as a
|
|
4
|
+
// "key function" for the audio classes - this allow for RTTI to work
|
|
5
|
+
// properly across dynamic library boundaries (i.e. dynamic_cast that is used by
|
|
6
|
+
// isHostObject method), android specific issue
|
|
7
|
+
namespace audioapi {
|
|
8
|
+
BaseAudioContextHostObject::~BaseAudioContextHostObject() = default;
|
|
9
|
+
}
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
#include <audioapi/HostObjects/AudioDestinationNodeHostObject.h>
|
|
9
9
|
#include <audioapi/core/BaseAudioContext.h>
|
|
10
10
|
#include <audioapi/HostObjects/BiquadFilterNodeHostObject.h>
|
|
11
|
-
#include <audioapi/HostObjects/CustomProcessorNodeHostObject.h>
|
|
12
11
|
#include <audioapi/HostObjects/GainNodeHostObject.h>
|
|
13
12
|
#include <audioapi/HostObjects/OscillatorNodeHostObject.h>
|
|
14
13
|
#include <audioapi/HostObjects/PeriodicWaveHostObject.h>
|
|
@@ -43,7 +42,6 @@ class BaseAudioContextHostObject : public JsiHostObject {
|
|
|
43
42
|
addFunctions(
|
|
44
43
|
JSI_EXPORT_FUNCTION(BaseAudioContextHostObject, createRecorderAdapter),
|
|
45
44
|
JSI_EXPORT_FUNCTION(BaseAudioContextHostObject, createOscillator),
|
|
46
|
-
JSI_EXPORT_FUNCTION(BaseAudioContextHostObject, createCustomProcessor),
|
|
47
45
|
JSI_EXPORT_FUNCTION(BaseAudioContextHostObject, createGain),
|
|
48
46
|
JSI_EXPORT_FUNCTION(BaseAudioContextHostObject, createStereoPanner),
|
|
49
47
|
JSI_EXPORT_FUNCTION(BaseAudioContextHostObject, createBiquadFilter),
|
|
@@ -57,6 +55,8 @@ class BaseAudioContextHostObject : public JsiHostObject {
|
|
|
57
55
|
JSI_EXPORT_FUNCTION(BaseAudioContextHostObject, decodePCMAudioDataInBase64));
|
|
58
56
|
}
|
|
59
57
|
|
|
58
|
+
~BaseAudioContextHostObject() override;
|
|
59
|
+
|
|
60
60
|
JSI_PROPERTY_GETTER(destination) {
|
|
61
61
|
auto destination = std::make_shared<AudioDestinationNodeHostObject>(
|
|
62
62
|
context_->getDestination());
|
|
@@ -88,13 +88,6 @@ class BaseAudioContextHostObject : public JsiHostObject {
|
|
|
88
88
|
return jsi::Object::createFromHostObject(runtime, oscillatorHostObject);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
JSI_HOST_FUNCTION(createCustomProcessor) {
|
|
92
|
-
auto identifier = args[0].getString(runtime).utf8(runtime);
|
|
93
|
-
auto customProcessor = context_->createCustomProcessor(identifier);
|
|
94
|
-
auto customProcessorHostObject = std::make_shared<CustomProcessorNodeHostObject>(customProcessor);
|
|
95
|
-
return jsi::Object::createFromHostObject(runtime, customProcessorHostObject);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
91
|
JSI_HOST_FUNCTION(createGain) {
|
|
99
92
|
auto gain = context_->createGain();
|
|
100
93
|
auto gainHostObject = std::make_shared<GainNodeHostObject>(gain);
|
|
@@ -123,12 +116,12 @@ class BaseAudioContextHostObject : public JsiHostObject {
|
|
|
123
116
|
return jsi::Object::createFromHostObject(runtime, bufferSourceHostObject);
|
|
124
117
|
}
|
|
125
118
|
|
|
126
|
-
JSI_HOST_FUNCTION(createBufferQueueSource) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
119
|
+
JSI_HOST_FUNCTION(createBufferQueueSource) {
|
|
120
|
+
auto bufferSource = context_->createBufferQueueSource();
|
|
121
|
+
auto bufferStreamSourceHostObject =
|
|
122
|
+
std::make_shared<AudioBufferQueueSourceNodeHostObject>(bufferSource);
|
|
123
|
+
return jsi::Object::createFromHostObject(runtime, bufferStreamSourceHostObject);
|
|
124
|
+
}
|
|
132
125
|
|
|
133
126
|
JSI_HOST_FUNCTION(createBuffer) {
|
|
134
127
|
auto numberOfChannels = static_cast<int>(args[0].getNumber());
|
|
@@ -253,8 +246,9 @@ JSI_HOST_FUNCTION(createBufferQueueSource) {
|
|
|
253
246
|
return promise;
|
|
254
247
|
}
|
|
255
248
|
|
|
249
|
+
std::shared_ptr<BaseAudioContext> context_;
|
|
250
|
+
|
|
256
251
|
protected:
|
|
257
|
-
std::shared_ptr<BaseAudioContext> context_;
|
|
258
252
|
std::shared_ptr<PromiseVendor> promiseVendor_;
|
|
259
253
|
std::shared_ptr<react::CallInvoker> callInvoker_;
|
|
260
254
|
};
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
#include <audioapi/core/analysis/AnalyserNode.h>
|
|
3
3
|
#include <audioapi/core/destinations/AudioDestinationNode.h>
|
|
4
4
|
#include <audioapi/core/effects/BiquadFilterNode.h>
|
|
5
|
-
#include <audioapi/core/effects/CustomProcessorNode.h>
|
|
6
5
|
#include <audioapi/core/effects/GainNode.h>
|
|
7
6
|
#include <audioapi/core/effects/StereoPannerNode.h>
|
|
8
7
|
#include <audioapi/core/sources/AudioBuffer.h>
|
|
@@ -62,14 +61,6 @@ std::shared_ptr<OscillatorNode> BaseAudioContext::createOscillator() {
|
|
|
62
61
|
return oscillator;
|
|
63
62
|
}
|
|
64
63
|
|
|
65
|
-
std::shared_ptr<CustomProcessorNode> BaseAudioContext::createCustomProcessor(
|
|
66
|
-
const std::string &identifier) {
|
|
67
|
-
auto customProcessor =
|
|
68
|
-
std::make_shared<CustomProcessorNode>(this, identifier);
|
|
69
|
-
nodeManager_->addProcessingNode(customProcessor);
|
|
70
|
-
return customProcessor;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
64
|
std::shared_ptr<GainNode> BaseAudioContext::createGain() {
|
|
74
65
|
auto gain = std::make_shared<GainNode>(this);
|
|
75
66
|
nodeManager_->addProcessingNode(gain);
|
|
@@ -148,7 +139,8 @@ std::shared_ptr<AudioBuffer> BaseAudioContext::decodeAudioData(
|
|
|
148
139
|
}
|
|
149
140
|
|
|
150
141
|
std::shared_ptr<AudioBuffer> BaseAudioContext::decodeWithPCMInBase64(
|
|
151
|
-
const std::string &data,
|
|
142
|
+
const std::string &data,
|
|
143
|
+
float playbackSpeed) {
|
|
152
144
|
auto audioBus = audioDecoder_->decodeWithPCMInBase64(data, playbackSpeed);
|
|
153
145
|
|
|
154
146
|
if (!audioBus) {
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
namespace audioapi {
|
|
17
17
|
|
|
18
18
|
class AudioBus;
|
|
19
|
-
class CustomProcessorNode;
|
|
20
19
|
class GainNode;
|
|
21
20
|
class AudioBuffer;
|
|
22
21
|
class PeriodicWave;
|
|
@@ -46,7 +45,6 @@ class BaseAudioContext {
|
|
|
46
45
|
|
|
47
46
|
std::shared_ptr<RecorderAdapterNode> createRecorderAdapter();
|
|
48
47
|
std::shared_ptr<OscillatorNode> createOscillator();
|
|
49
|
-
std::shared_ptr<CustomProcessorNode> createCustomProcessor(const std::string& identifier);
|
|
50
48
|
std::shared_ptr<GainNode> createGain();
|
|
51
49
|
std::shared_ptr<StereoPannerNode> createStereoPanner();
|
|
52
50
|
std::shared_ptr<BiquadFilterNode> createBiquadFilter();
|
package/lib/commonjs/api.js
CHANGED
|
@@ -105,12 +105,6 @@ Object.defineProperty(exports, "ContextState", {
|
|
|
105
105
|
return _types.ContextState;
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
|
-
Object.defineProperty(exports, "CustomProcessorNode", {
|
|
109
|
-
enumerable: true,
|
|
110
|
-
get: function () {
|
|
111
|
-
return _CustomProcessorNode.default;
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
108
|
Object.defineProperty(exports, "GainNode", {
|
|
115
109
|
enumerable: true,
|
|
116
110
|
get: function () {
|
|
@@ -209,7 +203,6 @@ var _AudioParam = _interopRequireDefault(require("./core/AudioParam"));
|
|
|
209
203
|
var _AudioScheduledSourceNode = _interopRequireDefault(require("./core/AudioScheduledSourceNode"));
|
|
210
204
|
var _BaseAudioContext = _interopRequireDefault(require("./core/BaseAudioContext"));
|
|
211
205
|
var _BiquadFilterNode = _interopRequireDefault(require("./core/BiquadFilterNode"));
|
|
212
|
-
var _CustomProcessorNode = _interopRequireDefault(require("./core/CustomProcessorNode"));
|
|
213
206
|
var _GainNode = _interopRequireDefault(require("./core/GainNode"));
|
|
214
207
|
var _OscillatorNode = _interopRequireDefault(require("./core/OscillatorNode"));
|
|
215
208
|
var _StereoPannerNode = _interopRequireDefault(require("./core/StereoPannerNode"));
|
package/lib/commonjs/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_specs","require","_RecorderAdapterNode","_interopRequireDefault","_AudioBuffer","_AudioBufferSourceNode","_AudioBufferQueueSourceNode","_AudioContext","_OfflineAudioContext","_AudioDestinationNode","_AudioNode","_AnalyserNode","_AudioParam","_AudioScheduledSourceNode","_BaseAudioContext","_BiquadFilterNode","
|
|
1
|
+
{"version":3,"names":["_specs","require","_RecorderAdapterNode","_interopRequireDefault","_AudioBuffer","_AudioBufferSourceNode","_AudioBufferQueueSourceNode","_AudioContext","_OfflineAudioContext","_AudioDestinationNode","_AudioNode","_AnalyserNode","_AudioParam","_AudioScheduledSourceNode","_BaseAudioContext","_BiquadFilterNode","_GainNode","_OscillatorNode","_StereoPannerNode","_AudioRecorder","_system","_useSytemVolume","_types","_errors","e","__esModule","default","global","createAudioContext","createOfflineAudioContext","createAudioRecorder","AudioEventEmitter","NativeAudioAPIModule","Error","install"],"sourceRoot":"../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,GAAAtB,OAAA;AAMkB,SAAAE,uBAAAqB,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AArElB;;AAgBA;;AAEA,IACEG,MAAM,CAACC,kBAAkB,IAAI,IAAI,IACjCD,MAAM,CAACE,yBAAyB,IAAI,IAAI,IACxCF,MAAM,CAACG,mBAAmB,IAAI,IAAI,IAClCH,MAAM,CAACI,iBAAiB,IAAI,IAAI,EAChC;EACA,IAAI,CAACC,2BAAoB,EAAE;IACzB,MAAM,IAAIC,KAAK,CACb,iFACF,CAAC;EACH;EAEAD,2BAAoB,CAACE,OAAO,CAAC,CAAC;AAChC","ignoreList":[]}
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _AudioDestinationNode = _interopRequireDefault(require("./AudioDestinationNode"));
|
|
8
8
|
var _OscillatorNode = _interopRequireDefault(require("./OscillatorNode"));
|
|
9
|
-
var _CustomProcessorNode = _interopRequireDefault(require("./CustomProcessorNode"));
|
|
10
9
|
var _GainNode = _interopRequireDefault(require("./GainNode"));
|
|
11
10
|
var _StereoPannerNode = _interopRequireDefault(require("./StereoPannerNode"));
|
|
12
11
|
var _BiquadFilterNode = _interopRequireDefault(require("./BiquadFilterNode"));
|
|
@@ -36,9 +35,6 @@ class BaseAudioContext {
|
|
|
36
35
|
createOscillator() {
|
|
37
36
|
return new _OscillatorNode.default(this, this.context.createOscillator());
|
|
38
37
|
}
|
|
39
|
-
createCustomProcessor(identifier) {
|
|
40
|
-
return new _CustomProcessorNode.default(this, this.context.createCustomProcessor(identifier));
|
|
41
|
-
}
|
|
42
38
|
createGain() {
|
|
43
39
|
return new _GainNode.default(this, this.context.createGain());
|
|
44
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_AudioDestinationNode","_interopRequireDefault","require","_OscillatorNode","
|
|
1
|
+
{"version":3,"names":["_AudioDestinationNode","_interopRequireDefault","require","_OscillatorNode","_GainNode","_StereoPannerNode","_BiquadFilterNode","_AudioBufferSourceNode","_AudioBuffer","_PeriodicWave","_AnalyserNode","_AudioBufferQueueSourceNode","_errors","_RecorderAdapterNode","e","__esModule","default","BaseAudioContext","constructor","context","destination","AudioDestinationNode","sampleRate","currentTime","state","createRecorderAdapter","RecorderAdapterNode","createOscillator","OscillatorNode","createGain","GainNode","createStereoPanner","StereoPannerNode","createBiquadFilter","BiquadFilterNode","createBufferSource","options","pitchCorrection","AudioBufferSourceNode","createBufferQueueSource","AudioBufferQueueSourceNode","createBuffer","numOfChannels","length","NotSupportedError","AudioBuffer","createPeriodicWave","real","imag","constraints","InvalidAccessError","disableNormalization","PeriodicWave","createAnalyser","AnalyserNode","decodeAudioDataSource","sourcePath","startsWith","replace","decodeAudioData","data","Uint8Array","decodePCMInBase64Data","base64","playbackRate","decodePCMAudioDataInBase64","exports"],"sourceRoot":"../../../src","sources":["core/BaseAudioContext.ts"],"mappings":";;;;;;AAMA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,iBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,iBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,sBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,YAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,aAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,aAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,2BAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,oBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AAAwD,SAAAD,uBAAAa,CAAA,WAAAA,CAAA,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AEAE,cAAcA,CAAA,EAAiB;IAC7B,OAAO,IAAIC,qBAAY,CAAC,IAAI,EAAE,IAAI,CAACnC,OAAO,CAACkC,cAAc,CAAC,CAAC,CAAC;EAC9D;;EAEA;EACA,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,CAAC1B,OAAO,CAACoC,qBAAqB,CAACC,UAAU,CACrD,CAAC;EACH;;EAEA;EACA,MAAMG,eAAeA,CAACC,IAAiB,EAAwB;IAC7D,OAAO,IAAIf,oBAAW,CACpB,MAAM,IAAI,CAAC1B,OAAO,CAACwC,eAAe,CAAC,IAAIE,UAAU,CAACD,IAAI,CAAC,CACzD,CAAC;EACH;EAEA,MAAME,qBAAqBA,CACzBC,MAAc,EACdC,YAAoB,GAAG,GAAG,EACJ;IACtB,OAAO,IAAInB,oBAAW,CACpB,MAAM,IAAI,CAAC1B,OAAO,CAAC8C,0BAA0B,CAACF,MAAM,EAAEC,YAAY,CACpE,CAAC;EACH;AACF;AAACE,OAAA,CAAAlD,OAAA,GAAAC,gBAAA","ignoreList":[]}
|
package/lib/module/api.js
CHANGED
|
@@ -25,7 +25,6 @@ export { default as AudioParam } from "./core/AudioParam.js";
|
|
|
25
25
|
export { default as AudioScheduledSourceNode } from "./core/AudioScheduledSourceNode.js";
|
|
26
26
|
export { default as BaseAudioContext } from "./core/BaseAudioContext.js";
|
|
27
27
|
export { default as BiquadFilterNode } from "./core/BiquadFilterNode.js";
|
|
28
|
-
export { default as CustomProcessorNode } from "./core/CustomProcessorNode.js";
|
|
29
28
|
export { default as GainNode } from "./core/GainNode.js";
|
|
30
29
|
export { default as OscillatorNode } from "./core/OscillatorNode.js";
|
|
31
30
|
export { default as StereoPannerNode } from "./core/StereoPannerNode.js";
|
package/lib/module/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeAudioAPIModule","global","createAudioContext","createOfflineAudioContext","createAudioRecorder","AudioEventEmitter","Error","install","default","RecorderAdapterNode","AudioBuffer","AudioBufferSourceNode","AudioBufferQueueSourceNode","AudioContext","OfflineAudioContext","AudioDestinationNode","AudioNode","AnalyserNode","AudioParam","AudioScheduledSourceNode","BaseAudioContext","BiquadFilterNode","
|
|
1
|
+
{"version":3,"names":["NativeAudioAPIModule","global","createAudioContext","createOfflineAudioContext","createAudioRecorder","AudioEventEmitter","Error","install","default","RecorderAdapterNode","AudioBuffer","AudioBufferSourceNode","AudioBufferQueueSourceNode","AudioContext","OfflineAudioContext","AudioDestinationNode","AudioNode","AnalyserNode","AudioParam","AudioScheduledSourceNode","BaseAudioContext","BiquadFilterNode","GainNode","OscillatorNode","StereoPannerNode","AudioRecorder","AudioManager","useSystemVolume","OscillatorType","BiquadFilterType","ChannelCountMode","ChannelInterpretation","ContextState","WindowType","PeriodicWaveConstraints","IndexSizeError","InvalidAccessError","InvalidStateError","RangeError","NotSupportedError"],"sourceRoot":"../../src","sources":["api.ts"],"mappings":";;AAAA,SAASA,oBAAoB,QAAQ,kBAAS;;AAS9C;;AAgBA;;AAEA,IACEC,MAAM,CAACC,kBAAkB,IAAI,IAAI,IACjCD,MAAM,CAACE,yBAAyB,IAAI,IAAI,IACxCF,MAAM,CAACG,mBAAmB,IAAI,IAAI,IAClCH,MAAM,CAACI,iBAAiB,IAAI,IAAI,EAChC;EACA,IAAI,CAACL,oBAAoB,EAAE;IACzB,MAAM,IAAIM,KAAK,CACb,iFACF,CAAC;EACH;EAEAN,oBAAoB,CAACO,OAAO,CAAC,CAAC;AAChC;AAEA,SAASC,OAAO,IAAIC,mBAAmB,QAAQ,+BAA4B;AAC3E,SAASD,OAAO,IAAIE,WAAW,QAAQ,uBAAoB;AAC3D,SAASF,OAAO,IAAIG,qBAAqB,QAAQ,iCAA8B;AAC/E,SAASH,OAAO,IAAII,0BAA0B,QAAQ,sCAAmC;AACzF,SAASJ,OAAO,IAAIK,YAAY,QAAQ,wBAAqB;AAC7D,SAASL,OAAO,IAAIM,mBAAmB,QAAQ,+BAA4B;AAC3E,SAASN,OAAO,IAAIO,oBAAoB,QAAQ,gCAA6B;AAC7E,SAASP,OAAO,IAAIQ,SAAS,QAAQ,qBAAkB;AACvD,SAASR,OAAO,IAAIS,YAAY,QAAQ,wBAAqB;AAC7D,SAAST,OAAO,IAAIU,UAAU,QAAQ,sBAAmB;AACzD,SAASV,OAAO,IAAIW,wBAAwB,QAAQ,oCAAiC;AACrF,SAASX,OAAO,IAAIY,gBAAgB,QAAQ,4BAAyB;AACrE,SAASZ,OAAO,IAAIa,gBAAgB,QAAQ,4BAAyB;AACrE,SAASb,OAAO,IAAIc,QAAQ,QAAQ,oBAAiB;AACrD,SAASd,OAAO,IAAIe,cAAc,QAAQ,0BAAuB;AACjE,SAASf,OAAO,IAAIgB,gBAAgB,QAAQ,4BAAyB;AACrE,SAAShB,OAAO,IAAIiB,aAAa,QAAQ,yBAAsB;AAC/D,SAASjB,OAAO,IAAIkB,YAAY,QAAQ,mBAAU;AAClD,SAASlB,OAAO,IAAImB,eAAe,QAAQ,2BAAwB;AAEnE,SACEC,cAAc,EACdC,gBAAgB,EAChBC,gBAAgB,EAChBC,qBAAqB,EACrBC,YAAY,EACZC,UAAU,EACVC,uBAAuB,QAClB,YAAS;AAEhB,SACEC,cAAc,EACdC,kBAAkB,EAClBC,iBAAiB,EACjBC,UAAU,EACVC,iBAAiB,QACZ,mBAAU","ignoreList":[]}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import AudioDestinationNode from "./AudioDestinationNode.js";
|
|
4
4
|
import OscillatorNode from "./OscillatorNode.js";
|
|
5
|
-
import CustomProcessorNode from "./CustomProcessorNode.js";
|
|
6
5
|
import GainNode from "./GainNode.js";
|
|
7
6
|
import StereoPannerNode from "./StereoPannerNode.js";
|
|
8
7
|
import BiquadFilterNode from "./BiquadFilterNode.js";
|
|
@@ -31,9 +30,6 @@ export default class BaseAudioContext {
|
|
|
31
30
|
createOscillator() {
|
|
32
31
|
return new OscillatorNode(this, this.context.createOscillator());
|
|
33
32
|
}
|
|
34
|
-
createCustomProcessor(identifier) {
|
|
35
|
-
return new CustomProcessorNode(this, this.context.createCustomProcessor(identifier));
|
|
36
|
-
}
|
|
37
33
|
createGain() {
|
|
38
34
|
return new GainNode(this, this.context.createGain());
|
|
39
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AudioDestinationNode","OscillatorNode","
|
|
1
|
+
{"version":3,"names":["AudioDestinationNode","OscillatorNode","GainNode","StereoPannerNode","BiquadFilterNode","AudioBufferSourceNode","AudioBuffer","PeriodicWave","AnalyserNode","AudioBufferQueueSourceNode","InvalidAccessError","NotSupportedError","RecorderAdapterNode","BaseAudioContext","constructor","context","destination","sampleRate","currentTime","state","createRecorderAdapter","createOscillator","createGain","createStereoPanner","createBiquadFilter","createBufferSource","options","pitchCorrection","createBufferQueueSource","createBuffer","numOfChannels","length","createPeriodicWave","real","imag","constraints","disableNormalization","createAnalyser","decodeAudioDataSource","sourcePath","startsWith","replace","decodeAudioData","data","Uint8Array","decodePCMInBase64Data","base64","playbackRate","decodePCMAudioDataInBase64"],"sourceRoot":"../../../src","sources":["core/BaseAudioContext.ts"],"mappings":";;AAMA,OAAOA,oBAAoB,MAAM,2BAAwB;AACzD,OAAOC,cAAc,MAAM,qBAAkB;AAC7C,OAAOC,QAAQ,MAAM,eAAY;AACjC,OAAOC,gBAAgB,MAAM,uBAAoB;AACjD,OAAOC,gBAAgB,MAAM,uBAAoB;AACjD,OAAOC,qBAAqB,MAAM,4BAAyB;AAC3D,OAAOC,WAAW,MAAM,kBAAe;AACvC,OAAOC,YAAY,MAAM,mBAAgB;AACzC,OAAOC,YAAY,MAAM,mBAAgB;AACzC,OAAOC,0BAA0B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,oBAAoB,CAClE,CAAC;EACH;EAEAC,cAAcA,CAAA,EAAiB;IAC7B,OAAO,IAAI7B,YAAY,CAAC,IAAI,EAAE,IAAI,CAACO,OAAO,CAACsB,cAAc,CAAC,CAAC,CAAC;EAC9D;;EAEA;EACA,MAAMC,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,IAAInC,WAAW,CACpB,MAAM,IAAI,CAACS,OAAO,CAACuB,qBAAqB,CAACC,UAAU,CACrD,CAAC;EACH;;EAEA;EACA,MAAMG,eAAeA,CAACC,IAAiB,EAAwB;IAC7D,OAAO,IAAIrC,WAAW,CACpB,MAAM,IAAI,CAACS,OAAO,CAAC2B,eAAe,CAAC,IAAIE,UAAU,CAACD,IAAI,CAAC,CACzD,CAAC;EACH;EAEA,MAAME,qBAAqBA,CACzBC,MAAc,EACdC,YAAoB,GAAG,GAAG,EACJ;IACtB,OAAO,IAAIzC,WAAW,CACpB,MAAM,IAAI,CAACS,OAAO,CAACiC,0BAA0B,CAACF,MAAM,EAAEC,YAAY,CACpE,CAAC;EACH;AACF","ignoreList":[]}
|
package/lib/typescript/api.d.ts
CHANGED
|
@@ -19,7 +19,6 @@ export { default as AudioParam } from './core/AudioParam';
|
|
|
19
19
|
export { default as AudioScheduledSourceNode } from './core/AudioScheduledSourceNode';
|
|
20
20
|
export { default as BaseAudioContext } from './core/BaseAudioContext';
|
|
21
21
|
export { default as BiquadFilterNode } from './core/BiquadFilterNode';
|
|
22
|
-
export { default as CustomProcessorNode } from './core/CustomProcessorNode';
|
|
23
22
|
export { default as GainNode } from './core/GainNode';
|
|
24
23
|
export { default as OscillatorNode } from './core/OscillatorNode';
|
|
25
24
|
export { default as StereoPannerNode } from './core/StereoPannerNode';
|
|
@@ -1 +1 @@
|
|
|
1
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MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEpE,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,UAAU,EACV,uBAAuB,GACxB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,iBAAiB,GAClB,MAAM,UAAU,CAAC"}
|
|
@@ -2,7 +2,6 @@ import { IBaseAudioContext } from '../interfaces';
|
|
|
2
2
|
import { ContextState, PeriodicWaveConstraints, AudioBufferSourceNodeOptions } from '../types';
|
|
3
3
|
import AudioDestinationNode from './AudioDestinationNode';
|
|
4
4
|
import OscillatorNode from './OscillatorNode';
|
|
5
|
-
import CustomProcessorNode from './CustomProcessorNode';
|
|
6
5
|
import GainNode from './GainNode';
|
|
7
6
|
import StereoPannerNode from './StereoPannerNode';
|
|
8
7
|
import BiquadFilterNode from './BiquadFilterNode';
|
|
@@ -15,13 +14,12 @@ import RecorderAdapterNode from './RecorderAdapterNode';
|
|
|
15
14
|
export default class BaseAudioContext {
|
|
16
15
|
readonly destination: AudioDestinationNode;
|
|
17
16
|
readonly sampleRate: number;
|
|
18
|
-
|
|
17
|
+
readonly context: IBaseAudioContext;
|
|
19
18
|
constructor(context: IBaseAudioContext);
|
|
20
19
|
get currentTime(): number;
|
|
21
20
|
get state(): ContextState;
|
|
22
21
|
createRecorderAdapter(): RecorderAdapterNode;
|
|
23
22
|
createOscillator(): OscillatorNode;
|
|
24
|
-
createCustomProcessor(identifier: string): CustomProcessorNode;
|
|
25
23
|
createGain(): GainNode;
|
|
26
24
|
createStereoPanner(): StereoPannerNode;
|
|
27
25
|
createBiquadFilter(): BiquadFilterNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseAudioContext.d.ts","sourceRoot":"","sources":["../../../src/core/BaseAudioContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,4BAA4B,EAC7B,MAAM,UAAU,CAAC;AAClB,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,
|
|
1
|
+
{"version":3,"file":"BaseAudioContext.d.ts","sourceRoot":"","sources":["../../../src/core/BaseAudioContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,4BAA4B,EAC7B,MAAM,UAAU,CAAC;AAClB,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,cAAc,MAAM,kBAAkB,CAA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AW,GAAG,OAAO,CAAC,WAAW,CAAC;IAMxD,qBAAqB,CACzB,MAAM,EAAE,MAAM,EACd,YAAY,GAAE,MAAY,GACzB,OAAO,CAAC,WAAW,CAAC;CAKxB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WindowType, ContextState, OscillatorType, BiquadFilterType, ChannelCountMode, ChannelInterpretation
|
|
1
|
+
import { WindowType, ContextState, OscillatorType, BiquadFilterType, ChannelCountMode, ChannelInterpretation } from './types';
|
|
2
2
|
import { AudioEventName, AudioEventCallback } from './events/types';
|
|
3
3
|
export interface IBaseAudioContext {
|
|
4
4
|
readonly destination: IAudioDestinationNode;
|
|
@@ -7,7 +7,6 @@ export interface IBaseAudioContext {
|
|
|
7
7
|
readonly currentTime: number;
|
|
8
8
|
createRecorderAdapter(): IRecorderAdapterNode;
|
|
9
9
|
createOscillator(): IOscillatorNode;
|
|
10
|
-
createCustomProcessor(identifier: string): ICustomProcessorNode;
|
|
11
10
|
createGain(): IGainNode;
|
|
12
11
|
createStereoPanner(): IStereoPannerNode;
|
|
13
12
|
createBiquadFilter: () => IBiquadFilterNode;
|
|
@@ -40,10 +39,6 @@ export interface IAudioNode {
|
|
|
40
39
|
connect: (destination: IAudioNode | IAudioParam) => void;
|
|
41
40
|
disconnect: (destination?: IAudioNode | IAudioParam) => void;
|
|
42
41
|
}
|
|
43
|
-
export interface ICustomProcessorNode extends IAudioNode {
|
|
44
|
-
readonly customProcessor: IAudioParam;
|
|
45
|
-
processorMode: ProcessorMode;
|
|
46
|
-
}
|
|
47
42
|
export interface IGainNode extends IAudioNode {
|
|
48
43
|
readonly gain: IAudioParam;
|
|
49
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,
|
|
1
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;CACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-audio-api",
|
|
3
|
-
"version": "0.7.0-nightly-
|
|
3
|
+
"version": "0.7.0-nightly-a914864-20250729",
|
|
4
4
|
"description": "react-native-audio-api provides system for controlling audio in React Native environment compatible with Web Audio API specification",
|
|
5
5
|
"bin": {
|
|
6
6
|
"setup-rn-audio-api-web": "./scripts/setup-rn-audio-api-web.js"
|
package/src/api.ts
CHANGED
|
@@ -53,7 +53,6 @@ export { default as AudioParam } from './core/AudioParam';
|
|
|
53
53
|
export { default as AudioScheduledSourceNode } from './core/AudioScheduledSourceNode';
|
|
54
54
|
export { default as BaseAudioContext } from './core/BaseAudioContext';
|
|
55
55
|
export { default as BiquadFilterNode } from './core/BiquadFilterNode';
|
|
56
|
-
export { default as CustomProcessorNode } from './core/CustomProcessorNode';
|
|
57
56
|
export { default as GainNode } from './core/GainNode';
|
|
58
57
|
export { default as OscillatorNode } from './core/OscillatorNode';
|
|
59
58
|
export { default as StereoPannerNode } from './core/StereoPannerNode';
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
} from '../types';
|
|
7
7
|
import AudioDestinationNode from './AudioDestinationNode';
|
|
8
8
|
import OscillatorNode from './OscillatorNode';
|
|
9
|
-
import CustomProcessorNode from './CustomProcessorNode';
|
|
10
9
|
import GainNode from './GainNode';
|
|
11
10
|
import StereoPannerNode from './StereoPannerNode';
|
|
12
11
|
import BiquadFilterNode from './BiquadFilterNode';
|
|
@@ -21,7 +20,7 @@ import RecorderAdapterNode from './RecorderAdapterNode';
|
|
|
21
20
|
export default class BaseAudioContext {
|
|
22
21
|
readonly destination: AudioDestinationNode;
|
|
23
22
|
readonly sampleRate: number;
|
|
24
|
-
|
|
23
|
+
readonly context: IBaseAudioContext;
|
|
25
24
|
|
|
26
25
|
constructor(context: IBaseAudioContext) {
|
|
27
26
|
this.context = context;
|
|
@@ -45,13 +44,6 @@ export default class BaseAudioContext {
|
|
|
45
44
|
return new OscillatorNode(this, this.context.createOscillator());
|
|
46
45
|
}
|
|
47
46
|
|
|
48
|
-
createCustomProcessor(identifier: string): CustomProcessorNode {
|
|
49
|
-
return new CustomProcessorNode(
|
|
50
|
-
this,
|
|
51
|
-
this.context.createCustomProcessor(identifier)
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
47
|
createGain(): GainNode {
|
|
56
48
|
return new GainNode(this, this.context.createGain());
|
|
57
49
|
}
|
package/src/interfaces.ts
CHANGED
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
BiquadFilterType,
|
|
6
6
|
ChannelCountMode,
|
|
7
7
|
ChannelInterpretation,
|
|
8
|
-
ProcessorMode,
|
|
9
8
|
} from './types';
|
|
10
9
|
import { AudioEventName, AudioEventCallback } from './events/types';
|
|
11
10
|
|
|
@@ -17,7 +16,6 @@ export interface IBaseAudioContext {
|
|
|
17
16
|
|
|
18
17
|
createRecorderAdapter(): IRecorderAdapterNode;
|
|
19
18
|
createOscillator(): IOscillatorNode;
|
|
20
|
-
createCustomProcessor(identifier: string): ICustomProcessorNode;
|
|
21
19
|
createGain(): IGainNode;
|
|
22
20
|
createStereoPanner(): IStereoPannerNode;
|
|
23
21
|
createBiquadFilter: () => IBiquadFilterNode;
|
|
@@ -66,11 +64,6 @@ export interface IAudioNode {
|
|
|
66
64
|
disconnect: (destination?: IAudioNode | IAudioParam) => void;
|
|
67
65
|
}
|
|
68
66
|
|
|
69
|
-
export interface ICustomProcessorNode extends IAudioNode {
|
|
70
|
-
readonly customProcessor: IAudioParam;
|
|
71
|
-
processorMode: ProcessorMode;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
67
|
export interface IGainNode extends IAudioNode {
|
|
75
68
|
readonly gain: IAudioParam;
|
|
76
69
|
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <audioapi/HostObjects/AudioNodeHostObject.h>
|
|
4
|
-
#include <audioapi/HostObjects/AudioParamHostObject.h>
|
|
5
|
-
#include <audioapi/core/effects/CustomProcessorNode.h>
|
|
6
|
-
|
|
7
|
-
#include <memory>
|
|
8
|
-
#include <string>
|
|
9
|
-
#include <vector>
|
|
10
|
-
|
|
11
|
-
namespace audioapi {
|
|
12
|
-
using namespace facebook;
|
|
13
|
-
|
|
14
|
-
class CustomProcessorNodeHostObject : public AudioNodeHostObject {
|
|
15
|
-
public:
|
|
16
|
-
explicit CustomProcessorNodeHostObject(const std::shared_ptr<CustomProcessorNode> &node)
|
|
17
|
-
: AudioNodeHostObject(node) {
|
|
18
|
-
addGetters(
|
|
19
|
-
JSI_EXPORT_PROPERTY_GETTER(CustomProcessorNodeHostObject, customProcessor),
|
|
20
|
-
JSI_EXPORT_PROPERTY_GETTER(CustomProcessorNodeHostObject, processorMode));
|
|
21
|
-
|
|
22
|
-
addSetters(
|
|
23
|
-
JSI_EXPORT_PROPERTY_SETTER(CustomProcessorNodeHostObject, processorMode));
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
JSI_PROPERTY_GETTER(customProcessor) {
|
|
27
|
-
auto customProcessorNode = std::static_pointer_cast<CustomProcessorNode>(node_);
|
|
28
|
-
auto customProcessorParam =
|
|
29
|
-
std::make_shared<AudioParamHostObject>(customProcessorNode->getCustomProcessorParam());
|
|
30
|
-
return jsi::Object::createFromHostObject(runtime, customProcessorParam);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
JSI_PROPERTY_GETTER(processorMode) {
|
|
34
|
-
auto customProcessorNode = std::static_pointer_cast<CustomProcessorNode>(node_);
|
|
35
|
-
auto mode = customProcessorNode->getProcessorMode();
|
|
36
|
-
std::string modeStr = (mode == CustomProcessorNode::ProcessorMode::ProcessThrough)
|
|
37
|
-
? "processThrough"
|
|
38
|
-
: "processInPlace";
|
|
39
|
-
return jsi::String::createFromUtf8(runtime, modeStr);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
JSI_PROPERTY_SETTER(processorMode) {
|
|
43
|
-
auto customProcessorNode = std::static_pointer_cast<CustomProcessorNode>(node_);
|
|
44
|
-
std::string modeStr = value.getString(runtime).utf8(runtime);
|
|
45
|
-
|
|
46
|
-
if (modeStr == "processThrough") {
|
|
47
|
-
customProcessorNode->setProcessorMode(CustomProcessorNode::ProcessorMode::ProcessThrough);
|
|
48
|
-
} else {
|
|
49
|
-
customProcessorNode->setProcessorMode(CustomProcessorNode::ProcessorMode::ProcessInPlace);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
} // namespace audioapi
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
#include <audioapi/core/BaseAudioContext.h>
|
|
2
|
-
#include <audioapi/core/effects/CustomProcessorNode.h>
|
|
3
|
-
#include <audioapi/utils/AudioArray.h>
|
|
4
|
-
#include <audioapi/utils/AudioBus.h>
|
|
5
|
-
|
|
6
|
-
#include <algorithm>
|
|
7
|
-
#include <cstring>
|
|
8
|
-
#include <iostream>
|
|
9
|
-
|
|
10
|
-
namespace audioapi {
|
|
11
|
-
|
|
12
|
-
// Static registries and active node tracking
|
|
13
|
-
std::map<std::string, std::function<std::shared_ptr<CustomAudioProcessor>()>>
|
|
14
|
-
CustomProcessorNode::s_processorFactoriesByIdentifier;
|
|
15
|
-
std::unordered_map<std::string, CustomProcessorNode::GenericControlHandler>
|
|
16
|
-
CustomProcessorNode::s_controlHandlersByIdentifier;
|
|
17
|
-
std::unordered_map<std::string, std::vector<CustomProcessorNode *>>
|
|
18
|
-
CustomProcessorNode::s_activeNodes;
|
|
19
|
-
|
|
20
|
-
// Constructor: initializes processor, tracking, and preallocated buffers
|
|
21
|
-
CustomProcessorNode::CustomProcessorNode(
|
|
22
|
-
BaseAudioContext *context,
|
|
23
|
-
const std::string &identifier)
|
|
24
|
-
: AudioNode(context), processorMode_(ProcessorMode::ProcessInPlace) {
|
|
25
|
-
customProcessorParam_ = std::make_shared<AudioParam>(
|
|
26
|
-
1.0f, MOST_NEGATIVE_SINGLE_FLOAT, MOST_POSITIVE_SINGLE_FLOAT, context);
|
|
27
|
-
isInitialized_ = true;
|
|
28
|
-
|
|
29
|
-
auto it = s_processorFactoriesByIdentifier.find(identifier);
|
|
30
|
-
processor_ =
|
|
31
|
-
(it != s_processorFactoriesByIdentifier.end()) ? it->second() : nullptr;
|
|
32
|
-
|
|
33
|
-
s_activeNodes[identifier].push_back(this);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Destructor: cleans up tracking for this instance
|
|
37
|
-
CustomProcessorNode::~CustomProcessorNode() {
|
|
38
|
-
for (auto &pair : s_activeNodes) {
|
|
39
|
-
auto &vec = pair.second;
|
|
40
|
-
vec.erase(std::remove(vec.begin(), vec.end(), this), vec.end());
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Gets the modifiable parameter
|
|
45
|
-
std::shared_ptr<AudioParam> CustomProcessorNode::getCustomProcessorParam()
|
|
46
|
-
const {
|
|
47
|
-
return customProcessorParam_;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Returns the current processing mode
|
|
51
|
-
CustomProcessorNode::ProcessorMode CustomProcessorNode::getProcessorMode()
|
|
52
|
-
const {
|
|
53
|
-
return processorMode_;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Updates the processing mode
|
|
57
|
-
void CustomProcessorNode::setProcessorMode(ProcessorMode mode) {
|
|
58
|
-
processorMode_ = mode;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Registers a factory for dynamic processor instantiation
|
|
62
|
-
void CustomProcessorNode::registerProcessorFactory(
|
|
63
|
-
const std::string &identifier,
|
|
64
|
-
std::function<std::shared_ptr<CustomAudioProcessor>()> factory) {
|
|
65
|
-
s_processorFactoriesByIdentifier[identifier] = std::move(factory);
|
|
66
|
-
notifyProcessorChanged(identifier);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// Removes a processor factory from registry
|
|
70
|
-
void CustomProcessorNode::unregisterProcessorFactory(
|
|
71
|
-
const std::string &identifier) {
|
|
72
|
-
s_processorFactoriesByIdentifier.erase(identifier);
|
|
73
|
-
notifyProcessorChanged(identifier);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Updates processor instances for all nodes using given identifier
|
|
77
|
-
void CustomProcessorNode::notifyProcessorChanged(
|
|
78
|
-
const std::string &identifier) {
|
|
79
|
-
auto it = s_activeNodes.find(identifier);
|
|
80
|
-
if (it != s_activeNodes.end()) {
|
|
81
|
-
for (CustomProcessorNode *node : it->second) {
|
|
82
|
-
auto f = s_processorFactoriesByIdentifier.find(identifier);
|
|
83
|
-
node->processor_ =
|
|
84
|
-
(f != s_processorFactoriesByIdentifier.end()) ? f->second() : nullptr;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Registers control handler for runtime automation
|
|
90
|
-
void CustomProcessorNode::registerControlHandler(
|
|
91
|
-
const std::string &identifier,
|
|
92
|
-
GenericControlHandler handler) {
|
|
93
|
-
s_controlHandlersByIdentifier[identifier] = std::move(handler);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Removes a control handler
|
|
97
|
-
void CustomProcessorNode::unregisterControlHandler(
|
|
98
|
-
const std::string &identifier) {
|
|
99
|
-
s_controlHandlersByIdentifier.erase(identifier);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// Core processing method routed by selected mode
|
|
103
|
-
void CustomProcessorNode::processNode(
|
|
104
|
-
const std::shared_ptr<AudioBus> &processingBus,
|
|
105
|
-
int framesToProcess) {
|
|
106
|
-
if (!processor_)
|
|
107
|
-
return;
|
|
108
|
-
|
|
109
|
-
int numChannels = processingBus->getNumberOfChannels();
|
|
110
|
-
if (preallocatedOutputBuffers_.size() != static_cast<size_t>(numChannels)) {
|
|
111
|
-
preallocatedOutputBuffers_.resize(numChannels);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
for (int ch = 0; ch < numChannels; ++ch) {
|
|
115
|
-
if (preallocatedOutputBuffers_[ch].size() !=
|
|
116
|
-
static_cast<size_t>(framesToProcess)) {
|
|
117
|
-
preallocatedOutputBuffers_[ch].resize(framesToProcess);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
switch (processorMode_) {
|
|
122
|
-
case ProcessorMode::ProcessThrough:
|
|
123
|
-
processThrough(processingBus, framesToProcess);
|
|
124
|
-
break;
|
|
125
|
-
case ProcessorMode::ProcessInPlace:
|
|
126
|
-
default:
|
|
127
|
-
processInPlace(processingBus, framesToProcess);
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// Executes in-place processing on the shared audio buffer
|
|
133
|
-
void CustomProcessorNode::processInPlace(
|
|
134
|
-
const std::shared_ptr<AudioBus> &bus,
|
|
135
|
-
int frames) {
|
|
136
|
-
if (!processor_)
|
|
137
|
-
return;
|
|
138
|
-
|
|
139
|
-
int numChannels = bus->getNumberOfChannels();
|
|
140
|
-
std::vector<float *> channelData(numChannels);
|
|
141
|
-
for (int ch = 0; ch < numChannels; ++ch) {
|
|
142
|
-
channelData[ch] = bus->getChannel(ch)->getData();
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
processor_->processInPlace(channelData.data(), numChannels, frames);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Executes processing using separate input and output buffers with
|
|
149
|
-
// preallocation
|
|
150
|
-
void CustomProcessorNode::processThrough(
|
|
151
|
-
const std::shared_ptr<AudioBus> &bus,
|
|
152
|
-
int frames) {
|
|
153
|
-
if (!processor_)
|
|
154
|
-
return;
|
|
155
|
-
|
|
156
|
-
int numChannels = bus->getNumberOfChannels();
|
|
157
|
-
std::vector<float *> input(numChannels);
|
|
158
|
-
std::vector<float *> output(numChannels);
|
|
159
|
-
|
|
160
|
-
for (int ch = 0; ch < numChannels; ++ch) {
|
|
161
|
-
input[ch] = bus->getChannel(ch)->getData();
|
|
162
|
-
output[ch] = preallocatedOutputBuffers_[ch].data();
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
processor_->processThrough(input.data(), output.data(), numChannels, frames);
|
|
166
|
-
|
|
167
|
-
for (int ch = 0; ch < numChannels; ++ch) {
|
|
168
|
-
std::memcpy(
|
|
169
|
-
bus->getChannel(ch)->getData(), output[ch], sizeof(float) * frames);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
} // namespace audioapi
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <audioapi/core/AudioNode.h>
|
|
4
|
-
#include <audioapi/core/AudioParam.h>
|
|
5
|
-
#include <memory>
|
|
6
|
-
#include <string>
|
|
7
|
-
#include <cstring>
|
|
8
|
-
#include <functional>
|
|
9
|
-
#include <map>
|
|
10
|
-
#include <unordered_map>
|
|
11
|
-
#include <vector>
|
|
12
|
-
#include <any>
|
|
13
|
-
#include <utility>
|
|
14
|
-
|
|
15
|
-
namespace audioapi {
|
|
16
|
-
|
|
17
|
-
class AudioBus;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @brief Interface for defining custom audio processors that can be attached to nodes.
|
|
21
|
-
*/
|
|
22
|
-
class CustomAudioProcessor {
|
|
23
|
-
public:
|
|
24
|
-
virtual ~CustomAudioProcessor() = default;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @brief Processes audio data in-place.
|
|
28
|
-
* @param channelData Array of float pointers for each channel.
|
|
29
|
-
* @param numChannels Number of audio channels.
|
|
30
|
-
* @param numFrames Number of frames per channel.
|
|
31
|
-
*/
|
|
32
|
-
virtual void processInPlace(float** channelData, int numChannels, int numFrames) {
|
|
33
|
-
// Default: do nothing
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @brief Processes audio data from input to output buffers.
|
|
38
|
-
* Default behavior copies input to output and then calls in-place processing.
|
|
39
|
-
* @param input Input audio buffers.
|
|
40
|
-
* @param output Output audio buffers.
|
|
41
|
-
* @param numChannels Number of channels.
|
|
42
|
-
* @param numFrames Number of frames per channel.
|
|
43
|
-
*/
|
|
44
|
-
virtual void processThrough(float** input, float** output, int numChannels, int numFrames) {
|
|
45
|
-
for (int ch = 0; ch < numChannels; ++ch) {
|
|
46
|
-
std::memcpy(output[ch], input[ch], sizeof(float) * numFrames);
|
|
47
|
-
}
|
|
48
|
-
processInPlace(output, numChannels, numFrames);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @brief Audio node that wraps a user-defined processor for custom audio processing.
|
|
54
|
-
*/
|
|
55
|
-
class CustomProcessorNode : public AudioNode {
|
|
56
|
-
public:
|
|
57
|
-
/**
|
|
58
|
-
* @brief Enumerates supported audio processing modes.
|
|
59
|
-
*/
|
|
60
|
-
enum class ProcessorMode {
|
|
61
|
-
ProcessInPlace,
|
|
62
|
-
ProcessThrough
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* @brief Constructs a new CustomProcessorNode attached to a given context with a processor identifier.
|
|
67
|
-
* @param context Audio context this node belongs to.
|
|
68
|
-
* @param identifier The identifier of the processor to instantiate and bind.
|
|
69
|
-
*/
|
|
70
|
-
CustomProcessorNode(BaseAudioContext* context, const std::string& identifier);
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* @brief Destroys the node and removes it from active tracking.
|
|
74
|
-
*/
|
|
75
|
-
~CustomProcessorNode();
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* @brief Gets the custom AudioParam associated with this node.
|
|
79
|
-
* @return Shared pointer to an AudioParam.
|
|
80
|
-
*/
|
|
81
|
-
std::shared_ptr<AudioParam> getCustomProcessorParam() const;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* @brief Gets the processor mode.
|
|
85
|
-
* @return The current processing mode as an enum.
|
|
86
|
-
*/
|
|
87
|
-
ProcessorMode getProcessorMode() const;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* @brief Sets the processor mode.
|
|
91
|
-
* @param processorMode Processing mode to apply.
|
|
92
|
-
*/
|
|
93
|
-
void setProcessorMode(ProcessorMode processorMode);
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* @brief Registers a factory for creating processors for a given identifier.
|
|
97
|
-
* @param identifier Unique string key.
|
|
98
|
-
* @param factory Function that returns a shared CustomAudioProcessor.
|
|
99
|
-
*/
|
|
100
|
-
static void registerProcessorFactory(
|
|
101
|
-
const std::string& identifier,
|
|
102
|
-
std::function<std::shared_ptr<CustomAudioProcessor>()> factory);
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* @brief Unregisters a processor factory.
|
|
106
|
-
* @param identifier Key to remove.
|
|
107
|
-
*/
|
|
108
|
-
static void unregisterProcessorFactory(const std::string& identifier);
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* @brief Alias for control callbacks accepting arbitrary parameters.
|
|
112
|
-
*/
|
|
113
|
-
using GenericControlHandler = std::function<void(const std::vector<std::any>&)>;
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* @brief Registers a control handler for automation (e.g., gain or filter changes).
|
|
117
|
-
* @param identifier Control name key.
|
|
118
|
-
* @param handler Function to handle dynamic updates.
|
|
119
|
-
*/
|
|
120
|
-
static void registerControlHandler(const std::string& identifier, GenericControlHandler handler);
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* @brief Unregisters a control handler by identifier.
|
|
124
|
-
* @param identifier The key to remove.
|
|
125
|
-
*/
|
|
126
|
-
static void unregisterControlHandler(const std::string& identifier);
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* @brief Invokes a control handler using variadic arguments.
|
|
130
|
-
* @tparam Args Parameter types.
|
|
131
|
-
* @param identifier Key associated with the control handler.
|
|
132
|
-
* @param args Arguments passed to the handler.
|
|
133
|
-
*/
|
|
134
|
-
template <typename... Args>
|
|
135
|
-
static void applyControlToNode(const std::string& identifier, Args&&... args) {
|
|
136
|
-
auto it = s_controlHandlersByIdentifier.find(identifier);
|
|
137
|
-
if (it != s_controlHandlersByIdentifier.end()) {
|
|
138
|
-
std::vector<std::any> paramList = { std::forward<Args>(args)... };
|
|
139
|
-
it->second(paramList);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
protected:
|
|
144
|
-
/**
|
|
145
|
-
* @brief Core audio processing callback invoked each render cycle.
|
|
146
|
-
* @param processingBus The audio bus containing buffers.
|
|
147
|
-
* @param framesToProcess Number of frames to process.
|
|
148
|
-
*/
|
|
149
|
-
void processNode(const std::shared_ptr<AudioBus>& processingBus, int framesToProcess) override;
|
|
150
|
-
|
|
151
|
-
private:
|
|
152
|
-
/**
|
|
153
|
-
* @brief In-place audio processing.
|
|
154
|
-
* @param bus The shared audio bus buffer.
|
|
155
|
-
* @param frames Number of frames to process.
|
|
156
|
-
*/
|
|
157
|
-
void processInPlace(const std::shared_ptr<AudioBus>& bus, int frames);
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* @brief Processes audio using separate input and output buffers.
|
|
161
|
-
* @param bus Audio bus used for both input and output access.
|
|
162
|
-
* @param frames Number of frames to process.
|
|
163
|
-
*/
|
|
164
|
-
void processThrough(const std::shared_ptr<AudioBus>& bus, int frames);
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* @brief Ensures that preallocated output buffers match the required frame and channel dimensions.
|
|
168
|
-
* This avoids real-time heap allocations.
|
|
169
|
-
*/
|
|
170
|
-
void ensurePreallocatedBuffers(int numChannels, int numFrames);
|
|
171
|
-
|
|
172
|
-
std::shared_ptr<AudioParam> customProcessorParam_; ///< Optional real-time modifiable parameter.
|
|
173
|
-
ProcessorMode processorMode_ = ProcessorMode::ProcessInPlace; ///< Determines processing style.
|
|
174
|
-
std::shared_ptr<CustomAudioProcessor> processor_; ///< Processor instance.
|
|
175
|
-
|
|
176
|
-
std::vector<std::vector<float>> preallocatedOutputBuffers_; ///< Storage for preallocated channel data.
|
|
177
|
-
std::vector<float*> preallocatedOutputPointers_; ///< Pointers to preallocatedOutputBuffers_ for processor API.
|
|
178
|
-
|
|
179
|
-
static void notifyProcessorChanged(const std::string& identifier); ///< Notify and update all nodes with given identifier.
|
|
180
|
-
|
|
181
|
-
static std::map<std::string, std::function<std::shared_ptr<CustomAudioProcessor>()>> s_processorFactoriesByIdentifier; ///< Global registry of processor factories.
|
|
182
|
-
static std::unordered_map<std::string, GenericControlHandler> s_controlHandlersByIdentifier; ///< Global registry of control handlers.
|
|
183
|
-
static std::unordered_map<std::string, std::vector<CustomProcessorNode*>> s_activeNodes; ///< Tracks active node instances by identifier.
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
} // namespace audioapi
|
|
@@ -1,23 +0,0 @@
|
|
|
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 CustomProcessorNode extends _AudioNode.default {
|
|
11
|
-
constructor(context, customProcessor) {
|
|
12
|
-
super(context, customProcessor);
|
|
13
|
-
this.customProcessor = new _AudioParam.default(customProcessor.customProcessor, context);
|
|
14
|
-
}
|
|
15
|
-
get processorMode() {
|
|
16
|
-
return this.node.processorMode;
|
|
17
|
-
}
|
|
18
|
-
set processorMode(value) {
|
|
19
|
-
this.node.processorMode = value;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.default = CustomProcessorNode;
|
|
23
|
-
//# sourceMappingURL=CustomProcessorNode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_AudioNode","_interopRequireDefault","require","_AudioParam","e","__esModule","default","CustomProcessorNode","AudioNode","constructor","context","customProcessor","AudioParam","processorMode","node","value","exports"],"sourceRoot":"../../../src","sources":["core/CustomProcessorNode.ts"],"mappings":";;;;;;AAEA,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,mBAAmB,SAASC,kBAAS,CAAC;EAGzDC,WAAWA,CACTC,OAAyB,EACzBC,eAAqC,EACrC;IACA,KAAK,CAACD,OAAO,EAAEC,eAAe,CAAC;IAC/B,IAAI,CAACA,eAAe,GAAG,IAAIC,mBAAU,CACnCD,eAAe,CAACA,eAAe,EAC/BD,OACF,CAAC;EACH;EAEA,IAAWG,aAAaA,CAAA,EAAkB;IACxC,OAAQ,IAAI,CAACC,IAAI,CAA0BD,aAAa;EAC1D;EAEA,IAAWA,aAAaA,CAACE,KAAoB,EAAE;IAC5C,IAAI,CAACD,IAAI,CAA0BD,aAAa,GAAGE,KAAK;EAC3D;AACF;AAACC,OAAA,CAAAV,OAAA,GAAAC,mBAAA","ignoreList":[]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import AudioNode from "./AudioNode.js";
|
|
4
|
-
import AudioParam from "./AudioParam.js";
|
|
5
|
-
export default class CustomProcessorNode extends AudioNode {
|
|
6
|
-
constructor(context, customProcessor) {
|
|
7
|
-
super(context, customProcessor);
|
|
8
|
-
this.customProcessor = new AudioParam(customProcessor.customProcessor, context);
|
|
9
|
-
}
|
|
10
|
-
get processorMode() {
|
|
11
|
-
return this.node.processorMode;
|
|
12
|
-
}
|
|
13
|
-
set processorMode(value) {
|
|
14
|
-
this.node.processorMode = value;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=CustomProcessorNode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["AudioNode","AudioParam","CustomProcessorNode","constructor","context","customProcessor","processorMode","node","value"],"sourceRoot":"../../../src","sources":["core/CustomProcessorNode.ts"],"mappings":";;AAEA,OAAOA,SAAS,MAAM,gBAAa;AACnC,OAAOC,UAAU,MAAM,iBAAc;AAGrC,eAAe,MAAMC,mBAAmB,SAASF,SAAS,CAAC;EAGzDG,WAAWA,CACTC,OAAyB,EACzBC,eAAqC,EACrC;IACA,KAAK,CAACD,OAAO,EAAEC,eAAe,CAAC;IAC/B,IAAI,CAACA,eAAe,GAAG,IAAIJ,UAAU,CACnCI,eAAe,CAACA,eAAe,EAC/BD,OACF,CAAC;EACH;EAEA,IAAWE,aAAaA,CAAA,EAAkB;IACxC,OAAQ,IAAI,CAACC,IAAI,CAA0BD,aAAa;EAC1D;EAEA,IAAWA,aAAaA,CAACE,KAAoB,EAAE;IAC5C,IAAI,CAACD,IAAI,CAA0BD,aAAa,GAAGE,KAAK;EAC3D;AACF","ignoreList":[]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ICustomProcessorNode } from '../interfaces';
|
|
2
|
-
import { ProcessorMode } from '../types';
|
|
3
|
-
import AudioNode from './AudioNode';
|
|
4
|
-
import AudioParam from './AudioParam';
|
|
5
|
-
import BaseAudioContext from './BaseAudioContext';
|
|
6
|
-
export default class CustomProcessorNode extends AudioNode {
|
|
7
|
-
readonly customProcessor: AudioParam;
|
|
8
|
-
constructor(context: BaseAudioContext, customProcessor: ICustomProcessorNode);
|
|
9
|
-
get processorMode(): ProcessorMode;
|
|
10
|
-
set processorMode(value: ProcessorMode);
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=CustomProcessorNode.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CustomProcessorNode.d.ts","sourceRoot":"","sources":["../../../src/core/CustomProcessorNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,SAAS;IACxD,QAAQ,CAAC,eAAe,EAAE,UAAU,CAAC;gBAGnC,OAAO,EAAE,gBAAgB,EACzB,eAAe,EAAE,oBAAoB;IASvC,IAAW,aAAa,IAAI,aAAa,CAExC;IAED,IAAW,aAAa,CAAC,KAAK,EAAE,aAAa,EAE5C;CACF"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { ICustomProcessorNode } from '../interfaces';
|
|
2
|
-
import { ProcessorMode } from '../types';
|
|
3
|
-
import AudioNode from './AudioNode';
|
|
4
|
-
import AudioParam from './AudioParam';
|
|
5
|
-
import BaseAudioContext from './BaseAudioContext';
|
|
6
|
-
|
|
7
|
-
export default class CustomProcessorNode extends AudioNode {
|
|
8
|
-
readonly customProcessor: AudioParam;
|
|
9
|
-
|
|
10
|
-
constructor(
|
|
11
|
-
context: BaseAudioContext,
|
|
12
|
-
customProcessor: ICustomProcessorNode
|
|
13
|
-
) {
|
|
14
|
-
super(context, customProcessor);
|
|
15
|
-
this.customProcessor = new AudioParam(
|
|
16
|
-
customProcessor.customProcessor,
|
|
17
|
-
context
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public get processorMode(): ProcessorMode {
|
|
22
|
-
return (this.node as ICustomProcessorNode).processorMode;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public set processorMode(value: ProcessorMode) {
|
|
26
|
-
(this.node as ICustomProcessorNode).processorMode = value;
|
|
27
|
-
}
|
|
28
|
-
}
|