react-native-audio-api 0.10.0-nightly-c815c40-20251027 → 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-audio-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0-alpha.0",
|
|
4
4
|
"description": "react-native-audio-api provides system for controlling audio in React Native environment compatible with Web Audio API specification",
|
|
5
5
|
"bin": {
|
|
6
6
|
"setup-rn-audio-api-web": "./scripts/setup-rn-audio-api-web.js"
|
|
@@ -35,9 +35,6 @@
|
|
|
35
35
|
"!**/.*",
|
|
36
36
|
"!**/node_modules",
|
|
37
37
|
"scripts/setup-rn-audio-api-web.js",
|
|
38
|
-
"scripts/rnaa_utils.rb",
|
|
39
|
-
"scripts/validate-worklets-version.js",
|
|
40
|
-
"scripts/download-prebuilt-binaries.sh",
|
|
41
38
|
"app.plugin.js"
|
|
42
39
|
],
|
|
43
40
|
"scripts": {
|
|
@@ -91,7 +88,7 @@
|
|
|
91
88
|
"@babel/core": "^7.25.2",
|
|
92
89
|
"@babel/preset-env": "^7.25.3",
|
|
93
90
|
"@babel/types": "^7.20.0",
|
|
94
|
-
"@commitlint/config-conventional": "
|
|
91
|
+
"@commitlint/config-conventional": "17.0.2",
|
|
95
92
|
"@evilmartians/lefthook": "^1.5.0",
|
|
96
93
|
"@expo/config-plugins": "^9.0.0",
|
|
97
94
|
"@expo/config-types": "^53.0.4",
|
|
@@ -108,7 +105,7 @@
|
|
|
108
105
|
"@types/react": "^19.1.1",
|
|
109
106
|
"@types/react-test-renderer": "^19.1.0",
|
|
110
107
|
"babel-plugin-module-resolver": "^4.1.0",
|
|
111
|
-
"commitlint": "
|
|
108
|
+
"commitlint": "17.0.2",
|
|
112
109
|
"del-cli": "^5.1.0",
|
|
113
110
|
"eslint": "^8.57.0",
|
|
114
111
|
"eslint-config-prettier": "^8.3.0",
|
|
@@ -130,7 +127,7 @@
|
|
|
130
127
|
"react-native": "0.82.0",
|
|
131
128
|
"react-native-builder-bob": "0.33.1",
|
|
132
129
|
"turbo": "^1.10.7",
|
|
133
|
-
"typescript": "5.8.3"
|
|
130
|
+
"typescript": "~5.8.3"
|
|
134
131
|
},
|
|
135
132
|
"react-native-builder-bob": {
|
|
136
133
|
"source": "src",
|
package/src/api.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { NativeAudioAPIModule } from './specs';
|
|
2
|
-
import { AudioRecorderOptions } from './types';
|
|
3
1
|
import type {
|
|
4
2
|
IAudioContext,
|
|
5
3
|
IAudioDecoder,
|
|
4
|
+
IAudioEventEmitter,
|
|
6
5
|
IAudioRecorder,
|
|
7
6
|
IAudioStretcher,
|
|
8
7
|
IOfflineAudioContext,
|
|
9
|
-
IAudioEventEmitter,
|
|
10
8
|
} from './interfaces';
|
|
9
|
+
import { NativeAudioAPIModule } from './specs';
|
|
11
10
|
|
|
12
11
|
/* eslint-disable no-var */
|
|
13
12
|
declare global {
|
|
@@ -25,7 +24,7 @@ declare global {
|
|
|
25
24
|
audioWorkletRuntime: any
|
|
26
25
|
) => IOfflineAudioContext;
|
|
27
26
|
|
|
28
|
-
var createAudioRecorder: (
|
|
27
|
+
var createAudioRecorder: () => IAudioRecorder;
|
|
29
28
|
|
|
30
29
|
var createAudioDecoder: () => IAudioDecoder;
|
|
31
30
|
|
|
@@ -52,58 +51,33 @@ if (
|
|
|
52
51
|
NativeAudioAPIModule.install();
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
export { default as
|
|
56
|
-
export { default as WorkletSourceNode } from './core/WorkletSourceNode';
|
|
57
|
-
export { default as WorkletProcessingNode } from './core/WorkletProcessingNode';
|
|
58
|
-
export { default as RecorderAdapterNode } from './core/RecorderAdapterNode';
|
|
54
|
+
export { default as AnalyserNode } from './core/AnalyserNode';
|
|
59
55
|
export { default as AudioBuffer } from './core/AudioBuffer';
|
|
60
|
-
export { default as AudioBufferSourceNode } from './core/AudioBufferSourceNode';
|
|
61
56
|
export { default as AudioBufferQueueSourceNode } from './core/AudioBufferQueueSourceNode';
|
|
57
|
+
export { default as AudioBufferSourceNode } from './core/AudioBufferSourceNode';
|
|
62
58
|
export { default as AudioContext } from './core/AudioContext';
|
|
63
|
-
export {
|
|
59
|
+
export { decodeAudioData, decodePCMInBase64 } from './core/AudioDecoder';
|
|
64
60
|
export { default as AudioDestinationNode } from './core/AudioDestinationNode';
|
|
65
61
|
export { default as AudioNode } from './core/AudioNode';
|
|
66
|
-
export { default as AnalyserNode } from './core/AnalyserNode';
|
|
67
62
|
export { default as AudioParam } from './core/AudioParam';
|
|
63
|
+
export { default as AudioRecorder } from './core/AudioRecorder';
|
|
68
64
|
export { default as AudioScheduledSourceNode } from './core/AudioScheduledSourceNode';
|
|
65
|
+
export { default as changePlaybackSpeed } from './core/AudioStretcher';
|
|
69
66
|
export { default as BaseAudioContext } from './core/BaseAudioContext';
|
|
70
67
|
export { default as BiquadFilterNode } from './core/BiquadFilterNode';
|
|
68
|
+
export { default as ConstantSourceNode } from './core/ConstantSourceNode';
|
|
71
69
|
export { default as GainNode } from './core/GainNode';
|
|
70
|
+
export { default as OfflineAudioContext } from './core/OfflineAudioContext';
|
|
72
71
|
export { default as OscillatorNode } from './core/OscillatorNode';
|
|
72
|
+
export { default as RecorderAdapterNode } from './core/RecorderAdapterNode';
|
|
73
73
|
export { default as StereoPannerNode } from './core/StereoPannerNode';
|
|
74
|
-
export { default as AudioRecorder } from './core/AudioRecorder';
|
|
75
74
|
export { default as StreamerNode } from './core/StreamerNode';
|
|
76
|
-
export { default as
|
|
77
|
-
export { default as
|
|
75
|
+
export { default as WorkletNode } from './core/WorkletNode';
|
|
76
|
+
export { default as WorkletProcessingNode } from './core/WorkletProcessingNode';
|
|
77
|
+
export { default as WorkletSourceNode } from './core/WorkletSourceNode';
|
|
78
78
|
export { default as useSystemVolume } from './hooks/useSystemVolume';
|
|
79
|
-
export {
|
|
80
|
-
export { default as changePlaybackSpeed } from './core/AudioStretcher';
|
|
81
|
-
|
|
82
|
-
export {
|
|
83
|
-
OscillatorType,
|
|
84
|
-
BiquadFilterType,
|
|
85
|
-
ChannelCountMode,
|
|
86
|
-
ChannelInterpretation,
|
|
87
|
-
ContextState,
|
|
88
|
-
WindowType,
|
|
89
|
-
PeriodicWaveConstraints,
|
|
90
|
-
AudioWorkletRuntime,
|
|
91
|
-
} from './types';
|
|
92
|
-
|
|
93
|
-
export {
|
|
94
|
-
IOSCategory,
|
|
95
|
-
IOSMode,
|
|
96
|
-
IOSOption,
|
|
97
|
-
SessionOptions,
|
|
98
|
-
MediaState,
|
|
99
|
-
LockScreenInfo,
|
|
100
|
-
PermissionStatus,
|
|
101
|
-
} from './system/types';
|
|
79
|
+
export { default as AudioManager } from './system';
|
|
102
80
|
|
|
103
|
-
export
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
InvalidStateError,
|
|
107
|
-
RangeError,
|
|
108
|
-
NotSupportedError,
|
|
109
|
-
} from './errors';
|
|
81
|
+
export * from './errors';
|
|
82
|
+
export * from './system/types';
|
|
83
|
+
export * from './types';
|
package/src/core/AudioContext.ts
CHANGED
|
@@ -3,7 +3,7 @@ import BaseAudioContext from './BaseAudioContext';
|
|
|
3
3
|
import AudioManager from '../system';
|
|
4
4
|
import { AudioContextOptions } from '../types';
|
|
5
5
|
import { NotSupportedError } from '../errors';
|
|
6
|
-
import {
|
|
6
|
+
import { isWorkletsAvailable, workletsModule } from '../utils';
|
|
7
7
|
|
|
8
8
|
export default class AudioContext extends BaseAudioContext {
|
|
9
9
|
constructor(options?: AudioContextOptions) {
|
|
@@ -17,8 +17,7 @@ export default class AudioContext extends BaseAudioContext {
|
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
19
|
let audioRuntime = null;
|
|
20
|
-
|
|
21
|
-
if (isWorkletsVersionSupported) {
|
|
20
|
+
if (isWorkletsAvailable) {
|
|
22
21
|
audioRuntime = workletsModule.createWorkletRuntime('AudioWorkletRuntime');
|
|
23
22
|
}
|
|
24
23
|
|
|
@@ -1,30 +1,134 @@
|
|
|
1
|
+
import { AudioEventEmitter, AudioEventSubscription } from '../events';
|
|
2
|
+
import { OnAudioReadyEventType } from '../events/types';
|
|
1
3
|
import { IAudioRecorder } from '../interfaces';
|
|
2
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
AndroidFormat,
|
|
6
|
+
AudioRecorderCallbackOptions,
|
|
7
|
+
AudioRecorderFileOptions,
|
|
8
|
+
BitDepth,
|
|
9
|
+
FileDirectory,
|
|
10
|
+
IOSAudioQuality,
|
|
11
|
+
IOSFormat,
|
|
12
|
+
} from '../types';
|
|
13
|
+
import { encodeFlags } from '../utils';
|
|
3
14
|
import AudioBuffer from './AudioBuffer';
|
|
4
|
-
import { OnAudioReadyEventType } from '../events/types';
|
|
5
|
-
import { AudioEventEmitter } from '../events';
|
|
6
15
|
import RecorderAdapterNode from './RecorderAdapterNode';
|
|
7
16
|
|
|
17
|
+
function withDefaultOptions(inOptions: AudioRecorderFileOptions) {
|
|
18
|
+
return {
|
|
19
|
+
directory: FileDirectory.Cache,
|
|
20
|
+
sampleRate: 48000,
|
|
21
|
+
channels: 2,
|
|
22
|
+
bitRate: 128000,
|
|
23
|
+
bitDepth: BitDepth.Bit24,
|
|
24
|
+
...inOptions,
|
|
25
|
+
ios: {
|
|
26
|
+
format: IOSFormat.M4A,
|
|
27
|
+
quality: IOSAudioQuality.High,
|
|
28
|
+
...(inOptions.ios ?? {}),
|
|
29
|
+
},
|
|
30
|
+
android: {
|
|
31
|
+
format: AndroidFormat.M4A,
|
|
32
|
+
...(inOptions.android ?? {}),
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function parseFileOptions(inOptions: AudioRecorderFileOptions) {
|
|
38
|
+
const { sampleRate, channels, bitRate, directory, bitDepth, ios, android } =
|
|
39
|
+
withDefaultOptions(inOptions);
|
|
40
|
+
|
|
41
|
+
const iosFlags = encodeFlags(
|
|
42
|
+
ios.format,
|
|
43
|
+
ios.quality,
|
|
44
|
+
ios.flacCompressionLevel || 0,
|
|
45
|
+
directory,
|
|
46
|
+
bitDepth
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
// TODO: ensure directory and bitDepth are last in the bitmask
|
|
50
|
+
const androidFlags = encodeFlags(android.format, directory, bitDepth);
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
sampleRate,
|
|
54
|
+
channels,
|
|
55
|
+
bitRate,
|
|
56
|
+
ios: iosFlags,
|
|
57
|
+
android: androidFlags,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
8
61
|
export default class AudioRecorder {
|
|
62
|
+
protected onAudioReadySubscription: AudioEventSubscription | null = null;
|
|
9
63
|
protected readonly recorder: IAudioRecorder;
|
|
64
|
+
protected options_: AudioRecorderFileOptions | null = null;
|
|
10
65
|
|
|
11
|
-
|
|
66
|
+
protected readonly audioEventEmitter = new AudioEventEmitter(
|
|
12
67
|
global.AudioEventEmitter
|
|
13
68
|
);
|
|
14
69
|
|
|
15
|
-
constructor(
|
|
16
|
-
this.recorder = global.createAudioRecorder(
|
|
70
|
+
constructor() {
|
|
71
|
+
this.recorder = global.createAudioRecorder();
|
|
17
72
|
}
|
|
18
73
|
|
|
74
|
+
enableFileOutput(options: AudioRecorderFileOptions): void {
|
|
75
|
+
if (this.recorder.isRecording()) {
|
|
76
|
+
throw new Error(
|
|
77
|
+
'Cannot enable file output while recording is in progress. Please stop the recorder before changing output options.'
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
this.options_ = options;
|
|
82
|
+
|
|
83
|
+
const parsedOptions = parseFileOptions(options);
|
|
84
|
+
this.recorder.enableFileOutput(parsedOptions);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
public get options(): AudioRecorderFileOptions | null {
|
|
88
|
+
return this.options_;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
disableFileOutput(): void {
|
|
92
|
+
this.options_ = null;
|
|
93
|
+
this.recorder.disableFileOutput();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Starts the audio recording process with configured output options */
|
|
19
97
|
public start(): void {
|
|
20
98
|
this.recorder.start();
|
|
21
99
|
}
|
|
22
100
|
|
|
23
|
-
|
|
24
|
-
|
|
101
|
+
/** Stops the audio recording process and releases internal resources */
|
|
102
|
+
public stop(): void | string {
|
|
103
|
+
return this.recorder.stop();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Pauses the audio recording process without tearing down anything */
|
|
107
|
+
public pause(): void {
|
|
108
|
+
this.recorder.pause();
|
|
25
109
|
}
|
|
26
110
|
|
|
111
|
+
/** Resumes the audio recording process after being paused */
|
|
112
|
+
public resume(): void {
|
|
113
|
+
this.recorder.resume();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Connects a {@link RecorderAdapterNode} to the recorder’s audio graph.
|
|
118
|
+
*
|
|
119
|
+
* Each node can only be connected once. Attempting to connect a node multiple
|
|
120
|
+
* times will throw an error.
|
|
121
|
+
*
|
|
122
|
+
* @param node - The adapter node to connect to the recorder.
|
|
123
|
+
* @throws If the node has already been connected.
|
|
124
|
+
*/
|
|
27
125
|
public connect(node: RecorderAdapterNode): void {
|
|
126
|
+
if (this.recorder.isRecording()) {
|
|
127
|
+
throw new Error(
|
|
128
|
+
'Cannot connect adapter node while recording is in progress. Please stop the recorder before connecting new nodes.'
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
28
132
|
if (node.wasConnected) {
|
|
29
133
|
throw new Error(
|
|
30
134
|
'RecorderAdapterNode cannot be connected more than once. Refer to the documentation for more details.'
|
|
@@ -34,24 +138,90 @@ export default class AudioRecorder {
|
|
|
34
138
|
this.recorder.connect(node.getNode());
|
|
35
139
|
}
|
|
36
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Disconnects the recorder from all connected adapter nodes.
|
|
143
|
+
*
|
|
144
|
+
* After calling this method, any connected {@link RecorderAdapterNode} will no
|
|
145
|
+
* longer receive audio data until reconnected.
|
|
146
|
+
*/
|
|
37
147
|
public disconnect(): void {
|
|
38
148
|
this.recorder.disconnect();
|
|
39
149
|
}
|
|
40
150
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
151
|
+
/**
|
|
152
|
+
* Registers a callback to receive raw audio data during an active recording
|
|
153
|
+
* session.
|
|
154
|
+
*
|
|
155
|
+
* The callback is periodically invoked with audio buffers that match the
|
|
156
|
+
* preferred configuration provided in `options`. These parameters (sample
|
|
157
|
+
* rate, buffer length, and channel count) guide how audio data is chunked and
|
|
158
|
+
* delivered, though the exact values may vary depending on device
|
|
159
|
+
* capabilities. Values may vary depending on device capabilities.
|
|
160
|
+
*
|
|
161
|
+
* @param options - Preferred configuration for the audio buffers delivered to
|
|
162
|
+
* the callback.
|
|
163
|
+
* @param callback - Function invoked each time a new audio buffer is
|
|
164
|
+
* available. The callback receives an {@link OnAudioReadyEventType} object
|
|
165
|
+
* containing the audio data and associated metadata.
|
|
166
|
+
*/
|
|
167
|
+
public onAudioReady(
|
|
168
|
+
options: AudioRecorderCallbackOptions,
|
|
169
|
+
callback: (event: OnAudioReadyEventType) => void
|
|
170
|
+
): void {
|
|
171
|
+
if (this.recorder.isRecording()) {
|
|
172
|
+
throw new Error(
|
|
173
|
+
'Cannot set onAudioReady callback while recording is in progress. Please stop the recorder before setting a new callback.'
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (this.onAudioReadySubscription) {
|
|
178
|
+
this.recorder.clearOnAudioReady();
|
|
179
|
+
this.onAudioReadySubscription.remove();
|
|
180
|
+
this.onAudioReadySubscription = null;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
this.onAudioReadySubscription =
|
|
184
|
+
this.audioEventEmitter.addAudioEventListener('audioReady', (event) => {
|
|
185
|
+
const audioBuffer = new AudioBuffer(event.buffer);
|
|
186
|
+
callback({
|
|
187
|
+
...event,
|
|
188
|
+
buffer: audioBuffer,
|
|
189
|
+
});
|
|
47
190
|
});
|
|
48
|
-
};
|
|
49
191
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
192
|
+
this.recorder.setOnAudioReady({
|
|
193
|
+
sampleRate: options.sampleRate,
|
|
194
|
+
bufferLength: options.bufferLength,
|
|
195
|
+
channelCount: options.channelCount,
|
|
196
|
+
callbackId: this.onAudioReadySubscription.subscriptionId,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Removes the previously registered audio data callback, if any.
|
|
202
|
+
*
|
|
203
|
+
* This stops further `onAudioReady` events from being delivered during
|
|
204
|
+
* recording. Calling this method is safe even if no callback is currently
|
|
205
|
+
* registered.
|
|
206
|
+
*/
|
|
207
|
+
public clearOnAudioReady(): void {
|
|
208
|
+
if (this.recorder.isRecording()) {
|
|
209
|
+
throw new Error(
|
|
210
|
+
'Cannot clear onAudioReady callback while recording is in progress. Please stop the recorder before clearing the callback.'
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (!this.onAudioReadySubscription) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
this.recorder.clearOnAudioReady();
|
|
219
|
+
|
|
220
|
+
this.onAudioReadySubscription.remove();
|
|
221
|
+
this.onAudioReadySubscription = null;
|
|
222
|
+
}
|
|
54
223
|
|
|
55
|
-
|
|
224
|
+
public isRecording(): boolean {
|
|
225
|
+
return this.recorder.isRecording();
|
|
56
226
|
}
|
|
57
227
|
}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
PeriodicWaveConstraints,
|
|
7
7
|
AudioWorkletRuntime,
|
|
8
8
|
} from '../types';
|
|
9
|
-
import {
|
|
9
|
+
import { isWorkletsAvailable, workletsModule } from '../utils';
|
|
10
10
|
import WorkletSourceNode from './WorkletSourceNode';
|
|
11
11
|
import WorkletProcessingNode from './WorkletProcessingNode';
|
|
12
12
|
import AnalyserNode from './AnalyserNode';
|
|
@@ -84,24 +84,30 @@ export default class BaseAudioContext {
|
|
|
84
84
|
`The buffer length provided (${bufferLength}) can not be less than 1`
|
|
85
85
|
);
|
|
86
86
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
87
|
+
|
|
88
|
+
if (isWorkletsAvailable) {
|
|
89
|
+
const shareableWorklet = workletsModule.makeShareableCloneRecursive(
|
|
90
|
+
(audioBuffers: Array<ArrayBuffer>, channelCount: number) => {
|
|
91
|
+
'worklet';
|
|
92
|
+
const floatAudioData: Array<Float32Array> = audioBuffers.map(
|
|
93
|
+
(buffer) => new Float32Array(buffer)
|
|
94
|
+
);
|
|
95
|
+
callback(floatAudioData, channelCount);
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
return new WorkletNode(
|
|
99
|
+
this,
|
|
100
|
+
this.context.createWorkletNode(
|
|
101
|
+
shareableWorklet,
|
|
102
|
+
workletRuntime === 'UIRuntime',
|
|
103
|
+
bufferLength,
|
|
104
|
+
inputChannelCount
|
|
105
|
+
)
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
/// User does not have worklets as a dependency so he cannot use the worklet API.
|
|
109
|
+
throw new Error(
|
|
110
|
+
'[RnAudioApi] Worklets are not available, please install react-native-worklets as a dependency. Refer to documentation for more details.'
|
|
105
111
|
);
|
|
106
112
|
}
|
|
107
113
|
|
|
@@ -114,30 +120,35 @@ export default class BaseAudioContext {
|
|
|
114
120
|
) => void,
|
|
115
121
|
workletRuntime: AudioWorkletRuntime = 'AudioRuntime'
|
|
116
122
|
): WorkletProcessingNode {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
123
|
+
if (isWorkletsAvailable) {
|
|
124
|
+
const shareableWorklet = workletsModule.makeShareableCloneRecursive(
|
|
125
|
+
(
|
|
126
|
+
inputBuffers: Array<ArrayBuffer>,
|
|
127
|
+
outputBuffers: Array<ArrayBuffer>,
|
|
128
|
+
framesToProcess: number,
|
|
129
|
+
currentTime: number
|
|
130
|
+
) => {
|
|
131
|
+
'worklet';
|
|
132
|
+
const inputData: Array<Float32Array> = inputBuffers.map(
|
|
133
|
+
(buffer) => new Float32Array(buffer, 0, framesToProcess)
|
|
134
|
+
);
|
|
135
|
+
const outputData: Array<Float32Array> = outputBuffers.map(
|
|
136
|
+
(buffer) => new Float32Array(buffer, 0, framesToProcess)
|
|
137
|
+
);
|
|
138
|
+
callback(inputData, outputData, framesToProcess, currentTime);
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
return new WorkletProcessingNode(
|
|
142
|
+
this,
|
|
143
|
+
this.context.createWorkletProcessingNode(
|
|
144
|
+
shareableWorklet,
|
|
145
|
+
workletRuntime === 'UIRuntime'
|
|
146
|
+
)
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
/// User does not have worklets as a dependency so he cannot use the worklet API.
|
|
150
|
+
throw new Error(
|
|
151
|
+
'[RnAudioApi] Worklets are not available, please install react-native-worklets as a dependency. Refer to documentation for more details.'
|
|
141
152
|
);
|
|
142
153
|
}
|
|
143
154
|
|
|
@@ -150,7 +161,12 @@ export default class BaseAudioContext {
|
|
|
150
161
|
) => void,
|
|
151
162
|
workletRuntime: AudioWorkletRuntime = 'AudioRuntime'
|
|
152
163
|
): WorkletSourceNode {
|
|
153
|
-
|
|
164
|
+
if (!isWorkletsAvailable) {
|
|
165
|
+
/// User does not have worklets as a dependency so he cannot use the worklet API.
|
|
166
|
+
throw new Error(
|
|
167
|
+
'[RnAudioApi] Worklets are not available, please install react-native-worklets as a dependency. Refer to documentation for more details.'
|
|
168
|
+
);
|
|
169
|
+
}
|
|
154
170
|
const shareableWorklet = workletsModule.makeShareableCloneRecursive(
|
|
155
171
|
(
|
|
156
172
|
audioBuffers: Array<ArrayBuffer>,
|
|
@@ -3,7 +3,7 @@ import BaseAudioContext from './BaseAudioContext';
|
|
|
3
3
|
import { OfflineAudioContextOptions } from '../types';
|
|
4
4
|
import { InvalidStateError, NotSupportedError } from '../errors';
|
|
5
5
|
import AudioBuffer from './AudioBuffer';
|
|
6
|
-
import {
|
|
6
|
+
import { isWorkletsAvailable, workletsModule } from '../utils';
|
|
7
7
|
|
|
8
8
|
export default class OfflineAudioContext extends BaseAudioContext {
|
|
9
9
|
private isSuspended: boolean;
|
|
@@ -18,7 +18,7 @@ export default class OfflineAudioContext extends BaseAudioContext {
|
|
|
18
18
|
arg2?: number
|
|
19
19
|
) {
|
|
20
20
|
let audioRuntime = null;
|
|
21
|
-
if (
|
|
21
|
+
if (isWorkletsAvailable) {
|
|
22
22
|
audioRuntime = workletsModule.createWorkletRuntime('AudioWorkletRuntime');
|
|
23
23
|
}
|
|
24
24
|
|
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,5 +1,5 @@
|
|
|
1
1
|
import { AudioEventCallback, AudioEventName } from './events/types';
|
|
2
|
-
import {
|
|
2
|
+
import type {
|
|
3
3
|
BiquadFilterType,
|
|
4
4
|
ChannelCountMode,
|
|
5
5
|
ChannelInterpretation,
|
|
@@ -250,14 +250,57 @@ export interface IWorkletSourceNode extends IAudioScheduledSourceNode {}
|
|
|
250
250
|
|
|
251
251
|
export interface IWorkletProcessingNode extends IAudioNode {}
|
|
252
252
|
|
|
253
|
+
type IOSAudioRecorderFileDescriptor = number;
|
|
254
|
+
type AndroidAudioRecorderFileDescriptor = number;
|
|
255
|
+
|
|
256
|
+
interface IAudioRecorderFileOptions {
|
|
257
|
+
sampleRate: number;
|
|
258
|
+
channels: number;
|
|
259
|
+
bitRate: number;
|
|
260
|
+
/**
|
|
261
|
+
* IOS specific file recording options
|
|
262
|
+
*
|
|
263
|
+
* - `format` - IOSFormat, bitmask 0 x 0000000F
|
|
264
|
+
* - `quality` - IOSAudioQuality, bitmask 0 x 000000F0
|
|
265
|
+
* - `flacCompressionLevel` - FlacCompressionLevel, bitmask 0 x 00000F00
|
|
266
|
+
* - `directory` - FileDirectory, bitmask 0 x 0000F000
|
|
267
|
+
* - `bitDepth` - BitDepth, bitmask 0 x 000F0000
|
|
268
|
+
*/
|
|
269
|
+
ios: IOSAudioRecorderFileDescriptor;
|
|
270
|
+
/**
|
|
271
|
+
* Android specific file recording options
|
|
272
|
+
*
|
|
273
|
+
* - He he
|
|
274
|
+
*/
|
|
275
|
+
android: AndroidAudioRecorderFileDescriptor;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
interface IAudioRecorderCallbackOptions {
|
|
279
|
+
sampleRate: number;
|
|
280
|
+
bufferLength: number;
|
|
281
|
+
channelCount: number;
|
|
282
|
+
callbackId: string;
|
|
283
|
+
}
|
|
284
|
+
|
|
253
285
|
export interface IAudioRecorder {
|
|
286
|
+
// default recorder methods
|
|
254
287
|
start: () => void;
|
|
255
|
-
stop: () => void;
|
|
288
|
+
stop: () => string | void;
|
|
289
|
+
isRecording: () => boolean;
|
|
290
|
+
|
|
291
|
+
enableFileOutput: (options: IAudioRecorderFileOptions) => void;
|
|
292
|
+
disableFileOutput: () => void;
|
|
293
|
+
|
|
294
|
+
// pause and resume methods for file recording
|
|
295
|
+
pause: () => void;
|
|
296
|
+
resume: () => void;
|
|
297
|
+
|
|
298
|
+
// Graph integration methods
|
|
256
299
|
connect: (node: IRecorderAdapterNode) => void;
|
|
257
300
|
disconnect: () => void;
|
|
258
301
|
|
|
259
|
-
|
|
260
|
-
|
|
302
|
+
setOnAudioReady: (options: IAudioRecorderCallbackOptions) => void;
|
|
303
|
+
clearOnAudioReady: () => void;
|
|
261
304
|
}
|
|
262
305
|
|
|
263
306
|
export interface IAudioDecoder {
|