react-native-audio-api 0.4.11 → 0.4.12-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RNAudioAPI.podspec +11 -1
- package/android/CMakeLists.txt +9 -48
- package/android/src/main/cpp/audioapi/CMakeLists.txt +44 -0
- package/android/src/main/cpp/{AudioAPIModule.cpp → audioapi/android/AudioAPIModule.cpp} +1 -4
- package/android/src/main/cpp/{AudioAPIModule.h → audioapi/android/AudioAPIModule.h} +2 -1
- package/android/src/main/cpp/{OnLoad.cpp → audioapi/android/OnLoad.cpp} +2 -1
- package/android/src/main/cpp/{core → audioapi/android/core}/AudioDecoder.cpp +5 -5
- package/android/src/main/cpp/{core → audioapi/android/core}/AudioPlayer.cpp +5 -7
- package/android/src/main/cpp/{core → audioapi/android/core}/AudioPlayer.h +1 -0
- package/android/src/main/cpp/{libs → audioapi/android/libs}/pffft.c +2 -2
- package/android/src/main/java/com/swmansion/audioapi/AudioAPIPackage.kt +1 -0
- package/common/cpp/{installer → audioapi}/AudioAPIModuleInstaller.h +9 -7
- package/common/cpp/{HostObjects → audioapi/HostObjects}/AnalyserNodeHostObject.h +3 -3
- package/common/cpp/{HostObjects → audioapi/HostObjects}/AudioBufferHostObject.h +3 -3
- package/common/cpp/{HostObjects → audioapi/HostObjects}/AudioBufferSourceNodeHostObject.h +6 -7
- package/common/cpp/{HostObjects → audioapi/HostObjects}/AudioContextHostObject.h +3 -3
- package/common/cpp/{HostObjects → audioapi/HostObjects}/AudioDestinationNodeHostObject.h +3 -3
- package/common/cpp/{HostObjects → audioapi/HostObjects}/AudioNodeHostObject.h +3 -3
- package/common/cpp/{HostObjects → audioapi/HostObjects}/AudioParamHostObject.h +3 -3
- package/common/cpp/{HostObjects → audioapi/HostObjects}/AudioScheduledSourceNodeHostObject.h +3 -3
- package/common/cpp/{HostObjects → audioapi/HostObjects}/BaseAudioContextHostObject.h +21 -14
- package/common/cpp/{HostObjects → audioapi/HostObjects}/BiquadFilterNodeHostObject.h +4 -4
- package/common/cpp/{HostObjects → audioapi/HostObjects}/GainNodeHostObject.h +6 -6
- package/common/cpp/{HostObjects → audioapi/HostObjects}/OscillatorNodeHostObject.h +5 -5
- package/common/cpp/{HostObjects → audioapi/HostObjects}/PeriodicWaveHostObject.h +2 -2
- package/common/cpp/{HostObjects → audioapi/HostObjects}/StereoPannerNodeHostObject.h +4 -4
- package/common/cpp/audioapi/HostObjects/StretcherNodeHostObject.h +35 -0
- package/common/cpp/{core → audioapi/core}/AudioContext.cpp +6 -6
- package/common/cpp/{core → audioapi/core}/AudioContext.h +2 -2
- package/common/cpp/{core → audioapi/core}/AudioNode.cpp +14 -12
- package/common/cpp/{core → audioapi/core}/AudioNode.h +9 -6
- package/common/cpp/{core → audioapi/core}/AudioParam.cpp +3 -4
- package/common/cpp/{core → audioapi/core}/AudioParam.h +3 -3
- package/common/cpp/{core → audioapi/core}/BaseAudioContext.cpp +20 -16
- package/common/cpp/{core → audioapi/core}/BaseAudioContext.h +6 -3
- package/common/cpp/{core → audioapi/core/analysis}/AnalyserNode.cpp +6 -10
- package/common/cpp/{core → audioapi/core/analysis}/AnalyserNode.h +4 -3
- package/common/cpp/{core → audioapi/core/destinations}/AudioDestinationNode.cpp +6 -6
- package/common/cpp/{core → audioapi/core/destinations}/AudioDestinationNode.h +2 -2
- package/common/cpp/{core → audioapi/core/effects}/BiquadFilterNode.cpp +4 -4
- package/common/cpp/{core → audioapi/core/effects}/BiquadFilterNode.h +4 -4
- package/common/cpp/{core → audioapi/core/effects}/GainNode.cpp +4 -4
- package/common/cpp/{core → audioapi/core/effects}/GainNode.h +3 -3
- package/common/cpp/{core → audioapi/core/effects}/PeriodicWave.cpp +4 -2
- package/common/cpp/{core → audioapi/core/effects}/PeriodicWave.h +2 -4
- package/common/cpp/{core → audioapi/core/effects}/StereoPannerNode.cpp +5 -7
- package/common/cpp/{core → audioapi/core/effects}/StereoPannerNode.h +4 -3
- package/common/cpp/audioapi/core/effects/StretcherNode.cpp +94 -0
- package/common/cpp/audioapi/core/effects/StretcherNode.h +35 -0
- package/common/cpp/{core → audioapi/core/sources}/AudioBuffer.cpp +3 -3
- package/common/cpp/{core → audioapi/core/sources}/AudioBufferSourceNode.cpp +8 -11
- package/common/cpp/{core → audioapi/core/sources}/AudioBufferSourceNode.h +5 -3
- package/common/cpp/{core → audioapi/core/sources}/AudioScheduledSourceNode.cpp +6 -8
- package/common/cpp/{core → audioapi/core/sources}/AudioScheduledSourceNode.h +3 -2
- package/common/cpp/{core → audioapi/core/sources}/OscillatorNode.cpp +4 -4
- package/common/cpp/{core → audioapi/core/sources}/OscillatorNode.h +5 -5
- package/common/cpp/{core → audioapi/core/utils}/AudioArray.cpp +2 -4
- package/common/cpp/{core → audioapi/core/utils}/AudioBus.cpp +12 -7
- package/common/cpp/{core → audioapi/core/utils}/AudioBus.h +5 -2
- package/common/cpp/{core → audioapi/core/utils}/AudioNodeManager.cpp +3 -4
- package/common/cpp/{core → audioapi/core/utils}/ParamChangeEvent.cpp +1 -3
- package/common/cpp/{core → audioapi/core/utils}/ParamChangeEvent.h +3 -1
- package/common/cpp/{utils → audioapi/dsp}/AudioUtils.cpp +1 -1
- package/common/cpp/{utils → audioapi/dsp}/FFTFrame.cpp +1 -10
- package/common/cpp/{utils → audioapi/dsp}/FFTFrame.h +4 -3
- package/common/cpp/{utils → audioapi/dsp}/VectorMath.cpp +2 -5
- package/common/cpp/{utils → audioapi/dsp}/VectorMath.h +2 -0
- package/common/cpp/{jsi → audioapi/jsi}/JsiHostObject.cpp +1 -1
- package/common/cpp/{jsi → audioapi/jsi}/JsiHostObject.h +2 -2
- package/common/cpp/{jsi → audioapi/jsi}/JsiPromise.cpp +2 -6
- package/common/cpp/{jsi → audioapi/jsi}/RuntimeAwareCache.h +2 -3
- package/common/cpp/{jsi → audioapi/jsi}/RuntimeLifecycleMonitor.cpp +1 -5
- package/common/cpp/{jsi → audioapi/jsi}/RuntimeLifecycleMonitor.h +3 -0
- package/common/cpp/audioapi/libs/dsp/common.h +47 -0
- package/common/cpp/audioapi/libs/dsp/delay.h +717 -0
- package/common/cpp/audioapi/libs/dsp/fft.h +523 -0
- package/common/cpp/audioapi/libs/dsp/perf.h +84 -0
- package/common/cpp/audioapi/libs/dsp/spectral.h +496 -0
- package/common/cpp/audioapi/libs/dsp/windows.h +219 -0
- package/common/cpp/audioapi/libs/signalsmith-stretch.h +637 -0
- package/ios/{AudioAPIModule.mm → audioapi/ios/AudioAPIModule.mm} +1 -1
- package/ios/{core → audioapi/ios/core}/AudioDecoder.mm +4 -4
- package/ios/{core → audioapi/ios/core}/AudioPlayer.m +3 -3
- package/ios/{core → audioapi/ios/core}/IOSAudioPlayer.mm +4 -4
- package/lib/module/core/BaseAudioContext.js +4 -0
- package/lib/module/core/BaseAudioContext.js.map +1 -1
- package/lib/module/core/StretcherNode.js +12 -0
- package/lib/module/core/StretcherNode.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +1 -1
- package/lib/module/index.web.js.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/StretcherNode.d.ts +10 -0
- package/lib/typescript/core/StretcherNode.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/index.web.d.ts +1 -1
- package/lib/typescript/index.web.d.ts.map +1 -1
- package/lib/typescript/interfaces.d.ts +5 -0
- package/lib/typescript/interfaces.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/core/BaseAudioContext.ts +5 -0
- package/src/core/StretcherNode.ts +15 -0
- package/src/index.ts +1 -0
- package/src/index.web.ts +1 -0
- package/src/interfaces.ts +6 -0
- package/common/cpp/installer/AudioAPIModuleInstaller.cpp +0 -49
- /package/android/src/main/cpp/{libs → audioapi/android/libs}/pffft.h +0 -0
- /package/common/cpp/{core → audioapi/core}/Constants.h +0 -0
- /package/common/cpp/{core → audioapi/core/sources}/AudioBuffer.h +0 -0
- /package/common/cpp/{types → audioapi/core/types}/BiquadFilterType.h +0 -0
- /package/common/cpp/{types → audioapi/core/types}/ChannelCountMode.h +0 -0
- /package/common/cpp/{types → audioapi/core/types}/ChannelInterpretation.h +0 -0
- /package/common/cpp/{types → audioapi/core/types}/ContextState.h +0 -0
- /package/common/cpp/{types → audioapi/core/types}/OscillatorType.h +0 -0
- /package/common/cpp/{types → audioapi/core/types}/ParamChangeEventType.h +0 -0
- /package/common/cpp/{core → audioapi/core/utils}/AudioArray.h +0 -0
- /package/common/cpp/{core → audioapi/core/utils}/AudioDecoder.h +0 -0
- /package/common/cpp/{core → audioapi/core/utils}/AudioNodeManager.h +0 -0
- /package/common/cpp/{utils → audioapi/core/utils}/Locker.h +0 -0
- /package/common/cpp/{utils → audioapi/dsp}/AudioUtils.h +0 -0
- /package/common/cpp/{jsi → audioapi/jsi}/JsiPromise.h +0 -0
- /package/common/cpp/{libs → audioapi/libs}/miniaudio.h +0 -0
- /package/ios/{AudioAPIModule.h → audioapi/ios/AudioAPIModule.h} +0 -0
- /package/ios/{core → audioapi/ios/core}/AudioPlayer.h +0 -0
- /package/ios/{core → audioapi/ios/core}/IOSAudioPlayer.h +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
+
#include <audioapi/core/AudioParam.h>
|
|
4
|
+
#include <audioapi/core/sources/AudioScheduledSourceNode.h>
|
|
5
|
+
#include <audioapi/core/types/OscillatorType.h>
|
|
6
|
+
#include <audioapi/core/effects/PeriodicWave.h>
|
|
7
|
+
|
|
3
8
|
#include <cmath>
|
|
4
9
|
#include <memory>
|
|
5
10
|
#include <string>
|
|
6
11
|
|
|
7
|
-
#include "AudioParam.h"
|
|
8
|
-
#include "AudioScheduledSourceNode.h"
|
|
9
|
-
#include "OscillatorType.h"
|
|
10
|
-
#include "PeriodicWave.h"
|
|
11
|
-
|
|
12
12
|
namespace audioapi {
|
|
13
13
|
|
|
14
14
|
class AudioBus;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
#include <
|
|
2
|
-
|
|
3
|
-
#include
|
|
4
|
-
#include
|
|
5
|
-
#include "BaseAudioContext.h"
|
|
6
|
-
#include "Constants.h"
|
|
7
|
-
#include "VectorMath.h"
|
|
1
|
+
#include <audioapi/core/Constants.h>
|
|
2
|
+
#include <audioapi/core/utils/AudioArray.h>
|
|
3
|
+
#include <audioapi/core/utils/AudioBus.h>
|
|
4
|
+
#include <audioapi/dsp/VectorMath.h>
|
|
8
5
|
|
|
9
6
|
// Implementation of channel summing/mixing is based on the WebKit approach,
|
|
10
7
|
// source:
|
|
@@ -119,6 +116,14 @@ AudioArray *AudioBus::getChannelByType(int channelType) const {
|
|
|
119
116
|
}
|
|
120
117
|
}
|
|
121
118
|
|
|
119
|
+
AudioArray &AudioBus::operator[](size_t index) {
|
|
120
|
+
return *channels_[index];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const AudioArray &AudioBus::operator[](size_t index) const {
|
|
124
|
+
return *channels_[index];
|
|
125
|
+
}
|
|
126
|
+
|
|
122
127
|
/**
|
|
123
128
|
* Public interfaces - audio processing and setters
|
|
124
129
|
*/
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
+
#include <audioapi/core/types/ChannelInterpretation.h>
|
|
4
|
+
|
|
3
5
|
#include <algorithm>
|
|
4
6
|
#include <memory>
|
|
5
7
|
#include <vector>
|
|
6
8
|
#include <cstddef>
|
|
7
9
|
|
|
8
|
-
#include "ChannelInterpretation.h"
|
|
9
|
-
|
|
10
10
|
namespace audioapi {
|
|
11
11
|
|
|
12
12
|
class BaseAudioContext;
|
|
@@ -34,6 +34,9 @@ class AudioBus {
|
|
|
34
34
|
[[nodiscard]] AudioArray *getChannel(int index) const;
|
|
35
35
|
[[nodiscard]] AudioArray *getChannelByType(int channelType) const;
|
|
36
36
|
|
|
37
|
+
AudioArray &operator[](size_t index);
|
|
38
|
+
const AudioArray &operator[](size_t index) const;
|
|
39
|
+
|
|
37
40
|
void normalize();
|
|
38
41
|
void scale(float value);
|
|
39
42
|
[[nodiscard]] float maxAbsValue() const;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
#include
|
|
2
|
-
|
|
3
|
-
#if defined(HAVE_ACCELERATE)
|
|
4
|
-
#include <Accelerate/Accelerate.h>
|
|
5
|
-
#endif
|
|
6
|
-
|
|
7
|
-
#if defined(ANDROID)
|
|
8
|
-
#include <pffft.h>
|
|
9
|
-
#include <complex>
|
|
10
|
-
#endif
|
|
1
|
+
#include <audioapi/dsp/FFTFrame.h>
|
|
11
2
|
|
|
12
3
|
namespace audioapi {
|
|
13
4
|
#if defined(HAVE_ACCELERATE)
|
|
@@ -28,19 +28,20 @@
|
|
|
28
28
|
|
|
29
29
|
#pragma once
|
|
30
30
|
|
|
31
|
+
#include <audioapi/dsp/VectorMath.h>
|
|
32
|
+
|
|
31
33
|
#include <algorithm>
|
|
32
34
|
#include <cmath>
|
|
33
35
|
#include <utility>
|
|
34
36
|
#include <unordered_map>
|
|
35
|
-
|
|
36
|
-
#include "VectorMath.h"
|
|
37
|
+
#include <complex>
|
|
37
38
|
|
|
38
39
|
#if defined(HAVE_ACCELERATE)
|
|
39
40
|
#include <Accelerate/Accelerate.h>
|
|
40
41
|
#endif
|
|
41
42
|
|
|
42
43
|
#if defined(ANDROID)
|
|
43
|
-
#include <pffft.h>
|
|
44
|
+
#include <audioapi/android/libs/pffft.h>
|
|
44
45
|
#endif
|
|
45
46
|
|
|
46
47
|
namespace audioapi {
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
#include
|
|
27
|
-
#include
|
|
26
|
+
#include <audioapi/dsp/AudioUtils.h>
|
|
27
|
+
#include <audioapi/dsp/VectorMath.h>
|
|
28
28
|
|
|
29
29
|
#if defined(HAVE_ACCELERATE)
|
|
30
30
|
#include <Accelerate/Accelerate.h>
|
|
@@ -38,9 +38,6 @@
|
|
|
38
38
|
#include <arm_neon.h>
|
|
39
39
|
#endif
|
|
40
40
|
|
|
41
|
-
#include <algorithm>
|
|
42
|
-
#include <cmath>
|
|
43
|
-
|
|
44
41
|
namespace audioapi::VectorMath {
|
|
45
42
|
|
|
46
43
|
#if defined(HAVE_ACCELERATE)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
+
#include <audioapi/jsi/RuntimeAwareCache.h>
|
|
4
|
+
|
|
3
5
|
#include <jsi/jsi.h>
|
|
4
6
|
#include <map>
|
|
5
7
|
#include <memory>
|
|
@@ -8,8 +10,6 @@
|
|
|
8
10
|
#include <utility>
|
|
9
11
|
#include <vector>
|
|
10
12
|
|
|
11
|
-
#include "RuntimeAwareCache.h"
|
|
12
|
-
|
|
13
13
|
#define JSI_HOST_FUNCTION(NAME) \
|
|
14
14
|
jsi::Value NAME( \
|
|
15
15
|
jsi::Runtime &runtime, \
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
#include
|
|
2
|
-
|
|
3
|
-
#include <ReactCommon/CallInvoker.h>
|
|
4
|
-
#include <jsi/jsi.h>
|
|
5
|
-
#include <functional>
|
|
1
|
+
#include <audioapi/jsi/JsiPromise.h>
|
|
6
2
|
|
|
7
3
|
namespace audioapi {
|
|
8
4
|
|
|
@@ -37,7 +33,7 @@ jsi::Value PromiseVendor::createPromise(
|
|
|
37
33
|
|
|
38
34
|
auto resolveWrapper =
|
|
39
35
|
[resolve, &runtime, callInvoker](
|
|
40
|
-
const std::function<jsi::Value(jsi::Runtime &)> resolver)
|
|
36
|
+
const std::function<jsi::Value(jsi::Runtime &)> &resolver)
|
|
41
37
|
-> void {
|
|
42
38
|
callInvoker->invokeAsync([resolve, &runtime, resolver]() -> void {
|
|
43
39
|
auto valueShared = std::make_shared<jsi::Value>(resolver(runtime));
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include <jsi/
|
|
3
|
+
#include <audioapi/jsi/RuntimeLifecycleMonitor.h>
|
|
4
4
|
|
|
5
|
+
#include <jsi/jsi.h>
|
|
5
6
|
#include <memory>
|
|
6
7
|
#include <unordered_map>
|
|
7
8
|
#include <utility>
|
|
8
9
|
|
|
9
|
-
#include "RuntimeLifecycleMonitor.h"
|
|
10
|
-
|
|
11
10
|
namespace audioapi {
|
|
12
11
|
|
|
13
12
|
using namespace facebook;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#ifndef SIGNALSMITH_DSP_COMMON_H
|
|
2
|
+
#define SIGNALSMITH_DSP_COMMON_H
|
|
3
|
+
|
|
4
|
+
#if defined(__FAST_MATH__) && (__apple_build_version__ >= 16000000) && (__apple_build_version__ <= 16000099)
|
|
5
|
+
# error Apple Clang 16.0.0 generates incorrect SIMD for ARM. If you HAVE to use this version of Clang, turn off -ffast-math.
|
|
6
|
+
#endif
|
|
7
|
+
|
|
8
|
+
#ifndef M_PI
|
|
9
|
+
#define M_PI 3.14159265358979323846264338327950288
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
namespace signalsmith {
|
|
13
|
+
/** @defgroup Common Common
|
|
14
|
+
@brief Definitions and helper classes used by the rest of the library
|
|
15
|
+
|
|
16
|
+
@{
|
|
17
|
+
@file
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#define SIGNALSMITH_DSP_VERSION_MAJOR 1
|
|
21
|
+
#define SIGNALSMITH_DSP_VERSION_MINOR 6
|
|
22
|
+
#define SIGNALSMITH_DSP_VERSION_PATCH 1
|
|
23
|
+
#define SIGNALSMITH_DSP_VERSION_STRING "1.6.1"
|
|
24
|
+
|
|
25
|
+
/** Version compatability check.
|
|
26
|
+
\code{.cpp}
|
|
27
|
+
static_assert(signalsmith::version(1, 4, 1), "version check");
|
|
28
|
+
\endcode
|
|
29
|
+
... or use the equivalent `SIGNALSMITH_DSP_VERSION_CHECK`.
|
|
30
|
+
Major versions are not compatible with each other. Minor and patch versions are backwards-compatible.
|
|
31
|
+
*/
|
|
32
|
+
constexpr bool versionCheck(int major, int minor, int patch=0) {
|
|
33
|
+
return major == SIGNALSMITH_DSP_VERSION_MAJOR
|
|
34
|
+
&& (SIGNALSMITH_DSP_VERSION_MINOR > minor
|
|
35
|
+
|| (SIGNALSMITH_DSP_VERSION_MINOR == minor && SIGNALSMITH_DSP_VERSION_PATCH >= patch));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/// Check the library version is compatible (semver).
|
|
39
|
+
#define SIGNALSMITH_DSP_VERSION_CHECK(major, minor, patch) \
|
|
40
|
+
static_assert(::signalsmith::versionCheck(major, minor, patch), "signalsmith library version is " SIGNALSMITH_DSP_VERSION_STRING);
|
|
41
|
+
|
|
42
|
+
/** @} */
|
|
43
|
+
} // signalsmith::
|
|
44
|
+
#else
|
|
45
|
+
// If we've already included it, check it's the same version
|
|
46
|
+
static_assert(SIGNALSMITH_DSP_VERSION_MAJOR == 1 && SIGNALSMITH_DSP_VERSION_MINOR == 6 && SIGNALSMITH_DSP_VERSION_PATCH == 1, "multiple versions of the Signalsmith DSP library");
|
|
47
|
+
#endif // include guard
|