react-native-audio-api 0.3.0-rc2 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RNAudioAPI.podspec +40 -29
- package/android/CMakeLists.txt +17 -21
- package/android/build.gradle +26 -9
- package/android/src/main/cpp/OnLoad.cpp +1 -1
- package/android/src/main/cpp/core/AudioAPIInstaller.cpp +37 -0
- package/android/src/main/cpp/{AudioAPIInstaller → core}/AudioAPIInstaller.h +5 -16
- package/android/src/main/cpp/{AudioDecoder → core}/AudioDecoder.cpp +0 -8
- package/android/src/main/java/com/swmansion/audioapi/AudioAPIPackage.kt +2 -0
- package/android/src/main/java/com/swmansion/audioapi/nativemodules/AudioAPIModule.kt +6 -4
- package/common/cpp/HostObjects/AudioAPIInstallerHostObject.h +48 -0
- package/common/cpp/HostObjects/AudioBufferHostObject.h +79 -13
- package/common/cpp/HostObjects/AudioBufferSourceNodeHostObject.h +93 -14
- package/common/cpp/HostObjects/AudioContextHostObject.h +10 -21
- package/common/cpp/HostObjects/AudioDestinationNodeHostObject.h +3 -16
- package/common/cpp/HostObjects/AudioNodeHostObject.h +48 -11
- package/common/cpp/HostObjects/AudioParamHostObject.h +93 -14
- package/common/cpp/HostObjects/AudioScheduledSourceNodeHostObject.h +23 -16
- package/common/cpp/HostObjects/BaseAudioContextHostObject.h +131 -14
- package/common/cpp/HostObjects/BiquadFilterNodeHostObject.h +76 -18
- package/common/cpp/HostObjects/GainNodeHostObject.h +10 -15
- package/common/cpp/HostObjects/OscillatorNodeHostObject.h +40 -17
- package/common/cpp/HostObjects/PeriodicWaveHostObject.h +4 -17
- package/common/cpp/HostObjects/StereoPannerNodeHostObject.h +10 -17
- package/common/cpp/core/AudioBufferSourceNode.cpp +181 -73
- package/common/cpp/core/AudioBufferSourceNode.h +41 -1
- package/{android/src/main/cpp/AudioDecoder → common/cpp/core}/AudioDecoder.h +1 -3
- package/common/cpp/core/AudioDestinationNode.h +1 -1
- package/common/cpp/core/AudioParam.cpp +218 -58
- package/common/cpp/core/AudioParam.h +19 -15
- package/common/cpp/core/AudioScheduledSourceNode.cpp +94 -21
- package/common/cpp/core/AudioScheduledSourceNode.h +16 -5
- package/common/cpp/core/BaseAudioContext.cpp +3 -13
- package/common/cpp/core/BaseAudioContext.h +2 -4
- package/common/cpp/core/BiquadFilterNode.cpp +5 -7
- package/common/cpp/{HostObjects → core}/Constants.h +2 -2
- package/common/cpp/core/GainNode.cpp +1 -1
- package/common/cpp/core/OscillatorNode.cpp +11 -5
- package/common/cpp/core/ParamChangeEvent.cpp +58 -0
- package/common/cpp/core/{ParamChange.h → ParamChangeEvent.h} +11 -5
- package/common/cpp/core/StereoPannerNode.cpp +1 -1
- package/common/cpp/jsi/JsiHostObject.cpp +90 -0
- package/common/cpp/jsi/JsiHostObject.h +100 -0
- package/common/cpp/{utils → jsi}/JsiPromise.cpp +10 -9
- package/common/cpp/jsi/JsiPromise.h +48 -0
- package/common/cpp/jsi/RuntimeAwareCache.h +57 -0
- package/common/cpp/jsi/RuntimeLifecycleMonitor.cpp +61 -0
- package/common/cpp/jsi/RuntimeLifecycleMonitor.h +32 -0
- package/common/cpp/types/BiquadFilterType.h +0 -4
- package/common/cpp/types/ChannelCountMode.h +0 -3
- package/common/cpp/types/ChannelInterpretation.h +0 -3
- package/common/cpp/types/ContextState.h +0 -3
- package/common/cpp/types/OscillatorType.h +0 -4
- package/common/cpp/types/ParamChangeEventType.h +13 -0
- package/common/cpp/utils/AudioUtils.cpp +26 -0
- package/common/cpp/utils/AudioUtils.h +12 -0
- package/common/cpp/utils/{ios/FFTFrame.cpp → FFTFrame.cpp} +30 -3
- package/common/cpp/utils/VectorMath.h +7 -33
- package/ios/AudioAPIModule.h +4 -12
- package/ios/AudioAPIModule.mm +26 -25
- package/ios/core/AudioDecoder.mm +45 -0
- package/ios/{AudioPlayer → core}/AudioPlayer.m +2 -1
- package/lib/module/core/AudioBuffer.js +3 -1
- package/lib/module/core/AudioBuffer.js.map +1 -1
- package/lib/module/core/AudioBufferSourceNode.js +19 -2
- package/lib/module/core/AudioBufferSourceNode.js.map +1 -1
- package/lib/module/core/AudioContext.js +3 -1
- package/lib/module/core/AudioContext.js.map +1 -1
- package/lib/module/core/AudioDestinationNode.js +4 -6
- package/lib/module/core/AudioDestinationNode.js.map +1 -1
- package/lib/module/core/AudioNode.js +3 -1
- package/lib/module/core/AudioNode.js.map +1 -1
- package/lib/module/core/AudioParam.js +27 -1
- package/lib/module/core/AudioParam.js.map +1 -1
- package/lib/module/core/AudioScheduledSourceNode.js +4 -5
- package/lib/module/core/AudioScheduledSourceNode.js.map +1 -1
- package/lib/module/core/BaseAudioContext.js +11 -9
- package/lib/module/core/BaseAudioContext.js.map +1 -1
- package/lib/module/core/BiquadFilterNode.js +5 -3
- package/lib/module/core/BiquadFilterNode.js.map +1 -1
- package/lib/module/core/GainNode.js +4 -2
- package/lib/module/core/GainNode.js.map +1 -1
- package/lib/module/core/OscillatorNode.js +5 -3
- package/lib/module/core/OscillatorNode.js.map +1 -1
- package/lib/module/core/PeriodicWave.js +2 -0
- package/lib/module/core/PeriodicWave.js.map +1 -1
- package/lib/module/core/StereoPannerNode.js +4 -2
- package/lib/module/core/StereoPannerNode.js.map +1 -1
- package/lib/module/core/types.js +1 -1
- package/lib/module/errors/IndexSizeError.js +2 -0
- package/lib/module/errors/IndexSizeError.js.map +1 -1
- package/lib/module/errors/InvalidAccessError.js +2 -0
- package/lib/module/errors/InvalidAccessError.js.map +1 -1
- package/lib/module/errors/InvalidStateError.js +2 -0
- package/lib/module/errors/InvalidStateError.js.map +1 -1
- package/lib/module/errors/RangeError.js +2 -0
- package/lib/module/errors/RangeError.js.map +1 -1
- package/lib/module/errors/index.js +6 -4
- package/lib/module/errors/index.js.map +1 -1
- package/lib/module/index.js +35 -10
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.native.js +16 -14
- package/lib/module/index.native.js.map +1 -1
- package/lib/module/interfaces.js +2 -0
- package/lib/module/specs/global.d.js +4 -0
- package/lib/module/{modules → specs}/global.d.js.map +1 -1
- package/lib/module/{utils → specs}/install.js +5 -9
- package/lib/module/specs/install.js.map +1 -0
- package/lib/typescript/core/AudioBuffer.d.ts +2 -0
- package/lib/typescript/core/AudioBuffer.d.ts.map +1 -1
- package/lib/typescript/core/AudioBufferSourceNode.d.ts +7 -0
- package/lib/typescript/core/AudioBufferSourceNode.d.ts.map +1 -1
- package/lib/typescript/core/AudioDestinationNode.d.ts +0 -3
- package/lib/typescript/core/AudioDestinationNode.d.ts.map +1 -1
- package/lib/typescript/core/AudioParam.d.ts +4 -0
- package/lib/typescript/core/AudioParam.d.ts.map +1 -1
- package/lib/typescript/core/AudioScheduledSourceNode.d.ts +0 -3
- package/lib/typescript/core/AudioScheduledSourceNode.d.ts.map +1 -1
- package/lib/typescript/core/PeriodicWave.d.ts +2 -0
- package/lib/typescript/core/PeriodicWave.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +13 -3
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/interfaces.d.ts +8 -0
- package/lib/typescript/interfaces.d.ts.map +1 -1
- package/lib/typescript/{utils → specs}/install.d.ts.map +1 -1
- package/metro-config/index.d.ts +5 -0
- package/metro-config/index.js +41 -0
- package/metro-config/tsconfig.json +3 -0
- package/package.json +50 -16
- package/scripts/audioapi_utils.rb +56 -0
- package/src/core/AudioBufferSourceNode.ts +23 -0
- package/src/core/AudioDestinationNode.ts +1 -7
- package/src/core/AudioParam.ts +48 -0
- package/src/core/AudioScheduledSourceNode.ts +0 -5
- package/src/index.native.ts +1 -1
- package/src/index.ts +54 -13
- package/src/interfaces.ts +17 -0
- package/src/{modules → specs}/global.d.ts +2 -0
- package/src/{utils → specs}/install.ts +4 -11
- package/android/src/main/cpp/AudioAPIInstaller/AudioAPIInstaller.cpp +0 -26
- package/common/cpp/AudioAPIInstaller/AudioAPIInstallerHostObject.cpp +0 -58
- package/common/cpp/AudioAPIInstaller/AudioAPIInstallerHostObject.h +0 -51
- package/common/cpp/AudioAPIInstaller/AudioAPIInstallerWrapper.h +0 -38
- package/common/cpp/AudioAPIInstaller/android/AudioAPIInstallerWrapper.cpp +0 -16
- package/common/cpp/AudioAPIInstaller/ios/AudioAPIInstallerWrapper.cpp +0 -12
- package/common/cpp/HostObjects/AudioBufferHostObject.cpp +0 -150
- package/common/cpp/HostObjects/AudioBufferSourceNodeHostObject.cpp +0 -79
- package/common/cpp/HostObjects/AudioContextHostObject.cpp +0 -55
- package/common/cpp/HostObjects/AudioDestinationNodeHostObject.cpp +0 -33
- package/common/cpp/HostObjects/AudioNodeHostObject.cpp +0 -102
- package/common/cpp/HostObjects/AudioParamHostObject.cpp +0 -115
- package/common/cpp/HostObjects/AudioScheduledSourceNodeHostObject.cpp +0 -73
- package/common/cpp/HostObjects/BaseAudioContextHostObject.cpp +0 -250
- package/common/cpp/HostObjects/BiquadFilterNodeHostObject.cpp +0 -125
- package/common/cpp/HostObjects/GainNodeHostObject.cpp +0 -41
- package/common/cpp/HostObjects/OscillatorNodeHostObject.cpp +0 -88
- package/common/cpp/HostObjects/PeriodicWaveHostObject.cpp +0 -33
- package/common/cpp/HostObjects/StereoPannerNodeHostObject.cpp +0 -41
- package/common/cpp/core/ParamChange.cpp +0 -46
- package/common/cpp/utils/JsiPromise.h +0 -48
- package/common/cpp/utils/android/FFTFrame.cpp +0 -23
- package/common/cpp/wrappers/AudioBufferSourceNodeWrapper.cpp +0 -45
- package/common/cpp/wrappers/AudioBufferSourceNodeWrapper.h +0 -26
- package/common/cpp/wrappers/AudioBufferWrapper.cpp +0 -46
- package/common/cpp/wrappers/AudioBufferWrapper.h +0 -30
- package/common/cpp/wrappers/AudioContextWrapper.cpp +0 -17
- package/common/cpp/wrappers/AudioContextWrapper.h +0 -19
- package/common/cpp/wrappers/AudioDestinationNodeWrapper.h +0 -16
- package/common/cpp/wrappers/AudioNodeWrapper.cpp +0 -37
- package/common/cpp/wrappers/AudioNodeWrapper.h +0 -25
- package/common/cpp/wrappers/AudioParamWrapper.cpp +0 -42
- package/common/cpp/wrappers/AudioParamWrapper.h +0 -25
- package/common/cpp/wrappers/AudioScheduledSourceNodeWrapper.cpp +0 -23
- package/common/cpp/wrappers/AudioScheduledSourceNodeWrapper.h +0 -23
- package/common/cpp/wrappers/BaseAudioContextWrapper.cpp +0 -83
- package/common/cpp/wrappers/BaseAudioContextWrapper.h +0 -51
- package/common/cpp/wrappers/BiquadFilterNodeWrapper.cpp +0 -60
- package/common/cpp/wrappers/BiquadFilterNodeWrapper.h +0 -37
- package/common/cpp/wrappers/GainNodeWrapper.cpp +0 -14
- package/common/cpp/wrappers/GainNodeWrapper.h +0 -20
- package/common/cpp/wrappers/OscillatorNodeWrapper.cpp +0 -44
- package/common/cpp/wrappers/OscillatorNodeWrapper.h +0 -31
- package/common/cpp/wrappers/PeriodicWaveWrapper.h +0 -17
- package/common/cpp/wrappers/StereoPannerNodeWrapper.cpp +0 -16
- package/common/cpp/wrappers/StereoPannerNodeWrapper.h +0 -21
- package/ios/AudioDecoder/AudioDecoder.h +0 -17
- package/ios/AudioDecoder/AudioDecoder.m +0 -80
- package/ios/AudioDecoder/IOSAudioDecoder.h +0 -28
- package/ios/AudioDecoder/IOSAudioDecoder.mm +0 -46
- package/lib/module/modules/global.d.js +0 -2
- package/lib/module/utils/install.js.map +0 -1
- /package/android/src/main/cpp/{AudioPlayer → core}/AudioPlayer.cpp +0 -0
- /package/android/src/main/cpp/{AudioPlayer → core}/AudioPlayer.h +0 -0
- /package/{android/libs/include → common/cpp/libs}/miniaudio.h +0 -0
- /package/ios/{AudioPlayer → core}/AudioPlayer.h +0 -0
- /package/ios/{AudioPlayer → core}/IOSAudioPlayer.h +0 -0
- /package/ios/{AudioPlayer → core}/IOSAudioPlayer.mm +0 -0
- /package/lib/typescript/{utils → specs}/install.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-audio-api",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "react-native-audio-api provides system for controlling audio in React Native environment compatible with Web Audio API specification",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -11,20 +11,27 @@
|
|
|
11
11
|
"src/",
|
|
12
12
|
"lib/",
|
|
13
13
|
"common/",
|
|
14
|
-
"android",
|
|
14
|
+
"android/src/main/AndroidManifest.xml",
|
|
15
|
+
"android/src/main/java/",
|
|
16
|
+
"android/build.gradle",
|
|
17
|
+
"android/",
|
|
15
18
|
"ios",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
19
|
+
"RNAudioAPI.podspec",
|
|
20
|
+
"scripts/audioapi_utils.rb",
|
|
21
|
+
"metro-config",
|
|
18
22
|
"!ios/build",
|
|
19
23
|
"!android/build",
|
|
20
24
|
"!android/gradle",
|
|
21
25
|
"!android/gradlew",
|
|
22
26
|
"!android/gradlew.bat",
|
|
23
27
|
"!android/local.properties",
|
|
28
|
+
"!android/.cxx/",
|
|
29
|
+
"!android/.gradle/",
|
|
24
30
|
"!**/__tests__",
|
|
25
31
|
"!**/__fixtures__",
|
|
26
32
|
"!**/__mocks__",
|
|
27
|
-
"!**/.*"
|
|
33
|
+
"!**/.*",
|
|
34
|
+
"!**/node_modules"
|
|
28
35
|
],
|
|
29
36
|
"scripts": {
|
|
30
37
|
"test": "jest",
|
|
@@ -36,7 +43,7 @@
|
|
|
36
43
|
"lint:kotlin": "ktlint 'android/src/main/java/**'",
|
|
37
44
|
"format:android": "find android/src/ -iname \"*.h\" -o -iname \"*.cpp\" | xargs clang-format -i",
|
|
38
45
|
"format:ios": "find ios/ -iname \"*.h\" -o -iname \"*.m\" -o -iname \"*.mm\" -o -iname \"*.cpp\" | xargs clang-format -i --Werror",
|
|
39
|
-
"format:common": "find common/cpp/ -iname \"*.h\" -o -iname \"*.cpp\" | xargs clang-format -i",
|
|
46
|
+
"format:common": "find common/cpp/ -path 'common/cpp/libs' -prune -iname \"*.h\" -o -iname \"*.cpp\" | xargs clang-format -i",
|
|
40
47
|
"format:kotlin": "ktlint -F 'android/src/main/java/**'",
|
|
41
48
|
"build": "bob build",
|
|
42
49
|
"prepack": "cp ../../README.md ./README.md",
|
|
@@ -67,24 +74,48 @@
|
|
|
67
74
|
"react-native": "*"
|
|
68
75
|
},
|
|
69
76
|
"devDependencies": {
|
|
77
|
+
"@babel/cli": "^7.20.0",
|
|
78
|
+
"@babel/core": "^7.25.2",
|
|
79
|
+
"@babel/preset-env": "^7.25.3",
|
|
80
|
+
"@babel/types": "^7.20.0",
|
|
70
81
|
"@commitlint/config-conventional": "^17.0.2",
|
|
71
82
|
"@evilmartians/lefthook": "^1.5.0",
|
|
72
|
-
"@react-native/
|
|
83
|
+
"@react-native/babel-preset": "0.76.5",
|
|
84
|
+
"@react-native/eslint-config": "^0.76.5",
|
|
85
|
+
"@react-native/metro-config": "0.76.5",
|
|
86
|
+
"@react-native/typescript-config": "0.76.5",
|
|
87
|
+
"@types/babel__core": "^7.20.0",
|
|
88
|
+
"@types/babel__generator": "^7.6.4",
|
|
89
|
+
"@types/babel__traverse": "^7.14.2",
|
|
90
|
+
"@types/convert-source-map": "^2.0.0",
|
|
73
91
|
"@types/jest": "^29.5.5",
|
|
92
|
+
"@types/node": "^18.0.0",
|
|
74
93
|
"@types/react": "^18.2.44",
|
|
94
|
+
"@types/react-test-renderer": "^17.0.0-0",
|
|
95
|
+
"babel-plugin-module-resolver": "^4.1.0",
|
|
75
96
|
"commitlint": "^17.0.2",
|
|
76
97
|
"del-cli": "^5.1.0",
|
|
77
|
-
"eslint": "^8.
|
|
78
|
-
"eslint-config-prettier": "^
|
|
98
|
+
"eslint": "^8.57.0",
|
|
99
|
+
"eslint-config-prettier": "^8.3.0",
|
|
100
|
+
"eslint-config-standard": "^17.1.0",
|
|
101
|
+
"eslint-import-resolver-babel-module": "^5.3.1",
|
|
102
|
+
"eslint-plugin-import": "^2.25.4",
|
|
103
|
+
"eslint-plugin-jest": "^27.2.1",
|
|
104
|
+
"eslint-plugin-n": "^16.4.0",
|
|
105
|
+
"eslint-plugin-no-inline-styles": "^1.0.5",
|
|
79
106
|
"eslint-plugin-prettier": "^5.0.1",
|
|
107
|
+
"eslint-plugin-promise": "^6.0.0",
|
|
80
108
|
"eslint-plugin-react": "^7.34.3",
|
|
109
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
110
|
+
"eslint-plugin-standard": "^5.0.0",
|
|
111
|
+
"eslint-plugin-tsdoc": "^0.2.17",
|
|
81
112
|
"jest": "^29.7.0",
|
|
82
|
-
"prettier": "^3.
|
|
83
|
-
"react": "18.
|
|
84
|
-
"react-native": "0.
|
|
85
|
-
"react-native-builder-bob": "
|
|
113
|
+
"prettier": "^3.3.3",
|
|
114
|
+
"react": "18.3.1",
|
|
115
|
+
"react-native": "0.76.5",
|
|
116
|
+
"react-native-builder-bob": "0.33.1",
|
|
86
117
|
"turbo": "^1.10.7",
|
|
87
|
-
"typescript": "
|
|
118
|
+
"typescript": "~5.3.0"
|
|
88
119
|
},
|
|
89
120
|
"react-native-builder-bob": {
|
|
90
121
|
"source": "src",
|
|
@@ -100,9 +131,12 @@
|
|
|
100
131
|
]
|
|
101
132
|
},
|
|
102
133
|
"codegenConfig": {
|
|
103
|
-
"name": "
|
|
134
|
+
"name": "rnaudioapi",
|
|
104
135
|
"type": "modules",
|
|
105
|
-
"jsSrcsDir": "src"
|
|
136
|
+
"jsSrcsDir": "src/specs",
|
|
137
|
+
"android": {
|
|
138
|
+
"javaPackageName": "com.swmansion.audioapi"
|
|
139
|
+
}
|
|
106
140
|
},
|
|
107
141
|
"create-react-native-library": {
|
|
108
142
|
"type": "module-legacy",
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
def try_to_parse_react_native_package_json(node_modules_dir)
|
|
2
|
+
react_native_package_json_path = File.join(node_modules_dir, 'react-native/package.json')
|
|
3
|
+
if !File.exist?(react_native_package_json_path)
|
|
4
|
+
return nil
|
|
5
|
+
end
|
|
6
|
+
return JSON.parse(File.read(react_native_package_json_path))
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def find_config()
|
|
10
|
+
result = {
|
|
11
|
+
:react_native_version => nil,
|
|
12
|
+
:react_native_minor_version => nil,
|
|
13
|
+
:react_native_node_modules_dir => nil,
|
|
14
|
+
:react_native_common_dir => nil,
|
|
15
|
+
:react_native_audioapi_dir_from_pods_root => nil,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
react_native_node_modules_dir = File.join(File.dirname(`cd "#{Pod::Config.instance.installation_root.to_s}" && node --print "require.resolve('react-native/package.json')"`), '..')
|
|
19
|
+
react_native_json = try_to_parse_react_native_package_json(react_native_node_modules_dir)
|
|
20
|
+
|
|
21
|
+
if react_native_json == nil
|
|
22
|
+
# user configuration, just in case
|
|
23
|
+
node_modules_dir = ENV["REACT_NATIVE_NODE_MODULES_DIR"]
|
|
24
|
+
react_native_json = try_to_parse_react_native_package_json(node_modules_dir)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
if react_native_json == nil
|
|
28
|
+
raise '[Audio API] Unable to recognize your `react-native` version. Please set environmental variable with `react-native` location: `export REACT_NATIVE_NODE_MODULES_DIR="<path to react-native>" && pod install`.'
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
result[:react_native_version] = react_native_json['version']
|
|
32
|
+
result[:react_native_minor_version] = react_native_json['version'].split('.')[1].to_i
|
|
33
|
+
if result[:react_native_minor_version] == 0 # nightly
|
|
34
|
+
result[:react_native_minor_version] = 1000
|
|
35
|
+
end
|
|
36
|
+
result[:react_native_node_modules_dir] = File.expand_path(react_native_node_modules_dir)
|
|
37
|
+
|
|
38
|
+
pods_root = Pod::Config.instance.project_pods_root
|
|
39
|
+
react_native_common_dir_absolute = File.join(react_native_node_modules_dir, 'react-native', 'ReactCommon')
|
|
40
|
+
react_native_common_dir_relative = Pathname.new(react_native_common_dir_absolute).relative_path_from(pods_root).to_s
|
|
41
|
+
result[:react_native_common_dir] = react_native_common_dir_relative
|
|
42
|
+
|
|
43
|
+
react_native_audioapi_dir_absolute = File.join(__dir__, '..')
|
|
44
|
+
react_native_audioapi_dir_relative = Pathname.new(react_native_audioapi_dir_absolute).relative_path_from(pods_root).to_s
|
|
45
|
+
result[:react_native_audioapi_dir_from_pods_root] = react_native_audioapi_dir_relative
|
|
46
|
+
|
|
47
|
+
return result
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def assert_minimal_react_native_version(config)
|
|
51
|
+
# If you change the minimal React Native version remember to update Compatibility Table in docs
|
|
52
|
+
minimalReactNativeVersion = 75
|
|
53
|
+
if config[:react_native_minor_version] < minimalReactNativeVersion
|
|
54
|
+
raise "[Audio API] Unsupported React Native version. Please use #{minimalReactNativeVersion} or newer."
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -2,10 +2,17 @@ import { IAudioBufferSourceNode } from '../interfaces';
|
|
|
2
2
|
import AudioScheduledSourceNode from './AudioScheduledSourceNode';
|
|
3
3
|
import BaseAudioContext from './BaseAudioContext';
|
|
4
4
|
import AudioBuffer from './AudioBuffer';
|
|
5
|
+
import AudioParam from './AudioParam';
|
|
5
6
|
|
|
6
7
|
export default class AudioBufferSourceNode extends AudioScheduledSourceNode {
|
|
8
|
+
readonly playbackRate: AudioParam;
|
|
9
|
+
readonly detune: AudioParam;
|
|
10
|
+
|
|
7
11
|
constructor(context: BaseAudioContext, node: IAudioBufferSourceNode) {
|
|
8
12
|
super(context, node);
|
|
13
|
+
|
|
14
|
+
this.detune = new AudioParam(node.detune);
|
|
15
|
+
this.playbackRate = new AudioParam(node.playbackRate);
|
|
9
16
|
}
|
|
10
17
|
|
|
11
18
|
public get buffer(): AudioBuffer | null {
|
|
@@ -32,4 +39,20 @@ export default class AudioBufferSourceNode extends AudioScheduledSourceNode {
|
|
|
32
39
|
public set loop(value: boolean) {
|
|
33
40
|
(this.node as IAudioBufferSourceNode).loop = value;
|
|
34
41
|
}
|
|
42
|
+
|
|
43
|
+
public get loopStart(): number {
|
|
44
|
+
return (this.node as IAudioBufferSourceNode).loopStart;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public set loopStart(value: number) {
|
|
48
|
+
(this.node as IAudioBufferSourceNode).loopStart = value;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public get loopEnd(): number {
|
|
52
|
+
return (this.node as IAudioBufferSourceNode).loopEnd;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public set loopEnd(value: number) {
|
|
56
|
+
(this.node as IAudioBufferSourceNode).loopEnd = value;
|
|
57
|
+
}
|
|
35
58
|
}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { IAudioDestinationNode } from '../interfaces';
|
|
2
1
|
import AudioNode from './AudioNode';
|
|
3
|
-
import BaseAudioContext from './BaseAudioContext';
|
|
4
2
|
|
|
5
|
-
export default class AudioDestinationNode extends AudioNode {
|
|
6
|
-
constructor(context: BaseAudioContext, destination: IAudioDestinationNode) {
|
|
7
|
-
super(context, destination);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
3
|
+
export default class AudioDestinationNode extends AudioNode {}
|
package/src/core/AudioParam.ts
CHANGED
|
@@ -52,4 +52,52 @@ export default class AudioParam {
|
|
|
52
52
|
|
|
53
53
|
this.audioParam.exponentialRampToValueAtTime(value, endTime);
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
public setTargetAtTime(
|
|
57
|
+
target: number,
|
|
58
|
+
startTime: number,
|
|
59
|
+
timeConstant: number
|
|
60
|
+
): void {
|
|
61
|
+
if (startTime < 0) {
|
|
62
|
+
throw new RangeError(
|
|
63
|
+
`Time must be a finite non-negative number: ${startTime}`
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
this.audioParam.setTargetAtTime(target, startTime, timeConstant);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public setValueCurveAtTime(
|
|
71
|
+
values: number[],
|
|
72
|
+
startTime: number,
|
|
73
|
+
duration: number
|
|
74
|
+
): void {
|
|
75
|
+
if (startTime < 0) {
|
|
76
|
+
throw new RangeError(
|
|
77
|
+
`Time must be a finite non-negative number: ${startTime}`
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
this.audioParam.setValueCurveAtTime(values, startTime, duration);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public cancelScheduledValues(cancelTime: number): void {
|
|
85
|
+
if (cancelTime < 0) {
|
|
86
|
+
throw new RangeError(
|
|
87
|
+
`Time must be a finite non-negative number: ${cancelTime}`
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
this.audioParam.cancelScheduledValues(cancelTime);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
public cancelAndHoldAtTime(cancelTime: number): void {
|
|
95
|
+
if (cancelTime < 0) {
|
|
96
|
+
throw new RangeError(
|
|
97
|
+
`Time must be a finite non-negative number: ${cancelTime}`
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
this.audioParam.cancelAndHoldAtTime(cancelTime);
|
|
102
|
+
}
|
|
55
103
|
}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import { IAudioScheduledSourceNode } from '../interfaces';
|
|
2
2
|
import AudioNode from './AudioNode';
|
|
3
|
-
import BaseAudioContext from './BaseAudioContext';
|
|
4
3
|
import { InvalidStateError, RangeError } from '../errors';
|
|
5
4
|
|
|
6
5
|
export default class AudioScheduledSourceNode extends AudioNode {
|
|
7
6
|
private hasBeenStarted: boolean = false;
|
|
8
7
|
|
|
9
|
-
constructor(context: BaseAudioContext, node: IAudioScheduledSourceNode) {
|
|
10
|
-
super(context, node);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
8
|
public start(when: number = 0): void {
|
|
14
9
|
if (when < 0) {
|
|
15
10
|
throw new RangeError(
|
package/src/index.native.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ export class AudioBuffer {
|
|
|
6
6
|
readonly sampleRate: number;
|
|
7
7
|
readonly numberOfChannels: number;
|
|
8
8
|
|
|
9
|
+
/** @internal */
|
|
9
10
|
public readonly buffer: globalThis.AudioBuffer;
|
|
10
11
|
|
|
11
12
|
constructor(buffer: globalThis.AudioBuffer) {
|
|
@@ -112,13 +113,6 @@ export class AudioNode {
|
|
|
112
113
|
export class AudioScheduledSourceNode extends AudioNode {
|
|
113
114
|
private hasBeenStarted: boolean = false;
|
|
114
115
|
|
|
115
|
-
constructor(
|
|
116
|
-
context: AudioContext,
|
|
117
|
-
node: globalThis.AudioScheduledSourceNode
|
|
118
|
-
) {
|
|
119
|
-
super(context, node);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
116
|
public start(when: number = 0): void {
|
|
123
117
|
if (when < 0) {
|
|
124
118
|
throw new RangeError(
|
|
@@ -150,8 +144,14 @@ export class AudioScheduledSourceNode extends AudioNode {
|
|
|
150
144
|
}
|
|
151
145
|
|
|
152
146
|
export class AudioBufferSourceNode extends AudioScheduledSourceNode {
|
|
147
|
+
readonly playbackRate: AudioParam;
|
|
148
|
+
readonly detune: AudioParam;
|
|
149
|
+
|
|
153
150
|
constructor(context: AudioContext, node: globalThis.AudioBufferSourceNode) {
|
|
154
151
|
super(context, node);
|
|
152
|
+
|
|
153
|
+
this.detune = new AudioParam(node.detune);
|
|
154
|
+
this.playbackRate = new AudioParam(node.playbackRate);
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
public get buffer(): AudioBuffer | null {
|
|
@@ -180,14 +180,26 @@ export class AudioBufferSourceNode extends AudioScheduledSourceNode {
|
|
|
180
180
|
public set loop(value: boolean) {
|
|
181
181
|
(this.node as globalThis.AudioBufferSourceNode).loop = value;
|
|
182
182
|
}
|
|
183
|
-
}
|
|
184
183
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
184
|
+
public get loopStart(): number {
|
|
185
|
+
return (this.node as globalThis.AudioBufferSourceNode).loopStart;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
public set loopStart(value: number) {
|
|
189
|
+
(this.node as globalThis.AudioBufferSourceNode).loopStart = value;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
public get loopEnd(): number {
|
|
193
|
+
return (this.node as globalThis.AudioBufferSourceNode).loopEnd;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
public set loopEnd(value: number) {
|
|
197
|
+
(this.node as globalThis.AudioBufferSourceNode).loopEnd = value;
|
|
188
198
|
}
|
|
189
199
|
}
|
|
190
200
|
|
|
201
|
+
export class AudioDestinationNode extends AudioNode {}
|
|
202
|
+
|
|
191
203
|
export class AudioParam {
|
|
192
204
|
readonly defaultValue: number;
|
|
193
205
|
readonly minValue: number;
|
|
@@ -221,6 +233,34 @@ export class AudioParam {
|
|
|
221
233
|
public exponentialRampToValueAtTime(value: number, endTime: number): void {
|
|
222
234
|
this.param.exponentialRampToValueAtTime(value, endTime);
|
|
223
235
|
}
|
|
236
|
+
|
|
237
|
+
public setTargetAtTime(
|
|
238
|
+
target: number,
|
|
239
|
+
startTime: number,
|
|
240
|
+
timeConstant: number
|
|
241
|
+
): void {
|
|
242
|
+
this.param.setTargetAtTime(target, startTime, timeConstant);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
public setValueCurveAtTime(
|
|
246
|
+
values: number[],
|
|
247
|
+
startTime: number,
|
|
248
|
+
duration: number
|
|
249
|
+
): void {
|
|
250
|
+
this.param.setValueCurveAtTime(
|
|
251
|
+
new Float32Array(values),
|
|
252
|
+
startTime,
|
|
253
|
+
duration
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
public cancelScheduledValues(startTime: number): void {
|
|
258
|
+
this.param.cancelScheduledValues(startTime);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
public cancelAndHoldAtTime(cancelTime: number): void {
|
|
262
|
+
this.param.cancelAndHoldAtTime(cancelTime);
|
|
263
|
+
}
|
|
224
264
|
}
|
|
225
265
|
|
|
226
266
|
export class BiquadFilterNode extends AudioNode {
|
|
@@ -271,6 +311,7 @@ export class BiquadFilterNode extends AudioNode {
|
|
|
271
311
|
}
|
|
272
312
|
|
|
273
313
|
export class PeriodicWave {
|
|
314
|
+
/** @internal */
|
|
274
315
|
readonly periodicWave: globalThis.PeriodicWave;
|
|
275
316
|
|
|
276
317
|
constructor(periodicWave: globalThis.PeriodicWave) {
|
|
@@ -395,8 +436,8 @@ export class AudioContext {
|
|
|
395
436
|
return new AudioBuffer(await this.context.decodeAudioData(arrayBuffer));
|
|
396
437
|
}
|
|
397
438
|
|
|
398
|
-
close(): void {
|
|
399
|
-
this.context.close();
|
|
439
|
+
async close(): Promise<void> {
|
|
440
|
+
await this.context.close();
|
|
400
441
|
}
|
|
401
442
|
}
|
|
402
443
|
|
package/src/interfaces.ts
CHANGED
|
@@ -86,6 +86,11 @@ export interface IOscillatorNode extends IAudioScheduledSourceNode {
|
|
|
86
86
|
export interface IAudioBufferSourceNode extends IAudioScheduledSourceNode {
|
|
87
87
|
buffer: IAudioBuffer | null;
|
|
88
88
|
loop: boolean;
|
|
89
|
+
loopStart: number;
|
|
90
|
+
loopEnd: number;
|
|
91
|
+
|
|
92
|
+
detune: IAudioParam;
|
|
93
|
+
playbackRate: IAudioParam;
|
|
89
94
|
}
|
|
90
95
|
|
|
91
96
|
export interface IAudioBuffer {
|
|
@@ -116,6 +121,18 @@ export interface IAudioParam {
|
|
|
116
121
|
setValueAtTime: (value: number, startTime: number) => void;
|
|
117
122
|
linearRampToValueAtTime: (value: number, endTime: number) => void;
|
|
118
123
|
exponentialRampToValueAtTime: (value: number, endTime: number) => void;
|
|
124
|
+
setTargetAtTime: (
|
|
125
|
+
target: number,
|
|
126
|
+
startTime: number,
|
|
127
|
+
timeConstant: number
|
|
128
|
+
) => void;
|
|
129
|
+
setValueCurveAtTime: (
|
|
130
|
+
values: number[],
|
|
131
|
+
startTime: number,
|
|
132
|
+
duration: number
|
|
133
|
+
) => void;
|
|
134
|
+
cancelScheduledValues: (cancelTime: number) => void;
|
|
135
|
+
cancelAndHoldAtTime: (cancelTime: number) => void;
|
|
119
136
|
}
|
|
120
137
|
|
|
121
138
|
export interface IPeriodicWave {}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable no-var */
|
|
1
2
|
import type { IAudioContext } from '../interfaces';
|
|
2
3
|
|
|
3
4
|
type AudioAPIInstaller = {
|
|
@@ -8,3 +9,4 @@ declare global {
|
|
|
8
9
|
function nativeCallSyncHook(): unknown;
|
|
9
10
|
var __AudioAPIInstaller: AudioAPIInstaller;
|
|
10
11
|
}
|
|
12
|
+
/* eslint-disable no-var */
|
|
@@ -6,7 +6,7 @@ interface AudioAPIModuleSpec extends TurboModule {
|
|
|
6
6
|
|
|
7
7
|
export function installModule() {
|
|
8
8
|
const AudioAPIModule =
|
|
9
|
-
TurboModuleRegistry.
|
|
9
|
+
TurboModuleRegistry.get<AudioAPIModuleSpec>('AudioAPIModule');
|
|
10
10
|
|
|
11
11
|
if (AudioAPIModule == null) {
|
|
12
12
|
throw new Error(
|
|
@@ -14,26 +14,19 @@ export function installModule() {
|
|
|
14
14
|
);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
verifyInstallation();
|
|
19
|
-
|
|
20
|
-
return AudioAPIModule;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function runInstall(Module: any) {
|
|
24
|
-
const result = Module.install();
|
|
17
|
+
const result = AudioAPIModule.install();
|
|
25
18
|
|
|
26
19
|
if (result !== true) {
|
|
27
20
|
throw new Error(
|
|
28
21
|
`Failed to install react-native-audio-api: The native Audio API Module could not be installed! Looks like something went wrong when installing JSI bindings: ${result}`
|
|
29
22
|
);
|
|
30
23
|
}
|
|
31
|
-
}
|
|
32
24
|
|
|
33
|
-
function verifyInstallation() {
|
|
34
25
|
if (global.__AudioAPIInstaller == null) {
|
|
35
26
|
throw new Error(
|
|
36
27
|
'Failed to install react-native-audio-api, the native initializer private does not exist. Are you trying to use Audio API from different JS Runtimes?'
|
|
37
28
|
);
|
|
38
29
|
}
|
|
30
|
+
|
|
31
|
+
return AudioAPIModule;
|
|
39
32
|
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
#include "AudioAPIInstaller.h"
|
|
2
|
-
|
|
3
|
-
namespace audioapi {
|
|
4
|
-
|
|
5
|
-
using namespace facebook::jni;
|
|
6
|
-
|
|
7
|
-
AudioAPIInstaller::AudioAPIInstaller(
|
|
8
|
-
jni::alias_ref<AudioAPIInstaller::jhybridobject> &jThis,
|
|
9
|
-
jsi::Runtime *rnRuntime,
|
|
10
|
-
const std::shared_ptr<facebook::react::CallInvoker> &jsCallInvoker)
|
|
11
|
-
: javaPart_(make_global(jThis)),
|
|
12
|
-
rnRuntime_(rnRuntime),
|
|
13
|
-
jsCallInvoker_(jsCallInvoker) {}
|
|
14
|
-
|
|
15
|
-
void AudioAPIInstaller::install() {
|
|
16
|
-
auto audioAPIInstallerWrapper =
|
|
17
|
-
std::make_shared<AudioAPIInstallerWrapper>(this);
|
|
18
|
-
AudioAPIInstallerHostObject::createAndInstallFromWrapper(
|
|
19
|
-
audioAPIInstallerWrapper, rnRuntime_, jsCallInvoker_);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
std::shared_ptr<AudioContext> AudioAPIInstaller::createAudioContext() {
|
|
23
|
-
return std::make_shared<AudioContext>();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
} // namespace audioapi
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
#include "AudioAPIInstallerHostObject.h"
|
|
2
|
-
|
|
3
|
-
namespace audioapi {
|
|
4
|
-
using namespace facebook;
|
|
5
|
-
|
|
6
|
-
AudioAPIInstallerHostObject::AudioAPIInstallerHostObject(
|
|
7
|
-
const std::shared_ptr<AudioAPIInstallerWrapper> &wrapper,
|
|
8
|
-
jsi::Runtime *runtime,
|
|
9
|
-
const std::shared_ptr<facebook::react::CallInvoker> &jsInvoker)
|
|
10
|
-
: wrapper_(wrapper) {
|
|
11
|
-
promiseVendor_ =
|
|
12
|
-
std::make_shared<JsiPromise::PromiseVendor>(runtime, jsInvoker);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
std::vector<jsi::PropNameID> AudioAPIInstallerHostObject::getPropertyNames(
|
|
16
|
-
jsi::Runtime &runtime) {
|
|
17
|
-
std::vector<jsi::PropNameID> propertyNames;
|
|
18
|
-
propertyNames.push_back(
|
|
19
|
-
jsi::PropNameID::forUtf8(runtime, "createAudioContext"));
|
|
20
|
-
return propertyNames;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
jsi::Value AudioAPIInstallerHostObject::get(
|
|
24
|
-
jsi::Runtime &runtime,
|
|
25
|
-
const jsi::PropNameID &propNameId) {
|
|
26
|
-
auto propName = propNameId.utf8(runtime);
|
|
27
|
-
|
|
28
|
-
if (propName == "createAudioContext") {
|
|
29
|
-
return jsi::Function::createFromHostFunction(
|
|
30
|
-
runtime,
|
|
31
|
-
propNameId,
|
|
32
|
-
0,
|
|
33
|
-
[this](
|
|
34
|
-
jsi::Runtime &runtime,
|
|
35
|
-
const jsi::Value &thisValue,
|
|
36
|
-
const jsi::Value *arguments,
|
|
37
|
-
size_t count) -> jsi::Value {
|
|
38
|
-
auto audioContext = wrapper_->createAudioContext();
|
|
39
|
-
auto audioContextHostObject =
|
|
40
|
-
AudioContextHostObject::createFromWrapper(
|
|
41
|
-
audioContext, promiseVendor_);
|
|
42
|
-
return jsi::Object::createFromHostObject(
|
|
43
|
-
runtime, audioContextHostObject);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
throw std::runtime_error("Not yet implemented!");
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
void AudioAPIInstallerHostObject::set(
|
|
51
|
-
jsi::Runtime &runtime,
|
|
52
|
-
const jsi::PropNameID &propNameId,
|
|
53
|
-
const jsi::Value &value) {
|
|
54
|
-
auto propName = propNameId.utf8(runtime);
|
|
55
|
-
|
|
56
|
-
throw std::runtime_error("Not yet implemented!");
|
|
57
|
-
}
|
|
58
|
-
} // namespace audioapi
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <ReactCommon/CallInvoker.h>
|
|
4
|
-
#include <jsi/jsi.h>
|
|
5
|
-
#include <memory>
|
|
6
|
-
#include <utility>
|
|
7
|
-
#include <vector>
|
|
8
|
-
|
|
9
|
-
#include "AudioAPIInstallerWrapper.h"
|
|
10
|
-
#include "AudioContextHostObject.h"
|
|
11
|
-
#include "JsiPromise.h"
|
|
12
|
-
|
|
13
|
-
namespace audioapi {
|
|
14
|
-
using namespace facebook;
|
|
15
|
-
|
|
16
|
-
class AudioAPIInstallerWrapper;
|
|
17
|
-
|
|
18
|
-
class AudioAPIInstallerHostObject : public jsi::HostObject {
|
|
19
|
-
public:
|
|
20
|
-
explicit AudioAPIInstallerHostObject(
|
|
21
|
-
const std::shared_ptr<AudioAPIInstallerWrapper> &wrapper,
|
|
22
|
-
jsi::Runtime *runtime,
|
|
23
|
-
const std::shared_ptr<react::CallInvoker> &jsInvoker);
|
|
24
|
-
|
|
25
|
-
#ifdef ANDROID
|
|
26
|
-
static void createAndInstallFromWrapper(
|
|
27
|
-
const std::shared_ptr<AudioAPIInstallerWrapper> &wrapper,
|
|
28
|
-
jsi::Runtime *rnRuntime,
|
|
29
|
-
const std::shared_ptr<react::CallInvoker> &jsInvoker) {
|
|
30
|
-
auto hostObject = std::make_shared<AudioAPIInstallerHostObject>(
|
|
31
|
-
wrapper, rnRuntime, jsInvoker);
|
|
32
|
-
auto object = jsi::Object::createFromHostObject(*rnRuntime, hostObject);
|
|
33
|
-
rnRuntime->global().setProperty(
|
|
34
|
-
*rnRuntime, "__AudioAPIInstaller", std::move(object));
|
|
35
|
-
}
|
|
36
|
-
#endif
|
|
37
|
-
|
|
38
|
-
jsi::Value get(jsi::Runtime &runtime, const jsi::PropNameID &name) override;
|
|
39
|
-
|
|
40
|
-
void set(
|
|
41
|
-
jsi::Runtime &runtime,
|
|
42
|
-
const jsi::PropNameID &name,
|
|
43
|
-
const jsi::Value &value) override;
|
|
44
|
-
|
|
45
|
-
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime &rt) override;
|
|
46
|
-
|
|
47
|
-
private:
|
|
48
|
-
std::shared_ptr<AudioAPIInstallerWrapper> wrapper_;
|
|
49
|
-
std::shared_ptr<JsiPromise::PromiseVendor> promiseVendor_;
|
|
50
|
-
};
|
|
51
|
-
} // namespace audioapi
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <memory>
|
|
4
|
-
#include <string>
|
|
5
|
-
#include <utility>
|
|
6
|
-
|
|
7
|
-
#include "AudioContextWrapper.h"
|
|
8
|
-
|
|
9
|
-
#ifdef ANDROID
|
|
10
|
-
#include "AudioAPIInstaller.h"
|
|
11
|
-
#else
|
|
12
|
-
#include "AudioContext.h"
|
|
13
|
-
#endif
|
|
14
|
-
|
|
15
|
-
namespace audioapi {
|
|
16
|
-
|
|
17
|
-
#ifdef ANDROID
|
|
18
|
-
class AudioAPIInstaller;
|
|
19
|
-
#endif
|
|
20
|
-
|
|
21
|
-
class AudioAPIInstallerWrapper {
|
|
22
|
-
#ifdef ANDROID
|
|
23
|
-
|
|
24
|
-
public:
|
|
25
|
-
explicit AudioAPIInstallerWrapper(AudioAPIInstaller *audioAPIInstaller);
|
|
26
|
-
|
|
27
|
-
private:
|
|
28
|
-
AudioAPIInstaller *audioAPIInstaller_;
|
|
29
|
-
#else
|
|
30
|
-
|
|
31
|
-
public:
|
|
32
|
-
AudioAPIInstallerWrapper() = default;
|
|
33
|
-
#endif
|
|
34
|
-
|
|
35
|
-
public:
|
|
36
|
-
std::shared_ptr<AudioContextWrapper> createAudioContext() const;
|
|
37
|
-
};
|
|
38
|
-
} // namespace audioapi
|