react-native-audio-api 0.7.2-nightly-4919304-20250817 → 0.7.2-nightly-31b46b8-20250818
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/android/CMakeLists.txt +11 -5
- package/android/build.gradle +3 -3
- package/android/src/main/cpp/audioapi/android/core/AudioDecoder.cpp +9 -5
- package/android/src/main/java/com/swmansion/audioapi/AudioAPIPackage.kt +0 -1
- package/common/cpp/audioapi/core/utils/AudioDecoder.h +4 -4
- package/common/cpp/audioapi/core/utils/AudioNodeManager.cpp +2 -1
- package/ios/audioapi/ios/core/AudioDecoder.mm +4 -5
- package/ios/audioapi/ios/core/NativeAudioPlayer.m +2 -2
- package/package.json +7 -7
package/android/CMakeLists.txt
CHANGED
|
@@ -12,14 +12,20 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64")
|
|
|
12
12
|
set(HAVE_X86_SSE2 TRUE)
|
|
13
13
|
endif()
|
|
14
14
|
|
|
15
|
+
# default CMAKE_CXX_FLAGS: "-g -DANDROID -fdata-sections -ffunction-sections
|
|
16
|
+
# -funwind-tables -fstack-protector-strong -no-canonical-prefixes
|
|
17
|
+
# -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-protector-all"
|
|
15
18
|
include("${REACT_NATIVE_DIR}/ReactAndroid/cmake-utils/folly-flags.cmake")
|
|
16
19
|
add_compile_options(${folly_FLAGS})
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 80)
|
|
22
|
+
include("${REACT_NATIVE_DIR}/ReactCommon/cmake-utils/react-native-flags.cmake")
|
|
23
|
+
target_compile_reactnative_options(react-native-audio-api PRIVATE)
|
|
24
|
+
else()
|
|
25
|
+
string(APPEND CMAKE_CXX_FLAGS " -fexceptions -frtti -std=c++${CMAKE_CXX_STANDARD} -Wall")
|
|
26
|
+
endif()
|
|
27
|
+
|
|
28
|
+
string(APPEND CMAKE_CXX_FLAGS " -fno-omit-frame-pointer")
|
|
23
29
|
|
|
24
30
|
if(${IS_NEW_ARCHITECTURE_ENABLED})
|
|
25
31
|
string(APPEND CMAKE_CXX_FLAGS " -DRCT_NEW_ARCH_ENABLED")
|
package/android/build.gradle
CHANGED
|
@@ -172,8 +172,8 @@ android {
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
compileOptions {
|
|
175
|
-
sourceCompatibility JavaVersion.
|
|
176
|
-
targetCompatibility JavaVersion.
|
|
175
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
176
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
177
177
|
|
|
178
178
|
packagingOptions {
|
|
179
179
|
doNotStrip resolveBuildType() == 'debug' ? "**/**/*.so" : ''
|
|
@@ -217,7 +217,7 @@ dependencies {
|
|
|
217
217
|
implementation "com.facebook.react:react-native:+"
|
|
218
218
|
implementation 'androidx.core:core-ktx:1.13.1'
|
|
219
219
|
implementation 'com.facebook.fbjni:fbjni:0.6.0'
|
|
220
|
-
implementation 'com.google.oboe:oboe:1.9.
|
|
220
|
+
implementation 'com.google.oboe:oboe:1.9.3'
|
|
221
221
|
implementation 'androidx.media:media:1.7.0'
|
|
222
222
|
}
|
|
223
223
|
|
|
@@ -20,19 +20,23 @@ namespace audioapi {
|
|
|
20
20
|
std::vector<int16_t> AudioDecoder::readAllPcmFrames(
|
|
21
21
|
ma_decoder &decoder,
|
|
22
22
|
int numChannels,
|
|
23
|
-
ma_uint64 &outFramesRead)
|
|
23
|
+
ma_uint64 &outFramesRead) {
|
|
24
24
|
std::vector<int16_t> buffer;
|
|
25
|
-
int16_t temp
|
|
25
|
+
std::vector<int16_t> temp(CHUNK_SIZE * numChannels);
|
|
26
26
|
outFramesRead = 0;
|
|
27
27
|
|
|
28
28
|
while (true) {
|
|
29
29
|
ma_uint64 tempFramesDecoded = 0;
|
|
30
|
-
ma_decoder_read_pcm_frames(
|
|
30
|
+
ma_decoder_read_pcm_frames(
|
|
31
|
+
&decoder, temp.data(), CHUNK_SIZE, &tempFramesDecoded);
|
|
31
32
|
if (tempFramesDecoded == 0) {
|
|
32
33
|
break;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
buffer.insert(
|
|
36
|
+
buffer.insert(
|
|
37
|
+
buffer.end(),
|
|
38
|
+
temp.data(),
|
|
39
|
+
temp.data() + tempFramesDecoded * numChannels);
|
|
36
40
|
outFramesRead += tempFramesDecoded;
|
|
37
41
|
}
|
|
38
42
|
|
|
@@ -42,7 +46,7 @@ std::vector<int16_t> AudioDecoder::readAllPcmFrames(
|
|
|
42
46
|
std::shared_ptr<AudioBus> AudioDecoder::makeAudioBusFromInt16Buffer(
|
|
43
47
|
const std::vector<int16_t> &buffer,
|
|
44
48
|
int numChannels,
|
|
45
|
-
float sampleRate)
|
|
49
|
+
float sampleRate) {
|
|
46
50
|
auto outputFrames = buffer.size() / numChannels;
|
|
47
51
|
auto audioBus =
|
|
48
52
|
std::make_shared<AudioBus>(outputFrames, numChannels, sampleRate);
|
|
@@ -29,14 +29,14 @@ class AudioDecoder {
|
|
|
29
29
|
float sampleRate_;
|
|
30
30
|
int numChannels_ = 2;
|
|
31
31
|
|
|
32
|
-
std::vector<int16_t> readAllPcmFrames(
|
|
32
|
+
static std::vector<int16_t> readAllPcmFrames(
|
|
33
33
|
ma_decoder &decoder,
|
|
34
34
|
int numChannels,
|
|
35
|
-
ma_uint64 &outFramesRead)
|
|
36
|
-
std::shared_ptr<AudioBus> makeAudioBusFromInt16Buffer(
|
|
35
|
+
ma_uint64 &outFramesRead);
|
|
36
|
+
static std::shared_ptr<AudioBus> makeAudioBusFromInt16Buffer(
|
|
37
37
|
const std::vector<int16_t> &buffer,
|
|
38
38
|
int numChannels,
|
|
39
|
-
float sampleRate)
|
|
39
|
+
float sampleRate);
|
|
40
40
|
|
|
41
41
|
void changePlaybackSpeedIfNeeded(
|
|
42
42
|
std::vector<int16_t> &buffer,
|
|
@@ -72,7 +72,8 @@ void AudioNodeManager::settlePendingConnections() {
|
|
|
72
72
|
assert(to != nullptr);
|
|
73
73
|
from->disconnectNode(to);
|
|
74
74
|
} else {
|
|
75
|
-
for (auto it = from->outputNodes_.begin();
|
|
75
|
+
for (auto it = from->outputNodes_.begin();
|
|
76
|
+
it != from->outputNodes_.end();) {
|
|
76
77
|
auto next = std::next(it);
|
|
77
78
|
from->disconnectNode(*it);
|
|
78
79
|
it = next;
|
|
@@ -17,20 +17,19 @@ namespace audioapi {
|
|
|
17
17
|
// determined in advance. Note: ma_decoder_get_length_in_pcm_frames() always
|
|
18
18
|
// returns 0 for Vorbis decoders.
|
|
19
19
|
std::vector<int16_t> AudioDecoder::readAllPcmFrames(ma_decoder &decoder, int numChannels, ma_uint64 &outFramesRead)
|
|
20
|
-
const
|
|
21
20
|
{
|
|
22
21
|
std::vector<int16_t> buffer;
|
|
23
|
-
int16_t temp
|
|
22
|
+
std::vector<int16_t> temp(CHUNK_SIZE * numChannels);
|
|
24
23
|
outFramesRead = 0;
|
|
25
24
|
|
|
26
25
|
while (true) {
|
|
27
26
|
ma_uint64 tempFramesDecoded = 0;
|
|
28
|
-
ma_decoder_read_pcm_frames(&decoder, temp, CHUNK_SIZE, &tempFramesDecoded);
|
|
27
|
+
ma_decoder_read_pcm_frames(&decoder, temp.data(), CHUNK_SIZE, &tempFramesDecoded);
|
|
29
28
|
if (tempFramesDecoded == 0) {
|
|
30
29
|
break;
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
buffer.insert(buffer.end(), temp, temp + tempFramesDecoded * numChannels);
|
|
32
|
+
buffer.insert(buffer.end(), temp.data(), temp.data() + tempFramesDecoded * numChannels);
|
|
34
33
|
outFramesRead += tempFramesDecoded;
|
|
35
34
|
}
|
|
36
35
|
|
|
@@ -38,7 +37,7 @@ std::vector<int16_t> AudioDecoder::readAllPcmFrames(ma_decoder &decoder, int num
|
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
std::shared_ptr<AudioBus>
|
|
41
|
-
AudioDecoder::makeAudioBusFromInt16Buffer(const std::vector<int16_t> &buffer, int numChannels, float sampleRate)
|
|
40
|
+
AudioDecoder::makeAudioBusFromInt16Buffer(const std::vector<int16_t> &buffer, int numChannels, float sampleRate)
|
|
42
41
|
{
|
|
43
42
|
auto outputFrames = buffer.size() / numChannels;
|
|
44
43
|
auto audioBus = std::make_shared<AudioBus>(outputFrames, numChannels, sampleRate);
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
- (bool)start
|
|
36
36
|
{
|
|
37
37
|
NSLog(@"[AudioPlayer] start");
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
AudioEngine *audioEngine = [AudioEngine sharedInstance];
|
|
40
40
|
assert(audioEngine != nil);
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
// AudioEngine allows us to attach and connect nodes at runtime but with few limitations
|
|
43
43
|
// in this case if it is the first player and recorder started the engine we need to restart.
|
|
44
44
|
// It can be optimized by tracking if we haven't break rules of at runtime modifications from docs
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-audio-api",
|
|
3
|
-
"version": "0.7.2-nightly-
|
|
3
|
+
"version": "0.7.2-nightly-31b46b8-20250818",
|
|
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"
|
|
@@ -91,10 +91,10 @@
|
|
|
91
91
|
"@evilmartians/lefthook": "^1.5.0",
|
|
92
92
|
"@expo/config-plugins": "^9.0.0",
|
|
93
93
|
"@expo/config-types": "^53.0.4",
|
|
94
|
-
"@react-native/babel-preset": "0.
|
|
95
|
-
"@react-native/eslint-config": "0.
|
|
96
|
-
"@react-native/metro-config": "0.
|
|
97
|
-
"@react-native/typescript-config": "0.
|
|
94
|
+
"@react-native/babel-preset": "0.81.0",
|
|
95
|
+
"@react-native/eslint-config": "0.81.0",
|
|
96
|
+
"@react-native/metro-config": "0.81.0",
|
|
97
|
+
"@react-native/typescript-config": "0.81.0",
|
|
98
98
|
"@types/babel__core": "^7.20.0",
|
|
99
99
|
"@types/babel__generator": "^7.6.4",
|
|
100
100
|
"@types/babel__traverse": "^7.14.2",
|
|
@@ -123,10 +123,10 @@
|
|
|
123
123
|
"jest": "^29.7.0",
|
|
124
124
|
"prettier": "^3.3.3",
|
|
125
125
|
"react": "19.1.0",
|
|
126
|
-
"react-native": "0.
|
|
126
|
+
"react-native": "0.81.0",
|
|
127
127
|
"react-native-builder-bob": "0.33.1",
|
|
128
128
|
"turbo": "^1.10.7",
|
|
129
|
-
"typescript": "
|
|
129
|
+
"typescript": "5.8.3"
|
|
130
130
|
},
|
|
131
131
|
"react-native-builder-bob": {
|
|
132
132
|
"source": "src",
|