react-native-audio-api 0.6.3-rc.1 → 0.6.4-nightly-a960beb-20250703

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.
Files changed (49) hide show
  1. package/android/src/main/cpp/audioapi/android/AudioAPIModule.cpp +11 -3
  2. package/android/src/main/java/com/swmansion/audioapi/AudioAPIModule.kt +1 -1
  3. package/android/src/main/java/com/swmansion/audioapi/system/AudioFocusListener.kt +5 -5
  4. package/android/src/main/java/com/swmansion/audioapi/system/LockScreenManager.kt +1 -2
  5. package/common/cpp/audioapi/HostObjects/AudioBufferBaseSourceNodeHostObject.h +8 -1
  6. package/common/cpp/audioapi/core/AudioContext.cpp +2 -1
  7. package/common/cpp/audioapi/core/AudioContext.h +1 -1
  8. package/common/cpp/audioapi/core/AudioParam.cpp +17 -5
  9. package/common/cpp/audioapi/core/AudioParam.h +3 -0
  10. package/common/cpp/audioapi/core/BaseAudioContext.cpp +7 -1
  11. package/common/cpp/audioapi/core/BaseAudioContext.h +5 -2
  12. package/common/cpp/audioapi/core/OfflineAudioContext.cpp +2 -1
  13. package/common/cpp/audioapi/core/OfflineAudioContext.h +1 -1
  14. package/common/cpp/audioapi/core/effects/PeriodicWave.cpp +1 -1
  15. package/common/cpp/audioapi/core/inputs/AudioRecorder.cpp +4 -2
  16. package/common/cpp/audioapi/core/inputs/AudioRecorder.h +1 -0
  17. package/common/cpp/audioapi/core/sources/AudioBuffer.h +1 -0
  18. package/common/cpp/audioapi/core/sources/AudioBufferBaseSourceNode.cpp +15 -1
  19. package/common/cpp/audioapi/core/sources/AudioBufferBaseSourceNode.h +7 -4
  20. package/common/cpp/audioapi/core/sources/AudioScheduledSourceNode.cpp +13 -2
  21. package/common/cpp/audioapi/core/sources/AudioScheduledSourceNode.h +1 -0
  22. package/common/cpp/audioapi/core/utils/AudioNodeDestructor.h +1 -0
  23. package/common/cpp/audioapi/core/utils/AudioNodeManager.h +1 -2
  24. package/common/cpp/audioapi/dsp/AudioUtils.cpp +1 -1
  25. package/common/cpp/audioapi/events/AudioEventHandlerRegistry.cpp +80 -29
  26. package/common/cpp/audioapi/events/AudioEventHandlerRegistry.h +9 -5
  27. package/common/cpp/audioapi/events/IAudioEventHandlerRegistry.h +25 -0
  28. package/common/cpp/audioapi/utils/AudioArray.h +1 -0
  29. package/common/cpp/audioapi/utils/CircularAudioArray.h +1 -0
  30. package/common/cpp/test/CMakeLists.txt +79 -0
  31. package/common/cpp/test/MockAudioEventHandlerRegistry.h +22 -0
  32. package/common/cpp/test/OscillatorTest.cpp +22 -0
  33. package/common/cpp/test/RunTests.sh +26 -0
  34. package/ios/audioapi/ios/AudioAPIModule.mm +11 -12
  35. package/lib/commonjs/core/AudioBufferBaseSourceNode.js +10 -6
  36. package/lib/commonjs/core/AudioBufferBaseSourceNode.js.map +1 -1
  37. package/lib/commonjs/core/AudioScheduledSourceNode.js +6 -2
  38. package/lib/commonjs/core/AudioScheduledSourceNode.js.map +1 -1
  39. package/lib/module/core/AudioBufferBaseSourceNode.js +10 -6
  40. package/lib/module/core/AudioBufferBaseSourceNode.js.map +1 -1
  41. package/lib/module/core/AudioScheduledSourceNode.js +6 -2
  42. package/lib/module/core/AudioScheduledSourceNode.js.map +1 -1
  43. package/lib/typescript/core/AudioBufferBaseSourceNode.d.ts +6 -3
  44. package/lib/typescript/core/AudioBufferBaseSourceNode.d.ts.map +1 -1
  45. package/lib/typescript/core/AudioScheduledSourceNode.d.ts +2 -0
  46. package/lib/typescript/core/AudioScheduledSourceNode.d.ts.map +1 -1
  47. package/package.json +9 -9
  48. package/src/core/AudioBufferBaseSourceNode.ts +20 -7
  49. package/src/core/AudioScheduledSourceNode.ts +9 -1
