react-native-audio-api 0.10.0-nightly-c815c40-20251026 → 0.11.0-alpha.0
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 +5 -9
- package/android/build.gradle +3 -33
- package/android/src/main/cpp/audioapi/android/AudioAPIModule.cpp +0 -5
- package/android/src/main/cpp/audioapi/android/AudioAPIModule.h +0 -1
- package/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.cpp +94 -28
- package/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.h +28 -14
- package/android/src/main/cpp/audioapi/android/core/AudioPlayer.cpp +2 -4
- package/android/src/main/cpp/audioapi/android/core/NativeAudioRecorder.hpp +9 -9
- package/android/src/main/cpp/audioapi/android/core/utils/AndroidFileWriterBackend.h +33 -0
- package/android/src/main/cpp/audioapi/android/core/utils/AudioDecoder.cpp +0 -6
- package/android/src/main/cpp/audioapi/android/core/utils/FileUtils.h +34 -0
- package/android/src/main/cpp/audioapi/android/core/utils/FileUtilts.cpp +133 -0
- package/android/src/main/cpp/audioapi/android/core/utils/MiniaudioImplementation.cpp +3 -0
- package/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/FFmpegAudioFileOptions.cpp +154 -0
- package/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/FFmpegAudioFileOptions.h +41 -0
- package/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/FFmpegFileWriter.cpp +431 -0
- package/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/FFmpegFileWriter.h +112 -0
- package/android/src/main/cpp/audioapi/android/core/utils/miniaudioBackend/MiniAudioFileOptions.cpp +47 -0
- package/android/src/main/cpp/audioapi/android/core/utils/miniaudioBackend/MiniAudioFileOptions.h +28 -0
- package/android/src/main/cpp/audioapi/android/core/utils/miniaudioBackend/MiniAudioFileWriter.cpp +237 -0
- package/android/src/main/cpp/audioapi/android/core/utils/miniaudioBackend/MiniAudioFileWriter.h +46 -0
- package/android/src/main/cpp/audioapi/android/system/NativeFileInfo.hpp +31 -0
- package/android/src/main/java/com/swmansion/audioapi/AudioAPIModule.kt +3 -29
- package/android/src/main/java/com/swmansion/audioapi/system/AudioFocusListener.kt +9 -21
- package/android/src/main/java/com/swmansion/audioapi/system/NativeFileInfo.kt +18 -0
- package/android/src/main/jniLibs/arm64-v8a/libavcodec.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libavformat.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libavutil.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libswresample.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libavcodec.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libavformat.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libavutil.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libswresample.so +0 -0
- package/android/src/main/jniLibs/x86/libavcodec.so +0 -0
- package/android/src/main/jniLibs/x86/libavformat.so +0 -0
- package/android/src/main/jniLibs/x86/libavutil.so +0 -0
- package/android/src/main/jniLibs/x86/libswresample.so +0 -0
- package/android/src/main/jniLibs/x86_64/libavcodec.so +0 -0
- package/android/src/main/jniLibs/x86_64/libavformat.so +0 -0
- package/android/src/main/jniLibs/x86_64/libavutil.so +0 -0
- package/android/src/main/jniLibs/x86_64/libswresample.so +0 -0
- package/common/cpp/audioapi/AudioAPIModuleInstaller.h +2 -30
- package/common/cpp/audioapi/HostObjects/effects/BiquadFilterNodeHostObject.cpp +1 -1
- package/common/cpp/audioapi/HostObjects/inputs/AudioRecorderHostObject.cpp +80 -18
- package/common/cpp/audioapi/HostObjects/inputs/AudioRecorderHostObject.h +15 -6
- package/common/cpp/audioapi/core/AudioParam.cpp +2 -2
- package/common/cpp/audioapi/core/effects/BiquadFilterNode.cpp +32 -69
- package/common/cpp/audioapi/core/effects/BiquadFilterNode.h +1 -37
- package/common/cpp/audioapi/core/inputs/AudioRecorder.cpp +102 -49
- package/common/cpp/audioapi/core/inputs/AudioRecorder.h +46 -28
- package/common/cpp/audioapi/core/utils/Constants.h +1 -2
- package/common/cpp/audioapi/core/utils/worklets/SafeIncludes.h +10 -0
- package/common/cpp/audioapi/external/arm64-v8a/libcrypto.a +0 -0
- package/common/cpp/audioapi/external/arm64-v8a/libogg.a +0 -0
- package/common/cpp/audioapi/external/arm64-v8a/libopus.a +0 -0
- package/common/cpp/audioapi/external/arm64-v8a/libopusfile.a +0 -0
- package/common/cpp/audioapi/external/arm64-v8a/libssl.a +0 -0
- package/common/cpp/audioapi/external/arm64-v8a/libvorbis.a +0 -0
- package/common/cpp/audioapi/external/arm64-v8a/libvorbisenc.a +0 -0
- package/common/cpp/audioapi/external/arm64-v8a/libvorbisfile.a +0 -0
- package/common/cpp/audioapi/external/armeabi-v7a/libcrypto.a +0 -0
- package/common/cpp/audioapi/external/armeabi-v7a/libogg.a +0 -0
- package/common/cpp/audioapi/external/armeabi-v7a/libopus.a +0 -0
- package/common/cpp/audioapi/external/armeabi-v7a/libopusfile.a +0 -0
- package/common/cpp/audioapi/external/armeabi-v7a/libssl.a +0 -0
- package/common/cpp/audioapi/external/armeabi-v7a/libvorbis.a +0 -0
- package/common/cpp/audioapi/external/armeabi-v7a/libvorbisenc.a +0 -0
- package/common/cpp/audioapi/external/armeabi-v7a/libvorbisfile.a +0 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/avcodec.h +2 -2
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/codec.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/codec_desc.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/codec_id.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/codec_par.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavformat/avformat.h +2 -2
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/avutil.h +2 -2
- package/common/cpp/audioapi/external/iphoneos/libcrypto.a +0 -0
- package/common/cpp/audioapi/external/iphoneos/libogg.a +0 -0
- package/common/cpp/audioapi/external/iphoneos/libopus.a +0 -0
- package/common/cpp/audioapi/external/iphoneos/libopusfile.a +0 -0
- package/common/cpp/audioapi/external/iphoneos/libssl.a +0 -0
- package/common/cpp/audioapi/external/iphoneos/libvorbis.a +0 -0
- package/common/cpp/audioapi/external/iphoneos/libvorbisenc.a +0 -0
- package/common/cpp/audioapi/external/iphoneos/libvorbisfile.a +0 -0
- package/common/cpp/audioapi/external/iphonesimulator/libcrypto.a +0 -0
- package/common/cpp/audioapi/external/iphonesimulator/libogg.a +0 -0
- package/common/cpp/audioapi/external/iphonesimulator/libopus.a +0 -0
- package/common/cpp/audioapi/external/iphonesimulator/libopusfile.a +0 -0
- package/common/cpp/audioapi/external/iphonesimulator/libssl.a +0 -0
- package/common/cpp/audioapi/external/iphonesimulator/libvorbis.a +0 -0
- package/common/cpp/audioapi/external/iphonesimulator/libvorbisenc.a +0 -0
- package/common/cpp/audioapi/external/iphonesimulator/libvorbisfile.a +0 -0
- package/common/cpp/audioapi/external/libavcodec.xcframework/Info.plist +44 -0
- package/common/cpp/audioapi/external/libavcodec.xcframework/ios-arm64/libavcodec.framework/Info.plist +1 -0
- package/common/cpp/audioapi/external/libavcodec.xcframework/ios-arm64/libavcodec.framework/libavcodec +0 -0
- package/common/cpp/audioapi/external/libavcodec.xcframework/ios-arm64_x86_64-simulator/libavcodec.framework/Info.plist +1 -0
- package/common/cpp/audioapi/external/libavcodec.xcframework/ios-arm64_x86_64-simulator/libavcodec.framework/libavcodec +0 -0
- package/common/cpp/audioapi/external/libavformat.xcframework/Info.plist +44 -0
- package/common/cpp/audioapi/external/libavformat.xcframework/ios-arm64/libavformat.framework/Info.plist +1 -0
- package/common/cpp/audioapi/external/libavformat.xcframework/ios-arm64/libavformat.framework/libavformat +0 -0
- package/common/cpp/audioapi/external/libavformat.xcframework/ios-arm64_x86_64-simulator/libavformat.framework/Info.plist +1 -0
- package/common/cpp/audioapi/external/libavformat.xcframework/ios-arm64_x86_64-simulator/libavformat.framework/libavformat +0 -0
- package/common/cpp/audioapi/external/libavutil.xcframework/Info.plist +44 -0
- package/common/cpp/audioapi/external/libavutil.xcframework/ios-arm64/libavutil.framework/Info.plist +1 -0
- package/common/cpp/audioapi/external/libavutil.xcframework/ios-arm64/libavutil.framework/libavutil +0 -0
- package/common/cpp/audioapi/external/libavutil.xcframework/ios-arm64_x86_64-simulator/libavutil.framework/Info.plist +1 -0
- package/common/cpp/audioapi/external/libavutil.xcframework/ios-arm64_x86_64-simulator/libavutil.framework/libavutil +0 -0
- package/common/cpp/audioapi/external/libswresample.xcframework/Info.plist +44 -0
- package/common/cpp/audioapi/external/libswresample.xcframework/ios-arm64/libswresample.framework/Info.plist +1 -0
- package/common/cpp/audioapi/external/libswresample.xcframework/ios-arm64/libswresample.framework/libswresample +0 -0
- package/common/cpp/audioapi/external/libswresample.xcframework/ios-arm64_x86_64-simulator/libswresample.framework/Info.plist +1 -0
- package/common/cpp/audioapi/external/libswresample.xcframework/ios-arm64_x86_64-simulator/libswresample.framework/libswresample +0 -0
- package/common/cpp/audioapi/external/x86/libcrypto.a +0 -0
- package/common/cpp/audioapi/external/x86/libogg.a +0 -0
- package/common/cpp/audioapi/external/x86/libopus.a +0 -0
- package/common/cpp/audioapi/external/x86/libopusfile.a +0 -0
- package/common/cpp/audioapi/external/x86/libssl.a +0 -0
- package/common/cpp/audioapi/external/x86/libvorbis.a +0 -0
- package/common/cpp/audioapi/external/x86/libvorbisenc.a +0 -0
- package/common/cpp/audioapi/external/x86/libvorbisfile.a +0 -0
- package/common/cpp/audioapi/external/x86_64/libcrypto.a +0 -0
- package/common/cpp/audioapi/external/x86_64/libogg.a +0 -0
- package/common/cpp/audioapi/external/x86_64/libopus.a +0 -0
- package/common/cpp/audioapi/external/x86_64/libopusfile.a +0 -0
- package/common/cpp/audioapi/external/x86_64/libssl.a +0 -0
- package/common/cpp/audioapi/external/x86_64/libvorbis.a +0 -0
- package/common/cpp/audioapi/external/x86_64/libvorbisenc.a +0 -0
- package/common/cpp/audioapi/external/x86_64/libvorbisfile.a +0 -0
- package/common/cpp/audioapi/libs/ffmpeg/FFmpegDecoding.cpp +3 -2
- package/common/cpp/audioapi/libs/ffmpeg/INSTRUCTIONS.md +32 -0
- package/common/cpp/audioapi/libs/ffmpeg/create_xcframework.sh +111 -0
- package/common/cpp/audioapi/libs/ffmpeg/ffmpeg_setup.sh +391 -0
- package/common/cpp/test/CMakeLists.txt +0 -3
- package/ios/audioapi/ios/AudioAPIModule.h +1 -2
- package/ios/audioapi/ios/AudioAPIModule.mm +0 -2
- package/ios/audioapi/ios/core/IOSAudioFileOptions.h +35 -0
- package/ios/audioapi/ios/core/IOSAudioFileOptions.mm +135 -0
- package/ios/audioapi/ios/core/IOSAudioFileWriter.h +38 -0
- package/ios/audioapi/ios/core/IOSAudioFileWriter.mm +187 -0
- package/ios/audioapi/ios/core/IOSAudioRecorder.h +18 -10
- package/ios/audioapi/ios/core/IOSAudioRecorder.mm +70 -28
- package/ios/audioapi/ios/core/NativeAudioRecorder.h +2 -6
- package/ios/audioapi/ios/core/NativeAudioRecorder.m +5 -73
- package/ios/audioapi/ios/system/AudioEngine.mm +3 -3
- package/ios/audioapi/ios/system/AudioSessionManager.mm +0 -9
- package/ios/audioapi/ios/system/LockScreenManager.h +1 -0
- package/ios/audioapi/ios/system/LockScreenManager.mm +19 -6
- package/lib/commonjs/api.js +76 -134
- package/lib/commonjs/api.js.map +1 -1
- package/lib/commonjs/core/AudioContext.js +1 -1
- package/lib/commonjs/core/AudioContext.js.map +1 -1
- package/lib/commonjs/core/AudioRecorder.js +157 -12
- package/lib/commonjs/core/AudioRecorder.js.map +1 -1
- package/lib/commonjs/core/BaseAudioContext.js +25 -16
- package/lib/commonjs/core/BaseAudioContext.js.map +1 -1
- package/lib/commonjs/core/OfflineAudioContext.js +1 -1
- package/lib/commonjs/core/OfflineAudioContext.js.map +1 -1
- package/lib/commonjs/types.js +50 -0
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/bitEnums.js +33 -0
- package/lib/commonjs/utils/bitEnums.js.map +1 -0
- package/lib/commonjs/utils/index.js +21 -19
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/module/api.js +15 -15
- package/lib/module/api.js.map +1 -1
- package/lib/module/core/AudioContext.js +2 -2
- package/lib/module/core/AudioContext.js.map +1 -1
- package/lib/module/core/AudioRecorder.js +157 -12
- package/lib/module/core/AudioRecorder.js.map +1 -1
- package/lib/module/core/BaseAudioContext.js +26 -17
- package/lib/module/core/BaseAudioContext.js.map +1 -1
- package/lib/module/core/OfflineAudioContext.js +2 -2
- package/lib/module/core/OfflineAudioContext.js.map +1 -1
- package/lib/module/types.js +46 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/bitEnums.js +27 -0
- package/lib/module/utils/bitEnums.js.map +1 -0
- package/lib/module/utils/index.js +2 -15
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/api.d.ts +17 -18
- package/lib/typescript/api.d.ts.map +1 -1
- package/lib/typescript/core/AudioContext.d.ts.map +1 -1
- package/lib/typescript/core/AudioRecorder.d.ts +58 -6
- package/lib/typescript/core/AudioRecorder.d.ts.map +1 -1
- package/lib/typescript/core/BaseAudioContext.d.ts.map +1 -1
- package/lib/typescript/events/types.d.ts +16 -0
- package/lib/typescript/events/types.d.ts.map +1 -1
- package/lib/typescript/interfaces.d.ts +39 -3
- package/lib/typescript/interfaces.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +75 -4
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/utils/bitEnums.d.ts +4 -0
- package/lib/typescript/utils/bitEnums.d.ts.map +1 -0
- package/lib/typescript/utils/index.d.ts +2 -5
- package/lib/typescript/utils/index.d.ts.map +1 -1
- package/package.json +4 -7
- package/src/api.ts +18 -44
- package/src/core/AudioContext.ts +2 -3
- package/src/core/AudioRecorder.ts +190 -20
- package/src/core/BaseAudioContext.ts +60 -44
- package/src/core/OfflineAudioContext.ts +2 -2
- package/src/events/types.ts +18 -0
- package/src/interfaces.ts +47 -4
- package/src/types.ts +86 -4
- package/src/utils/bitEnums.ts +51 -0
- package/src/utils/index.ts +2 -22
- package/common/cpp/audioapi/libs/ffmpeg/relinking.md +0 -24
- package/common/cpp/test/src/biquad/BiquadFilterChromium.cpp +0 -389
- package/common/cpp/test/src/biquad/BiquadFilterChromium.h +0 -64
- package/common/cpp/test/src/biquad/BiquadFilterTest.cpp +0 -284
- package/common/cpp/test/src/biquad/BiquadFilterTest.h +0 -40
- package/scripts/download-prebuilt-binaries.sh +0 -52
- package/scripts/rnaa_utils.rb +0 -8
- package/scripts/validate-worklets-version.js +0 -28
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
#include <test/src/biquad/BiquadFilterChromium.h>
|
|
2
|
-
#include <test/src/biquad/BiquadFilterTest.h>
|
|
3
|
-
|
|
4
|
-
namespace audioapi {
|
|
5
|
-
|
|
6
|
-
void BiquadFilterTest::expectCoefficientsNear(
|
|
7
|
-
const std::shared_ptr<BiquadFilterNode> &biquadNode,
|
|
8
|
-
const BiquadCoefficients &expected) {
|
|
9
|
-
EXPECT_NEAR(biquadNode->b0_, expected.b0, tolerance);
|
|
10
|
-
EXPECT_NEAR(biquadNode->b1_, expected.b1, tolerance);
|
|
11
|
-
EXPECT_NEAR(biquadNode->b2_, expected.b2, tolerance);
|
|
12
|
-
EXPECT_NEAR(biquadNode->a1_, expected.a1, tolerance);
|
|
13
|
-
EXPECT_NEAR(biquadNode->a2_, expected.a2, tolerance);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
void BiquadFilterTest::testLowpass(float frequency, float Q) {
|
|
17
|
-
auto node = std::make_shared<BiquadFilterNode>(context.get());
|
|
18
|
-
float normalizedFrequency = frequency / nyquistFrequency;
|
|
19
|
-
|
|
20
|
-
node->setLowpassCoefficients(normalizedFrequency, Q);
|
|
21
|
-
expectCoefficientsNear(
|
|
22
|
-
node, calculateLowpassCoefficients(normalizedFrequency, Q));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
void BiquadFilterTest::testHighpass(float frequency, float Q) {
|
|
26
|
-
auto node = std::make_shared<BiquadFilterNode>(context.get());
|
|
27
|
-
float normalizedFrequency = frequency / nyquistFrequency;
|
|
28
|
-
|
|
29
|
-
node->setHighpassCoefficients(normalizedFrequency, Q);
|
|
30
|
-
expectCoefficientsNear(
|
|
31
|
-
node, calculateHighpassCoefficients(normalizedFrequency, Q));
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
void BiquadFilterTest::testBandpass(float frequency, float Q) {
|
|
35
|
-
auto node = std::make_shared<BiquadFilterNode>(context.get());
|
|
36
|
-
float normalizedFrequency = frequency / nyquistFrequency;
|
|
37
|
-
|
|
38
|
-
node->setBandpassCoefficients(normalizedFrequency, Q);
|
|
39
|
-
expectCoefficientsNear(
|
|
40
|
-
node, calculateBandpassCoefficients(normalizedFrequency, Q));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
void BiquadFilterTest::testNotch(float frequency, float Q) {
|
|
44
|
-
auto node = std::make_shared<BiquadFilterNode>(context.get());
|
|
45
|
-
float normalizedFrequency = frequency / nyquistFrequency;
|
|
46
|
-
|
|
47
|
-
node->setNotchCoefficients(normalizedFrequency, Q);
|
|
48
|
-
expectCoefficientsNear(
|
|
49
|
-
node, calculateNotchCoefficients(normalizedFrequency, Q));
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
void BiquadFilterTest::testAllpass(float frequency, float Q) {
|
|
53
|
-
auto node = std::make_shared<BiquadFilterNode>(context.get());
|
|
54
|
-
float normalizedFrequency = frequency / nyquistFrequency;
|
|
55
|
-
|
|
56
|
-
node->setAllpassCoefficients(normalizedFrequency, Q);
|
|
57
|
-
expectCoefficientsNear(
|
|
58
|
-
node, calculateAllpassCoefficients(normalizedFrequency, Q));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
void BiquadFilterTest::testPeaking(float frequency, float Q, float gain) {
|
|
62
|
-
auto node = std::make_shared<BiquadFilterNode>(context.get());
|
|
63
|
-
float normalizedFrequency = frequency / nyquistFrequency;
|
|
64
|
-
|
|
65
|
-
node->setPeakingCoefficients(normalizedFrequency, Q, gain);
|
|
66
|
-
expectCoefficientsNear(
|
|
67
|
-
node, calculatePeakingCoefficients(normalizedFrequency, Q, gain));
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
void BiquadFilterTest::testLowshelf(float frequency, float gain) {
|
|
71
|
-
auto node = std::make_shared<BiquadFilterNode>(context.get());
|
|
72
|
-
float normalizedFrequency = frequency / nyquistFrequency;
|
|
73
|
-
|
|
74
|
-
node->setLowshelfCoefficients(normalizedFrequency, gain);
|
|
75
|
-
expectCoefficientsNear(
|
|
76
|
-
node, calculateLowshelfCoefficients(normalizedFrequency, gain));
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
void BiquadFilterTest::testHighshelf(float frequency, float gain) {
|
|
80
|
-
auto node = std::make_shared<BiquadFilterNode>(context.get());
|
|
81
|
-
float normalizedFrequency = frequency / nyquistFrequency;
|
|
82
|
-
|
|
83
|
-
node->setHighshelfCoefficients(normalizedFrequency, gain);
|
|
84
|
-
expectCoefficientsNear(
|
|
85
|
-
node, calculateHighshelfCoefficients(normalizedFrequency, gain));
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
INSTANTIATE_TEST_SUITE_P(
|
|
89
|
-
Frequencies,
|
|
90
|
-
BiquadFilterFrequencyTest,
|
|
91
|
-
::testing::Values(
|
|
92
|
-
0.0f, // 0 Hz - the filter should block all input signal
|
|
93
|
-
10.0f, // very low frequency
|
|
94
|
-
350.0f, // default
|
|
95
|
-
nyquistFrequency - 0.0001f, // frequency near Nyquist
|
|
96
|
-
nyquistFrequency)); // maximal frequency
|
|
97
|
-
|
|
98
|
-
INSTANTIATE_TEST_SUITE_P(
|
|
99
|
-
QEdgeCases,
|
|
100
|
-
BiquadFilterQTestLowpassHighpass,
|
|
101
|
-
::testing::Values(
|
|
102
|
-
-770.63678f, // min value for lowpass and highpass
|
|
103
|
-
0.0f, // default
|
|
104
|
-
770.63678f)); // max value for lowpass and highpass
|
|
105
|
-
|
|
106
|
-
INSTANTIATE_TEST_SUITE_P(
|
|
107
|
-
QEdgeCases,
|
|
108
|
-
BiquadFilterQTestRestTypes, // bandpass, notch, allpass, peaking
|
|
109
|
-
::testing::Values(
|
|
110
|
-
0.0f, // default and min value
|
|
111
|
-
MOST_POSITIVE_SINGLE_FLOAT));
|
|
112
|
-
|
|
113
|
-
INSTANTIATE_TEST_SUITE_P(
|
|
114
|
-
GainEdgeCases,
|
|
115
|
-
BiquadFilterGainTest,
|
|
116
|
-
::testing::Values(
|
|
117
|
-
-40.0f,
|
|
118
|
-
0.0f, // default
|
|
119
|
-
40.0f));
|
|
120
|
-
|
|
121
|
-
TEST_P(BiquadFilterFrequencyTest, SetLowpassCoefficients) {
|
|
122
|
-
float frequency = GetParam();
|
|
123
|
-
float Q = 1.0f;
|
|
124
|
-
testLowpass(frequency, Q);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
TEST_P(BiquadFilterFrequencyTest, SetHighpassCoefficients) {
|
|
128
|
-
float frequency = GetParam();
|
|
129
|
-
float Q = 1.0f;
|
|
130
|
-
testHighpass(frequency, Q);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
TEST_P(BiquadFilterFrequencyTest, SetBandpassCoefficients) {
|
|
134
|
-
float frequency = GetParam();
|
|
135
|
-
float Q = 1.0f;
|
|
136
|
-
testBandpass(frequency, Q);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
TEST_P(BiquadFilterFrequencyTest, SetNotchCoefficients) {
|
|
140
|
-
float frequency = GetParam();
|
|
141
|
-
float Q = 1.0f;
|
|
142
|
-
testNotch(frequency, Q);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
TEST_P(BiquadFilterFrequencyTest, SetAllpassCoefficients) {
|
|
146
|
-
float frequency = GetParam();
|
|
147
|
-
float Q = 1.0f;
|
|
148
|
-
testAllpass(frequency, Q);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
TEST_P(BiquadFilterFrequencyTest, SetPeakingCoefficients) {
|
|
152
|
-
float frequency = GetParam();
|
|
153
|
-
float Q = 1.0f;
|
|
154
|
-
float gain = 2.0f;
|
|
155
|
-
testPeaking(frequency, Q, gain);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
TEST_P(BiquadFilterFrequencyTest, SetLowshelfCoefficients) {
|
|
159
|
-
float frequency = GetParam();
|
|
160
|
-
float gain = 2.0f;
|
|
161
|
-
testLowshelf(frequency, gain);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
TEST_P(BiquadFilterFrequencyTest, SetHighshelfCoefficients) {
|
|
165
|
-
float frequency = GetParam();
|
|
166
|
-
float gain = 2.0f;
|
|
167
|
-
testHighshelf(frequency, gain);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
TEST_P(BiquadFilterQTestLowpassHighpass, SetLowpassCoefficients) {
|
|
171
|
-
float frequency = 1000.0f;
|
|
172
|
-
float Q = GetParam();
|
|
173
|
-
testLowpass(frequency, Q);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
TEST_P(BiquadFilterQTestLowpassHighpass, SetHighpassCoefficients) {
|
|
177
|
-
float frequency = 1000.0f;
|
|
178
|
-
float Q = GetParam();
|
|
179
|
-
testHighpass(frequency, Q);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
TEST_P(BiquadFilterQTestRestTypes, SetBandpassCoefficients) {
|
|
183
|
-
float frequency = 1000.0f;
|
|
184
|
-
float Q = GetParam();
|
|
185
|
-
testBandpass(frequency, Q);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
TEST_P(BiquadFilterQTestRestTypes, SetNotchCoefficients) {
|
|
189
|
-
float frequency = 1000.0f;
|
|
190
|
-
float Q = GetParam();
|
|
191
|
-
testNotch(frequency, Q);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
TEST_P(BiquadFilterQTestRestTypes, SetAllpassCoefficients) {
|
|
195
|
-
float frequency = 1000.0f;
|
|
196
|
-
float Q = GetParam();
|
|
197
|
-
testAllpass(frequency, Q);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
TEST_P(BiquadFilterQTestRestTypes, SetPeakingCoefficients) {
|
|
201
|
-
float frequency = 1000.0f;
|
|
202
|
-
float Q = GetParam();
|
|
203
|
-
float gain = 2.0f;
|
|
204
|
-
testPeaking(frequency, Q, gain);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
TEST_P(BiquadFilterGainTest, SetPeakingCoefficients) {
|
|
208
|
-
float frequency = 1000.0f;
|
|
209
|
-
float Q = 1.0f;
|
|
210
|
-
float gain = GetParam();
|
|
211
|
-
testPeaking(frequency, Q, gain);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
TEST_P(BiquadFilterGainTest, SetLowshelfCoefficients) {
|
|
215
|
-
float frequency = 1000.0f;
|
|
216
|
-
float gain = GetParam();
|
|
217
|
-
testLowshelf(frequency, gain);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
TEST_P(BiquadFilterGainTest, SetHighshelfCoefficients) {
|
|
221
|
-
float frequency = 1000.0f;
|
|
222
|
-
float gain = GetParam();
|
|
223
|
-
testHighshelf(frequency, gain);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
TEST_F(BiquadFilterTest, GetFrequencyResponse) {
|
|
227
|
-
auto node = std::make_shared<BiquadFilterNode>(context.get());
|
|
228
|
-
|
|
229
|
-
float frequency = 1000.0f;
|
|
230
|
-
float Q = 1.0f;
|
|
231
|
-
float normalizedFrequency = frequency / nyquistFrequency;
|
|
232
|
-
|
|
233
|
-
node->setLowpassCoefficients(normalizedFrequency, Q);
|
|
234
|
-
auto coeffs = calculateLowpassCoefficients(normalizedFrequency, Q);
|
|
235
|
-
|
|
236
|
-
std::vector<float> TestFrequencies = {
|
|
237
|
-
-0.0001f,
|
|
238
|
-
0.0f,
|
|
239
|
-
0.0001f,
|
|
240
|
-
0.25f * nyquistFrequency,
|
|
241
|
-
0.5f * nyquistFrequency,
|
|
242
|
-
0.75f * nyquistFrequency,
|
|
243
|
-
nyquistFrequency - 0.0001f,
|
|
244
|
-
nyquistFrequency,
|
|
245
|
-
nyquistFrequency + 0.0001f};
|
|
246
|
-
|
|
247
|
-
std::vector<float> magResponseNode(TestFrequencies.size());
|
|
248
|
-
std::vector<float> phaseResponseNode(TestFrequencies.size());
|
|
249
|
-
std::vector<float> magResponseExpected(TestFrequencies.size());
|
|
250
|
-
std::vector<float> phaseResponseExpected(TestFrequencies.size());
|
|
251
|
-
|
|
252
|
-
node->getFrequencyResponse(
|
|
253
|
-
TestFrequencies.data(),
|
|
254
|
-
magResponseNode.data(),
|
|
255
|
-
phaseResponseNode.data(),
|
|
256
|
-
TestFrequencies.size());
|
|
257
|
-
getFrequencyResponse(
|
|
258
|
-
coeffs,
|
|
259
|
-
TestFrequencies,
|
|
260
|
-
magResponseExpected,
|
|
261
|
-
phaseResponseExpected,
|
|
262
|
-
nyquistFrequency);
|
|
263
|
-
|
|
264
|
-
for (size_t i = 0; i < TestFrequencies.size(); ++i) {
|
|
265
|
-
float f = TestFrequencies[i];
|
|
266
|
-
if (std::isnan(magResponseExpected[i])) {
|
|
267
|
-
EXPECT_TRUE(std::isnan(magResponseNode[i]))
|
|
268
|
-
<< "Expected NaN at frequency " << f;
|
|
269
|
-
} else {
|
|
270
|
-
EXPECT_NEAR(magResponseNode[i], magResponseExpected[i], tolerance)
|
|
271
|
-
<< "Magnitude mismatch at " << f << " Hz";
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
if (std::isnan(phaseResponseExpected[i])) {
|
|
275
|
-
EXPECT_TRUE(std::isnan(phaseResponseNode[i]))
|
|
276
|
-
<< "Expected NaN at frequency " << f;
|
|
277
|
-
} else {
|
|
278
|
-
EXPECT_NEAR(phaseResponseNode[i], phaseResponseExpected[i], tolerance)
|
|
279
|
-
<< "Phase mismatch at " << f << " Hz";
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
} // namespace audioapi
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <audioapi/core/OfflineAudioContext.h>
|
|
4
|
-
#include <audioapi/core/effects/BiquadFilterNode.h>
|
|
5
|
-
#include <audioapi/core/utils/worklets/SafeIncludes.h>
|
|
6
|
-
#include <gtest/gtest.h>
|
|
7
|
-
#include <test/src/MockAudioEventHandlerRegistry.h>
|
|
8
|
-
#include <memory>
|
|
9
|
-
|
|
10
|
-
static constexpr int sampleRate = 44100;
|
|
11
|
-
static constexpr float nyquistFrequency = sampleRate / 2.0f;
|
|
12
|
-
static constexpr float tolerance = 0.0001f;
|
|
13
|
-
|
|
14
|
-
namespace audioapi {
|
|
15
|
-
class BiquadFilterTest : public ::testing::Test {
|
|
16
|
-
protected:
|
|
17
|
-
std::shared_ptr<IAudioEventHandlerRegistry> eventRegistry;
|
|
18
|
-
std::unique_ptr<OfflineAudioContext> context;
|
|
19
|
-
|
|
20
|
-
void SetUp() override {
|
|
21
|
-
eventRegistry = std::make_shared<MockAudioEventHandlerRegistry>();
|
|
22
|
-
context = std::make_unique<OfflineAudioContext>(2, 5 * sampleRate, sampleRate, eventRegistry, RuntimeRegistry{});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
void expectCoefficientsNear(const std::shared_ptr<BiquadFilterNode> &node, const BiquadCoefficients &expected);
|
|
26
|
-
void testLowpass(float frequency, float Q);
|
|
27
|
-
void testHighpass(float frequency, float Q);
|
|
28
|
-
void testBandpass(float frequency, float Q);
|
|
29
|
-
void testNotch(float frequency, float Q);
|
|
30
|
-
void testAllpass(float frequency, float Q);
|
|
31
|
-
void testPeaking(float frequency, float Q, float gain);
|
|
32
|
-
void testLowshelf(float frequency, float gain);
|
|
33
|
-
void testHighshelf(float frequency, float gain);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
class BiquadFilterQTestLowpassHighpass : public BiquadFilterTest, public ::testing::WithParamInterface<float> {};
|
|
37
|
-
class BiquadFilterQTestRestTypes : public BiquadFilterTest, public ::testing::WithParamInterface<float> {};
|
|
38
|
-
class BiquadFilterFrequencyTest : public BiquadFilterTest, public ::testing::WithParamInterface<float> {};
|
|
39
|
-
class BiquadFilterGainTest : public BiquadFilterTest, public ::testing::WithParamInterface<float> {};
|
|
40
|
-
} // namespace audioapi
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Script to download and unzip prebuilt native binaries for React Native.
|
|
3
|
-
|
|
4
|
-
MAIN_DOWNLOAD_URL="https://github.com/software-mansion-labs/rn-audio-libs/releases/download"
|
|
5
|
-
TAG="v1.0.0"
|
|
6
|
-
DOWNLOAD_NAMES=(
|
|
7
|
-
"armeabi-v7a.zip" "arm64-v8a.zip" "x86.zip" "x86_64.zip"
|
|
8
|
-
"ffmpeg_ios.zip" "iphoneos.zip" "iphonesimulator.zip" "jniLibs.zip"
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
# Use a temporary directory for downloads, ensuring it exists
|
|
12
|
-
TEMP_DOWNLOAD_DIR="$(pwd)/audioapi-binaries-temp"
|
|
13
|
-
mkdir -p "$TEMP_DOWNLOAD_DIR"
|
|
14
|
-
if [ $1 == "android" ]
|
|
15
|
-
then
|
|
16
|
-
PROJECT_ROOT="$(pwd)/.."
|
|
17
|
-
else
|
|
18
|
-
PROJECT_ROOT="$(pwd)"
|
|
19
|
-
fi
|
|
20
|
-
|
|
21
|
-
for name in "${DOWNLOAD_NAMES[@]}"; do
|
|
22
|
-
ARCH_URL="${MAIN_DOWNLOAD_URL}/${TAG}/${name}"
|
|
23
|
-
ZIP_FILE_PATH="${TEMP_DOWNLOAD_DIR}/${name}"
|
|
24
|
-
|
|
25
|
-
if [[ "$name" == "jniLibs.zip" ]]; then
|
|
26
|
-
OUTPUT_DIR="${PROJECT_ROOT}/android/src/main"
|
|
27
|
-
else
|
|
28
|
-
OUTPUT_DIR="${PROJECT_ROOT}/common/cpp/audioapi/external"
|
|
29
|
-
fi
|
|
30
|
-
|
|
31
|
-
mkdir -p "$OUTPUT_DIR"
|
|
32
|
-
|
|
33
|
-
if [ -f "$ZIP_FILE_PATH" ]; then
|
|
34
|
-
echo "Zip file already exists locally. Skipping download."
|
|
35
|
-
continue
|
|
36
|
-
fi
|
|
37
|
-
echo "Downloading from: $ARCH_URL"
|
|
38
|
-
curl -fsSL "$ARCH_URL" -o "$ZIP_FILE_PATH"
|
|
39
|
-
|
|
40
|
-
if [ $? -ne 0 ]; then
|
|
41
|
-
rm -f "$ZIP_FILE_PATH"
|
|
42
|
-
continue
|
|
43
|
-
fi
|
|
44
|
-
|
|
45
|
-
unzip -o "$ZIP_FILE_PATH" -d "$OUTPUT_DIR"
|
|
46
|
-
|
|
47
|
-
# Clean up any __MACOSX directories that may have been created
|
|
48
|
-
rm -rf "${OUTPUT_DIR}/__MACOSX"
|
|
49
|
-
|
|
50
|
-
done
|
|
51
|
-
|
|
52
|
-
rm -rf "$TEMP_DOWNLOAD_DIR"
|
package/scripts/rnaa_utils.rb
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
def check_if_worklets_enabled()
|
|
2
|
-
validate_worklets_script = File.expand_path(File.join(__dir__, 'validate-worklets-version.js'))
|
|
3
|
-
unless system("node \"#{validate_worklets_script}\"")
|
|
4
|
-
# If the validation script fails, we assume worklets are not present or have an incompatible version
|
|
5
|
-
return false
|
|
6
|
-
end
|
|
7
|
-
true
|
|
8
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const semverPrerelease = require('semver/functions/prerelease');
|
|
3
|
-
const validWorkletsVersions = [
|
|
4
|
-
'0.6.0',
|
|
5
|
-
'0.6.1',
|
|
6
|
-
];
|
|
7
|
-
|
|
8
|
-
function validateVersion() {
|
|
9
|
-
let workletsVersion;
|
|
10
|
-
try {
|
|
11
|
-
const { version } = require('react-native-worklets/package.json');
|
|
12
|
-
workletsVersion = version;
|
|
13
|
-
} catch (e) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
if (semverPrerelease(workletsVersion)) {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return validWorkletsVersions.includes(workletsVersion);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (!validateVersion()) {
|
|
24
|
-
console.error(
|
|
25
|
-
'Incompatible version of react-native-audio-worklets detected. Please install a compatible version.',
|
|
26
|
-
);
|
|
27
|
-
process.exit(1);
|
|
28
|
-
}
|