react-native-audio-api 0.12.0-nightly-3254662-20260127 → 0.12.0-nightly-1a3c43b-20260128
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/android/src/main/cpp/audioapi/CMakeLists.txt +0 -6
- package/android/src/main/cpp/audioapi/android/AudioAPIModule.cpp +3 -2
- package/android/src/main/cpp/audioapi/android/AudioAPIModule.h +1 -1
- package/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.cpp +1 -1
- package/android/src/main/java/com/swmansion/audioapi/AudioAPIModule.kt +5 -1
- package/android/src/main/java/com/swmansion/audioapi/system/AudioEvent.kt +28 -0
- package/android/src/main/java/com/swmansion/audioapi/system/AudioFocusListener.kt +4 -4
- package/android/src/main/java/com/swmansion/audioapi/system/VolumeChangeListener.kt +1 -1
- package/android/src/main/java/com/swmansion/audioapi/system/notification/PlaybackNotification.kt +27 -18
- package/android/src/main/java/com/swmansion/audioapi/system/notification/PlaybackNotificationReceiver.kt +13 -8
- package/android/src/main/java/com/swmansion/audioapi/system/notification/RecordingNotificationReceiver.kt +3 -2
- package/android/src/oldarch/NativeAudioAPIModuleSpec.java +2 -2
- package/common/cpp/audioapi/AudioAPIModuleInstaller.h +9 -12
- package/common/cpp/audioapi/HostObjects/AudioContextHostObject.cpp +4 -2
- package/common/cpp/audioapi/HostObjects/AudioContextHostObject.h +5 -1
- package/common/cpp/audioapi/HostObjects/BaseAudioContextHostObject.cpp +38 -38
- package/common/cpp/audioapi/HostObjects/BaseAudioContextHostObject.h +4 -2
- package/common/cpp/audioapi/HostObjects/OfflineAudioContextHostObject.cpp +8 -4
- package/common/cpp/audioapi/HostObjects/OfflineAudioContextHostObject.h +7 -1
- package/common/cpp/audioapi/HostObjects/analysis/AnalyserNodeHostObject.cpp +6 -4
- package/common/cpp/audioapi/HostObjects/analysis/AnalyserNodeHostObject.h +6 -2
- package/common/cpp/audioapi/HostObjects/effects/BiquadFilterNodeHostObject.cpp +8 -5
- package/common/cpp/audioapi/HostObjects/effects/BiquadFilterNodeHostObject.h +5 -3
- package/common/cpp/audioapi/HostObjects/effects/ConvolverNodeHostObject.cpp +5 -3
- package/common/cpp/audioapi/HostObjects/effects/ConvolverNodeHostObject.h +5 -2
- package/common/cpp/audioapi/HostObjects/effects/DelayNodeHostObject.cpp +4 -3
- package/common/cpp/audioapi/HostObjects/effects/DelayNodeHostObject.h +5 -2
- package/common/cpp/audioapi/HostObjects/effects/GainNodeHostObject.cpp +6 -2
- package/common/cpp/audioapi/HostObjects/effects/GainNodeHostObject.h +5 -2
- package/common/cpp/audioapi/HostObjects/effects/IIRFilterNodeHostObject.cpp +6 -2
- package/common/cpp/audioapi/HostObjects/effects/IIRFilterNodeHostObject.h +5 -2
- package/common/cpp/audioapi/HostObjects/effects/StereoPannerNodeHostObject.cpp +5 -2
- package/common/cpp/audioapi/HostObjects/effects/StereoPannerNodeHostObject.h +5 -2
- package/common/cpp/audioapi/HostObjects/effects/WaveShaperNodeHostObject.cpp +9 -4
- package/common/cpp/audioapi/HostObjects/effects/WaveShaperNodeHostObject.h +5 -2
- package/common/cpp/audioapi/HostObjects/events/AudioEventHandlerRegistryHostObject.cpp +3 -2
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferQueueSourceNodeHostObject.cpp +9 -6
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferQueueSourceNodeHostObject.h +4 -2
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferSourceNodeHostObject.cpp +5 -2
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferSourceNodeHostObject.h +5 -2
- package/common/cpp/audioapi/HostObjects/sources/ConstantSourceNodeHostObject.cpp +5 -2
- package/common/cpp/audioapi/HostObjects/sources/ConstantSourceNodeHostObject.h +5 -2
- package/common/cpp/audioapi/HostObjects/sources/OscillatorNodeHostObject.cpp +7 -3
- package/common/cpp/audioapi/HostObjects/sources/OscillatorNodeHostObject.h +5 -2
- package/common/cpp/audioapi/HostObjects/sources/StreamerNodeHostObject.cpp +6 -2
- package/common/cpp/audioapi/HostObjects/sources/StreamerNodeHostObject.h +5 -2
- package/common/cpp/audioapi/HostObjects/utils/JsEnumParser.cpp +63 -0
- package/common/cpp/audioapi/HostObjects/utils/JsEnumParser.h +5 -0
- package/common/cpp/audioapi/core/AudioContext.cpp +2 -4
- package/common/cpp/audioapi/core/AudioNode.cpp +2 -2
- package/common/cpp/audioapi/core/AudioNode.h +6 -6
- package/common/cpp/audioapi/core/BaseAudioContext.cpp +7 -22
- package/common/cpp/audioapi/core/BaseAudioContext.h +20 -22
- package/common/cpp/audioapi/core/OfflineAudioContext.cpp +3 -6
- package/common/cpp/audioapi/core/analysis/AnalyserNode.cpp +5 -2
- package/common/cpp/audioapi/core/analysis/AnalyserNode.h +4 -2
- package/common/cpp/audioapi/core/destinations/AudioDestinationNode.cpp +1 -1
- package/common/cpp/audioapi/core/destinations/AudioDestinationNode.h +1 -1
- package/common/cpp/audioapi/core/effects/BiquadFilterNode.cpp +6 -6
- package/common/cpp/audioapi/core/effects/BiquadFilterNode.h +2 -2
- package/common/cpp/audioapi/core/effects/ConvolverNode.cpp +1 -1
- package/common/cpp/audioapi/core/effects/ConvolverNode.h +2 -2
- package/common/cpp/audioapi/core/effects/DelayNode.cpp +1 -1
- package/common/cpp/audioapi/core/effects/DelayNode.h +2 -2
- package/common/cpp/audioapi/core/effects/GainNode.cpp +1 -1
- package/common/cpp/audioapi/core/effects/GainNode.h +2 -2
- package/common/cpp/audioapi/core/effects/IIRFilterNode.cpp +5 -3
- package/common/cpp/audioapi/core/effects/IIRFilterNode.h +2 -2
- package/common/cpp/audioapi/core/effects/StereoPannerNode.cpp +5 -2
- package/common/cpp/audioapi/core/effects/StereoPannerNode.h +2 -2
- package/common/cpp/audioapi/core/effects/WaveShaperNode.cpp +4 -2
- package/common/cpp/audioapi/core/effects/WaveShaperNode.h +2 -2
- package/common/cpp/audioapi/core/sources/AudioBuffer.h +1 -1
- package/common/cpp/audioapi/core/sources/AudioBufferBaseSourceNode.cpp +10 -4
- package/common/cpp/audioapi/core/sources/AudioBufferBaseSourceNode.h +2 -2
- package/common/cpp/audioapi/core/sources/AudioBufferQueueSourceNode.cpp +13 -13
- package/common/cpp/audioapi/core/sources/AudioBufferQueueSourceNode.h +2 -2
- package/common/cpp/audioapi/core/sources/AudioBufferSourceNode.cpp +6 -5
- package/common/cpp/audioapi/core/sources/AudioBufferSourceNode.h +2 -2
- package/common/cpp/audioapi/core/sources/AudioScheduledSourceNode.cpp +2 -2
- package/common/cpp/audioapi/core/sources/ConstantSourceNode.cpp +10 -2
- package/common/cpp/audioapi/core/sources/ConstantSourceNode.h +2 -2
- package/common/cpp/audioapi/core/sources/OscillatorNode.cpp +11 -6
- package/common/cpp/audioapi/core/sources/OscillatorNode.h +2 -2
- package/common/cpp/audioapi/core/sources/StreamerNode.cpp +17 -4
- package/common/cpp/audioapi/core/sources/StreamerNode.h +4 -2
- package/common/cpp/audioapi/core/utils/AudioFileWriter.cpp +1 -1
- package/common/cpp/audioapi/core/utils/AudioRecorderCallback.cpp +2 -2
- package/common/cpp/audioapi/events/AudioEvent.h +30 -0
- package/common/cpp/audioapi/events/AudioEventHandlerRegistry.cpp +9 -20
- package/common/cpp/audioapi/events/AudioEventHandlerRegistry.h +7 -34
- package/common/cpp/audioapi/events/IAudioEventHandlerRegistry.h +5 -4
- package/common/cpp/test/src/MockAudioEventHandlerRegistry.h +5 -10
- package/ios/audioapi/ios/AudioAPIModule.h +3 -1
- package/ios/audioapi/ios/AudioAPIModule.mm +7 -6
- package/ios/audioapi/ios/system/AudioSessionManager.h +3 -1
- package/ios/audioapi/ios/system/AudioSessionManager.mm +8 -1
- package/ios/audioapi/ios/system/SystemNotificationManager.mm +17 -8
- package/ios/audioapi/ios/system/notification/PlaybackNotification.mm +36 -33
- package/lib/commonjs/core/AudioDecoder.js +2 -2
- package/lib/commonjs/core/AudioDecoder.js.map +1 -1
- package/lib/commonjs/specs/NativeAudioAPIModule.js.map +1 -1
- package/lib/commonjs/specs/NativeAudioAPIModule.web.js.map +1 -1
- package/lib/commonjs/system/AudioManager.js +1 -1
- package/lib/commonjs/system/AudioManager.js.map +1 -1
- package/lib/module/core/AudioDecoder.js +2 -2
- package/lib/module/core/AudioDecoder.js.map +1 -1
- package/lib/module/specs/NativeAudioAPIModule.js.map +1 -1
- package/lib/module/specs/NativeAudioAPIModule.web.js.map +1 -1
- package/lib/module/system/AudioManager.js +1 -1
- package/lib/module/system/AudioManager.js.map +1 -1
- package/lib/typescript/core/AudioDecoder.d.ts.map +1 -1
- package/lib/typescript/events/types.d.ts +1 -17
- package/lib/typescript/events/types.d.ts.map +1 -1
- package/lib/typescript/specs/NativeAudioAPIModule.d.ts +1 -1
- package/lib/typescript/specs/NativeAudioAPIModule.d.ts.map +1 -1
- package/lib/typescript/specs/NativeAudioAPIModule.web.d.ts +1 -1
- package/lib/typescript/specs/NativeAudioAPIModule.web.d.ts.map +1 -1
- package/lib/typescript/system/AudioManager.d.ts.map +1 -1
- package/lib/typescript/system/notification/types.d.ts +4 -3
- package/lib/typescript/system/notification/types.d.ts.map +1 -1
- package/lib/typescript/system/types.d.ts +8 -0
- package/lib/typescript/system/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/AudioDecoder.ts +2 -2
- package/src/events/types.ts +1 -18
- package/src/specs/NativeAudioAPIModule.ts +3 -2
- package/src/specs/NativeAudioAPIModule.web.ts +2 -1
- package/src/system/AudioManager.ts +2 -1
- package/src/system/notification/types.ts +6 -4
- package/src/system/types.ts +8 -0
|
@@ -8,10 +8,14 @@
|
|
|
8
8
|
namespace audioapi {
|
|
9
9
|
|
|
10
10
|
OfflineAudioContextHostObject::OfflineAudioContextHostObject(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
int numberOfChannels,
|
|
12
|
+
size_t length,
|
|
13
|
+
float sampleRate,
|
|
14
|
+
const std::shared_ptr<IAudioEventHandlerRegistry> &audioEventHandlerRegistry,
|
|
15
|
+
const RuntimeRegistry &runtimeRegistry,
|
|
16
|
+
jsi::Runtime *runtime,
|
|
17
|
+
const std::shared_ptr<react::CallInvoker> &callInvoker)
|
|
18
|
+
: BaseAudioContextHostObject(std::make_shared<OfflineAudioContext>(numberOfChannels, length, sampleRate, audioEventHandlerRegistry, runtimeRegistry), runtime, callInvoker) {
|
|
15
19
|
addFunctions(
|
|
16
20
|
JSI_EXPORT_FUNCTION(OfflineAudioContextHostObject, resume),
|
|
17
21
|
JSI_EXPORT_FUNCTION(OfflineAudioContextHostObject, suspend),
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
3
|
#include <audioapi/HostObjects/BaseAudioContextHostObject.h>
|
|
4
|
+
#include <audioapi/core/utils/worklets/SafeIncludes.h>
|
|
5
|
+
#include <audioapi/events/IAudioEventHandlerRegistry.h>
|
|
4
6
|
|
|
5
7
|
#include <jsi/jsi.h>
|
|
6
8
|
#include <memory>
|
|
@@ -15,7 +17,11 @@ class OfflineAudioContext;
|
|
|
15
17
|
class OfflineAudioContextHostObject : public BaseAudioContextHostObject {
|
|
16
18
|
public:
|
|
17
19
|
explicit OfflineAudioContextHostObject(
|
|
18
|
-
|
|
20
|
+
int numberOfChannels,
|
|
21
|
+
size_t length,
|
|
22
|
+
float sampleRate,
|
|
23
|
+
const std::shared_ptr<IAudioEventHandlerRegistry> &audioEventHandlerRegistry,
|
|
24
|
+
const RuntimeRegistry &runtimeRegistry,
|
|
19
25
|
jsi::Runtime *runtime,
|
|
20
26
|
const std::shared_ptr<react::CallInvoker> &callInvoker);
|
|
21
27
|
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
#include <audioapi/HostObjects/analysis/AnalyserNodeHostObject.h>
|
|
2
|
-
|
|
3
|
-
#include <audioapi/core/analysis/AnalyserNode.h>
|
|
2
|
+
#include <audioapi/HostObjects/utils/NodeOptions.h>
|
|
4
3
|
#include <audioapi/HostObjects/utils/JsEnumParser.h>
|
|
4
|
+
#include <audioapi/core/BaseAudioContext.h>
|
|
5
|
+
#include <audioapi/core/analysis/AnalyserNode.h>
|
|
6
|
+
|
|
5
7
|
#include <memory>
|
|
6
8
|
|
|
7
9
|
namespace audioapi {
|
|
8
10
|
|
|
9
|
-
AnalyserNodeHostObject::AnalyserNodeHostObject(const std::shared_ptr<
|
|
10
|
-
: AudioNodeHostObject(
|
|
11
|
+
AnalyserNodeHostObject::AnalyserNodeHostObject(const std::shared_ptr<BaseAudioContext>& context, const AnalyserOptions &options)
|
|
12
|
+
: AudioNodeHostObject(context->createAnalyser(options)) {
|
|
11
13
|
addGetters(
|
|
12
14
|
JSI_EXPORT_PROPERTY_GETTER(AnalyserNodeHostObject, fftSize),
|
|
13
15
|
JSI_EXPORT_PROPERTY_GETTER(AnalyserNodeHostObject, frequencyBinCount),
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
3
|
#include <audioapi/HostObjects/AudioNodeHostObject.h>
|
|
4
|
-
#include <audioapi/core/analysis/AnalyserNode.h>
|
|
5
4
|
|
|
6
5
|
#include <memory>
|
|
7
6
|
#include <string>
|
|
@@ -10,9 +9,14 @@
|
|
|
10
9
|
namespace audioapi {
|
|
11
10
|
using namespace facebook;
|
|
12
11
|
|
|
12
|
+
struct AnalyserOptions;
|
|
13
|
+
class BaseAudioContext;
|
|
14
|
+
|
|
13
15
|
class AnalyserNodeHostObject : public AudioNodeHostObject {
|
|
14
16
|
public:
|
|
15
|
-
explicit AnalyserNodeHostObject(
|
|
17
|
+
explicit AnalyserNodeHostObject(
|
|
18
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
19
|
+
const AnalyserOptions &options);
|
|
16
20
|
|
|
17
21
|
JSI_PROPERTY_GETTER_DECL(fftSize);
|
|
18
22
|
JSI_PROPERTY_GETTER_DECL(frequencyBinCount);
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
#include <audioapi/HostObjects/effects/BiquadFilterNodeHostObject.h>
|
|
2
|
-
|
|
3
2
|
#include <audioapi/HostObjects/AudioParamHostObject.h>
|
|
4
|
-
#include <audioapi/core/effects/BiquadFilterNode.h>
|
|
5
3
|
#include <audioapi/HostObjects/utils/JsEnumParser.h>
|
|
4
|
+
#include <audioapi/HostObjects/utils/NodeOptions.h>
|
|
5
|
+
#include <audioapi/core/BaseAudioContext.h>
|
|
6
|
+
#include <audioapi/core/effects/BiquadFilterNode.h>
|
|
7
|
+
#include <audioapi/core/types/BiquadFilterType.h>
|
|
8
|
+
|
|
6
9
|
#include <memory>
|
|
7
10
|
|
|
8
11
|
namespace audioapi {
|
|
9
12
|
|
|
10
|
-
BiquadFilterNodeHostObject::BiquadFilterNodeHostObject(
|
|
11
|
-
|
|
12
|
-
: AudioNodeHostObject(
|
|
13
|
+
BiquadFilterNodeHostObject::BiquadFilterNodeHostObject(const std::shared_ptr<BaseAudioContext>& context,
|
|
14
|
+
const BiquadFilterOptions &options)
|
|
15
|
+
: AudioNodeHostObject(context->createBiquadFilter(options)) {
|
|
13
16
|
addGetters(
|
|
14
17
|
JSI_EXPORT_PROPERTY_GETTER(BiquadFilterNodeHostObject, frequency),
|
|
15
18
|
JSI_EXPORT_PROPERTY_GETTER(BiquadFilterNodeHostObject, detune),
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
3
|
#include <audioapi/HostObjects/AudioNodeHostObject.h>
|
|
4
|
-
#include <audioapi/core/types/BiquadFilterType.h>
|
|
5
4
|
|
|
6
5
|
#include <memory>
|
|
7
6
|
#include <string>
|
|
@@ -10,11 +9,14 @@
|
|
|
10
9
|
namespace audioapi {
|
|
11
10
|
using namespace facebook;
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
struct BiquadFilterOptions;
|
|
13
|
+
class BaseAudioContext;
|
|
14
14
|
|
|
15
15
|
class BiquadFilterNodeHostObject : public AudioNodeHostObject {
|
|
16
16
|
public:
|
|
17
|
-
explicit BiquadFilterNodeHostObject(
|
|
17
|
+
explicit BiquadFilterNodeHostObject(
|
|
18
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
19
|
+
const BiquadFilterOptions &options);
|
|
18
20
|
|
|
19
21
|
JSI_PROPERTY_GETTER_DECL(frequency);
|
|
20
22
|
JSI_PROPERTY_GETTER_DECL(detune);
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
#include <audioapi/HostObjects/effects/ConvolverNodeHostObject.h>
|
|
2
|
-
|
|
3
2
|
#include <audioapi/HostObjects/sources/AudioBufferHostObject.h>
|
|
3
|
+
#include <audioapi/HostObjects/utils/NodeOptions.h>
|
|
4
|
+
#include <audioapi/core/BaseAudioContext.h>
|
|
4
5
|
#include <audioapi/core/effects/ConvolverNode.h>
|
|
6
|
+
|
|
5
7
|
#include <memory>
|
|
6
8
|
|
|
7
9
|
namespace audioapi {
|
|
8
10
|
|
|
9
|
-
ConvolverNodeHostObject::ConvolverNodeHostObject(const std::shared_ptr<
|
|
10
|
-
: AudioNodeHostObject(
|
|
11
|
+
ConvolverNodeHostObject::ConvolverNodeHostObject(const std::shared_ptr<BaseAudioContext>& context, const ConvolverOptions &options)
|
|
12
|
+
: AudioNodeHostObject(context->createConvolver(options)) {
|
|
11
13
|
addGetters(
|
|
12
14
|
JSI_EXPORT_PROPERTY_GETTER(ConvolverNodeHostObject, normalize),
|
|
13
15
|
JSI_EXPORT_PROPERTY_GETTER(ConvolverNodeHostObject, buffer));
|
|
@@ -7,11 +7,14 @@
|
|
|
7
7
|
namespace audioapi {
|
|
8
8
|
using namespace facebook;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
struct ConvolverOptions;
|
|
11
|
+
class BaseAudioContext;
|
|
11
12
|
|
|
12
13
|
class ConvolverNodeHostObject : public AudioNodeHostObject {
|
|
13
14
|
public:
|
|
14
|
-
explicit ConvolverNodeHostObject(
|
|
15
|
+
explicit ConvolverNodeHostObject(
|
|
16
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
17
|
+
const ConvolverOptions &options);
|
|
15
18
|
JSI_PROPERTY_GETTER_DECL(normalize);
|
|
16
19
|
JSI_PROPERTY_GETTER_DECL(buffer);
|
|
17
20
|
JSI_PROPERTY_SETTER_DECL(normalize);
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
#include <audioapi/HostObjects/effects/DelayNodeHostObject.h>
|
|
2
|
-
|
|
3
2
|
#include <audioapi/HostObjects/AudioParamHostObject.h>
|
|
4
3
|
#include <audioapi/core/BaseAudioContext.h>
|
|
5
4
|
#include <audioapi/core/effects/DelayNode.h>
|
|
5
|
+
#include <audioapi/HostObjects/utils/NodeOptions.h>
|
|
6
|
+
|
|
6
7
|
#include <memory>
|
|
7
8
|
|
|
8
9
|
namespace audioapi {
|
|
9
10
|
|
|
10
|
-
DelayNodeHostObject::DelayNodeHostObject(const std::shared_ptr<
|
|
11
|
-
: AudioNodeHostObject(
|
|
11
|
+
DelayNodeHostObject::DelayNodeHostObject(const std::shared_ptr<BaseAudioContext>& context, const DelayOptions &options)
|
|
12
|
+
: AudioNodeHostObject(context->createDelay(options)) {
|
|
12
13
|
addGetters(JSI_EXPORT_PROPERTY_GETTER(DelayNodeHostObject, delayTime));
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -8,11 +8,14 @@
|
|
|
8
8
|
namespace audioapi {
|
|
9
9
|
using namespace facebook;
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
struct DelayOptions;
|
|
12
|
+
class BaseAudioContext;
|
|
12
13
|
|
|
13
14
|
class DelayNodeHostObject : public AudioNodeHostObject {
|
|
14
15
|
public:
|
|
15
|
-
explicit DelayNodeHostObject(
|
|
16
|
+
explicit DelayNodeHostObject(
|
|
17
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
18
|
+
const DelayOptions &options);
|
|
16
19
|
|
|
17
20
|
[[nodiscard]] size_t getSizeInBytes() const;
|
|
18
21
|
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
#include <audioapi/HostObjects/effects/GainNodeHostObject.h>
|
|
2
2
|
|
|
3
3
|
#include <audioapi/HostObjects/AudioParamHostObject.h>
|
|
4
|
+
#include <audioapi/HostObjects/utils/NodeOptions.h>
|
|
5
|
+
#include <audioapi/core/BaseAudioContext.h>
|
|
4
6
|
#include <audioapi/core/effects/GainNode.h>
|
|
5
7
|
#include <memory>
|
|
6
8
|
|
|
7
9
|
namespace audioapi {
|
|
8
10
|
|
|
9
|
-
GainNodeHostObject::GainNodeHostObject(
|
|
10
|
-
|
|
11
|
+
GainNodeHostObject::GainNodeHostObject(
|
|
12
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
13
|
+
const GainOptions &options)
|
|
14
|
+
: AudioNodeHostObject(context->createGain(options)) {
|
|
11
15
|
addGetters(JSI_EXPORT_PROPERTY_GETTER(GainNodeHostObject, gain));
|
|
12
16
|
}
|
|
13
17
|
|
|
@@ -8,11 +8,14 @@
|
|
|
8
8
|
namespace audioapi {
|
|
9
9
|
using namespace facebook;
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
struct GainOptions;
|
|
12
|
+
class BaseAudioContext;
|
|
12
13
|
|
|
13
14
|
class GainNodeHostObject : public AudioNodeHostObject {
|
|
14
15
|
public:
|
|
15
|
-
explicit GainNodeHostObject(
|
|
16
|
+
explicit GainNodeHostObject(
|
|
17
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
18
|
+
const GainOptions &options);
|
|
16
19
|
|
|
17
20
|
JSI_PROPERTY_GETTER_DECL(gain);
|
|
18
21
|
};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
#include <audioapi/HostObjects/effects/IIRFilterNodeHostObject.h>
|
|
2
|
+
#include <audioapi/HostObjects/utils/NodeOptions.h>
|
|
3
|
+
#include <audioapi/core/BaseAudioContext.h>
|
|
2
4
|
#include <audioapi/core/effects/IIRFilterNode.h>
|
|
3
5
|
#include <memory>
|
|
4
6
|
|
|
5
7
|
namespace audioapi {
|
|
6
8
|
|
|
7
|
-
IIRFilterNodeHostObject::IIRFilterNodeHostObject(
|
|
8
|
-
|
|
9
|
+
IIRFilterNodeHostObject::IIRFilterNodeHostObject(
|
|
10
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
11
|
+
const IIRFilterOptions &options)
|
|
12
|
+
: AudioNodeHostObject(context->createIIRFilter(options)) {
|
|
9
13
|
|
|
10
14
|
addFunctions(JSI_EXPORT_FUNCTION(IIRFilterNodeHostObject, getFrequencyResponse));
|
|
11
15
|
}
|
|
@@ -9,11 +9,14 @@
|
|
|
9
9
|
namespace audioapi {
|
|
10
10
|
using namespace facebook;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
struct IIRFilterOptions;
|
|
13
|
+
class BaseAudioContext;
|
|
13
14
|
|
|
14
15
|
class IIRFilterNodeHostObject : public AudioNodeHostObject {
|
|
15
16
|
public:
|
|
16
|
-
explicit IIRFilterNodeHostObject(
|
|
17
|
+
explicit IIRFilterNodeHostObject(
|
|
18
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
19
|
+
const IIRFilterOptions &options);
|
|
17
20
|
|
|
18
21
|
JSI_HOST_FUNCTION_DECL(getFrequencyResponse);
|
|
19
22
|
};
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
#include <audioapi/HostObjects/effects/StereoPannerNodeHostObject.h>
|
|
2
2
|
|
|
3
3
|
#include <audioapi/HostObjects/AudioParamHostObject.h>
|
|
4
|
+
#include <audioapi/HostObjects/utils/NodeOptions.h>
|
|
5
|
+
#include <audioapi/core/BaseAudioContext.h>
|
|
4
6
|
#include <audioapi/core/effects/StereoPannerNode.h>
|
|
5
7
|
#include <memory>
|
|
6
8
|
|
|
7
9
|
namespace audioapi {
|
|
8
10
|
|
|
9
11
|
StereoPannerNodeHostObject::StereoPannerNodeHostObject(
|
|
10
|
-
const std::shared_ptr<
|
|
11
|
-
|
|
12
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
13
|
+
const StereoPannerOptions &options)
|
|
14
|
+
: AudioNodeHostObject(context->createStereoPanner(options)) {
|
|
12
15
|
addGetters(JSI_EXPORT_PROPERTY_GETTER(StereoPannerNodeHostObject, pan));
|
|
13
16
|
}
|
|
14
17
|
|
|
@@ -9,11 +9,14 @@
|
|
|
9
9
|
namespace audioapi {
|
|
10
10
|
using namespace facebook;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
struct StereoPannerOptions;
|
|
13
|
+
class BaseAudioContext;
|
|
13
14
|
|
|
14
15
|
class StereoPannerNodeHostObject : public AudioNodeHostObject {
|
|
15
16
|
public:
|
|
16
|
-
explicit StereoPannerNodeHostObject(
|
|
17
|
+
explicit StereoPannerNodeHostObject(
|
|
18
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
19
|
+
const StereoPannerOptions &options);
|
|
17
20
|
|
|
18
21
|
JSI_PROPERTY_GETTER_DECL(pan);
|
|
19
22
|
};
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
#include <audioapi/HostObjects/effects/WaveShaperNodeHostObject.h>
|
|
2
|
+
#include <audioapi/HostObjects/utils/JsEnumParser.h>
|
|
3
|
+
#include <audioapi/HostObjects/utils/NodeOptions.h>
|
|
4
|
+
#include <audioapi/core/BaseAudioContext.h>
|
|
2
5
|
#include <audioapi/core/effects/WaveShaperNode.h>
|
|
3
6
|
#include <audioapi/jsi/AudioArrayBuffer.h>
|
|
4
|
-
#include <audioapi/HostObjects/utils/JsEnumParser.h>
|
|
5
7
|
|
|
6
8
|
#include <memory>
|
|
7
9
|
#include <string>
|
|
8
10
|
|
|
9
11
|
namespace audioapi {
|
|
10
12
|
|
|
11
|
-
WaveShaperNodeHostObject::WaveShaperNodeHostObject(
|
|
12
|
-
|
|
13
|
+
WaveShaperNodeHostObject::WaveShaperNodeHostObject(
|
|
14
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
15
|
+
const WaveShaperOptions &options)
|
|
16
|
+
: AudioNodeHostObject(context->createWaveShaper(options)) {
|
|
13
17
|
addGetters(
|
|
14
18
|
JSI_EXPORT_PROPERTY_GETTER(WaveShaperNodeHostObject, oversample),
|
|
15
19
|
JSI_EXPORT_PROPERTY_GETTER(WaveShaperNodeHostObject, curve));
|
|
@@ -20,7 +24,8 @@ WaveShaperNodeHostObject::WaveShaperNodeHostObject(const std::shared_ptr<WaveSha
|
|
|
20
24
|
|
|
21
25
|
JSI_PROPERTY_GETTER_IMPL(WaveShaperNodeHostObject, oversample) {
|
|
22
26
|
auto waveShaperNode = std::static_pointer_cast<WaveShaperNode>(node_);
|
|
23
|
-
return jsi::String::createFromUtf8(
|
|
27
|
+
return jsi::String::createFromUtf8(
|
|
28
|
+
runtime, js_enum_parser::overSampleTypeToString(waveShaperNode->getOversample()));
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
JSI_PROPERTY_GETTER_IMPL(WaveShaperNodeHostObject, curve) {
|
|
@@ -10,11 +10,14 @@
|
|
|
10
10
|
namespace audioapi {
|
|
11
11
|
using namespace facebook;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
struct WaveShaperOptions;
|
|
14
|
+
class BaseAudioContext;
|
|
14
15
|
|
|
15
16
|
class WaveShaperNodeHostObject : public AudioNodeHostObject {
|
|
16
17
|
public:
|
|
17
|
-
explicit WaveShaperNodeHostObject(
|
|
18
|
+
explicit WaveShaperNodeHostObject(
|
|
19
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
20
|
+
const WaveShaperOptions &options);
|
|
18
21
|
|
|
19
22
|
JSI_PROPERTY_GETTER_DECL(oversample);
|
|
20
23
|
JSI_PROPERTY_GETTER_DECL(curve);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#include <audioapi/HostObjects/events/AudioEventHandlerRegistryHostObject.h>
|
|
2
2
|
|
|
3
3
|
#include <audioapi/events/AudioEventHandlerRegistry.h>
|
|
4
|
+
#include <audioapi/HostObjects/utils/JsEnumParser.h>
|
|
4
5
|
#include <memory>
|
|
5
6
|
|
|
6
7
|
namespace audioapi {
|
|
@@ -18,7 +19,7 @@ JSI_HOST_FUNCTION_IMPL(AudioEventHandlerRegistryHostObject, addAudioEventListene
|
|
|
18
19
|
auto eventName = args[0].getString(runtime).utf8(runtime);
|
|
19
20
|
auto callback = std::make_shared<jsi::Function>(args[1].getObject(runtime).getFunction(runtime));
|
|
20
21
|
|
|
21
|
-
auto listenerId = eventHandlerRegistry_->registerHandler(eventName, callback);
|
|
22
|
+
auto listenerId = eventHandlerRegistry_->registerHandler(js_enum_parser::audioEventFromString(eventName), callback);
|
|
22
23
|
|
|
23
24
|
return jsi::String::createFromUtf8(runtime, std::to_string(listenerId));
|
|
24
25
|
}
|
|
@@ -27,7 +28,7 @@ JSI_HOST_FUNCTION_IMPL(AudioEventHandlerRegistryHostObject, removeAudioEventList
|
|
|
27
28
|
auto eventName = args[0].getString(runtime).utf8(runtime);
|
|
28
29
|
uint64_t listenerId = std::stoull(args[1].getString(runtime).utf8(runtime));
|
|
29
30
|
|
|
30
|
-
eventHandlerRegistry_->unregisterHandler(eventName, listenerId);
|
|
31
|
+
eventHandlerRegistry_->unregisterHandler(js_enum_parser::audioEventFromString(eventName), listenerId);
|
|
31
32
|
|
|
32
33
|
return jsi::Value::undefined();
|
|
33
34
|
}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
#include <audioapi/HostObjects/sources/AudioBufferQueueSourceNodeHostObject.h>
|
|
2
2
|
|
|
3
3
|
#include <audioapi/HostObjects/sources/AudioBufferHostObject.h>
|
|
4
|
+
#include <audioapi/HostObjects/utils/NodeOptions.h>
|
|
5
|
+
#include <audioapi/core/BaseAudioContext.h>
|
|
4
6
|
#include <audioapi/core/sources/AudioBufferQueueSourceNode.h>
|
|
5
7
|
#include <memory>
|
|
6
8
|
|
|
7
9
|
namespace audioapi {
|
|
8
10
|
|
|
9
11
|
AudioBufferQueueSourceNodeHostObject::AudioBufferQueueSourceNodeHostObject(
|
|
10
|
-
const std::shared_ptr<
|
|
11
|
-
|
|
12
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
13
|
+
const BaseAudioBufferSourceOptions &options)
|
|
14
|
+
: AudioBufferBaseSourceNodeHostObject(context->createBufferQueueSource(options)) {
|
|
12
15
|
functions_->erase("start");
|
|
13
16
|
|
|
14
|
-
addSetters(
|
|
15
|
-
JSI_EXPORT_PROPERTY_SETTER(AudioBufferQueueSourceNodeHostObject, onBufferEnded));
|
|
17
|
+
addSetters(JSI_EXPORT_PROPERTY_SETTER(AudioBufferQueueSourceNodeHostObject, onBufferEnded));
|
|
16
18
|
|
|
17
19
|
addFunctions(
|
|
18
20
|
JSI_EXPORT_FUNCTION(AudioBufferQueueSourceNodeHostObject, start),
|
|
@@ -32,9 +34,10 @@ AudioBufferQueueSourceNodeHostObject::~AudioBufferQueueSourceNodeHostObject() {
|
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
JSI_PROPERTY_SETTER_IMPL(AudioBufferQueueSourceNodeHostObject, onBufferEnded) {
|
|
35
|
-
|
|
37
|
+
auto audioBufferQueueSourceNode = std::static_pointer_cast<AudioBufferQueueSourceNode>(node_);
|
|
36
38
|
|
|
37
|
-
|
|
39
|
+
audioBufferQueueSourceNode->setOnBufferEndedCallbackId(
|
|
40
|
+
std::stoull(value.getString(runtime).utf8(runtime)));
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
JSI_HOST_FUNCTION_IMPL(AudioBufferQueueSourceNodeHostObject, start) {
|
|
@@ -8,12 +8,14 @@
|
|
|
8
8
|
namespace audioapi {
|
|
9
9
|
using namespace facebook;
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
struct BaseAudioBufferSourceOptions;
|
|
12
|
+
class BaseAudioContext;
|
|
12
13
|
|
|
13
14
|
class AudioBufferQueueSourceNodeHostObject : public AudioBufferBaseSourceNodeHostObject {
|
|
14
15
|
public:
|
|
15
16
|
explicit AudioBufferQueueSourceNodeHostObject(
|
|
16
|
-
const std::shared_ptr<
|
|
17
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
18
|
+
const BaseAudioBufferSourceOptions &options);
|
|
17
19
|
|
|
18
20
|
~AudioBufferQueueSourceNodeHostObject() override;
|
|
19
21
|
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
#include <audioapi/HostObjects/sources/AudioBufferSourceNodeHostObject.h>
|
|
2
2
|
|
|
3
3
|
#include <audioapi/HostObjects/sources/AudioBufferHostObject.h>
|
|
4
|
+
#include <audioapi/HostObjects/utils/NodeOptions.h>
|
|
5
|
+
#include <audioapi/core/BaseAudioContext.h>
|
|
4
6
|
#include <audioapi/core/sources/AudioBufferSourceNode.h>
|
|
5
7
|
#include <memory>
|
|
6
8
|
|
|
7
9
|
namespace audioapi {
|
|
8
10
|
|
|
9
11
|
AudioBufferSourceNodeHostObject::AudioBufferSourceNodeHostObject(
|
|
10
|
-
const std::shared_ptr<
|
|
11
|
-
|
|
12
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
13
|
+
const AudioBufferSourceOptions &options)
|
|
14
|
+
: AudioBufferBaseSourceNodeHostObject(context->createBufferSource(options)) {
|
|
12
15
|
addGetters(
|
|
13
16
|
JSI_EXPORT_PROPERTY_GETTER(AudioBufferSourceNodeHostObject, loop),
|
|
14
17
|
JSI_EXPORT_PROPERTY_GETTER(AudioBufferSourceNodeHostObject, loopSkip),
|
|
@@ -8,11 +8,14 @@
|
|
|
8
8
|
namespace audioapi {
|
|
9
9
|
using namespace facebook;
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
struct AudioBufferSourceOptions;
|
|
12
|
+
class BaseAudioContext;
|
|
12
13
|
|
|
13
14
|
class AudioBufferSourceNodeHostObject : public AudioBufferBaseSourceNodeHostObject {
|
|
14
15
|
public:
|
|
15
|
-
explicit AudioBufferSourceNodeHostObject(
|
|
16
|
+
explicit AudioBufferSourceNodeHostObject(
|
|
17
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
18
|
+
const AudioBufferSourceOptions &options);
|
|
16
19
|
|
|
17
20
|
~AudioBufferSourceNodeHostObject() override;
|
|
18
21
|
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
#include <audioapi/HostObjects/AudioParamHostObject.h>
|
|
2
2
|
#include <audioapi/HostObjects/sources/ConstantSourceNodeHostObject.h>
|
|
3
|
+
#include <audioapi/HostObjects/utils/NodeOptions.h>
|
|
4
|
+
#include <audioapi/core/BaseAudioContext.h>
|
|
3
5
|
#include <audioapi/core/sources/ConstantSourceNode.h>
|
|
4
6
|
#include <memory>
|
|
5
7
|
|
|
6
8
|
namespace audioapi {
|
|
7
9
|
|
|
8
10
|
ConstantSourceNodeHostObject::ConstantSourceNodeHostObject(
|
|
9
|
-
const std::shared_ptr<
|
|
10
|
-
|
|
11
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
12
|
+
const ConstantSourceOptions &options)
|
|
13
|
+
: AudioScheduledSourceNodeHostObject(context->createConstantSource(options)) {
|
|
11
14
|
addGetters(JSI_EXPORT_PROPERTY_GETTER(ConstantSourceNodeHostObject, offset));
|
|
12
15
|
}
|
|
13
16
|
|
|
@@ -9,11 +9,14 @@
|
|
|
9
9
|
namespace audioapi {
|
|
10
10
|
using namespace facebook;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
struct ConstantSourceOptions;
|
|
13
|
+
class BaseAudioContext;
|
|
13
14
|
|
|
14
15
|
class ConstantSourceNodeHostObject : public AudioScheduledSourceNodeHostObject {
|
|
15
16
|
public:
|
|
16
|
-
explicit ConstantSourceNodeHostObject(
|
|
17
|
+
explicit ConstantSourceNodeHostObject(
|
|
18
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
19
|
+
const ConstantSourceOptions &options);
|
|
17
20
|
|
|
18
21
|
JSI_PROPERTY_GETTER_DECL(offset);
|
|
19
22
|
};
|
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
#include <audioapi/HostObjects/AudioParamHostObject.h>
|
|
4
4
|
#include <audioapi/HostObjects/effects/PeriodicWaveHostObject.h>
|
|
5
|
-
#include <audioapi/core/sources/OscillatorNode.h>
|
|
6
5
|
#include <audioapi/HostObjects/utils/JsEnumParser.h>
|
|
6
|
+
#include <audioapi/HostObjects/utils/NodeOptions.h>
|
|
7
|
+
#include <audioapi/core/BaseAudioContext.h>
|
|
8
|
+
#include <audioapi/core/sources/OscillatorNode.h>
|
|
7
9
|
#include <memory>
|
|
8
10
|
|
|
9
11
|
namespace audioapi {
|
|
10
12
|
|
|
11
|
-
OscillatorNodeHostObject::OscillatorNodeHostObject(
|
|
12
|
-
|
|
13
|
+
OscillatorNodeHostObject::OscillatorNodeHostObject(
|
|
14
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
15
|
+
const OscillatorOptions &options)
|
|
16
|
+
: AudioScheduledSourceNodeHostObject(context->createOscillator(options)) {
|
|
13
17
|
addGetters(
|
|
14
18
|
JSI_EXPORT_PROPERTY_GETTER(OscillatorNodeHostObject, frequency),
|
|
15
19
|
JSI_EXPORT_PROPERTY_GETTER(OscillatorNodeHostObject, detune),
|
|
@@ -10,11 +10,14 @@
|
|
|
10
10
|
namespace audioapi {
|
|
11
11
|
using namespace facebook;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
struct OscillatorOptions;
|
|
14
|
+
class BaseAudioContext;
|
|
14
15
|
|
|
15
16
|
class OscillatorNodeHostObject : public AudioScheduledSourceNodeHostObject {
|
|
16
17
|
public:
|
|
17
|
-
explicit OscillatorNodeHostObject(
|
|
18
|
+
explicit OscillatorNodeHostObject(
|
|
19
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
20
|
+
const OscillatorOptions &options);
|
|
18
21
|
|
|
19
22
|
JSI_PROPERTY_GETTER_DECL(frequency);
|
|
20
23
|
JSI_PROPERTY_GETTER_DECL(detune);
|
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
#include <audioapi/HostObjects/AudioParamHostObject.h>
|
|
4
4
|
#include <audioapi/HostObjects/effects/PeriodicWaveHostObject.h>
|
|
5
|
+
#include <audioapi/HostObjects/utils/NodeOptions.h>
|
|
6
|
+
#include <audioapi/core/BaseAudioContext.h>
|
|
5
7
|
#include <audioapi/core/sources/StreamerNode.h>
|
|
6
8
|
#include <memory>
|
|
7
9
|
|
|
8
10
|
namespace audioapi {
|
|
9
11
|
|
|
10
|
-
StreamerNodeHostObject::StreamerNodeHostObject(
|
|
11
|
-
|
|
12
|
+
StreamerNodeHostObject::StreamerNodeHostObject(
|
|
13
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
14
|
+
const StreamerOptions &options)
|
|
15
|
+
: AudioScheduledSourceNodeHostObject(context->createStreamer(options)) {
|
|
12
16
|
addFunctions(JSI_EXPORT_FUNCTION(StreamerNodeHostObject, initialize));
|
|
13
17
|
addGetters(JSI_EXPORT_PROPERTY_GETTER(StreamerNodeHostObject, streamPath));
|
|
14
18
|
}
|
|
@@ -9,11 +9,14 @@
|
|
|
9
9
|
namespace audioapi {
|
|
10
10
|
using namespace facebook;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
struct StreamerOptions;
|
|
13
|
+
class BaseAudioContext;
|
|
13
14
|
|
|
14
15
|
class StreamerNodeHostObject : public AudioScheduledSourceNodeHostObject {
|
|
15
16
|
public:
|
|
16
|
-
explicit StreamerNodeHostObject(
|
|
17
|
+
explicit StreamerNodeHostObject(
|
|
18
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
19
|
+
const StreamerOptions &options);
|
|
17
20
|
|
|
18
21
|
[[nodiscard]] static inline size_t getSizeInBytes() {
|
|
19
22
|
return SIZE;
|