react-native-audio-api 0.8.3 → 0.8.4

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.
@@ -23,15 +23,6 @@ AudioBufferBaseSourceNode::AudioBufferBaseSourceNode(BaseAudioContext *context)
23
23
  std::make_shared<signalsmith::stretch::SignalsmithStretch<float>>();
24
24
  }
25
25
 
26
- AudioBufferBaseSourceNode::~AudioBufferBaseSourceNode() {
27
- if (onPositionChangedCallbackId_ != 0 &&
28
- context_->audioEventHandlerRegistry_ != nullptr) {
29
- context_->audioEventHandlerRegistry_->unregisterHandler(
30
- "positionChanged", onPositionChangedCallbackId_);
31
- onPositionChangedCallbackId_ = 0;
32
- }
33
- }
34
-
35
26
  std::shared_ptr<AudioParam> AudioBufferBaseSourceNode::getDetuneParam() const {
36
27
  return detuneParam_;
37
28
  }
@@ -15,7 +15,6 @@ class AudioParam;
15
15
  class AudioBufferBaseSourceNode : public AudioScheduledSourceNode {
16
16
  public:
17
17
  explicit AudioBufferBaseSourceNode(BaseAudioContext *context);
18
- virtual ~AudioBufferBaseSourceNode();
19
18
 
20
19
  [[nodiscard]] std::shared_ptr<AudioParam> getDetuneParam() const;
21
20
  [[nodiscard]] std::shared_ptr<AudioParam> getPlaybackRateParam() const;
@@ -16,15 +16,6 @@ AudioScheduledSourceNode::AudioScheduledSourceNode(BaseAudioContext *context)
16
16
  numberOfInputs_ = 0;
17
17
  }
18
18
 
19
- AudioScheduledSourceNode::~AudioScheduledSourceNode() {
20
- if (onEndedCallbackId_ != 0 &&
21
- context_->audioEventHandlerRegistry_ != nullptr) {
22
- context_->audioEventHandlerRegistry_->unregisterHandler(
23
- "ended", onEndedCallbackId_);
24
- onEndedCallbackId_ = 0;
25
- }
26
- }
27
-
28
19
  void AudioScheduledSourceNode::start(double when) {
29
20
  playbackState_ = PlaybackState::SCHEDULED;
30
21
  startTime_ = when;
@@ -27,7 +27,6 @@ class AudioScheduledSourceNode : public AudioNode {
27
27
  // FINISHED: The node has finished playing.
28
28
  enum class PlaybackState { UNSCHEDULED, SCHEDULED, PLAYING, STOP_SCHEDULED, FINISHED };
29
29
  explicit AudioScheduledSourceNode(BaseAudioContext *context);
30
- virtual ~AudioScheduledSourceNode();
31
30
 
32
31
  void start(double when);
33
32
  virtual void stop(double when);
@@ -156,8 +156,12 @@ void AudioEventHandlerRegistry::invokeHandlerWithEventBody(
156
156
 
157
157
  // In case of debugging this, please increment the hours spent counter
158
158
 
159
- // Hours spent on this: 5
159
+ // Hours spent on this: 8
160
160
  try {
161
+ if (!handlerIt->second || !handlerIt->second->isFunction(*runtime_)) {
162
+ // If the handler is not valid, we can skip it
163
+ return;
164
+ }
161
165
  jsi::Object eventObject(*runtime_);
162
166
  // handle special logic for microphone, because we pass audio buffer which
163
167
  // has significant size
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-audio-api",
3
- "version": "0.8.3",
3
+ "version": "0.8.4",
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"