react-native-audio-api 0.6.4-nightly-e199fd6-20250715 → 0.6.4-nightly-61e39e7-20250716

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.
@@ -7,7 +7,7 @@
7
7
  #define MINIAUDIO_IMPLEMENTATION
8
8
  #include <audioapi/libs/miniaudio/miniaudio.h>
9
9
 
10
- #include <android/log.h>
10
+ // #include <android/log.h>
11
11
 
12
12
  namespace audioapi {
13
13
 
@@ -18,12 +18,11 @@ std::shared_ptr<AudioBus> AudioDecoder::decodeWithFilePath(
18
18
  ma_decoder_config_init(ma_format_f32, 2, static_cast<int>(sampleRate_));
19
19
  ma_result result = ma_decoder_init_file(path.c_str(), &config, &decoder);
20
20
  if (result != MA_SUCCESS) {
21
- __android_log_print(
22
- ANDROID_LOG_ERROR,
23
- "AudioDecoder",
24
- "Failed to initialize decoder for file: %s",
25
- path.c_str());
26
-
21
+ // __android_log_print(
22
+ // ANDROID_LOG_ERROR,
23
+ // "AudioDecoder",
24
+ // "Failed to initialize decoder for file: %s",
25
+ // path.c_str());
27
26
  ma_decoder_uninit(&decoder);
28
27
 
29
28
  return nullptr;
@@ -40,7 +39,7 @@ std::shared_ptr<AudioBus> AudioDecoder::decodeWithFilePath(
40
39
  ma_decoder_read_pcm_frames(&decoder, buffer, totalFrameCount, &framesDecoded);
41
40
 
42
41
  if (framesDecoded == 0) {
43
- __android_log_print(ANDROID_LOG_ERROR, "AudioDecoder", "Failed to decode");
42
+ // __android_log_print(ANDROID_LOG_ERROR, "AudioDecoder", "Failed to decode");
44
43
 
45
44
  delete[] buffer;
46
45
  ma_decoder_uninit(&decoder);
@@ -70,11 +69,10 @@ std::shared_ptr<AudioBus> AudioDecoder::decodeWithMemoryBlock(
70
69
  ma_decoder_config_init(ma_format_f32, 2, static_cast<int>(sampleRate_));
71
70
  ma_result result = ma_decoder_init_memory(data, size, &config, &decoder);
72
71
  if (result != MA_SUCCESS) {
73
- __android_log_print(
74
- ANDROID_LOG_ERROR,
75
- "AudioDecoder",
76
- "Failed to initialize decoder for memory block");
77
-
72
+ // __android_log_print(
73
+ // ANDROID_LOG_ERROR,
74
+ // "AudioDecoder",
75
+ // "Failed to initialize decoder for memory block");
78
76
  ma_decoder_uninit(&decoder);
79
77
 
80
78
  return nullptr;
@@ -90,7 +88,7 @@ std::shared_ptr<AudioBus> AudioDecoder::decodeWithMemoryBlock(
90
88
  ma_uint64 framesDecoded;
91
89
  ma_decoder_read_pcm_frames(&decoder, buffer, totalFrameCount, &framesDecoded);
92
90
  if (framesDecoded == 0) {
93
- __android_log_print(ANDROID_LOG_ERROR, "AudioDecoder", "Failed to decode");
91
+ // __android_log_print(ANDROID_LOG_ERROR, "AudioDecoder", "Failed to decode");
94
92
 
95
93
  delete[] buffer;
96
94
  ma_decoder_uninit(&decoder);
@@ -119,7 +119,6 @@ std::shared_ptr<AnalyserNode> BaseAudioContext::createAnalyser() {
119
119
 
120
120
  std::shared_ptr<AudioBuffer> BaseAudioContext::decodeAudioDataSource(
121
121
  const std::string &path) {
122
- #ifndef AUDIO_API_TEST_SUITE
123
122
  auto audioBus = audioDecoder_->decodeWithFilePath(path);
124
123
 
125
124
  if (!audioBus) {
@@ -127,15 +126,11 @@ std::shared_ptr<AudioBuffer> BaseAudioContext::decodeAudioDataSource(
127
126
  }
128
127
 
129
128
  return std::make_shared<AudioBuffer>(audioBus);
130
- #else
131
- return nullptr;
132
- #endif // AUDIO_API_TEST_SUITE
133
129
  }
134
130
 
135
131
  std::shared_ptr<AudioBuffer> BaseAudioContext::decodeAudioData(
136
132
  const void *data,
137
133
  size_t size) {
138
- #ifndef AUDIO_API_TEST_SUITE
139
134
  auto audioBus = audioDecoder_->decodeWithMemoryBlock(data, size);
140
135
 
141
136
  if (!audioBus) {
@@ -143,14 +138,10 @@ std::shared_ptr<AudioBuffer> BaseAudioContext::decodeAudioData(
143
138
  }
144
139
 
145
140
  return std::make_shared<AudioBuffer>(audioBus);
146
- #else
147
- return nullptr;
148
- #endif // AUDIO_API_TEST_SUITE
149
141
  }
150
142
 
151
143
  std::shared_ptr<AudioBuffer> BaseAudioContext::decodeWithPCMInBase64(
152
144
  const std::string &data) {
153
- #ifndef AUDIO_API_TEST_SUITE
154
145
  auto audioBus = audioDecoder_->decodeWithPCMInBase64(data);
155
146
 
156
147
  if (!audioBus) {
@@ -158,7 +149,6 @@ std::shared_ptr<AudioBuffer> BaseAudioContext::decodeWithPCMInBase64(
158
149
  }
159
150
 
160
151
  return std::make_shared<AudioBuffer>(audioBus);
161
- #endif // AUDIO_API_TEST_SUITE
162
152
  }
163
153
 
164
154
  AudioNodeManager *BaseAudioContext::getNodeManager() {
@@ -164,19 +164,20 @@ jsi::Object AudioEventHandlerRegistry::createEventObject(
164
164
  const auto name = pair.first.data();
165
165
  const auto &value = pair.second;
166
166
 
167
- if (holds_alternative<int>(value)) {
168
- eventObject.setProperty(*runtime_, name, get<int>(value));
169
- } else if (holds_alternative<double>(value)) {
170
- eventObject.setProperty(*runtime_, name, get<double>(value));
171
- } else if (holds_alternative<float>(value)) {
172
- eventObject.setProperty(*runtime_, name, get<float>(value));
173
- } else if (holds_alternative<bool>(value)) {
174
- eventObject.setProperty(*runtime_, name, get<bool>(value));
175
- } else if (holds_alternative<std::string>(value)) {
176
- eventObject.setProperty(*runtime_, name, get<std::string>(value));
177
- } else if (holds_alternative<std::shared_ptr<jsi::HostObject>>(value)) {
167
+ if (std::holds_alternative<int>(value)) {
168
+ eventObject.setProperty(*runtime_, name, std::get<int>(value));
169
+ } else if (std::holds_alternative<double>(value)) {
170
+ eventObject.setProperty(*runtime_, name, std::get<double>(value));
171
+ } else if (std::holds_alternative<float>(value)) {
172
+ eventObject.setProperty(*runtime_, name, std::get<float>(value));
173
+ } else if (std::holds_alternative<bool>(value)) {
174
+ eventObject.setProperty(*runtime_, name, std::get<bool>(value));
175
+ } else if (std::holds_alternative<std::string>(value)) {
176
+ eventObject.setProperty(*runtime_, name, std::get<std::string>(value));
177
+ } else if (std::holds_alternative<std::shared_ptr<jsi::HostObject>>(
178
+ value)) {
178
179
  auto hostObject = jsi::Object::createFromHostObject(
179
- *runtime_, get<std::shared_ptr<jsi::HostObject>>(value));
180
+ *runtime_, std::get<std::shared_ptr<jsi::HostObject>>(value));
180
181
  eventObject.setProperty(*runtime_, name, hostObject);
181
182
  }
182
183
  }
@@ -1,4 +1,5 @@
1
1
  #include <audioapi/jsi/JsiPromise.h>
2
+ #include <stdexcept>
2
3
 
3
4
  namespace audioapi {
4
5
 
@@ -7,46 +7,29 @@ set(ROOT ${CMAKE_SOURCE_DIR}/../../../../..)
7
7
  set(REACT_NATIVE_DIR "${ROOT}/node_modules/react-native")
8
8
  set(JSI_DIR "${REACT_NATIVE_DIR}/ReactCommon/jsi")
9
9
 
10
- include(CMakePrintHelpers)
11
- cmake_print_variables(ROOT)
12
-
13
10
  include(FetchContent)
14
11
  FetchContent_Declare(
15
12
  googletest
16
- URL https://github.com/google/googletest/archive/c67de117379f4d1c889c7581a0a76aa0979c2083.zip
13
+ URL https://github.com/google/googletest/archive/3983f67e32fb3e9294487b9d4f9586efa6e5d088.zip
17
14
  )
18
15
  # For Windows: Prevent overriding the parent project's compiler/linker settings
19
16
  set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
20
17
  FetchContent_MakeAvailable(googletest)
21
18
 
22
- message(STATUS "Using C++ compiler: ${CMAKE_CXX_COMPILER}")
23
-
24
19
  enable_testing()
25
- add_compile_definitions(AUDIO_API_TEST_SUITE)
26
20
 
27
21
  file(GLOB_RECURSE RNAUDIOAPI_SRC
28
22
  CONFIGURE_DEPENDS
29
- "${ROOT}/packages/react-native-audio-api/common/cpp/audioapi/core/AudioNode.cpp"
30
- "${ROOT}/packages/react-native-audio-api/common/cpp/audioapi/core/AudioParam.cpp"
31
- "${ROOT}/packages/react-native-audio-api/common/cpp/audioapi/core/BaseAudioContext.cpp"
32
- "${ROOT}/packages/react-native-audio-api/common/cpp/audioapi/core/OfflineAudioContext.cpp"
33
- "${ROOT}/packages/react-native-audio-api/common/cpp/audioapi/core/analysis/*.cpp"
34
- "${ROOT}/packages/react-native-audio-api/common/cpp/audioapi/core/destinations/*.cpp"
35
- "${ROOT}/packages/react-native-audio-api/common/cpp/audioapi/core/effects/*.cpp"
36
- "${ROOT}/packages/react-native-audio-api/common/cpp/audioapi/core/inputs/*.cpp"
37
- "${ROOT}/packages/react-native-audio-api/common/cpp/audioapi/core/sources/*.cpp"
38
- "${ROOT}/packages/react-native-audio-api/common/cpp/audioapi/core/types/*.cpp"
39
- "${ROOT}/packages/react-native-audio-api/common/cpp/audioapi/core/utils/*.cpp"
40
- "${ROOT}/packages/react-native-audio-api/common/cpp/audioapi/dsp/*.cpp"
41
- "${ROOT}/packages/react-native-audio-api/common/cpp/audioapi/utils/*.cpp"
23
+ "${ROOT}/node_modules/react-native-audio-api/common/cpp/audioapi/*.cpp"
24
+ "${ROOT}/node_modules/react-native-audio-api/android/src/main/cpp/audioapi/android/core/AudioDecoder.cpp"
42
25
  )
43
26
 
27
+ list(REMOVE_ITEM RNAUDIOAPI_SRC "${ROOT}/node_modules/react-native-audio-api/common/cpp/audioapi/core/AudioContext.cpp")
28
+
44
29
  file(GLOB_RECURSE RNAUDIOAPI_LIBS
45
30
  CONFIGURE_DEPENDS
46
- "${ROOT}/packages/react-native-audio-api/common/cpp/audioapi/libs/base64/*.h"
47
- "${ROOT}/packages/react-native-audio-api/common/cpp/audioapi/libs/miniaudio/*.h"
48
- "${ROOT}/packages/react-native-audio-api/common/cpp/audioapi/libs/pffft/*.c"
49
- "${ROOT}/packages/react-native-audio-api/common/cpp/audioapi/libs/signalsmith-stretch/*.h"
31
+ "${ROOT}/node_modules/react-native-audio-api/common/cpp/audioapi/libs/*.c"
32
+ "${ROOT}/node_modules/react-native-audio-api/common/cpp/audioapi/libs/*.h"
50
33
  )
51
34
 
52
35
  add_library(rnaudioapi STATIC ${RNAUDIOAPI_SRC})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-audio-api",
3
- "version": "0.6.4-nightly-e199fd6-20250715",
3
+ "version": "0.6.4-nightly-61e39e7-20250716",
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"