@@ -4,7 +4,8 @@ namespace audioapi {
4
4
 
5
5
  AudioEventHandlerRegistry::AudioEventHandlerRegistry(
6
6
  jsi::Runtime *runtime,
7
- const std::shared_ptr<react::CallInvoker> &callInvoker) {
7
+ const std::shared_ptr<react::CallInvoker> &callInvoker)
8
+ : IAudioEventHandlerRegistry() {
8
9
  runtime_ = runtime;
9
10
  callInvoker_ = callInvoker;
10
11
 
@@ -24,57 +25,107 @@ AudioEventHandlerRegistry::~AudioEventHandlerRegistry() {
24
25
  uint64_t AudioEventHandlerRegistry::registerHandler(
25
26
  const std::string &eventName,
26
27
  const std::shared_ptr<jsi::Function> &handler) {
27
- static uint64_t LISTENER_ID = 1;
28
+ uint64_t listenerId = listenerIdCounter_++;
28
29
 
29
- eventHandlers_[eventName][LISTENER_ID] = handler;
30
+ if (callInvoker_ == nullptr || runtime_ == nullptr) {
31
+ // If callInvoker or runtime is not valid, we cannot register the handler
32
+ return 0;
33
+ }
34
+
35
+ // Modify the eventHandlers_ map only on the main RN thread
36
+ callInvoker_->invokeAsync([this, eventName, listenerId, handler]() {
37
+ eventHandlers_[eventName][listenerId] = handler;
38
+ });
30
39
 
31
- return LISTENER_ID++;
40
+ return listenerId;
32
41
  }
33
42
 
34
43
  void AudioEventHandlerRegistry::unregisterHandler(
35
44
  const std::string &eventName,
36
45
  uint64_t listenerId) {
37
- auto it = eventHandlers_.find(eventName);
38
- if (it != eventHandlers_.end()) {
39
- it->second.erase(listenerId);
46
+ if (callInvoker_ == nullptr || runtime_ == nullptr) {
47
+ // If callInvoker or runtime is not valid, we cannot unregister the handler
48
+ return;
40
49
  }
50
+
51
+ callInvoker_->invokeAsync([this, eventName, listenerId]() {
52
+ auto it = eventHandlers_.find(eventName);
53
+
54
+ if (it == eventHandlers_.end()) {
55
+ return;
56
+ }
57
+
58
+ auto &handlersMap = it->second;
59
+ auto handlerIt = handlersMap.find(listenerId);
60
+
61
+ if (handlerIt != handlersMap.end()) {
62
+ handlersMap.erase(handlerIt);
63
+ }
64
+ });
41
65
  }
42
66
 
43
67
  void AudioEventHandlerRegistry::invokeHandlerWithEventBody(
44
68
  const std::string &eventName,
45
69
  const std::unordered_map<std::string, EventValue> &body) {
46
- auto it = eventHandlers_.find(eventName);
47
- if (it != eventHandlers_.end()) {
48
- for (const auto &pair : it->second) {
70
+ // callInvoker_ and runtime_ must be valid to invoke handlers
71
+ // this might happen when react-native is reloaded or the app is closed
72
+ if (callInvoker_ == nullptr || runtime_ == nullptr) {
73
+ return;
74
+ }
75
+
76
+ // Do any logic regarding triggering the event on the main RN thread
77
+ callInvoker_->invokeAsync([this, eventName, body]() {
78
+ auto it = eventHandlers_.find(eventName);
79
+
80
+ if (it == eventHandlers_.end()) {
81
+ // If the event name is not registered, we can skip invoking handlers
82
+ return;
83
+ }
84
+
85
+ auto handlersMap = it->second;
86
+
87
+ for (const auto &pair : handlersMap) {
49
88
  auto handler = pair.second;
50
- if (handler) {
51
- callInvoker_->invokeAsync([this, handler, body]() {
52
- auto eventObject = createEventObject(body);
53
- handler->call(*runtime_, eventObject);
54
- });
89
+
90
+ if (!handler || !handler->isFunction(*runtime_)) {
91
+ // If the handler is not valid, we can skip it
92
+ continue;
55
93
  }
94
+
95
+ auto eventObject = createEventObject(body);
96
+ handler->call(*runtime_, eventObject);
56
97
  }
57
- }
98
+ });
58
99
  }
59
100
 
60
101
  void AudioEventHandlerRegistry::invokeHandlerWithEventBody(
61
102
  const std::string &eventName,
62
103
  uint64_t listenerId,
63
104
  const std::unordered_map<std::string, EventValue> &body) {
64
- auto it = eventHandlers_.find(eventName);
65
- if (it != eventHandlers_.end()) {
66
- auto handlersMap = it->second;
67
- auto handlerIt = handlersMap.find(listenerId);
68
- if (handlerIt != handlersMap.end()) {
69
- auto handler = handlerIt->second;
70
- if (handler) {
71
- callInvoker_->invokeAsync([this, handler, body]() {
72
- auto eventObject = createEventObject(body);
73
- handler->call(*runtime_, eventObject);
74
- });
75
- }
76
- }
105
+ // callInvoker_ and runtime_ must be valid to invoke handlers
106
+ // this might happen when react-native is reloaded or the app is closed
107
+ if (callInvoker_ == nullptr || runtime_ == nullptr) {
108
+ return;
77
109
  }
110
+
111
+ callInvoker_->invokeAsync([this, eventName, listenerId, body]() {
112
+ auto it = eventHandlers_.find(eventName);
113
+
114
+ if (it == eventHandlers_.end()) {
115
+ // If the event name is not registered, we can skip invoking handlers
116
+ return;
117
+ }
118
+
119
+ auto handlerIt = it->second.find(listenerId);
120
+
121
+ if (handlerIt == it->second.end()) {
122
+ // If the listener ID is not registered, we can skip invoking handlers
123
+ return;
124
+ }
125
+
126
+ auto eventObject = createEventObject(body);
127
+ handlerIt->second->call(*runtime_, eventObject);
128
+ });
78
129
  }
79
130
 
80
131
  jsi::Object AudioEventHandlerRegistry::createEventObject(
@@ -2,31 +2,35 @@
2
2
 
3
3
  #include <jsi/jsi.h>
4
4
  #include <ReactCommon/CallInvoker.h>
5
+ #include <audioapi/events/IAudioEventHandlerRegistry.h>
5
6
  #include <memory>
6
7
  #include <unordered_map>
7
8
  #include <array>
8
9
  #include <string>
9
10
  #include <variant>
11
+ #include <atomic>
10
12
 
11
13
  namespace audioapi {
12
14
  using namespace facebook;
13
15
 
14
16
  using EventValue = std::variant<int, float, double, std::string, bool, std::shared_ptr<jsi::HostObject>>;
15
17
 
16
- class AudioEventHandlerRegistry {
18
+ class AudioEventHandlerRegistry : public IAudioEventHandlerRegistry {
17
19
  public:
18
20
  explicit AudioEventHandlerRegistry(
19
21
  jsi::Runtime *runtime,
20
22
  const std::shared_ptr<react::CallInvoker> &callInvoker);
21
23
  ~AudioEventHandlerRegistry();
22
24
 
23
- uint64_t registerHandler(const std::string &eventName, const std::shared_ptr<jsi::Function> &handler);
24
- void unregisterHandler(const std::string &eventName, uint64_t listenerId);
25
+ uint64_t registerHandler(const std::string &eventName, const std::shared_ptr<jsi::Function> &handler) override;
26
+ void unregisterHandler(const std::string &eventName, uint64_t listenerId) override;
25
27
 
26
- void invokeHandlerWithEventBody(const std::string &eventName, const std::unordered_map<std::string, EventValue> &body);
27
- void invokeHandlerWithEventBody(const std::string &eventName, uint64_t listenerId, const std::unordered_map<std::string, EventValue> &body);
28
+ void invokeHandlerWithEventBody(const std::string &eventName, const std::unordered_map<std::string, EventValue> &body) override;
29
+ void invokeHandlerWithEventBody(const std::string &eventName, uint64_t listenerId, const std::unordered_map<std::string, EventValue> &body) override;
28
30
 
29
31
  private:
32
+ std::atomic<uint64_t> listenerIdCounter_{1}; // Atomic counter for listener IDs
33
+
30
34
  std::shared_ptr<react::CallInvoker> callInvoker_;
31
35
  jsi::Runtime *runtime_;
32
36
  std::unordered_map<std::string, std::unordered_map<uint64_t, std::shared_ptr<jsi::Function>>> eventHandlers_;
@@ -0,0 +1,25 @@
1
+ #pragma once
2
+
3
+ #include <jsi/jsi.h>
4
+ #include <ReactCommon/CallInvoker.h>
5
+ #include <unordered_map>
6
+ #include <variant>
7
+ #include <string>
8
+ #include <memory>
9
+
10
+ namespace audioapi {
11
+
12
+ using EventValue = std::variant<int, float, double, std::string, bool, std::shared_ptr<facebook::jsi::HostObject>>;
13
+
14
+ class IAudioEventHandlerRegistry {
15
+ public:
16
+ virtual ~IAudioEventHandlerRegistry() = default;
17
+
18
+ virtual uint64_t registerHandler(const std::string &eventName, const std::shared_ptr<facebook::jsi::Function> &handler) = 0;
19
+ virtual void unregisterHandler(const std::string &eventName, uint64_t listenerId) = 0;
20
+
21
+ virtual void invokeHandlerWithEventBody(const std::string &eventName, const std::unordered_map<std::string, EventValue> &body) = 0;
22
+ virtual void invokeHandlerWithEventBody(const std::string &eventName, uint64_t listenerId, const std::unordered_map<std::string, EventValue> &body) = 0;
23
+ };
24
+
25
+ } // namespace audioapi
@@ -3,6 +3,7 @@
3
3
  #include <algorithm>
4
4
  #include <memory>
5
5
  #include <cstddef>
6
+ #include <cstring>
6
7
 
7
8
  namespace audioapi {
8
9
 
@@ -1,6 +1,7 @@
1
1
  #pragma once
2
2
 
3
3
  #include <audioapi/utils/AudioArray.h>
4
+ #include <stdexcept>
4
5
 
5
6
  namespace audioapi {
6
7
 
@@ -0,0 +1,79 @@
1
+ cmake_minimum_required(VERSION 3.14)
2
+ project(rnaudioapi_test)
3
+
4
+ set(CMAKE_CXX_STANDARD 17)
5
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
6
+ set(ROOT ${CMAKE_SOURCE_DIR}/../../../../..)
7
+ set(REACT_NATIVE_DIR "${ROOT}/node_modules/react-native")
8
+ set(JSI_DIR "${REACT_NATIVE_DIR}/ReactCommon/jsi")
9
+
10
+ include(CMakePrintHelpers)
11
+ cmake_print_variables(ROOT)
12
+
13
+ include(FetchContent)
14
+ FetchContent_Declare(
15
+ googletest
16
+ URL https://github.com/google/googletest/archive/c67de117379f4d1c889c7581a0a76aa0979c2083.zip
17
+ )
18
+ # For Windows: Prevent overriding the parent project's compiler/linker settings
19
+ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
20
+ FetchContent_MakeAvailable(googletest)
21
+
22
+ message(STATUS "Using C++ compiler: ${CMAKE_CXX_COMPILER}")
23
+
24
+ enable_testing()
25
+ add_compile_definitions(AUDIO_API_TEST_SUITE)
26
+
27
+ file(GLOB_RECURSE RNAUDIOAPI_SRC
28
+ 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"
42
+ )
43
+
44
+ file(GLOB_RECURSE RNAUDIOAPI_LIBS
45
+ 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"
50
+ )
51
+
52
+ add_library(rnaudioapi STATIC ${RNAUDIOAPI_SRC})
53
+ add_library(rnaudioapi_libs STATIC ${RNAUDIOAPI_LIBS})
54
+
55
+ target_include_directories(rnaudioapi PUBLIC
56
+ ${ROOT}/packages/react-native-audio-api/common/cpp
57
+ ${JSI_DIR}
58
+ "${REACT_NATIVE_DIR}/ReactCommon"
59
+ "${REACT_NATIVE_DIR}/ReactCommon/callinvoker"
60
+ )
61
+
62
+ target_include_directories(rnaudioapi_libs PUBLIC
63
+ ${ROOT}/packages/react-native-audio-api/common/cpp
64
+ )
65
+
66
+ add_executable(
67
+ tests
68
+ OscillatorTest.cpp
69
+ )
70
+
71
+ target_link_libraries(tests
72
+ rnaudioapi
73
+ rnaudioapi_libs
74
+ GTest::gtest_main
75
+ GTest::gmock
76
+ )
77
+
78
+ include(GoogleTest)
79
+ gtest_discover_tests(tests)
@@ -0,0 +1,22 @@
1
+ #pragma once
2
+
3
+ #include <gmock/gmock.h>
4
+ #include <audioapi/events/IAudioEventHandlerRegistry.h>
5
+ #include <unordered_map>
6
+ #include <string>
7
+ #include <memory>
8
+
9
+ using EventMap = std::unordered_map<std::string, audioapi::EventValue>;
10
+
11
+ class MockAudioEventHandlerRegistry : public audioapi::IAudioEventHandlerRegistry {
12
+ public:
13
+ MOCK_METHOD(uint64_t, registerHandler,
14
+ (const std::string &eventName, const std::shared_ptr<facebook::jsi::Function> &handler), (override));
15
+ MOCK_METHOD(void, unregisterHandler,
16
+ (const std::string &eventName, uint64_t listenerId), (override));
17
+
18
+ MOCK_METHOD(void, invokeHandlerWithEventBody,
19
+ (const std::string &eventName, const EventMap &body), (override));
20
+ MOCK_METHOD(void, invokeHandlerWithEventBody,
21
+ (const std::string &eventName, uint64_t listenerId, const EventMap &body), (override));
22
+ };
@@ -0,0 +1,22 @@
1
+ #include <audioapi/core/OfflineAudioContext.h>
2
+ #include <audioapi/core/sources/OscillatorNode.h>
3
+ #include <gtest/gtest.h>
4
+ #include "MockAudioEventHandlerRegistry.h"
5
+
6
+ class OscillatorTest : public ::testing::Test {
7
+ protected:
8
+ std::shared_ptr<audioapi::IAudioEventHandlerRegistry> eventRegistry;
9
+ std::unique_ptr<audioapi::OfflineAudioContext> context;
10
+ static constexpr int sampleRate = 44100;
11
+
12
+ void SetUp() override {
13
+ eventRegistry = std::make_shared<MockAudioEventHandlerRegistry>();
14
+ context = std::make_unique<audioapi::OfflineAudioContext>(
15
+ 2, 5 * sampleRate, sampleRate, eventRegistry);
16
+ }
17
+ };
18
+
19
+ TEST_F(OscillatorTest, OscillatorCanBeCreated) {
20
+ auto osc = context->createOscillator();
21
+ ASSERT_NE(osc, nullptr);
22
+ }
@@ -0,0 +1,26 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ cleanup() {
6
+ echo "Cleaning up..."
7
+ rm -rf build/
8
+ }
9
+
10
+ trap cleanup EXIT
11
+ # Step 1: Move to the script's directory
12
+ cd packages/react-native-audio-api/common/cpp/test
13
+ # Step 2: Configure CMake project
14
+ # mkdir build
15
+ cmake -S . -B build
16
+
17
+ # Step 3: Build the project
18
+ cmake --build build
19
+
20
+ # Step 4: Run the test binary
21
+ cd build
22
+ ./tests
23
+ cd ..
24
+
25
+ # Step 5: Clean up build directory
26
+ rm -rf build/
@@ -85,9 +85,8 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getDevicePreferredSampleRate)
85
85
  return [self.audioSessionManager getDevicePreferredSampleRate];
86
86
  }
87
87
 
88
- RCT_EXPORT_METHOD(
89
- setAudioSessionActivity : (BOOL)enabled resolve : (RCTPromiseResolveBlock)resolve reject : (RCTPromiseRejectBlock)
90
- reject)
88
+ RCT_EXPORT_METHOD(setAudioSessionActivity : (BOOL)enabled resolve : (RCTPromiseResolveBlock)
89
+ resolve reject : (RCTPromiseRejectBlock)reject)
91
90
  {
92
91
  if ([self.audioSessionManager setActive:enabled]) {
93
92
  resolve(@"true");
@@ -97,9 +96,8 @@ RCT_EXPORT_METHOD(
97
96
  resolve(@"false");
98
97
  }
99
98
 
100
- RCT_EXPORT_METHOD(
101
- setAudioSessionOptions : (NSString *)category mode : (NSString *)mode options : (NSArray *)
102
- options allowHaptics : (BOOL)allowHaptics)
99
+ RCT_EXPORT_METHOD(setAudioSessionOptions : (NSString *)category mode : (NSString *)mode options : (NSArray *)
100
+ options allowHaptics : (BOOL)allowHaptics)
103
101
  {
104
102
  [self.audioSessionManager setAudioSessionOptions:category mode:mode options:options allowHaptics:allowHaptics];
105
103
  }
@@ -129,15 +127,14 @@ RCT_EXPORT_METHOD(observeVolumeChanges : (BOOL)enabled)
129
127
  [self.notificationManager observeVolumeChanges:(BOOL)enabled];
130
128
  }
131
129
 
132
- RCT_EXPORT_METHOD(
133
- requestRecordingPermissions : (nonnull RCTPromiseResolveBlock)resolve reject : (nonnull RCTPromiseRejectBlock)
134
- reject)
130
+ RCT_EXPORT_METHOD(requestRecordingPermissions : (nonnull RCTPromiseResolveBlock)
131
+ resolve reject : (nonnull RCTPromiseRejectBlock)reject)
135
132
  {
136
133
  [self.audioSessionManager requestRecordingPermissions:resolve reject:reject];
137
134
  }
138
135
 
139
- RCT_EXPORT_METHOD(
140
- checkRecordingPermissions : (nonnull RCTPromiseResolveBlock)resolve reject : (nonnull RCTPromiseRejectBlock)reject)
136
+ RCT_EXPORT_METHOD(checkRecordingPermissions : (nonnull RCTPromiseResolveBlock)
137
+ resolve reject : (nonnull RCTPromiseRejectBlock)reject)
141
138
  {
142
139
  [self.audioSessionManager checkRecordingPermissions:resolve reject:reject];
143
140
  }
@@ -177,7 +174,9 @@ RCT_EXPORT_METHOD(
177
174
  }
178
175
  }
179
176
 
180
- _eventHandler->invokeHandlerWithEventBody(name, body);
177
+ if (_eventHandler != nullptr) {
178
+ _eventHandler->invokeHandlerWithEventBody(name, body);
179
+ }
181
180
  }
182
181
 
183
182
  @end
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _AudioScheduledSourceNode = _interopRequireDefault(require("./AudioScheduledSourceNode"));
8
7
  var _AudioParam = _interopRequireDefault(require("./AudioParam"));
8
+ var _AudioScheduledSourceNode = _interopRequireDefault(require("./AudioScheduledSourceNode"));
9
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
10
  class AudioBufferBaseSourceNode extends _AudioScheduledSourceNode.default {
11
11
  constructor(context, node) {
@@ -13,20 +13,24 @@ class AudioBufferBaseSourceNode extends _AudioScheduledSourceNode.default {
13
13
  this.detune = new _AudioParam.default(node.detune, context);
14
14
  this.playbackRate = new _AudioParam.default(node.playbackRate, context);
15
15
  }
16
-
17
- // eslint-disable-next-line accessor-pairs
16
+ get onPositionChanged() {
17
+ return this.positionChangedCallback;
18
+ }
18
19
  set onPositionChanged(callback) {
19
20
  if (!callback) {
21
+ this.node.onPositionChanged = '0';
20
22
  this.positionChangedSubscription?.remove();
21
23
  this.positionChangedSubscription = undefined;
22
- this.node.onPositionChanged = '0';
24
+ this.positionChangedCallback = undefined;
23
25
  return;
24
26
  }
27
+ this.positionChangedCallback = callback;
25
28
  this.positionChangedSubscription = this.audioEventEmitter.addAudioEventListener('positionChanged', callback);
26
29
  this.node.onPositionChanged = this.positionChangedSubscription.subscriptionId;
27
30
  }
28
-
29
- // eslint-disable-next-line accessor-pairs
31
+ get onPositionChangedInterval() {
32
+ return this.node.onPositionChangedInterval;
33
+ }
30
34
  set onPositionChangedInterval(value) {
31
35
  this.node.onPositionChangedInterval = value;
32
36
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_AudioScheduledSourceNode","_interopRequireDefault","require","_AudioParam","e","__esModule","default","AudioBufferBaseSourceNode","AudioScheduledSourceNode","constructor","context","node","detune","AudioParam","playbackRate","onPositionChanged","callback","positionChangedSubscription","remove","undefined","audioEventEmitter","addAudioEventListener","subscriptionId","onPositionChangedInterval","value","exports"],"sourceRoot":"../../../src","sources":["core/AudioBufferBaseSourceNode.ts"],"mappings":";;;;;;AACA,IAAAA,yBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAsC,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAIvB,MAAMG,yBAAyB,SAASC,iCAAwB,CAAC;EAK9EC,WAAWA,CAACC,OAAyB,EAAEC,IAAgC,EAAE;IACvE,KAAK,CAACD,OAAO,EAAEC,IAAI,CAAC;IAEpB,IAAI,CAACC,MAAM,GAAG,IAAIC,mBAAU,CAACF,IAAI,CAACC,MAAM,EAAEF,OAAO,CAAC;IAClD,IAAI,CAACI,YAAY,GAAG,IAAID,mBAAU,CAACF,IAAI,CAACG,YAAY,EAAEJ,OAAO,CAAC;EAChE;;EAEA;EACA,IAAWK,iBAAiBA,CAC1BC,QAAsD,EACtD;IACA,IAAI,CAACA,QAAQ,EAAE;MACb,IAAI,CAACC,2BAA2B,EAAEC,MAAM,CAAC,CAAC;MAC1C,IAAI,CAACD,2BAA2B,GAAGE,SAAS;MAC3C,IAAI,CAACR,IAAI,CAAgCI,iBAAiB,GAAG,GAAG;MACjE;IACF;IACA,IAAI,CAACE,2BAA2B,GAC9B,IAAI,CAACG,iBAAiB,CAACC,qBAAqB,CAAC,iBAAiB,EAAEL,QAAQ,CAAC;IAE1E,IAAI,CAACL,IAAI,CAAgCI,iBAAiB,GACzD,IAAI,CAACE,2BAA2B,CAACK,cAAc;EACnD;;EAEA;EACA,IAAWC,yBAAyBA,CAACC,KAAa,EAAE;IACjD,IAAI,CAACb,IAAI,CAAgCY,yBAAyB,GAAGC,KAAK;EAC7E;AACF;AAACC,OAAA,CAAAnB,OAAA,GAAAC,yBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_AudioParam","_interopRequireDefault","require","_AudioScheduledSourceNode","e","__esModule","default","AudioBufferBaseSourceNode","AudioScheduledSourceNode","constructor","context","node","detune","AudioParam","playbackRate","onPositionChanged","positionChangedCallback","callback","positionChangedSubscription","remove","undefined","audioEventEmitter","addAudioEventListener","subscriptionId","onPositionChangedInterval","value","exports"],"sourceRoot":"../../../src","sources":["core/AudioBufferBaseSourceNode.ts"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,yBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAkE,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEnD,MAAMG,yBAAyB,SAASC,iCAAwB,CAAC;EAM9EC,WAAWA,CAACC,OAAyB,EAAEC,IAAgC,EAAE;IACvE,KAAK,CAACD,OAAO,EAAEC,IAAI,CAAC;IAEpB,IAAI,CAACC,MAAM,GAAG,IAAIC,mBAAU,CAACF,IAAI,CAACC,MAAM,EAAEF,OAAO,CAAC;IAClD,IAAI,CAACI,YAAY,GAAG,IAAID,mBAAU,CAACF,IAAI,CAACG,YAAY,EAAEJ,OAAO,CAAC;EAChE;EAEA,IAAWK,iBAAiBA,CAAA,EAEd;IACZ,OAAO,IAAI,CAACC,uBAAuB;EACrC;EAEA,IAAWD,iBAAiBA,CAC1BE,QAAsD,EACtD;IACA,IAAI,CAACA,QAAQ,EAAE;MACZ,IAAI,CAACN,IAAI,CAAgCI,iBAAiB,GAAG,GAAG;MACjE,IAAI,CAACG,2BAA2B,EAAEC,MAAM,CAAC,CAAC;MAC1C,IAAI,CAACD,2BAA2B,GAAGE,SAAS;MAC5C,IAAI,CAACJ,uBAAuB,GAAGI,SAAS;MAExC;IACF;IAEA,IAAI,CAACJ,uBAAuB,GAAGC,QAAQ;IACvC,IAAI,CAACC,2BAA2B,GAC9B,IAAI,CAACG,iBAAiB,CAACC,qBAAqB,CAAC,iBAAiB,EAAEL,QAAQ,CAAC;IAE1E,IAAI,CAACN,IAAI,CAAgCI,iBAAiB,GACzD,IAAI,CAACG,2BAA2B,CAACK,cAAc;EACnD;EAEA,IAAWC,yBAAyBA,CAAA,EAAW;IAC7C,OAAQ,IAAI,CAACb,IAAI,CAAgCa,yBAAyB;EAC5E;EAEA,IAAWA,yBAAyBA,CAACC,KAAa,EAAE;IACjD,IAAI,CAACd,IAAI,CAAgCa,yBAAyB,GAAGC,KAAK;EAC7E;AACF;AAACC,OAAA,CAAApB,OAAA,GAAAC,yBAAA","ignoreList":[]}
@@ -30,14 +30,18 @@ class AudioScheduledSourceNode extends _AudioNode.default {
30
30
  }
31
31
  this.node.stop(when);
32
32
  }
33
-
34
- // eslint-disable-next-line accessor-pairs
33
+ get onended() {
34
+ return this.onEndedCallback;
35
+ }
35
36
  set onended(callback) {
36
37
  if (!callback) {
38
+ this.node.onended = '0';
37
39
  this.onendedSubscription?.remove();
38
40
  this.onendedSubscription = undefined;
41
+ this.onEndedCallback = undefined;
39
42
  return;
40
43
  }
44
+ this.onEndedCallback = callback;
41
45
  this.onendedSubscription = this.audioEventEmitter.addAudioEventListener('ended', callback);
42
46
  this.node.onended = this.onendedSubscription.subscriptionId;
43
47
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_AudioNode","_interopRequireDefault","require","_errors","_events","e","__esModule","default","AudioScheduledSourceNode","AudioNode","hasBeenStarted","audioEventEmitter","AudioEventEmitter","global","start","when","RangeError","InvalidStateError","node","stop","onended","callback","onendedSubscription","remove","undefined","addAudioEventListener","subscriptionId","exports"],"sourceRoot":"../../../src","sources":["core/AudioScheduledSourceNode.ts"],"mappings":";;;;;;AACA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAAsE,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEvD,MAAMG,wBAAwB,SAASC,kBAAS,CAAC;EACpDC,cAAc,GAAY,KAAK;EACtBC,iBAAiB,GAAG,IAAIC,yBAAiB,CAC1DC,MAAM,CAACD,iBACT,CAAC;EAIME,KAAKA,CAACC,IAAY,GAAG,CAAC,EAAQ;IACnC,IAAIA,IAAI,GAAG,CAAC,EAAE;MACZ,MAAM,IAAIC,kBAAU,CAClB,8CAA8CD,IAAI,EACpD,CAAC;IACH;IAEA,IAAI,IAAI,CAACL,cAAc,EAAE;MACvB,MAAM,IAAIO,yBAAiB,CAAC,kCAAkC,CAAC;IACjE;IAEA,IAAI,CAACP,cAAc,GAAG,IAAI;IACzB,IAAI,CAACQ,IAAI,CAA+BJ,KAAK,CAACC,IAAI,CAAC;EACtD;EAEOI,IAAIA,CAACJ,IAAY,GAAG,CAAC,EAAQ;IAClC,IAAIA,IAAI,GAAG,CAAC,EAAE;MACZ,MAAM,IAAIC,kBAAU,CAClB,8CAA8CD,IAAI,EACpD,CAAC;IACH;IAEA,IAAI,CAAC,IAAI,CAACL,cAAc,EAAE;MACxB,MAAM,IAAIO,yBAAiB,CACzB,8CACF,CAAC;IACH;IAEC,IAAI,CAACC,IAAI,CAA+BC,IAAI,CAACJ,IAAI,CAAC;EACrD;;EAEA;EACA,IAAWK,OAAOA,CAACC,QAAkD,EAAE;IACrE,IAAI,CAACA,QAAQ,EAAE;MACb,IAAI,CAACC,mBAAmB,EAAEC,MAAM,CAAC,CAAC;MAClC,IAAI,CAACD,mBAAmB,GAAGE,SAAS;MACpC;IACF;IACA,IAAI,CAACF,mBAAmB,GAAG,IAAI,CAACX,iBAAiB,CAACc,qBAAqB,CACrE,OAAO,EACPJ,QACF,CAAC;IAEA,IAAI,CAACH,IAAI,CAA+BE,OAAO,GAC9C,IAAI,CAACE,mBAAmB,CAACI,cAAc;EAC3C;AACF;AAACC,OAAA,CAAApB,OAAA,GAAAC,wBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_AudioNode","_interopRequireDefault","require","_errors","_events","e","__esModule","default","AudioScheduledSourceNode","AudioNode","hasBeenStarted","audioEventEmitter","AudioEventEmitter","global","start","when","RangeError","InvalidStateError","node","stop","onended","onEndedCallback","callback","onendedSubscription","remove","undefined","addAudioEventListener","subscriptionId","exports"],"sourceRoot":"../../../src","sources":["core/AudioScheduledSourceNode.ts"],"mappings":";;;;;;AACA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAAsE,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEvD,MAAMG,wBAAwB,SAASC,kBAAS,CAAC;EACpDC,cAAc,GAAY,KAAK;EACtBC,iBAAiB,GAAG,IAAIC,yBAAiB,CAC1DC,MAAM,CAACD,iBACT,CAAC;EAKME,KAAKA,CAACC,IAAY,GAAG,CAAC,EAAQ;IACnC,IAAIA,IAAI,GAAG,CAAC,EAAE;MACZ,MAAM,IAAIC,kBAAU,CAClB,8CAA8CD,IAAI,EACpD,CAAC;IACH;IAEA,IAAI,IAAI,CAACL,cAAc,EAAE;MACvB,MAAM,IAAIO,yBAAiB,CAAC,kCAAkC,CAAC;IACjE;IAEA,IAAI,CAACP,cAAc,GAAG,IAAI;IACzB,IAAI,CAACQ,IAAI,CAA+BJ,KAAK,CAACC,IAAI,CAAC;EACtD;EAEOI,IAAIA,CAACJ,IAAY,GAAG,CAAC,EAAQ;IAClC,IAAIA,IAAI,GAAG,CAAC,EAAE;MACZ,MAAM,IAAIC,kBAAU,CAClB,8CAA8CD,IAAI,EACpD,CAAC;IACH;IAEA,IAAI,CAAC,IAAI,CAACL,cAAc,EAAE;MACxB,MAAM,IAAIO,yBAAiB,CACzB,8CACF,CAAC;IACH;IAEC,IAAI,CAACC,IAAI,CAA+BC,IAAI,CAACJ,IAAI,CAAC;EACrD;EAEA,IAAWK,OAAOA,CAAA,EAAkD;IAClE,OAAO,IAAI,CAACC,eAAe;EAC7B;EAEA,IAAWD,OAAOA,CAACE,QAAkD,EAAE;IACrE,IAAI,CAACA,QAAQ,EAAE;MACZ,IAAI,CAACJ,IAAI,CAA+BE,OAAO,GAAG,GAAG;MACtD,IAAI,CAACG,mBAAmB,EAAEC,MAAM,CAAC,CAAC;MAClC,IAAI,CAACD,mBAAmB,GAAGE,SAAS;MACpC,IAAI,CAACJ,eAAe,GAAGI,SAAS;MAChC;IACF;IAEA,IAAI,CAACJ,eAAe,GAAGC,QAAQ;IAC/B,IAAI,CAACC,mBAAmB,GAAG,IAAI,CAACZ,iBAAiB,CAACe,qBAAqB,CACrE,OAAO,EACPJ,QACF,CAAC;IAEA,IAAI,CAACJ,IAAI,CAA+BE,OAAO,GAC9C,IAAI,CAACG,mBAAmB,CAACI,cAAc;EAC3C;AACF;AAACC,OAAA,CAAArB,OAAA,GAAAC,wBAAA","ignoreList":[]}
@@ -1,27 +1,31 @@
1
1
  "use strict";
2
2
 
3
- import AudioScheduledSourceNode from "./AudioScheduledSourceNode.js";
4
3
  import AudioParam from "./AudioParam.js";
4
+ import AudioScheduledSourceNode from "./AudioScheduledSourceNode.js";
5
5
  export default class AudioBufferBaseSourceNode extends AudioScheduledSourceNode {
6
6
  constructor(context, node) {
7
7
  super(context, node);
8
8
  this.detune = new AudioParam(node.detune, context);
9
9
  this.playbackRate = new AudioParam(node.playbackRate, context);
10
10
  }
11
-
12
- // eslint-disable-next-line accessor-pairs
11
+ get onPositionChanged() {
12
+ return this.positionChangedCallback;
13
+ }
13
14
  set onPositionChanged(callback) {
14
15
  if (!callback) {
16
+ this.node.onPositionChanged = '0';
15
17
  this.positionChangedSubscription?.remove();
16
18
  this.positionChangedSubscription = undefined;
17
- this.node.onPositionChanged = '0';
19
+ this.positionChangedCallback = undefined;
18
20
  return;
19
21
  }
22
+ this.positionChangedCallback = callback;
20
23
  this.positionChangedSubscription = this.audioEventEmitter.addAudioEventListener('positionChanged', callback);
21
24
  this.node.onPositionChanged = this.positionChangedSubscription.subscriptionId;
22
25
  }
23
-
24
- // eslint-disable-next-line accessor-pairs
26
+ get onPositionChangedInterval() {
27
+ return this.node.onPositionChangedInterval;
28
+ }
25
29
  set onPositionChangedInterval(value) {
26
30
  this.node.onPositionChangedInterval = value;
27
31
  }
@@ -1 +1 @@
1
- {"version":3,"names":["AudioScheduledSourceNode","AudioParam","AudioBufferBaseSourceNode","constructor","context","node","detune","playbackRate","onPositionChanged","callback","positionChangedSubscription","remove","undefined","audioEventEmitter","addAudioEventListener","subscriptionId","onPositionChangedInterval","value"],"sourceRoot":"../../../src","sources":["core/AudioBufferBaseSourceNode.ts"],"mappings":";;AACA,OAAOA,wBAAwB,MAAM,+BAA4B;AAEjE,OAAOC,UAAU,MAAM,iBAAc;AAIrC,eAAe,MAAMC,yBAAyB,SAASF,wBAAwB,CAAC;EAK9EG,WAAWA,CAACC,OAAyB,EAAEC,IAAgC,EAAE;IACvE,KAAK,CAACD,OAAO,EAAEC,IAAI,CAAC;IAEpB,IAAI,CAACC,MAAM,GAAG,IAAIL,UAAU,CAACI,IAAI,CAACC,MAAM,EAAEF,OAAO,CAAC;IAClD,IAAI,CAACG,YAAY,GAAG,IAAIN,UAAU,CAACI,IAAI,CAACE,YAAY,EAAEH,OAAO,CAAC;EAChE;;EAEA;EACA,IAAWI,iBAAiBA,CAC1BC,QAAsD,EACtD;IACA,IAAI,CAACA,QAAQ,EAAE;MACb,IAAI,CAACC,2BAA2B,EAAEC,MAAM,CAAC,CAAC;MAC1C,IAAI,CAACD,2BAA2B,GAAGE,SAAS;MAC3C,IAAI,CAACP,IAAI,CAAgCG,iBAAiB,GAAG,GAAG;MACjE;IACF;IACA,IAAI,CAACE,2BAA2B,GAC9B,IAAI,CAACG,iBAAiB,CAACC,qBAAqB,CAAC,iBAAiB,EAAEL,QAAQ,CAAC;IAE1E,IAAI,CAACJ,IAAI,CAAgCG,iBAAiB,GACzD,IAAI,CAACE,2BAA2B,CAACK,cAAc;EACnD;;EAEA;EACA,IAAWC,yBAAyBA,CAACC,KAAa,EAAE;IACjD,IAAI,CAACZ,IAAI,CAAgCW,yBAAyB,GAAGC,KAAK;EAC7E;AACF","ignoreList":[]}
1
+ {"version":3,"names":["AudioParam","AudioScheduledSourceNode","AudioBufferBaseSourceNode","constructor","context","node","detune","playbackRate","onPositionChanged","positionChangedCallback","callback","positionChangedSubscription","remove","undefined","audioEventEmitter","addAudioEventListener","subscriptionId","onPositionChangedInterval","value"],"sourceRoot":"../../../src","sources":["core/AudioBufferBaseSourceNode.ts"],"mappings":";;AAAA,OAAOA,UAAU,MAAM,iBAAc;AAKrC,OAAOC,wBAAwB,MAAM,+BAA4B;AAEjE,eAAe,MAAMC,yBAAyB,SAASD,wBAAwB,CAAC;EAM9EE,WAAWA,CAACC,OAAyB,EAAEC,IAAgC,EAAE;IACvE,KAAK,CAACD,OAAO,EAAEC,IAAI,CAAC;IAEpB,IAAI,CAACC,MAAM,GAAG,IAAIN,UAAU,CAACK,IAAI,CAACC,MAAM,EAAEF,OAAO,CAAC;IAClD,IAAI,CAACG,YAAY,GAAG,IAAIP,UAAU,CAACK,IAAI,CAACE,YAAY,EAAEH,OAAO,CAAC;EAChE;EAEA,IAAWI,iBAAiBA,CAAA,EAEd;IACZ,OAAO,IAAI,CAACC,uBAAuB;EACrC;EAEA,IAAWD,iBAAiBA,CAC1BE,QAAsD,EACtD;IACA,IAAI,CAACA,QAAQ,EAAE;MACZ,IAAI,CAACL,IAAI,CAAgCG,iBAAiB,GAAG,GAAG;MACjE,IAAI,CAACG,2BAA2B,EAAEC,MAAM,CAAC,CAAC;MAC1C,IAAI,CAACD,2BAA2B,GAAGE,SAAS;MAC5C,IAAI,CAACJ,uBAAuB,GAAGI,SAAS;MAExC;IACF;IAEA,IAAI,CAACJ,uBAAuB,GAAGC,QAAQ;IACvC,IAAI,CAACC,2BAA2B,GAC9B,IAAI,CAACG,iBAAiB,CAACC,qBAAqB,CAAC,iBAAiB,EAAEL,QAAQ,CAAC;IAE1E,IAAI,CAACL,IAAI,CAAgCG,iBAAiB,GACzD,IAAI,CAACG,2BAA2B,CAACK,cAAc;EACnD;EAEA,IAAWC,yBAAyBA,CAAA,EAAW;IAC7C,OAAQ,IAAI,CAACZ,IAAI,CAAgCY,yBAAyB;EAC5E;EAEA,IAAWA,yBAAyBA,CAACC,KAAa,EAAE;IACjD,IAAI,CAACb,IAAI,CAAgCY,yBAAyB,GAAGC,KAAK;EAC7E;AACF","ignoreList":[]}
@@ -25,14 +25,18 @@ export default class AudioScheduledSourceNode extends AudioNode {
25
25
  }
26
26
  this.node.stop(when);
27
27
  }
28
-
29
- // eslint-disable-next-line accessor-pairs
28
+ get onended() {
29
+ return this.onEndedCallback;
30
+ }
30
31
  set onended(callback) {
31
32
  if (!callback) {
33
+ this.node.onended = '0';
32
34
  this.onendedSubscription?.remove();
33
35
  this.onendedSubscription = undefined;
36
+ this.onEndedCallback = undefined;
34
37
  return;
35
38
  }
39
+ this.onEndedCallback = callback;
36
40
  this.onendedSubscription = this.audioEventEmitter.addAudioEventListener('ended', callback);
37
41
  this.node.onended = this.onendedSubscription.subscriptionId;
38
42
  }
@@ -1 +1 @@
1
- {"version":3,"names":["AudioNode","InvalidStateError","RangeError","AudioEventEmitter","AudioScheduledSourceNode","hasBeenStarted","audioEventEmitter","global","start","when","node","stop","onended","callback","onendedSubscription","remove","undefined","addAudioEventListener","subscriptionId"],"sourceRoot":"../../../src","sources":["core/AudioScheduledSourceNode.ts"],"mappings":";;AACA,OAAOA,SAAS,MAAM,gBAAa;AACnC,SAASC,iBAAiB,EAAEC,UAAU,QAAQ,oBAAW;AAEzD,SAASC,iBAAiB,QAAgC,oBAAW;AAErE,eAAe,MAAMC,wBAAwB,SAASJ,SAAS,CAAC;EACpDK,cAAc,GAAY,KAAK;EACtBC,iBAAiB,GAAG,IAAIH,iBAAiB,CAC1DI,MAAM,CAACJ,iBACT,CAAC;EAIMK,KAAKA,CAACC,IAAY,GAAG,CAAC,EAAQ;IACnC,IAAIA,IAAI,GAAG,CAAC,EAAE;MACZ,MAAM,IAAIP,UAAU,CAClB,8CAA8CO,IAAI,EACpD,CAAC;IACH;IAEA,IAAI,IAAI,CAACJ,cAAc,EAAE;MACvB,MAAM,IAAIJ,iBAAiB,CAAC,kCAAkC,CAAC;IACjE;IAEA,IAAI,CAACI,cAAc,GAAG,IAAI;IACzB,IAAI,CAACK,IAAI,CAA+BF,KAAK,CAACC,IAAI,CAAC;EACtD;EAEOE,IAAIA,CAACF,IAAY,GAAG,CAAC,EAAQ;IAClC,IAAIA,IAAI,GAAG,CAAC,EAAE;MACZ,MAAM,IAAIP,UAAU,CAClB,8CAA8CO,IAAI,EACpD,CAAC;IACH;IAEA,IAAI,CAAC,IAAI,CAACJ,cAAc,EAAE;MACxB,MAAM,IAAIJ,iBAAiB,CACzB,8CACF,CAAC;IACH;IAEC,IAAI,CAACS,IAAI,CAA+BC,IAAI,CAACF,IAAI,CAAC;EACrD;;EAEA;EACA,IAAWG,OAAOA,CAACC,QAAkD,EAAE;IACrE,IAAI,CAACA,QAAQ,EAAE;MACb,IAAI,CAACC,mBAAmB,EAAEC,MAAM,CAAC,CAAC;MAClC,IAAI,CAACD,mBAAmB,GAAGE,SAAS;MACpC;IACF;IACA,IAAI,CAACF,mBAAmB,GAAG,IAAI,CAACR,iBAAiB,CAACW,qBAAqB,CACrE,OAAO,EACPJ,QACF,CAAC;IAEA,IAAI,CAACH,IAAI,CAA+BE,OAAO,GAC9C,IAAI,CAACE,mBAAmB,CAACI,cAAc;EAC3C;AACF","ignoreList":[]}
1
+ {"version":3,"names":["AudioNode","InvalidStateError","RangeError","AudioEventEmitter","AudioScheduledSourceNode","hasBeenStarted","audioEventEmitter","global","start","when","node","stop","onended","onEndedCallback","callback","onendedSubscription","remove","undefined","addAudioEventListener","subscriptionId"],"sourceRoot":"../../../src","sources":["core/AudioScheduledSourceNode.ts"],"mappings":";;AACA,OAAOA,SAAS,MAAM,gBAAa;AACnC,SAASC,iBAAiB,EAAEC,UAAU,QAAQ,oBAAW;AAEzD,SAASC,iBAAiB,QAAgC,oBAAW;AAErE,eAAe,MAAMC,wBAAwB,SAASJ,SAAS,CAAC;EACpDK,cAAc,GAAY,KAAK;EACtBC,iBAAiB,GAAG,IAAIH,iBAAiB,CAC1DI,MAAM,CAACJ,iBACT,CAAC;EAKMK,KAAKA,CAACC,IAAY,GAAG,CAAC,EAAQ;IACnC,IAAIA,IAAI,GAAG,CAAC,EAAE;MACZ,MAAM,IAAIP,UAAU,CAClB,8CAA8CO,IAAI,EACpD,CAAC;IACH;IAEA,IAAI,IAAI,CAACJ,cAAc,EAAE;MACvB,MAAM,IAAIJ,iBAAiB,CAAC,kCAAkC,CAAC;IACjE;IAEA,IAAI,CAACI,cAAc,GAAG,IAAI;IACzB,IAAI,CAACK,IAAI,CAA+BF,KAAK,CAACC,IAAI,CAAC;EACtD;EAEOE,IAAIA,CAACF,IAAY,GAAG,CAAC,EAAQ;IAClC,IAAIA,IAAI,GAAG,CAAC,EAAE;MACZ,MAAM,IAAIP,UAAU,CAClB,8CAA8CO,IAAI,EACpD,CAAC;IACH;IAEA,IAAI,CAAC,IAAI,CAACJ,cAAc,EAAE;MACxB,MAAM,IAAIJ,iBAAiB,CACzB,8CACF,CAAC;IACH;IAEC,IAAI,CAACS,IAAI,CAA+BC,IAAI,CAACF,IAAI,CAAC;EACrD;EAEA,IAAWG,OAAOA,CAAA,EAAkD;IAClE,OAAO,IAAI,CAACC,eAAe;EAC7B;EAEA,IAAWD,OAAOA,CAACE,QAAkD,EAAE;IACrE,IAAI,CAACA,QAAQ,EAAE;MACZ,IAAI,CAACJ,IAAI,CAA+BE,OAAO,GAAG,GAAG;MACtD,IAAI,CAACG,mBAAmB,EAAEC,MAAM,CAAC,CAAC;MAClC,IAAI,CAACD,mBAAmB,GAAGE,SAAS;MACpC,IAAI,CAACJ,eAAe,GAAGI,SAAS;MAChC;IACF;IAEA,IAAI,CAACJ,eAAe,GAAGC,QAAQ;IAC/B,IAAI,CAACC,mBAAmB,GAAG,IAAI,CAACT,iBAAiB,CAACY,qBAAqB,CACrE,OAAO,EACPJ,QACF,CAAC;IAEA,IAAI,CAACJ,IAAI,CAA+BE,OAAO,GAC9C,IAAI,CAACG,mBAAmB,CAACI,cAAc;EAC3C;AACF","ignoreList":[]}
@@ -1,14 +1,17 @@
1
- import { IAudioBufferBaseSourceNode } from '../interfaces';
2
- import AudioScheduledSourceNode from './AudioScheduledSourceNode';
3
- import BaseAudioContext from './BaseAudioContext';
4
1
  import AudioParam from './AudioParam';
2
+ import BaseAudioContext from './BaseAudioContext';
5
3
  import { EventTypeWithValue } from '../events/types';
4
+ import { IAudioBufferBaseSourceNode } from '../interfaces';
5
+ import AudioScheduledSourceNode from './AudioScheduledSourceNode';
6
6
  export default class AudioBufferBaseSourceNode extends AudioScheduledSourceNode {
7
7
  readonly playbackRate: AudioParam;
8
8
  readonly detune: AudioParam;
9
9
  private positionChangedSubscription?;
10
+ private positionChangedCallback?;
10
11
  constructor(context: BaseAudioContext, node: IAudioBufferBaseSourceNode);
12
+ get onPositionChanged(): ((event: EventTypeWithValue) => void) | undefined;
11
13
  set onPositionChanged(callback: ((event: EventTypeWithValue) => void) | null);
14
+ get onPositionChangedInterval(): number;
12
15
  set onPositionChangedInterval(value: number);
13
16
  }
14
17
  //# sourceMappingURL=AudioBufferBaseSourceNode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AudioBufferBaseSourceNode.d.ts","sourceRoot":"","sources":["../../../src/core/AudioBufferBaseSourceNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAClE,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGrD,MAAM,CAAC,OAAO,OAAO,yBAA0B,SAAQ,wBAAwB;IAC7E,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,OAAO,CAAC,2BAA2B,CAAC,CAAyB;gBAEjD,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,0BAA0B;IAQvE,IAAW,iBAAiB,CAC1B,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC,GAAG,IAAI,EAavD;IAGD,IAAW,yBAAyB,CAAC,KAAK,EAAE,MAAM,EAEjD;CACF"}
1
+ {"version":3,"file":"AudioBufferBaseSourceNode.d.ts","sourceRoot":"","sources":["../../../src/core/AudioBufferBaseSourceNode.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAElE,MAAM,CAAC,OAAO,OAAO,yBAA0B,SAAQ,wBAAwB;IAC7E,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,OAAO,CAAC,2BAA2B,CAAC,CAAyB;IAC7D,OAAO,CAAC,uBAAuB,CAAC,CAAsC;gBAE1D,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,0BAA0B;IAOvE,IAAW,iBAAiB,IACxB,CAAC,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC,GACrC,SAAS,CAEZ;IAED,IAAW,iBAAiB,CAC1B,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC,GAAG,IAAI,EAiBvD;IAED,IAAW,yBAAyB,IAAI,MAAM,CAE7C;IAED,IAAW,yBAAyB,CAAC,KAAK,EAAE,MAAM,EAEjD;CACF"}