react-native-audio-api 0.10.0-nightly-e16d7ff-20251030 → 0.11.0-alpha.1
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 -16
- package/android/build.gradle +3 -33
- package/android/src/main/cpp/audioapi/CMakeLists.txt +0 -6
- 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 +142 -28
- package/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.h +40 -13
- 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 +37 -0
- package/android/src/main/cpp/audioapi/android/core/utils/AndroidRecorderCallback.cpp +187 -0
- package/android/src/main/cpp/audioapi/android/core/utils/AndroidRecorderCallback.h +57 -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 +429 -0
- package/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/FFmpegFileWriter.h +113 -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 +269 -0
- package/android/src/main/cpp/audioapi/android/core/utils/miniaudioBackend/MiniAudioFileWriter.h +47 -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/LockScreenManager.kt +6 -27
- package/android/src/main/java/com/swmansion/audioapi/system/MediaNotificationManager.kt +0 -11
- 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/BaseAudioContextHostObject.cpp +0 -18
- package/common/cpp/audioapi/HostObjects/BaseAudioContextHostObject.h +0 -1
- package/common/cpp/audioapi/HostObjects/effects/BiquadFilterNodeHostObject.cpp +1 -1
- package/common/cpp/audioapi/HostObjects/inputs/AudioRecorderHostObject.cpp +97 -18
- package/common/cpp/audioapi/HostObjects/inputs/AudioRecorderHostObject.h +18 -6
- package/common/cpp/audioapi/core/AudioNode.h +2 -3
- package/common/cpp/audioapi/core/AudioParam.cpp +2 -2
- package/common/cpp/audioapi/core/BaseAudioContext.cpp +0 -10
- package/common/cpp/audioapi/core/BaseAudioContext.h +0 -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 +36 -82
- package/common/cpp/audioapi/core/inputs/AudioRecorder.h +52 -31
- package/common/cpp/audioapi/core/sources/StreamerNode.cpp +58 -59
- package/common/cpp/audioapi/core/sources/StreamerNode.h +8 -37
- package/common/cpp/audioapi/core/utils/AudioNodeManager.cpp +0 -5
- 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/dsp/AudioUtils.cpp +1 -1
- package/common/cpp/audioapi/dsp/FFT.cpp +26 -0
- package/common/cpp/audioapi/dsp/FFT.h +2 -26
- 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/audioapi/utils/AudioBus.cpp +0 -28
- package/common/cpp/audioapi/utils/AudioBus.h +0 -3
- package/common/cpp/audioapi/utils/ThreadPool.hpp +1 -59
- package/common/cpp/test/CMakeLists.txt +14 -19
- package/ios/audioapi/ios/AudioAPIModule.h +1 -2
- package/ios/audioapi/ios/AudioAPIModule.mm +0 -2
- package/ios/audioapi/ios/core/IOSAudioFileOptions.h +36 -0
- package/ios/audioapi/ios/core/IOSAudioFileOptions.mm +140 -0
- package/ios/audioapi/ios/core/IOSAudioFileWriter.h +51 -0
- package/ios/audioapi/ios/core/IOSAudioFileWriter.mm +223 -0
- package/ios/audioapi/ios/core/IOSAudioRecorder.h +28 -10
- package/ios/audioapi/ios/core/IOSAudioRecorder.mm +117 -30
- package/ios/audioapi/ios/core/IOSRecorderCallback.h +57 -0
- package/ios/audioapi/ios/core/IOSRecorderCallback.mm +189 -0
- package/ios/audioapi/ios/core/NativeAudioRecorder.h +4 -9
- package/ios/audioapi/ios/core/NativeAudioRecorder.m +29 -71
- package/ios/audioapi/ios/core/utils/AudioDecoder.mm +1 -0
- 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 -141
- package/lib/commonjs/api.js.map +1 -1
- package/lib/commonjs/api.web.js +0 -8
- package/lib/commonjs/api.web.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 +171 -13
- package/lib/commonjs/core/AudioRecorder.js.map +1 -1
- package/lib/commonjs/core/BaseAudioContext.js +25 -28
- 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 +46 -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/commonjs/web-core/AudioContext.js +0 -12
- package/lib/commonjs/web-core/AudioContext.js.map +1 -1
- package/lib/commonjs/web-core/OfflineAudioContext.js +0 -12
- package/lib/commonjs/web-core/OfflineAudioContext.js.map +1 -1
- package/lib/module/api.js +15 -16
- package/lib/module/api.js.map +1 -1
- package/lib/module/api.web.js +0 -1
- package/lib/module/api.web.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 +171 -13
- package/lib/module/core/AudioRecorder.js.map +1 -1
- package/lib/module/core/BaseAudioContext.js +26 -29
- 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 +45 -1
- 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/module/web-core/AudioContext.js +0 -12
- package/lib/module/web-core/AudioContext.js.map +1 -1
- package/lib/module/web-core/OfflineAudioContext.js +0 -12
- package/lib/module/web-core/OfflineAudioContext.js.map +1 -1
- package/lib/typescript/api.d.ts +17 -19
- package/lib/typescript/api.d.ts.map +1 -1
- package/lib/typescript/api.web.d.ts +0 -1
- package/lib/typescript/api.web.d.ts.map +1 -1
- package/lib/typescript/core/AudioContext.d.ts.map +1 -1
- package/lib/typescript/core/AudioRecorder.d.ts +62 -7
- package/lib/typescript/core/AudioRecorder.d.ts.map +1 -1
- package/lib/typescript/core/BaseAudioContext.d.ts +1 -3
- package/lib/typescript/core/BaseAudioContext.d.ts.map +1 -1
- package/lib/typescript/events/types.d.ts +16 -0
- package/lib/typescript/events/types.d.ts.map +1 -1
- package/lib/typescript/interfaces.d.ts +42 -9
- package/lib/typescript/interfaces.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +79 -8
- 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/lib/typescript/web-core/AudioContext.d.ts +0 -3
- package/lib/typescript/web-core/AudioContext.d.ts.map +1 -1
- package/lib/typescript/web-core/BaseAudioContext.d.ts +0 -2
- package/lib/typescript/web-core/BaseAudioContext.d.ts.map +1 -1
- package/lib/typescript/web-core/OfflineAudioContext.d.ts +0 -3
- package/lib/typescript/web-core/OfflineAudioContext.d.ts.map +1 -1
- package/package.json +4 -7
- package/src/api.ts +18 -45
- package/src/api.web.ts +0 -1
- package/src/core/AudioContext.ts +2 -3
- package/src/core/AudioRecorder.ts +211 -24
- package/src/core/BaseAudioContext.ts +60 -67
- package/src/core/OfflineAudioContext.ts +2 -2
- package/src/events/types.ts +18 -0
- package/src/interfaces.ts +52 -16
- package/src/types.ts +90 -9
- package/src/utils/bitEnums.ts +51 -0
- package/src/utils/index.ts +2 -22
- package/src/web-core/AudioContext.tsx +0 -25
- package/src/web-core/BaseAudioContext.tsx +0 -2
- package/src/web-core/OfflineAudioContext.tsx +0 -25
- package/common/cpp/audioapi/HostObjects/effects/ConvolverNodeHostObject.cpp +0 -47
- package/common/cpp/audioapi/HostObjects/effects/ConvolverNodeHostObject.h +0 -20
- package/common/cpp/audioapi/core/effects/ConvolverNode.cpp +0 -210
- package/common/cpp/audioapi/core/effects/ConvolverNode.h +0 -55
- package/common/cpp/audioapi/dsp/Convolver.cpp +0 -213
- package/common/cpp/audioapi/dsp/Convolver.h +0 -45
- package/common/cpp/audioapi/libs/ffmpeg/relinking.md +0 -24
- package/common/cpp/audioapi/utils/AlignedAllocator.hpp +0 -50
- 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/lib/commonjs/core/ConvolverNode.js +0 -37
- package/lib/commonjs/core/ConvolverNode.js.map +0 -1
- package/lib/commonjs/web-core/ConvolverNode.js +0 -40
- package/lib/commonjs/web-core/ConvolverNode.js.map +0 -1
- package/lib/commonjs/web-core/ConvolverNodeOptions.js +0 -6
- package/lib/commonjs/web-core/ConvolverNodeOptions.js.map +0 -1
- package/lib/module/core/ConvolverNode.js +0 -31
- package/lib/module/core/ConvolverNode.js.map +0 -1
- package/lib/module/web-core/ConvolverNode.js +0 -34
- package/lib/module/web-core/ConvolverNode.js.map +0 -1
- package/lib/module/web-core/ConvolverNodeOptions.js +0 -4
- package/lib/module/web-core/ConvolverNodeOptions.js.map +0 -1
- package/lib/typescript/core/ConvolverNode.d.ts +0 -12
- package/lib/typescript/core/ConvolverNode.d.ts.map +0 -1
- package/lib/typescript/web-core/ConvolverNode.d.ts +0 -11
- package/lib/typescript/web-core/ConvolverNode.d.ts.map +0 -1
- package/lib/typescript/web-core/ConvolverNodeOptions.d.ts +0 -6
- package/lib/typescript/web-core/ConvolverNodeOptions.d.ts.map +0 -1
- package/scripts/download-prebuilt-binaries.sh +0 -52
- package/scripts/rnaa_utils.rb +0 -8
- package/scripts/validate-worklets-version.js +0 -28
- package/src/core/ConvolverNode.ts +0 -35
- package/src/web-core/ConvolverNode.tsx +0 -43
- package/src/web-core/ConvolverNodeOptions.tsx +0 -6
package/src/events/types.ts
CHANGED
|
@@ -49,9 +49,27 @@ export interface OnEndedEventType extends EventEmptyType {
|
|
|
49
49
|
isLast: boolean | undefined;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Represents the data payload received by the audio recorder callback each time
|
|
54
|
+
* a new audio buffer becomes available during recording.
|
|
55
|
+
*/
|
|
52
56
|
export interface OnAudioReadyEventType {
|
|
57
|
+
/**
|
|
58
|
+
* The audio buffer containing the recorded PCM data. This buffer includes one
|
|
59
|
+
* or more channels of floating-point samples in the range of -1.0 to 1.0.
|
|
60
|
+
*/
|
|
53
61
|
buffer: AudioBuffer;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The number of audio frames contained in this buffer. A frame represents a
|
|
65
|
+
* single sample across all channels.
|
|
66
|
+
*/
|
|
54
67
|
numFrames: number;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The timestamp (in seconds) indicating when this buffer was captured,
|
|
71
|
+
* relative to the start of the recording session.
|
|
72
|
+
*/
|
|
55
73
|
when: number;
|
|
56
74
|
}
|
|
57
75
|
|
package/src/interfaces.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { AudioEventCallback, AudioEventName } from './events/types';
|
|
2
|
-
import {
|
|
2
|
+
import type {
|
|
3
3
|
BiquadFilterType,
|
|
4
4
|
ChannelCountMode,
|
|
5
5
|
ChannelInterpretation,
|
|
6
6
|
ContextState,
|
|
7
|
+
FileInfo,
|
|
7
8
|
OscillatorType,
|
|
8
9
|
WindowType,
|
|
9
10
|
} from './types';
|
|
10
11
|
|
|
11
|
-
// IMPORTANT: use only IClass, because it is a part of contract between cpp host object and js layer
|
|
12
|
-
|
|
13
12
|
export type WorkletNodeCallback = (
|
|
14
13
|
audioData: Array<ArrayBuffer>,
|
|
15
14
|
channelCount: number
|
|
@@ -77,10 +76,6 @@ export interface IBaseAudioContext {
|
|
|
77
76
|
disableNormalization: boolean
|
|
78
77
|
) => IPeriodicWave;
|
|
79
78
|
createAnalyser: () => IAnalyserNode;
|
|
80
|
-
createConvolver: (
|
|
81
|
-
buffer: IAudioBuffer | undefined,
|
|
82
|
-
disableNormalization: boolean
|
|
83
|
-
) => IConvolverNode;
|
|
84
79
|
createStreamer: () => IStreamerNode;
|
|
85
80
|
}
|
|
86
81
|
|
|
@@ -190,11 +185,6 @@ export interface IAudioBufferQueueSourceNode
|
|
|
190
185
|
pause: () => void;
|
|
191
186
|
}
|
|
192
187
|
|
|
193
|
-
export interface IConvolverNode extends IAudioNode {
|
|
194
|
-
buffer: IAudioBuffer | null;
|
|
195
|
-
normalize: boolean;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
188
|
export interface IAudioBuffer {
|
|
199
189
|
readonly length: number;
|
|
200
190
|
readonly duration: number;
|
|
@@ -261,14 +251,60 @@ export interface IWorkletSourceNode extends IAudioScheduledSourceNode {}
|
|
|
261
251
|
|
|
262
252
|
export interface IWorkletProcessingNode extends IAudioNode {}
|
|
263
253
|
|
|
254
|
+
type IOSAudioRecorderFileDescriptor = number;
|
|
255
|
+
type AndroidAudioRecorderFileDescriptor = number;
|
|
256
|
+
|
|
257
|
+
interface IAudioRecorderFileOptions {
|
|
258
|
+
sampleRate: number;
|
|
259
|
+
channels: number;
|
|
260
|
+
bitRate: number;
|
|
261
|
+
/**
|
|
262
|
+
* IOS specific file recording options
|
|
263
|
+
*
|
|
264
|
+
* - `format` - IOSFormat, bitmask 0 x 0000000F
|
|
265
|
+
* - `quality` - IOSAudioQuality, bitmask 0 x 000000F0
|
|
266
|
+
* - `flacCompressionLevel` - FlacCompressionLevel, bitmask 0 x 00000F00
|
|
267
|
+
* - `directory` - FileDirectory, bitmask 0 x 0000F000
|
|
268
|
+
* - `bitDepth` - BitDepth, bitmask 0 x 000F0000
|
|
269
|
+
*/
|
|
270
|
+
ios: IOSAudioRecorderFileDescriptor;
|
|
271
|
+
/**
|
|
272
|
+
* Android specific file recording options
|
|
273
|
+
*
|
|
274
|
+
* - He he
|
|
275
|
+
*/
|
|
276
|
+
android: AndroidAudioRecorderFileDescriptor;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
interface IAudioRecorderCallbackOptions {
|
|
280
|
+
sampleRate: number;
|
|
281
|
+
bufferLength: number;
|
|
282
|
+
channelCount: number;
|
|
283
|
+
callbackId: string;
|
|
284
|
+
}
|
|
285
|
+
|
|
264
286
|
export interface IAudioRecorder {
|
|
265
|
-
|
|
266
|
-
|
|
287
|
+
// default recorder methods
|
|
288
|
+
start: () => string | void;
|
|
289
|
+
stop: () => FileInfo;
|
|
290
|
+
isRecording: () => boolean;
|
|
291
|
+
isPaused: () => boolean;
|
|
292
|
+
|
|
293
|
+
enableFileOutput: (options: IAudioRecorderFileOptions) => void;
|
|
294
|
+
disableFileOutput: () => void;
|
|
295
|
+
|
|
296
|
+
// pause and resume methods for file recording
|
|
297
|
+
pause: () => void;
|
|
298
|
+
resume: () => void;
|
|
299
|
+
|
|
300
|
+
// Graph integration methods
|
|
267
301
|
connect: (node: IRecorderAdapterNode) => void;
|
|
268
302
|
disconnect: () => void;
|
|
269
303
|
|
|
270
|
-
|
|
271
|
-
|
|
304
|
+
setOnAudioReady: (options: IAudioRecorderCallbackOptions) => void;
|
|
305
|
+
clearOnAudioReady: () => void;
|
|
306
|
+
|
|
307
|
+
getCurrentDuration: () => number;
|
|
272
308
|
}
|
|
273
309
|
|
|
274
310
|
export interface IAudioDecoder {
|
package/src/types.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import AudioBuffer from './core/AudioBuffer';
|
|
2
|
-
|
|
3
1
|
export type ChannelCountMode = 'max' | 'clamped-max' | 'explicit';
|
|
4
2
|
|
|
5
3
|
export type ChannelInterpretation = 'speakers' | 'discrete';
|
|
@@ -14,7 +12,7 @@ export type BiquadFilterType =
|
|
|
14
12
|
| 'notch'
|
|
15
13
|
| 'allpass';
|
|
16
14
|
|
|
17
|
-
export type ContextState = 'running' | 'closed' |
|
|
15
|
+
export type ContextState = 'running' | 'closed' | 'suspended';
|
|
18
16
|
|
|
19
17
|
export type AudioWorkletRuntime = 'AudioRuntime' | 'UIRuntime';
|
|
20
18
|
|
|
@@ -40,9 +38,69 @@ export interface OfflineAudioContextOptions {
|
|
|
40
38
|
sampleRate: number;
|
|
41
39
|
}
|
|
42
40
|
|
|
43
|
-
export
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
export enum FileDirectory {
|
|
42
|
+
Document = 1,
|
|
43
|
+
Cache = 2,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export enum IOSFormat {
|
|
47
|
+
Wav = 1,
|
|
48
|
+
Caf = 2,
|
|
49
|
+
M4A = 3,
|
|
50
|
+
Flac = 4,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export enum IOSAudioQuality {
|
|
54
|
+
Min = 1,
|
|
55
|
+
Low = 2,
|
|
56
|
+
Medium = 3,
|
|
57
|
+
High = 4,
|
|
58
|
+
Max = 5,
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export enum AndroidFormat {
|
|
62
|
+
Wav = 1,
|
|
63
|
+
Caf = 2,
|
|
64
|
+
M4A = 3,
|
|
65
|
+
Flac = 4,
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export enum FlacCompressionLevel {
|
|
69
|
+
L0 = 1,
|
|
70
|
+
L1 = 2,
|
|
71
|
+
L2 = 3,
|
|
72
|
+
L3 = 4,
|
|
73
|
+
L4 = 5,
|
|
74
|
+
L5 = 6,
|
|
75
|
+
L6 = 7,
|
|
76
|
+
L7 = 8,
|
|
77
|
+
L8 = 9,
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export enum BitDepth {
|
|
81
|
+
Bit16 = 1,
|
|
82
|
+
Bit24 = 2,
|
|
83
|
+
Bit32 = 3,
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface AudioRecorderFileOptionsIOS {
|
|
87
|
+
format?: IOSFormat;
|
|
88
|
+
quality?: IOSAudioQuality;
|
|
89
|
+
flacCompressionLevel?: FlacCompressionLevel;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface AudioRecorderFileOptionsAndroid {
|
|
93
|
+
format?: AndroidFormat;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface AudioRecorderFileOptions {
|
|
97
|
+
directory?: FileDirectory;
|
|
98
|
+
sampleRate?: number;
|
|
99
|
+
channels?: number;
|
|
100
|
+
bitRate?: number;
|
|
101
|
+
bitDepth?: BitDepth;
|
|
102
|
+
ios?: AudioRecorderFileOptionsIOS;
|
|
103
|
+
android?: AudioRecorderFileOptionsAndroid;
|
|
46
104
|
}
|
|
47
105
|
|
|
48
106
|
export type WindowType = 'blackman' | 'hann';
|
|
@@ -53,7 +111,30 @@ export interface AudioBufferBaseSourceNodeOptions {
|
|
|
53
111
|
|
|
54
112
|
export type ProcessorMode = 'processInPlace' | 'processThrough';
|
|
55
113
|
|
|
56
|
-
export interface
|
|
57
|
-
|
|
58
|
-
|
|
114
|
+
export interface AudioRecorderCallbackOptions {
|
|
115
|
+
/**
|
|
116
|
+
* The desired sample rate (in Hz) for audio buffers delivered to the
|
|
117
|
+
* recording callback. Common values include 44100 or 48000 Hz. The actual
|
|
118
|
+
* sample rate may differ depending on hardware and system capabilities.
|
|
119
|
+
*/
|
|
120
|
+
sampleRate: number;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The preferred size of each audio buffer, expressed as the number of samples
|
|
124
|
+
* per channel. Smaller buffers reduce latency but increase CPU load, while
|
|
125
|
+
* larger buffers improve efficiency at the cost of higher latency.
|
|
126
|
+
*/
|
|
127
|
+
bufferLength: number;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The desired number of audio channels per buffer. Typically 1 for mono or 2
|
|
131
|
+
* for stereo recordings.
|
|
132
|
+
*/
|
|
133
|
+
channelCount: number;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface FileInfo {
|
|
137
|
+
path: string;
|
|
138
|
+
size: number;
|
|
139
|
+
duration: number;
|
|
59
140
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
function setBitValue(
|
|
2
|
+
output: number,
|
|
3
|
+
value: number,
|
|
4
|
+
shift: number,
|
|
5
|
+
bitWidth = 4
|
|
6
|
+
): number {
|
|
7
|
+
const fieldMask = (1 << bitWidth) - 1;
|
|
8
|
+
|
|
9
|
+
if ((value & ~fieldMask) !== 0) {
|
|
10
|
+
throw new Error(
|
|
11
|
+
`Value ${value} exceeds the maximum for a field with width ${bitWidth} bits.`
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return (output & ~(fieldMask << shift)) | ((value & fieldMask) << shift);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function getBitValue(input: number, shift: number, bitWidth = 4): number {
|
|
19
|
+
const fieldMask = (1 << bitWidth) - 1;
|
|
20
|
+
return (input >> shift) & fieldMask;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function setEnumValue<T extends Record<string, number>>(
|
|
24
|
+
output: number,
|
|
25
|
+
value: T[keyof T],
|
|
26
|
+
shift: number,
|
|
27
|
+
bitWidth = 4
|
|
28
|
+
): number {
|
|
29
|
+
return setBitValue(output, value, shift, bitWidth);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function getEnumValue<T extends Record<string, number>>(
|
|
33
|
+
input: number,
|
|
34
|
+
_enum: T,
|
|
35
|
+
shift: number,
|
|
36
|
+
bitWidth = 4
|
|
37
|
+
): T[keyof T] {
|
|
38
|
+
return getBitValue(input, shift, bitWidth) as T[keyof T];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function encodeFlags<T extends Record<string, number>>(
|
|
42
|
+
...flags: Array<T[keyof T]>
|
|
43
|
+
): number {
|
|
44
|
+
let output = 0;
|
|
45
|
+
|
|
46
|
+
for (let i = 0; i < flags.length; i++) {
|
|
47
|
+
output |= setEnumValue(output, flags[i], i * 4);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return output;
|
|
51
|
+
}
|
package/src/utils/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ShareableWorkletCallback } from '../interfaces';
|
|
2
|
+
export * from './bitEnums';
|
|
2
3
|
|
|
3
4
|
interface SimplifiedWorkletModule {
|
|
4
5
|
makeShareableCloneRecursive: (
|
|
@@ -13,33 +14,12 @@ export function clamp(value: number, min: number, max: number): number {
|
|
|
13
14
|
return Math.min(Math.max(value, min), max);
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
let isWorkletsAvailable = false;
|
|
17
|
-
export let isWorkletsVersionSupported = false;
|
|
18
|
-
export let workletsVersion = 'unknown';
|
|
19
|
-
export const supportedWorkletsVersions = ['0.6.0', '0.6.1'];
|
|
17
|
+
export let isWorkletsAvailable = false;
|
|
20
18
|
export let workletsModule: SimplifiedWorkletModule;
|
|
21
19
|
|
|
22
|
-
export function assertWorkletsEnabled() {
|
|
23
|
-
if (!isWorkletsAvailable) {
|
|
24
|
-
throw new Error(
|
|
25
|
-
'[react-native-audio-api]: Worklets are not available. Please install react-native-worklets to use this feature.'
|
|
26
|
-
);
|
|
27
|
-
} else if (!isWorkletsVersionSupported) {
|
|
28
|
-
throw new Error(
|
|
29
|
-
`[react-native-audio-api]: Worklets version ${workletsVersion} is not supported.
|
|
30
|
-
Please install react-native-worklets of one of the following versions: [${supportedWorkletsVersions.join(', ')}] to use this feature.`
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
20
|
try {
|
|
36
21
|
workletsModule = require('react-native-worklets');
|
|
37
|
-
const workletsModuleJson = require('react-native-worklets/package.json');
|
|
38
|
-
isWorkletsVersionSupported = supportedWorkletsVersions.includes(
|
|
39
|
-
workletsModuleJson.version
|
|
40
|
-
);
|
|
41
22
|
isWorkletsAvailable = true;
|
|
42
|
-
workletsVersion = workletsModuleJson.version;
|
|
43
23
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
44
24
|
} catch (error) {
|
|
45
25
|
isWorkletsAvailable = false;
|
|
@@ -15,8 +15,6 @@ import GainNode from './GainNode';
|
|
|
15
15
|
import OscillatorNode from './OscillatorNode';
|
|
16
16
|
import PeriodicWave from './PeriodicWave';
|
|
17
17
|
import StereoPannerNode from './StereoPannerNode';
|
|
18
|
-
import ConvolverNode from './ConvolverNode';
|
|
19
|
-
import { ConvolverNodeOptions } from './ConvolverNodeOptions';
|
|
20
18
|
|
|
21
19
|
import { globalWasmPromise, globalTag } from './custom/LoadCustomWasm';
|
|
22
20
|
import ConstantSourceNode from './ConstantSourceNode';
|
|
@@ -72,29 +70,6 @@ export default class AudioContext implements BaseAudioContext {
|
|
|
72
70
|
return new BiquadFilterNode(this, this.context.createBiquadFilter());
|
|
73
71
|
}
|
|
74
72
|
|
|
75
|
-
createConvolver(options?: ConvolverNodeOptions): ConvolverNode {
|
|
76
|
-
if (options?.buffer) {
|
|
77
|
-
const numberOfChannels = options.buffer.numberOfChannels;
|
|
78
|
-
if (
|
|
79
|
-
numberOfChannels !== 1 &&
|
|
80
|
-
numberOfChannels !== 2 &&
|
|
81
|
-
numberOfChannels !== 4
|
|
82
|
-
) {
|
|
83
|
-
throw new NotSupportedError(
|
|
84
|
-
`The number of channels provided (${numberOfChannels}) in impulse response for ConvolverNode buffer must be 1 or 2 or 4.`
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
const buffer = options?.buffer ?? null;
|
|
89
|
-
const disableNormalization = options?.disableNormalization ?? false;
|
|
90
|
-
return new ConvolverNode(
|
|
91
|
-
this,
|
|
92
|
-
this.context.createConvolver(),
|
|
93
|
-
buffer,
|
|
94
|
-
disableNormalization
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
73
|
async createBufferSource(
|
|
99
74
|
options?: AudioBufferBaseSourceNodeOptions
|
|
100
75
|
): Promise<AudioBufferSourceNode> {
|
|
@@ -9,7 +9,6 @@ import OscillatorNode from './OscillatorNode';
|
|
|
9
9
|
import PeriodicWave from './PeriodicWave';
|
|
10
10
|
import StereoPannerNode from './StereoPannerNode';
|
|
11
11
|
import ConstantSourceNode from './ConstantSourceNode';
|
|
12
|
-
import ConvolverNode from './ConvolverNode';
|
|
13
12
|
|
|
14
13
|
export default interface BaseAudioContext {
|
|
15
14
|
readonly context: globalThis.BaseAudioContext;
|
|
@@ -24,7 +23,6 @@ export default interface BaseAudioContext {
|
|
|
24
23
|
createGain(): GainNode;
|
|
25
24
|
createStereoPanner(): StereoPannerNode;
|
|
26
25
|
createBiquadFilter(): BiquadFilterNode;
|
|
27
|
-
createConvolver(): ConvolverNode;
|
|
28
26
|
createBufferSource(): Promise<AudioBufferSourceNode>;
|
|
29
27
|
createBuffer(
|
|
30
28
|
numOfChannels: number,
|
|
@@ -18,8 +18,6 @@ import StereoPannerNode from './StereoPannerNode';
|
|
|
18
18
|
import ConstantSourceNode from './ConstantSourceNode';
|
|
19
19
|
|
|
20
20
|
import { globalWasmPromise, globalTag } from './custom/LoadCustomWasm';
|
|
21
|
-
import ConvolverNode from './ConvolverNode';
|
|
22
|
-
import { ConvolverNodeOptions } from './ConvolverNodeOptions';
|
|
23
21
|
|
|
24
22
|
export default class OfflineAudioContext implements BaseAudioContext {
|
|
25
23
|
readonly context: globalThis.OfflineAudioContext;
|
|
@@ -78,29 +76,6 @@ export default class OfflineAudioContext implements BaseAudioContext {
|
|
|
78
76
|
return new BiquadFilterNode(this, this.context.createBiquadFilter());
|
|
79
77
|
}
|
|
80
78
|
|
|
81
|
-
createConvolver(options?: ConvolverNodeOptions): ConvolverNode {
|
|
82
|
-
if (options?.buffer) {
|
|
83
|
-
const numberOfChannels = options.buffer.numberOfChannels;
|
|
84
|
-
if (
|
|
85
|
-
numberOfChannels !== 1 &&
|
|
86
|
-
numberOfChannels !== 2 &&
|
|
87
|
-
numberOfChannels !== 4
|
|
88
|
-
) {
|
|
89
|
-
throw new NotSupportedError(
|
|
90
|
-
`The number of channels provided (${numberOfChannels}) in impulse response for ConvolverNode buffer must be 1 or 2 or 4.`
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
const buffer = options?.buffer ?? null;
|
|
95
|
-
const disableNormalization = options?.disableNormalization ?? false;
|
|
96
|
-
return new ConvolverNode(
|
|
97
|
-
this,
|
|
98
|
-
this.context.createConvolver(),
|
|
99
|
-
buffer,
|
|
100
|
-
disableNormalization
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
79
|
async createBufferSource(
|
|
105
80
|
options?: AudioBufferBaseSourceNodeOptions
|
|
106
81
|
): Promise<AudioBufferSourceNode> {
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
#include <audioapi/HostObjects/effects/ConvolverNodeHostObject.h>
|
|
2
|
-
|
|
3
|
-
#include <audioapi/HostObjects/sources/AudioBufferHostObject.h>
|
|
4
|
-
#include <audioapi/core/effects/ConvolverNode.h>
|
|
5
|
-
|
|
6
|
-
namespace audioapi {
|
|
7
|
-
|
|
8
|
-
ConvolverNodeHostObject::ConvolverNodeHostObject(
|
|
9
|
-
const std::shared_ptr<ConvolverNode> &node)
|
|
10
|
-
: AudioNodeHostObject(node) {
|
|
11
|
-
addGetters(
|
|
12
|
-
JSI_EXPORT_PROPERTY_GETTER(ConvolverNodeHostObject, normalize),
|
|
13
|
-
JSI_EXPORT_PROPERTY_GETTER(ConvolverNodeHostObject, buffer));
|
|
14
|
-
addSetters(
|
|
15
|
-
JSI_EXPORT_PROPERTY_SETTER(ConvolverNodeHostObject, normalize),
|
|
16
|
-
JSI_EXPORT_PROPERTY_SETTER(ConvolverNodeHostObject, buffer));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
JSI_PROPERTY_GETTER_IMPL(ConvolverNodeHostObject, normalize) {
|
|
20
|
-
auto convolverNode = std::static_pointer_cast<ConvolverNode>(node_);
|
|
21
|
-
return {convolverNode->getNormalize_()};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
JSI_PROPERTY_GETTER_IMPL(ConvolverNodeHostObject, buffer) {
|
|
25
|
-
auto convolverNode = std::static_pointer_cast<ConvolverNode>(node_);
|
|
26
|
-
auto buffer = convolverNode->getBuffer();
|
|
27
|
-
auto bufferHostObject = std::make_shared<AudioBufferHostObject>(buffer);
|
|
28
|
-
return jsi::Object::createFromHostObject(runtime, bufferHostObject);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
JSI_PROPERTY_SETTER_IMPL(ConvolverNodeHostObject, normalize) {
|
|
32
|
-
auto convolverNode = std::static_pointer_cast<ConvolverNode>(node_);
|
|
33
|
-
convolverNode->setNormalize(value.getBool());
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
JSI_PROPERTY_SETTER_IMPL(ConvolverNodeHostObject, buffer) {
|
|
37
|
-
auto convolverNode = std::static_pointer_cast<ConvolverNode>(node_);
|
|
38
|
-
if (value.isNull()) {
|
|
39
|
-
convolverNode->setBuffer(nullptr);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
auto bufferHostObject =
|
|
44
|
-
value.getObject(runtime).asHostObject<AudioBufferHostObject>(runtime);
|
|
45
|
-
convolverNode->setBuffer(bufferHostObject->audioBuffer_);
|
|
46
|
-
}
|
|
47
|
-
} // namespace audioapi
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <audioapi/HostObjects/AudioNodeHostObject.h>
|
|
4
|
-
|
|
5
|
-
#include <memory>
|
|
6
|
-
|
|
7
|
-
namespace audioapi {
|
|
8
|
-
using namespace facebook;
|
|
9
|
-
|
|
10
|
-
class ConvolverNode;
|
|
11
|
-
|
|
12
|
-
class ConvolverNodeHostObject : public AudioNodeHostObject {
|
|
13
|
-
public:
|
|
14
|
-
explicit ConvolverNodeHostObject(const std::shared_ptr<ConvolverNode> &node);
|
|
15
|
-
JSI_PROPERTY_GETTER_DECL(normalize);
|
|
16
|
-
JSI_PROPERTY_GETTER_DECL(buffer);
|
|
17
|
-
JSI_PROPERTY_SETTER_DECL(normalize);
|
|
18
|
-
JSI_PROPERTY_SETTER_DECL(buffer);
|
|
19
|
-
};
|
|
20
|
-
} // namespace audioapi
|