react-native-audio-api 0.8.3-nightly-d178688-20250925 → 0.8.3-nightly-2295d0d-20250926
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/RNAudioAPI.podspec +8 -5
- package/android/build.gradle +44 -4
- package/android/src/main/cpp/audioapi/CMakeLists.txt +65 -0
- package/android/src/main/cpp/audioapi/android/AudioAPIModule.cpp +29 -1
- package/android/src/main/cpp/audioapi/android/AudioAPIModule.h +14 -0
- package/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.cpp +7 -1
- package/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.h +6 -1
- package/android/src/main/cpp/audioapi/android/core/AudioPlayer.cpp +1 -1
- package/android/src/main/cpp/audioapi/android/core/NativeAudioRecorder.hpp +36 -0
- package/android/src/main/java/com/swmansion/audioapi/AudioAPIModule.kt +11 -1
- package/android/src/main/java/com/swmansion/audioapi/core/NativeAudioRecorder.kt +24 -0
- package/android/src/main/java/com/swmansion/audioapi/system/MediaSessionManager.kt +15 -2
- package/common/cpp/audioapi/AudioAPIModuleInstaller.h +31 -13
- package/common/cpp/audioapi/HostObjects/AudioContextHostObject.cpp +57 -0
- package/common/cpp/audioapi/HostObjects/AudioContextHostObject.h +6 -46
- package/common/cpp/audioapi/HostObjects/AudioNodeHostObject.cpp +70 -6
- package/common/cpp/audioapi/HostObjects/AudioNodeHostObject.h +10 -66
- package/common/cpp/audioapi/HostObjects/AudioParamHostObject.cpp +105 -0
- package/common/cpp/audioapi/HostObjects/AudioParamHostObject.h +17 -91
- package/common/cpp/audioapi/HostObjects/BaseAudioContextHostObject.cpp +292 -6
- package/common/cpp/audioapi/HostObjects/BaseAudioContextHostObject.h +26 -242
- package/common/cpp/audioapi/HostObjects/OfflineAudioContextHostObject.cpp +70 -0
- package/common/cpp/audioapi/HostObjects/OfflineAudioContextHostObject.h +6 -50
- package/common/cpp/audioapi/HostObjects/WorkletNodeHostObject.h +18 -0
- package/common/cpp/audioapi/HostObjects/analysis/AnalyserNodeHostObject.cpp +148 -0
- package/common/cpp/audioapi/HostObjects/analysis/AnalyserNodeHostObject.h +37 -0
- package/common/cpp/audioapi/HostObjects/effects/BiquadFilterNodeHostObject.cpp +92 -0
- package/common/cpp/audioapi/HostObjects/effects/BiquadFilterNodeHostObject.h +29 -0
- package/common/cpp/audioapi/HostObjects/effects/GainNodeHostObject.cpp +20 -0
- package/common/cpp/audioapi/HostObjects/effects/GainNodeHostObject.h +19 -0
- package/common/cpp/audioapi/HostObjects/effects/StereoPannerNodeHostObject.cpp +21 -0
- package/common/cpp/audioapi/HostObjects/effects/StereoPannerNodeHostObject.h +21 -0
- package/common/cpp/audioapi/HostObjects/events/AudioEventHandlerRegistryHostObject.cpp +41 -0
- package/common/cpp/audioapi/HostObjects/events/AudioEventHandlerRegistryHostObject.h +28 -0
- package/common/cpp/audioapi/HostObjects/inputs/AudioRecorderHostObject.cpp +69 -0
- package/common/cpp/audioapi/HostObjects/inputs/AudioRecorderHostObject.h +33 -0
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferBaseSourceNodeHostObject.cpp +73 -0
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferBaseSourceNodeHostObject.h +29 -0
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferHostObject.cpp +94 -0
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferHostObject.h +46 -0
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferQueueSourceNodeHostObject.cpp +60 -0
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferQueueSourceNodeHostObject.h +25 -0
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferSourceNodeHostObject.cpp +133 -0
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferSourceNodeHostObject.h +34 -0
- package/common/cpp/audioapi/HostObjects/sources/AudioScheduledSourceNodeHostObject.cpp +52 -0
- package/common/cpp/audioapi/HostObjects/sources/AudioScheduledSourceNodeHostObject.h +25 -0
- package/common/cpp/audioapi/HostObjects/sources/OscillatorNodeHostObject.cpp +55 -0
- package/common/cpp/audioapi/HostObjects/sources/OscillatorNodeHostObject.h +27 -0
- package/common/cpp/audioapi/HostObjects/{RecorderAdapterNodeHostObject.h → sources/RecorderAdapterNodeHostObject.h} +1 -2
- package/common/cpp/audioapi/HostObjects/sources/StreamerNodeHostObject.cpp +22 -0
- package/common/cpp/audioapi/HostObjects/sources/StreamerNodeHostObject.h +28 -0
- package/common/cpp/audioapi/core/AudioContext.cpp +3 -2
- package/common/cpp/audioapi/core/AudioContext.h +2 -1
- package/common/cpp/audioapi/core/AudioNode.h +1 -1
- package/common/cpp/audioapi/core/AudioParam.h +1 -1
- package/common/cpp/audioapi/core/BaseAudioContext.cpp +15 -1
- package/common/cpp/audioapi/core/BaseAudioContext.h +7 -3
- package/common/cpp/audioapi/core/OfflineAudioContext.cpp +4 -3
- package/common/cpp/audioapi/core/OfflineAudioContext.h +2 -1
- package/common/cpp/audioapi/core/effects/PeriodicWave.cpp +1 -1
- package/common/cpp/audioapi/core/effects/StereoPannerNode.cpp +1 -1
- package/common/cpp/audioapi/core/effects/WorkletNode.cpp +86 -0
- package/common/cpp/audioapi/core/effects/WorkletNode.h +64 -0
- package/common/cpp/audioapi/core/inputs/AudioRecorder.cpp +1 -1
- package/common/cpp/audioapi/core/inputs/AudioRecorder.h +2 -2
- package/common/cpp/audioapi/core/sources/AudioBufferBaseSourceNode.cpp +1 -1
- package/common/cpp/audioapi/core/sources/AudioBufferQueueSourceNode.cpp +1 -1
- package/common/cpp/audioapi/core/sources/AudioBufferSourceNode.cpp +1 -1
- package/common/cpp/audioapi/core/sources/StreamerNode.h +0 -8
- package/common/cpp/audioapi/core/{AudioParamEventQueue.cpp → utils/AudioParamEventQueue.cpp} +1 -1
- package/common/cpp/audioapi/core/utils/worklets/SafeIncludes.h +45 -0
- package/common/cpp/audioapi/core/utils/worklets/UiWorkletsRunner.cpp +9 -0
- package/common/cpp/audioapi/core/utils/worklets/UiWorkletsRunner.h +73 -0
- package/common/cpp/audioapi/dsp/Windows.cpp +1 -1
- package/common/cpp/audioapi/events/AudioEventHandlerRegistry.cpp +1 -1
- package/common/cpp/audioapi/jsi/AudioArrayBuffer.h +14 -1
- package/common/cpp/audioapi/jsi/JsiHostObject.h +6 -12
- package/common/cpp/audioapi/utils/AudioBus.cpp +1 -1
- package/common/cpp/test/CMakeLists.txt +8 -3
- package/common/cpp/test/GainTest.cpp +1 -1
- package/common/cpp/test/OscillatorTest.cpp +1 -1
- package/ios/audioapi/ios/AudioAPIModule.mm +32 -5
- package/ios/audioapi/ios/core/IOSAudioPlayer.mm +1 -1
- package/ios/audioapi/ios/core/IOSAudioRecorder.h +1 -2
- package/ios/audioapi/ios/core/IOSAudioRecorder.mm +1 -1
- package/lib/commonjs/api.js +7 -0
- package/lib/commonjs/api.js.map +1 -1
- package/lib/commonjs/core/BaseAudioContext.js +29 -0
- package/lib/commonjs/core/BaseAudioContext.js.map +1 -1
- package/lib/commonjs/core/WorkletNode.js +11 -0
- package/lib/commonjs/core/WorkletNode.js.map +1 -0
- package/lib/commonjs/utils/index.js +9 -0
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/module/api.js +1 -0
- package/lib/module/api.js.map +1 -1
- package/lib/module/core/BaseAudioContext.js +29 -0
- package/lib/module/core/BaseAudioContext.js.map +1 -1
- package/lib/module/core/WorkletNode.js +5 -0
- package/lib/module/core/WorkletNode.js.map +1 -0
- package/lib/module/utils/index.js +8 -0
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/api.d.ts +1 -0
- package/lib/typescript/api.d.ts.map +1 -1
- package/lib/typescript/core/BaseAudioContext.d.ts +2 -0
- package/lib/typescript/core/BaseAudioContext.d.ts.map +1 -1
- package/lib/typescript/core/WorkletNode.d.ts +4 -0
- package/lib/typescript/core/WorkletNode.d.ts.map +1 -0
- package/lib/typescript/interfaces.d.ts +3 -0
- package/lib/typescript/interfaces.d.ts.map +1 -1
- package/lib/typescript/utils/index.d.ts +2 -0
- package/lib/typescript/utils/index.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/api.ts +1 -0
- package/src/core/BaseAudioContext.ts +51 -0
- package/src/core/WorkletNode.ts +3 -0
- package/src/interfaces.ts +7 -0
- package/src/utils/index.ts +10 -0
- package/common/cpp/audioapi/HostObjects/AnalyserNodeHostObject.h +0 -149
- package/common/cpp/audioapi/HostObjects/AudioBufferBaseSourceNodeHostObject.h +0 -76
- package/common/cpp/audioapi/HostObjects/AudioBufferHostObject.h +0 -120
- package/common/cpp/audioapi/HostObjects/AudioBufferQueueSourceNodeHostObject.h +0 -67
- package/common/cpp/audioapi/HostObjects/AudioBufferSourceNodeHostObject.h +0 -142
- package/common/cpp/audioapi/HostObjects/AudioRecorderHostObject.h +0 -86
- package/common/cpp/audioapi/HostObjects/AudioScheduledSourceNodeHostObject.h +0 -56
- package/common/cpp/audioapi/HostObjects/BiquadFilterNodeHostObject.h +0 -89
- package/common/cpp/audioapi/HostObjects/GainNodeHostObject.h +0 -27
- package/common/cpp/audioapi/HostObjects/OscillatorNodeHostObject.h +0 -65
- package/common/cpp/audioapi/HostObjects/StereoPannerNodeHostObject.h +0 -29
- package/common/cpp/audioapi/HostObjects/StreamerNodeHostObject.h +0 -30
- package/common/cpp/audioapi/events/AudioEventHandlerRegistryHostObject.h +0 -48
- package/ios/audioapi/ios/events/IOSAudioEventHandlerRegistry.h +0 -7
- package/ios/audioapi/ios/events/IOSAudioEventHandlerRegistry.mm +0 -12
- /package/common/cpp/audioapi/HostObjects/{AudioDestinationNodeHostObject.h → destinations/AudioDestinationNodeHostObject.h} +0 -0
- /package/common/cpp/audioapi/HostObjects/{PeriodicWaveHostObject.h → effects/PeriodicWaveHostObject.h} +0 -0
- /package/common/cpp/audioapi/core/{AudioParamEventQueue.h → utils/AudioParamEventQueue.h} +0 -0
- /package/common/cpp/audioapi/core/{Constants.h → utils/Constants.h} +0 -0
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <jsi/jsi.h>
|
|
4
|
-
|
|
5
|
-
#include <audioapi/core/sources/AudioBuffer.h>
|
|
6
|
-
#include <audioapi/HostObjects/AudioBufferHostObject.h>
|
|
7
|
-
#include <audioapi/core/inputs/AudioRecorder.h>
|
|
8
|
-
#include <audioapi/HostObjects/RecorderAdapterNodeHostObject.h>
|
|
9
|
-
|
|
10
|
-
#ifdef ANDROID
|
|
11
|
-
#include <audioapi/android/core/AndroidAudioRecorder.h>
|
|
12
|
-
#else
|
|
13
|
-
#include <audioapi/ios/core/IOSAudioRecorder.h>
|
|
14
|
-
#endif
|
|
15
|
-
|
|
16
|
-
#include <memory>
|
|
17
|
-
#include <utility>
|
|
18
|
-
#include <vector>
|
|
19
|
-
#include <cstdio>
|
|
20
|
-
|
|
21
|
-
namespace audioapi {
|
|
22
|
-
using namespace facebook;
|
|
23
|
-
|
|
24
|
-
class AudioRecorderHostObject : public JsiHostObject {
|
|
25
|
-
public:
|
|
26
|
-
explicit AudioRecorderHostObject(
|
|
27
|
-
jsi::Runtime *runtime,
|
|
28
|
-
const std::shared_ptr<AudioEventHandlerRegistry> &audioEventHandlerRegistry,
|
|
29
|
-
float sampleRate,
|
|
30
|
-
int bufferLength) {
|
|
31
|
-
#ifdef ANDROID
|
|
32
|
-
audioRecorder_ = std::make_shared<AndroidAudioRecorder>(
|
|
33
|
-
sampleRate,
|
|
34
|
-
bufferLength,
|
|
35
|
-
audioEventHandlerRegistry
|
|
36
|
-
);
|
|
37
|
-
#else
|
|
38
|
-
audioRecorder_ = std::make_shared<IOSAudioRecorder>(
|
|
39
|
-
sampleRate,
|
|
40
|
-
bufferLength,
|
|
41
|
-
audioEventHandlerRegistry
|
|
42
|
-
);
|
|
43
|
-
#endif
|
|
44
|
-
|
|
45
|
-
addSetters(JSI_EXPORT_PROPERTY_SETTER(AudioRecorderHostObject, onAudioReady));
|
|
46
|
-
|
|
47
|
-
addFunctions(
|
|
48
|
-
JSI_EXPORT_FUNCTION(AudioRecorderHostObject, start),
|
|
49
|
-
JSI_EXPORT_FUNCTION(AudioRecorderHostObject, stop),
|
|
50
|
-
JSI_EXPORT_FUNCTION(AudioRecorderHostObject, connect),
|
|
51
|
-
JSI_EXPORT_FUNCTION(AudioRecorderHostObject, disconnect)
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
JSI_HOST_FUNCTION(connect) {
|
|
56
|
-
auto adapterNodeHostObject = args[0].getObject(runtime).getHostObject<RecorderAdapterNodeHostObject>(runtime);
|
|
57
|
-
audioRecorder_->connect(
|
|
58
|
-
std::static_pointer_cast<RecorderAdapterNode>(adapterNodeHostObject->node_));
|
|
59
|
-
return jsi::Value::undefined();
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
JSI_HOST_FUNCTION(disconnect) {
|
|
63
|
-
audioRecorder_->disconnect();
|
|
64
|
-
return jsi::Value::undefined();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
JSI_HOST_FUNCTION(start) {
|
|
68
|
-
audioRecorder_->start();
|
|
69
|
-
|
|
70
|
-
return jsi::Value::undefined();
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
JSI_HOST_FUNCTION(stop) {
|
|
74
|
-
audioRecorder_->stop();
|
|
75
|
-
|
|
76
|
-
return jsi::Value::undefined();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
JSI_PROPERTY_SETTER(onAudioReady) {
|
|
80
|
-
audioRecorder_->setOnAudioReadyCallbackId(std::stoull(value.getString(runtime).utf8(runtime)));
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
private:
|
|
84
|
-
std::shared_ptr<AudioRecorder> audioRecorder_;
|
|
85
|
-
};
|
|
86
|
-
} // namespace audioapi
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <audioapi/HostObjects/AudioNodeHostObject.h>
|
|
4
|
-
#include <audioapi/core/sources/AudioScheduledSourceNode.h>
|
|
5
|
-
|
|
6
|
-
#include <memory>
|
|
7
|
-
#include <vector>
|
|
8
|
-
|
|
9
|
-
namespace audioapi {
|
|
10
|
-
using namespace facebook;
|
|
11
|
-
|
|
12
|
-
class AudioScheduledSourceNodeHostObject : public AudioNodeHostObject {
|
|
13
|
-
public:
|
|
14
|
-
explicit AudioScheduledSourceNodeHostObject(
|
|
15
|
-
const std::shared_ptr<AudioScheduledSourceNode> &node)
|
|
16
|
-
: AudioNodeHostObject(node) {
|
|
17
|
-
addSetters(
|
|
18
|
-
JSI_EXPORT_PROPERTY_SETTER(AudioScheduledSourceNodeHostObject, onEnded));
|
|
19
|
-
addFunctions(
|
|
20
|
-
JSI_EXPORT_FUNCTION(AudioScheduledSourceNodeHostObject, start),
|
|
21
|
-
JSI_EXPORT_FUNCTION(AudioScheduledSourceNodeHostObject, stop));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
~AudioScheduledSourceNodeHostObject() {
|
|
25
|
-
auto audioScheduledSourceNode =
|
|
26
|
-
std::static_pointer_cast<AudioScheduledSourceNode>(node_);
|
|
27
|
-
|
|
28
|
-
// When JSI object is garbage collected (together with the eventual callback),
|
|
29
|
-
// underlying source node might still be active and try to call the non-existing callback.
|
|
30
|
-
audioScheduledSourceNode->clearOnEndedCallback();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
JSI_PROPERTY_SETTER(onEnded) {
|
|
34
|
-
auto audioScheduleSourceNode =
|
|
35
|
-
std::static_pointer_cast<AudioScheduledSourceNode>(node_);
|
|
36
|
-
|
|
37
|
-
audioScheduleSourceNode->setOnEndedCallbackId(std::stoull(value.getString(runtime).utf8(runtime)));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
JSI_HOST_FUNCTION(start) {
|
|
41
|
-
auto when = args[0].getNumber();
|
|
42
|
-
auto audioScheduleSourceNode =
|
|
43
|
-
std::static_pointer_cast<AudioScheduledSourceNode>(node_);
|
|
44
|
-
audioScheduleSourceNode->start(when);
|
|
45
|
-
return jsi::Value::undefined();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
JSI_HOST_FUNCTION(stop) {
|
|
49
|
-
auto time = args[0].getNumber();
|
|
50
|
-
auto audioScheduleSourceNode =
|
|
51
|
-
std::static_pointer_cast<AudioScheduledSourceNode>(node_);
|
|
52
|
-
audioScheduleSourceNode->stop(time);
|
|
53
|
-
return jsi::Value::undefined();
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
} // namespace audioapi
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <audioapi/HostObjects/AudioNodeHostObject.h>
|
|
4
|
-
#include <audioapi/HostObjects/AudioParamHostObject.h>
|
|
5
|
-
#include <audioapi/core/effects/BiquadFilterNode.h>
|
|
6
|
-
|
|
7
|
-
#include <memory>
|
|
8
|
-
#include <string>
|
|
9
|
-
#include <vector>
|
|
10
|
-
|
|
11
|
-
namespace audioapi {
|
|
12
|
-
using namespace facebook;
|
|
13
|
-
|
|
14
|
-
class BiquadFilterNodeHostObject : public AudioNodeHostObject {
|
|
15
|
-
public:
|
|
16
|
-
explicit BiquadFilterNodeHostObject(
|
|
17
|
-
const std::shared_ptr<BiquadFilterNode> &node)
|
|
18
|
-
: AudioNodeHostObject(node) {
|
|
19
|
-
addGetters(
|
|
20
|
-
JSI_EXPORT_PROPERTY_GETTER(BiquadFilterNodeHostObject, frequency),
|
|
21
|
-
JSI_EXPORT_PROPERTY_GETTER(BiquadFilterNodeHostObject, detune),
|
|
22
|
-
JSI_EXPORT_PROPERTY_GETTER(BiquadFilterNodeHostObject, Q),
|
|
23
|
-
JSI_EXPORT_PROPERTY_GETTER(BiquadFilterNodeHostObject, gain),
|
|
24
|
-
JSI_EXPORT_PROPERTY_GETTER(BiquadFilterNodeHostObject, type));
|
|
25
|
-
|
|
26
|
-
addFunctions(
|
|
27
|
-
JSI_EXPORT_FUNCTION(BiquadFilterNodeHostObject, getFrequencyResponse));
|
|
28
|
-
|
|
29
|
-
addSetters(JSI_EXPORT_PROPERTY_SETTER(BiquadFilterNodeHostObject, type));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
JSI_PROPERTY_GETTER(frequency) {
|
|
33
|
-
auto biquadFilterNode = std::static_pointer_cast<BiquadFilterNode>(node_);
|
|
34
|
-
auto frequencyParam_ = std::make_shared<AudioParamHostObject>(
|
|
35
|
-
biquadFilterNode->getFrequencyParam());
|
|
36
|
-
return jsi::Object::createFromHostObject(runtime, frequencyParam_);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
JSI_PROPERTY_GETTER(detune) {
|
|
40
|
-
auto biquadFilterNode = std::static_pointer_cast<BiquadFilterNode>(node_);
|
|
41
|
-
auto detuneParam_ = std::make_shared<AudioParamHostObject>(
|
|
42
|
-
biquadFilterNode->getDetuneParam());
|
|
43
|
-
return jsi::Object::createFromHostObject(runtime, detuneParam_);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
JSI_PROPERTY_GETTER(Q) {
|
|
47
|
-
auto biquadFilterNode = std::static_pointer_cast<BiquadFilterNode>(node_);
|
|
48
|
-
auto QParam_ =
|
|
49
|
-
std::make_shared<AudioParamHostObject>(biquadFilterNode->getQParam());
|
|
50
|
-
return jsi::Object::createFromHostObject(runtime, QParam_);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
JSI_PROPERTY_GETTER(gain) {
|
|
54
|
-
auto biquadFilterNode = std::static_pointer_cast<BiquadFilterNode>(node_);
|
|
55
|
-
auto gainParam_ = std::make_shared<AudioParamHostObject>(
|
|
56
|
-
biquadFilterNode->getGainParam());
|
|
57
|
-
return jsi::Object::createFromHostObject(runtime, gainParam_);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
JSI_PROPERTY_GETTER(type) {
|
|
61
|
-
auto biquadFilterNode = std::static_pointer_cast<BiquadFilterNode>(node_);
|
|
62
|
-
auto type = biquadFilterNode->getType();
|
|
63
|
-
return jsi::String::createFromUtf8(runtime, type);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
JSI_HOST_FUNCTION(getFrequencyResponse) {
|
|
67
|
-
auto arrayBufferFrequency = args[0].getObject(runtime).getPropertyAsObject(runtime, "buffer").getArrayBuffer(runtime);
|
|
68
|
-
auto frequencyArray = reinterpret_cast<float *>(arrayBufferFrequency.data(runtime));
|
|
69
|
-
auto length = static_cast<int>(arrayBufferFrequency.size(runtime));
|
|
70
|
-
|
|
71
|
-
auto arrayBufferMag = args[1].getObject(runtime).getPropertyAsObject(runtime, "buffer").getArrayBuffer(runtime);
|
|
72
|
-
auto magResponseOut = reinterpret_cast<float *>(arrayBufferMag.data(runtime));
|
|
73
|
-
|
|
74
|
-
auto arrayBufferPhase = args[2].getObject(runtime).getPropertyAsObject(runtime, "buffer").getArrayBuffer(runtime);
|
|
75
|
-
auto phaseResponseOut = reinterpret_cast<float *>(arrayBufferPhase.data(runtime));
|
|
76
|
-
|
|
77
|
-
auto biquadFilterNode = std::static_pointer_cast<BiquadFilterNode>(node_);
|
|
78
|
-
biquadFilterNode->getFrequencyResponse(
|
|
79
|
-
frequencyArray, magResponseOut, phaseResponseOut, length);
|
|
80
|
-
|
|
81
|
-
return jsi::Value::undefined();
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
JSI_PROPERTY_SETTER(type) {
|
|
85
|
-
auto biquadFilterNode = std::static_pointer_cast<BiquadFilterNode>(node_);
|
|
86
|
-
biquadFilterNode->setType(value.getString(runtime).utf8(runtime));
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
} // namespace audioapi
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <audioapi/HostObjects/AudioNodeHostObject.h>
|
|
4
|
-
#include <audioapi/HostObjects/AudioParamHostObject.h>
|
|
5
|
-
#include <audioapi/core/effects/GainNode.h>
|
|
6
|
-
|
|
7
|
-
#include <memory>
|
|
8
|
-
#include <vector>
|
|
9
|
-
|
|
10
|
-
namespace audioapi {
|
|
11
|
-
using namespace facebook;
|
|
12
|
-
|
|
13
|
-
class GainNodeHostObject : public AudioNodeHostObject {
|
|
14
|
-
public:
|
|
15
|
-
explicit GainNodeHostObject(const std::shared_ptr<GainNode> &node)
|
|
16
|
-
: AudioNodeHostObject(node) {
|
|
17
|
-
addGetters(JSI_EXPORT_PROPERTY_GETTER(GainNodeHostObject, gain));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
JSI_PROPERTY_GETTER(gain) {
|
|
21
|
-
auto gainNode = std::static_pointer_cast<GainNode>(node_);
|
|
22
|
-
auto gainParam =
|
|
23
|
-
std::make_shared<AudioParamHostObject>(gainNode->getGainParam());
|
|
24
|
-
return jsi::Object::createFromHostObject(runtime, gainParam);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
} // namespace audioapi
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <audioapi/HostObjects/AudioScheduledSourceNodeHostObject.h>
|
|
4
|
-
#include <audioapi/HostObjects/AudioParamHostObject.h>
|
|
5
|
-
#include <audioapi/HostObjects/PeriodicWaveHostObject.h>
|
|
6
|
-
#include <audioapi/core/sources/OscillatorNode.h>
|
|
7
|
-
|
|
8
|
-
#include <memory>
|
|
9
|
-
#include <string>
|
|
10
|
-
#include <vector>
|
|
11
|
-
|
|
12
|
-
namespace audioapi {
|
|
13
|
-
using namespace facebook;
|
|
14
|
-
|
|
15
|
-
class OscillatorNodeHostObject : public AudioScheduledSourceNodeHostObject {
|
|
16
|
-
public:
|
|
17
|
-
explicit OscillatorNodeHostObject(
|
|
18
|
-
const std::shared_ptr<OscillatorNode> &node)
|
|
19
|
-
: AudioScheduledSourceNodeHostObject(node) {
|
|
20
|
-
addGetters(
|
|
21
|
-
JSI_EXPORT_PROPERTY_GETTER(OscillatorNodeHostObject, frequency),
|
|
22
|
-
JSI_EXPORT_PROPERTY_GETTER(OscillatorNodeHostObject, detune),
|
|
23
|
-
JSI_EXPORT_PROPERTY_GETTER(OscillatorNodeHostObject, type));
|
|
24
|
-
|
|
25
|
-
addFunctions(
|
|
26
|
-
JSI_EXPORT_FUNCTION(OscillatorNodeHostObject, setPeriodicWave));
|
|
27
|
-
|
|
28
|
-
addSetters(JSI_EXPORT_PROPERTY_SETTER(OscillatorNodeHostObject, type));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
JSI_PROPERTY_GETTER(frequency) {
|
|
32
|
-
auto oscillatorNode = std::static_pointer_cast<OscillatorNode>(node_);
|
|
33
|
-
auto frequencyParam_ = std::make_shared<AudioParamHostObject>(
|
|
34
|
-
oscillatorNode->getFrequencyParam());
|
|
35
|
-
return jsi::Object::createFromHostObject(runtime, frequencyParam_);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
JSI_PROPERTY_GETTER(detune) {
|
|
39
|
-
auto oscillatorNode = std::static_pointer_cast<OscillatorNode>(node_);
|
|
40
|
-
auto detuneParam_ = std::make_shared<AudioParamHostObject>(
|
|
41
|
-
oscillatorNode->getDetuneParam());
|
|
42
|
-
return jsi::Object::createFromHostObject(runtime, detuneParam_);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
JSI_PROPERTY_GETTER(type) {
|
|
46
|
-
auto oscillatorNode = std::static_pointer_cast<OscillatorNode>(node_);
|
|
47
|
-
auto waveType = oscillatorNode->getType();
|
|
48
|
-
return jsi::String::createFromUtf8(runtime, waveType);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
JSI_HOST_FUNCTION(setPeriodicWave) {
|
|
52
|
-
auto oscillatorNode = std::static_pointer_cast<OscillatorNode>(node_);
|
|
53
|
-
auto periodicWave =
|
|
54
|
-
args[0].getObject(runtime).getHostObject<PeriodicWaveHostObject>(
|
|
55
|
-
runtime);
|
|
56
|
-
oscillatorNode->setPeriodicWave(periodicWave->periodicWave_);
|
|
57
|
-
return jsi::Value::undefined();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
JSI_PROPERTY_SETTER(type) {
|
|
61
|
-
auto oscillatorNode = std::static_pointer_cast<OscillatorNode>(node_);
|
|
62
|
-
oscillatorNode->setType(value.getString(runtime).utf8(runtime));
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
} // namespace audioapi
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <audioapi/HostObjects/AudioNodeHostObject.h>
|
|
4
|
-
#include <audioapi/HostObjects/AudioParamHostObject.h>
|
|
5
|
-
#include <audioapi/core/effects/StereoPannerNode.h>
|
|
6
|
-
|
|
7
|
-
#include <memory>
|
|
8
|
-
#include <string>
|
|
9
|
-
#include <vector>
|
|
10
|
-
|
|
11
|
-
namespace audioapi {
|
|
12
|
-
using namespace facebook;
|
|
13
|
-
|
|
14
|
-
class StereoPannerNodeHostObject : public AudioNodeHostObject {
|
|
15
|
-
public:
|
|
16
|
-
explicit StereoPannerNodeHostObject(
|
|
17
|
-
const std::shared_ptr<StereoPannerNode> &node)
|
|
18
|
-
: AudioNodeHostObject(node) {
|
|
19
|
-
addGetters(JSI_EXPORT_PROPERTY_GETTER(StereoPannerNodeHostObject, pan));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
JSI_PROPERTY_GETTER(pan) {
|
|
23
|
-
auto stereoPannerNode = std::static_pointer_cast<StereoPannerNode>(node_);
|
|
24
|
-
auto panParam_ =
|
|
25
|
-
std::make_shared<AudioParamHostObject>(stereoPannerNode->getPanParam());
|
|
26
|
-
return jsi::Object::createFromHostObject(runtime, panParam_);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
} // namespace audioapi
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <audioapi/HostObjects/AudioScheduledSourceNodeHostObject.h>
|
|
4
|
-
#include <audioapi/HostObjects/AudioParamHostObject.h>
|
|
5
|
-
#include <audioapi/HostObjects/PeriodicWaveHostObject.h>
|
|
6
|
-
#include <audioapi/core/sources/StreamerNode.h>
|
|
7
|
-
|
|
8
|
-
#include <memory>
|
|
9
|
-
#include <string>
|
|
10
|
-
#include <vector>
|
|
11
|
-
|
|
12
|
-
namespace audioapi {
|
|
13
|
-
using namespace facebook;
|
|
14
|
-
|
|
15
|
-
class StreamerNodeHostObject : public AudioScheduledSourceNodeHostObject {
|
|
16
|
-
public:
|
|
17
|
-
explicit StreamerNodeHostObject(
|
|
18
|
-
const std::shared_ptr<StreamerNode> &node)
|
|
19
|
-
: AudioScheduledSourceNodeHostObject(node) {
|
|
20
|
-
addFunctions(JSI_EXPORT_FUNCTION(StreamerNodeHostObject, initialize));
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
JSI_HOST_FUNCTION(initialize) {
|
|
24
|
-
auto streamerNode = std::static_pointer_cast<StreamerNode>(node_);
|
|
25
|
-
auto path = args[0].getString(runtime).utf8(runtime);
|
|
26
|
-
auto result = streamerNode->initialize(path);
|
|
27
|
-
return jsi::Value(result);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
} // namespace audioapi
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <audioapi/jsi/JsiHostObject.h>
|
|
4
|
-
#include <audioapi/events/AudioEventHandlerRegistry.h>
|
|
5
|
-
|
|
6
|
-
#include <jsi/jsi.h>
|
|
7
|
-
#include <ReactCommon/CallInvoker.h>
|
|
8
|
-
#include <memory>
|
|
9
|
-
#include <unordered_map>
|
|
10
|
-
#include <vector>
|
|
11
|
-
#include <string>
|
|
12
|
-
|
|
13
|
-
namespace audioapi {
|
|
14
|
-
using namespace facebook;
|
|
15
|
-
|
|
16
|
-
class AudioEventHandlerRegistryHostObject : public JsiHostObject {
|
|
17
|
-
public:
|
|
18
|
-
explicit AudioEventHandlerRegistryHostObject(const std::shared_ptr<AudioEventHandlerRegistry>& eventHandlerRegistry) {
|
|
19
|
-
eventHandlerRegistry_ = eventHandlerRegistry;
|
|
20
|
-
|
|
21
|
-
addFunctions(
|
|
22
|
-
JSI_EXPORT_FUNCTION(AudioEventHandlerRegistryHostObject, addAudioEventListener),
|
|
23
|
-
JSI_EXPORT_FUNCTION(AudioEventHandlerRegistryHostObject, removeAudioEventListener));
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
JSI_HOST_FUNCTION(addAudioEventListener) {
|
|
27
|
-
auto eventName = args[0].getString(runtime).utf8(runtime);
|
|
28
|
-
auto callback = std::make_shared<jsi::Function>(args[1].getObject(runtime).getFunction(runtime));
|
|
29
|
-
|
|
30
|
-
auto listenerId = eventHandlerRegistry_->registerHandler(eventName, callback);
|
|
31
|
-
|
|
32
|
-
return jsi::String::createFromUtf8(runtime, std::to_string(listenerId));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
JSI_HOST_FUNCTION(removeAudioEventListener) {
|
|
36
|
-
auto eventName = args[0].getString(runtime).utf8(runtime);
|
|
37
|
-
uint64_t listenerId = std::stoull(args[1].getString(runtime).utf8(runtime));
|
|
38
|
-
|
|
39
|
-
eventHandlerRegistry_->unregisterHandler(eventName, listenerId);
|
|
40
|
-
|
|
41
|
-
return jsi::Value::undefined();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
private:
|
|
45
|
-
std::shared_ptr<AudioEventHandlerRegistry> eventHandlerRegistry_;
|
|
46
|
-
};
|
|
47
|
-
} // namespace audioapi
|
|
48
|
-
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// #import <audioapi/ios/events/IOSAudioEventHandlerRegistry.h>
|
|
2
|
-
//
|
|
3
|
-
// #include <memory>
|
|
4
|
-
// #include
|
|
5
|
-
//
|
|
6
|
-
//@implementation IOSAudioEventHandlerRegistry {
|
|
7
|
-
// std::shared_ptr<AudioEventHandlerRegistry> _eventHandler;
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// }
|
|
11
|
-
//
|
|
12
|
-
//@end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|