react-native-audio-api 0.12.0-nightly-3254662-20260127 → 0.12.0-nightly-1a3c43b-20260128
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/src/main/cpp/audioapi/CMakeLists.txt +0 -6
- package/android/src/main/cpp/audioapi/android/AudioAPIModule.cpp +3 -2
- package/android/src/main/cpp/audioapi/android/AudioAPIModule.h +1 -1
- package/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.cpp +1 -1
- package/android/src/main/java/com/swmansion/audioapi/AudioAPIModule.kt +5 -1
- package/android/src/main/java/com/swmansion/audioapi/system/AudioEvent.kt +28 -0
- package/android/src/main/java/com/swmansion/audioapi/system/AudioFocusListener.kt +4 -4
- package/android/src/main/java/com/swmansion/audioapi/system/VolumeChangeListener.kt +1 -1
- package/android/src/main/java/com/swmansion/audioapi/system/notification/PlaybackNotification.kt +27 -18
- package/android/src/main/java/com/swmansion/audioapi/system/notification/PlaybackNotificationReceiver.kt +13 -8
- package/android/src/main/java/com/swmansion/audioapi/system/notification/RecordingNotificationReceiver.kt +3 -2
- package/android/src/oldarch/NativeAudioAPIModuleSpec.java +2 -2
- package/common/cpp/audioapi/AudioAPIModuleInstaller.h +9 -12
- package/common/cpp/audioapi/HostObjects/AudioContextHostObject.cpp +4 -2
- package/common/cpp/audioapi/HostObjects/AudioContextHostObject.h +5 -1
- package/common/cpp/audioapi/HostObjects/BaseAudioContextHostObject.cpp +38 -38
- package/common/cpp/audioapi/HostObjects/BaseAudioContextHostObject.h +4 -2
- package/common/cpp/audioapi/HostObjects/OfflineAudioContextHostObject.cpp +8 -4
- package/common/cpp/audioapi/HostObjects/OfflineAudioContextHostObject.h +7 -1
- package/common/cpp/audioapi/HostObjects/analysis/AnalyserNodeHostObject.cpp +6 -4
- package/common/cpp/audioapi/HostObjects/analysis/AnalyserNodeHostObject.h +6 -2
- package/common/cpp/audioapi/HostObjects/effects/BiquadFilterNodeHostObject.cpp +8 -5
- package/common/cpp/audioapi/HostObjects/effects/BiquadFilterNodeHostObject.h +5 -3
- package/common/cpp/audioapi/HostObjects/effects/ConvolverNodeHostObject.cpp +5 -3
- package/common/cpp/audioapi/HostObjects/effects/ConvolverNodeHostObject.h +5 -2
- package/common/cpp/audioapi/HostObjects/effects/DelayNodeHostObject.cpp +4 -3
- package/common/cpp/audioapi/HostObjects/effects/DelayNodeHostObject.h +5 -2
- package/common/cpp/audioapi/HostObjects/effects/GainNodeHostObject.cpp +6 -2
- package/common/cpp/audioapi/HostObjects/effects/GainNodeHostObject.h +5 -2
- package/common/cpp/audioapi/HostObjects/effects/IIRFilterNodeHostObject.cpp +6 -2
- package/common/cpp/audioapi/HostObjects/effects/IIRFilterNodeHostObject.h +5 -2
- package/common/cpp/audioapi/HostObjects/effects/StereoPannerNodeHostObject.cpp +5 -2
- package/common/cpp/audioapi/HostObjects/effects/StereoPannerNodeHostObject.h +5 -2
- package/common/cpp/audioapi/HostObjects/effects/WaveShaperNodeHostObject.cpp +9 -4
- package/common/cpp/audioapi/HostObjects/effects/WaveShaperNodeHostObject.h +5 -2
- package/common/cpp/audioapi/HostObjects/events/AudioEventHandlerRegistryHostObject.cpp +3 -2
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferQueueSourceNodeHostObject.cpp +9 -6
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferQueueSourceNodeHostObject.h +4 -2
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferSourceNodeHostObject.cpp +5 -2
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferSourceNodeHostObject.h +5 -2
- package/common/cpp/audioapi/HostObjects/sources/ConstantSourceNodeHostObject.cpp +5 -2
- package/common/cpp/audioapi/HostObjects/sources/ConstantSourceNodeHostObject.h +5 -2
- package/common/cpp/audioapi/HostObjects/sources/OscillatorNodeHostObject.cpp +7 -3
- package/common/cpp/audioapi/HostObjects/sources/OscillatorNodeHostObject.h +5 -2
- package/common/cpp/audioapi/HostObjects/sources/StreamerNodeHostObject.cpp +6 -2
- package/common/cpp/audioapi/HostObjects/sources/StreamerNodeHostObject.h +5 -2
- package/common/cpp/audioapi/HostObjects/utils/JsEnumParser.cpp +63 -0
- package/common/cpp/audioapi/HostObjects/utils/JsEnumParser.h +5 -0
- package/common/cpp/audioapi/core/AudioContext.cpp +2 -4
- package/common/cpp/audioapi/core/AudioNode.cpp +2 -2
- package/common/cpp/audioapi/core/AudioNode.h +6 -6
- package/common/cpp/audioapi/core/BaseAudioContext.cpp +7 -22
- package/common/cpp/audioapi/core/BaseAudioContext.h +20 -22
- package/common/cpp/audioapi/core/OfflineAudioContext.cpp +3 -6
- package/common/cpp/audioapi/core/analysis/AnalyserNode.cpp +5 -2
- package/common/cpp/audioapi/core/analysis/AnalyserNode.h +4 -2
- package/common/cpp/audioapi/core/destinations/AudioDestinationNode.cpp +1 -1
- package/common/cpp/audioapi/core/destinations/AudioDestinationNode.h +1 -1
- package/common/cpp/audioapi/core/effects/BiquadFilterNode.cpp +6 -6
- package/common/cpp/audioapi/core/effects/BiquadFilterNode.h +2 -2
- package/common/cpp/audioapi/core/effects/ConvolverNode.cpp +1 -1
- package/common/cpp/audioapi/core/effects/ConvolverNode.h +2 -2
- package/common/cpp/audioapi/core/effects/DelayNode.cpp +1 -1
- package/common/cpp/audioapi/core/effects/DelayNode.h +2 -2
- package/common/cpp/audioapi/core/effects/GainNode.cpp +1 -1
- package/common/cpp/audioapi/core/effects/GainNode.h +2 -2
- package/common/cpp/audioapi/core/effects/IIRFilterNode.cpp +5 -3
- package/common/cpp/audioapi/core/effects/IIRFilterNode.h +2 -2
- package/common/cpp/audioapi/core/effects/StereoPannerNode.cpp +5 -2
- package/common/cpp/audioapi/core/effects/StereoPannerNode.h +2 -2
- package/common/cpp/audioapi/core/effects/WaveShaperNode.cpp +4 -2
- package/common/cpp/audioapi/core/effects/WaveShaperNode.h +2 -2
- package/common/cpp/audioapi/core/sources/AudioBuffer.h +1 -1
- package/common/cpp/audioapi/core/sources/AudioBufferBaseSourceNode.cpp +10 -4
- package/common/cpp/audioapi/core/sources/AudioBufferBaseSourceNode.h +2 -2
- package/common/cpp/audioapi/core/sources/AudioBufferQueueSourceNode.cpp +13 -13
- package/common/cpp/audioapi/core/sources/AudioBufferQueueSourceNode.h +2 -2
- package/common/cpp/audioapi/core/sources/AudioBufferSourceNode.cpp +6 -5
- package/common/cpp/audioapi/core/sources/AudioBufferSourceNode.h +2 -2
- package/common/cpp/audioapi/core/sources/AudioScheduledSourceNode.cpp +2 -2
- package/common/cpp/audioapi/core/sources/ConstantSourceNode.cpp +10 -2
- package/common/cpp/audioapi/core/sources/ConstantSourceNode.h +2 -2
- package/common/cpp/audioapi/core/sources/OscillatorNode.cpp +11 -6
- package/common/cpp/audioapi/core/sources/OscillatorNode.h +2 -2
- package/common/cpp/audioapi/core/sources/StreamerNode.cpp +17 -4
- package/common/cpp/audioapi/core/sources/StreamerNode.h +4 -2
- package/common/cpp/audioapi/core/utils/AudioFileWriter.cpp +1 -1
- package/common/cpp/audioapi/core/utils/AudioRecorderCallback.cpp +2 -2
- package/common/cpp/audioapi/events/AudioEvent.h +30 -0
- package/common/cpp/audioapi/events/AudioEventHandlerRegistry.cpp +9 -20
- package/common/cpp/audioapi/events/AudioEventHandlerRegistry.h +7 -34
- package/common/cpp/audioapi/events/IAudioEventHandlerRegistry.h +5 -4
- package/common/cpp/test/src/MockAudioEventHandlerRegistry.h +5 -10
- package/ios/audioapi/ios/AudioAPIModule.h +3 -1
- package/ios/audioapi/ios/AudioAPIModule.mm +7 -6
- package/ios/audioapi/ios/system/AudioSessionManager.h +3 -1
- package/ios/audioapi/ios/system/AudioSessionManager.mm +8 -1
- package/ios/audioapi/ios/system/SystemNotificationManager.mm +17 -8
- package/ios/audioapi/ios/system/notification/PlaybackNotification.mm +36 -33
- package/lib/commonjs/core/AudioDecoder.js +2 -2
- package/lib/commonjs/core/AudioDecoder.js.map +1 -1
- package/lib/commonjs/specs/NativeAudioAPIModule.js.map +1 -1
- package/lib/commonjs/specs/NativeAudioAPIModule.web.js.map +1 -1
- package/lib/commonjs/system/AudioManager.js +1 -1
- package/lib/commonjs/system/AudioManager.js.map +1 -1
- package/lib/module/core/AudioDecoder.js +2 -2
- package/lib/module/core/AudioDecoder.js.map +1 -1
- package/lib/module/specs/NativeAudioAPIModule.js.map +1 -1
- package/lib/module/specs/NativeAudioAPIModule.web.js.map +1 -1
- package/lib/module/system/AudioManager.js +1 -1
- package/lib/module/system/AudioManager.js.map +1 -1
- package/lib/typescript/core/AudioDecoder.d.ts.map +1 -1
- package/lib/typescript/events/types.d.ts +1 -17
- package/lib/typescript/events/types.d.ts.map +1 -1
- package/lib/typescript/specs/NativeAudioAPIModule.d.ts +1 -1
- package/lib/typescript/specs/NativeAudioAPIModule.d.ts.map +1 -1
- package/lib/typescript/specs/NativeAudioAPIModule.web.d.ts +1 -1
- package/lib/typescript/specs/NativeAudioAPIModule.web.d.ts.map +1 -1
- package/lib/typescript/system/AudioManager.d.ts.map +1 -1
- package/lib/typescript/system/notification/types.d.ts +4 -3
- package/lib/typescript/system/notification/types.d.ts.map +1 -1
- package/lib/typescript/system/types.d.ts +8 -0
- package/lib/typescript/system/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/AudioDecoder.ts +2 -2
- package/src/events/types.ts +1 -18
- package/src/specs/NativeAudioAPIModule.ts +3 -2
- package/src/specs/NativeAudioAPIModule.web.ts +2 -1
- package/src/system/AudioManager.ts +2 -1
- package/src/system/notification/types.ts +6 -4
- package/src/system/types.ts +8 -0
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
namespace audioapi {
|
|
20
20
|
|
|
21
21
|
AudioBufferQueueSourceNode::AudioBufferQueueSourceNode(
|
|
22
|
-
std::shared_ptr<BaseAudioContext> context,
|
|
22
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
23
23
|
const BaseAudioBufferSourceOptions &options)
|
|
24
24
|
: AudioBufferBaseSourceNode(context, options) {
|
|
25
25
|
buffers_ = {};
|
|
@@ -130,11 +130,11 @@ void AudioBufferQueueSourceNode::disable() {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
void AudioBufferQueueSourceNode::setOnBufferEndedCallbackId(uint64_t callbackId) {
|
|
133
|
-
|
|
133
|
+
auto oldCallbackId = onBufferEndedCallbackId_.exchange(callbackId, std::memory_order_acq_rel);
|
|
134
134
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
if (oldCallbackId != 0) {
|
|
136
|
+
audioEventHandlerRegistry_->unregisterHandler(AudioEvent::BUFFER_ENDED, oldCallbackId);
|
|
137
|
+
}
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
std::shared_ptr<AudioBus> AudioBufferQueueSourceNode::processNode(
|
|
@@ -171,15 +171,15 @@ double AudioBufferQueueSourceNode::getCurrentPosition() const {
|
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
void AudioBufferQueueSourceNode::sendOnBufferEndedEvent(size_t bufferId, bool isLastBufferInQueue) {
|
|
174
|
-
|
|
174
|
+
auto onBufferEndedCallbackId = onBufferEndedCallbackId_.load(std::memory_order_acquire);
|
|
175
175
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
if (onBufferEndedCallbackId != 0) {
|
|
177
|
+
std::unordered_map<std::string, EventValue> body = {
|
|
178
|
+
{"bufferId", std::to_string(bufferId)}, {"isLastBufferInQueue", isLastBufferInQueue}};
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
audioEventHandlerRegistry_->invokeHandlerWithEventBody(
|
|
181
|
+
AudioEvent::BUFFER_ENDED, onBufferEndedCallbackId, body);
|
|
182
|
+
}
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
/**
|
|
@@ -221,7 +221,7 @@ void AudioBufferQueueSourceNode::processWithoutInterpolation(
|
|
|
221
221
|
buffers_.pop();
|
|
222
222
|
|
|
223
223
|
if (!(buffers_.empty() && addExtraTailFrames_)) {
|
|
224
|
-
|
|
224
|
+
sendOnBufferEndedEvent(bufferId, buffers_.empty());
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
if (buffers_.empty()) {
|
|
@@ -14,12 +14,12 @@ namespace audioapi {
|
|
|
14
14
|
|
|
15
15
|
class AudioBus;
|
|
16
16
|
class AudioParam;
|
|
17
|
-
|
|
17
|
+
struct BaseAudioBufferSourceOptions;
|
|
18
18
|
|
|
19
19
|
class AudioBufferQueueSourceNode : public AudioBufferBaseSourceNode {
|
|
20
20
|
public:
|
|
21
21
|
explicit AudioBufferQueueSourceNode(
|
|
22
|
-
std::shared_ptr<BaseAudioContext> context,
|
|
22
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
23
23
|
const BaseAudioBufferSourceOptions &options);
|
|
24
24
|
~AudioBufferQueueSourceNode() override;
|
|
25
25
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
namespace audioapi {
|
|
15
15
|
|
|
16
16
|
AudioBufferSourceNode::AudioBufferSourceNode(
|
|
17
|
-
std::shared_ptr<BaseAudioContext> context,
|
|
17
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
18
18
|
const AudioBufferSourceOptions &options)
|
|
19
19
|
: AudioBufferBaseSourceNode(context, options),
|
|
20
20
|
loop_(options.loop),
|
|
@@ -105,8 +105,8 @@ void AudioBufferSourceNode::setBuffer(const std::shared_ptr<AudioBuffer> &buffer
|
|
|
105
105
|
}
|
|
106
106
|
audioBus_ =
|
|
107
107
|
std::make_shared<AudioBus>(RENDER_QUANTUM_SIZE, channelCount_, context->getSampleRate());
|
|
108
|
-
playbackRateBus_ =
|
|
109
|
-
RENDER_QUANTUM_SIZE * 3, channelCount_, context->getSampleRate());
|
|
108
|
+
playbackRateBus_ =
|
|
109
|
+
std::make_shared<AudioBus>(RENDER_QUANTUM_SIZE * 3, channelCount_, context->getSampleRate());
|
|
110
110
|
|
|
111
111
|
loopEnd_ = buffer_->getDuration();
|
|
112
112
|
}
|
|
@@ -141,7 +141,7 @@ void AudioBufferSourceNode::setOnLoopEndedCallbackId(uint64_t callbackId) {
|
|
|
141
141
|
auto oldCallbackId = onLoopEndedCallbackId_.exchange(callbackId, std::memory_order_acq_rel);
|
|
142
142
|
|
|
143
143
|
if (oldCallbackId != 0) {
|
|
144
|
-
audioEventHandlerRegistry_->unregisterHandler(
|
|
144
|
+
audioEventHandlerRegistry_->unregisterHandler(AudioEvent::LOOP_ENDED, oldCallbackId);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
|
|
@@ -176,7 +176,8 @@ double AudioBufferSourceNode::getCurrentPosition() const {
|
|
|
176
176
|
void AudioBufferSourceNode::sendOnLoopEndedEvent() {
|
|
177
177
|
auto onLoopEndedCallbackId = onLoopEndedCallbackId_.load(std::memory_order_acquire);
|
|
178
178
|
if (onLoopEndedCallbackId != 0) {
|
|
179
|
-
audioEventHandlerRegistry_->invokeHandlerWithEventBody(
|
|
179
|
+
audioEventHandlerRegistry_->invokeHandlerWithEventBody(
|
|
180
|
+
AudioEvent::LOOP_ENDED, onLoopEndedCallbackId, {});
|
|
180
181
|
}
|
|
181
182
|
}
|
|
182
183
|
|
|
@@ -13,12 +13,12 @@ namespace audioapi {
|
|
|
13
13
|
|
|
14
14
|
class AudioBus;
|
|
15
15
|
class AudioParam;
|
|
16
|
-
|
|
16
|
+
struct AudioBufferSourceOptions;
|
|
17
17
|
|
|
18
18
|
class AudioBufferSourceNode : public AudioBufferBaseSourceNode {
|
|
19
19
|
public:
|
|
20
20
|
explicit AudioBufferSourceNode(
|
|
21
|
-
std::shared_ptr<BaseAudioContext> context,
|
|
21
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
22
22
|
const AudioBufferSourceOptions &options);
|
|
23
23
|
~AudioBufferSourceNode() override;
|
|
24
24
|
|
|
@@ -66,7 +66,7 @@ void AudioScheduledSourceNode::setOnEndedCallbackId(const uint64_t callbackId) {
|
|
|
66
66
|
auto oldCallbackId = onEndedCallbackId_.exchange(callbackId, std::memory_order_acq_rel);
|
|
67
67
|
|
|
68
68
|
if (oldCallbackId != 0) {
|
|
69
|
-
audioEventHandlerRegistry_->unregisterHandler(
|
|
69
|
+
audioEventHandlerRegistry_->unregisterHandler(AudioEvent::ENDED, oldCallbackId);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -167,7 +167,7 @@ void AudioScheduledSourceNode::disable() {
|
|
|
167
167
|
|
|
168
168
|
auto onEndedCallbackId = onEndedCallbackId_.load(std::memory_order_acquire);
|
|
169
169
|
if (onEndedCallbackId != 0) {
|
|
170
|
-
audioEventHandlerRegistry_->invokeHandlerWithEventBody(
|
|
170
|
+
audioEventHandlerRegistry_->invokeHandlerWithEventBody(AudioEvent::ENDED, onEndedCallbackId, {});
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
#include <memory>
|
|
8
8
|
|
|
9
9
|
namespace audioapi {
|
|
10
|
-
ConstantSourceNode::ConstantSourceNode(
|
|
10
|
+
ConstantSourceNode::ConstantSourceNode(
|
|
11
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
12
|
+
const ConstantSourceOptions &options)
|
|
11
13
|
: AudioScheduledSourceNode(context) {
|
|
12
14
|
offsetParam_ = std::make_shared<AudioParam>(
|
|
13
15
|
options.offset, MOST_NEGATIVE_SINGLE_FLOAT, MOST_POSITIVE_SINGLE_FLOAT, context);
|
|
@@ -30,7 +32,13 @@ std::shared_ptr<AudioBus> ConstantSourceNode::processNode(
|
|
|
30
32
|
return processingBus;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
updatePlaybackInfo(
|
|
35
|
+
updatePlaybackInfo(
|
|
36
|
+
processingBus,
|
|
37
|
+
framesToProcess,
|
|
38
|
+
startOffset,
|
|
39
|
+
offsetLength,
|
|
40
|
+
context->getSampleRate(),
|
|
41
|
+
context->getCurrentSampleFrame());
|
|
34
42
|
|
|
35
43
|
if (!isPlaying() && !isStopScheduled()) {
|
|
36
44
|
processingBus->zero();
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
namespace audioapi {
|
|
11
11
|
|
|
12
12
|
class AudioBus;
|
|
13
|
-
|
|
13
|
+
struct ConstantSourceOptions;
|
|
14
14
|
|
|
15
15
|
class ConstantSourceNode : public AudioScheduledSourceNode {
|
|
16
16
|
public:
|
|
17
17
|
explicit ConstantSourceNode(
|
|
18
|
-
std::shared_ptr<BaseAudioContext> context,
|
|
18
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
19
19
|
const ConstantSourceOptions &options);
|
|
20
20
|
|
|
21
21
|
[[nodiscard]] std::shared_ptr<AudioParam> getOffsetParam() const;
|
|
@@ -9,13 +9,12 @@
|
|
|
9
9
|
|
|
10
10
|
namespace audioapi {
|
|
11
11
|
|
|
12
|
-
OscillatorNode::OscillatorNode(
|
|
12
|
+
OscillatorNode::OscillatorNode(
|
|
13
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
14
|
+
const OscillatorOptions &options)
|
|
13
15
|
: AudioScheduledSourceNode(context) {
|
|
14
16
|
frequencyParam_ = std::make_shared<AudioParam>(
|
|
15
|
-
options.frequency,
|
|
16
|
-
-context->getNyquistFrequency(),
|
|
17
|
-
context->getNyquistFrequency(),
|
|
18
|
-
context);
|
|
17
|
+
options.frequency, -context->getNyquistFrequency(), context->getNyquistFrequency(), context);
|
|
19
18
|
detuneParam_ = std::make_shared<AudioParam>(
|
|
20
19
|
options.detune,
|
|
21
20
|
-1200 * LOG2_MOST_POSITIVE_SINGLE_FLOAT,
|
|
@@ -69,7 +68,13 @@ std::shared_ptr<AudioBus> OscillatorNode::processNode(
|
|
|
69
68
|
return processingBus;
|
|
70
69
|
}
|
|
71
70
|
|
|
72
|
-
updatePlaybackInfo(
|
|
71
|
+
updatePlaybackInfo(
|
|
72
|
+
processingBus,
|
|
73
|
+
framesToProcess,
|
|
74
|
+
startOffset,
|
|
75
|
+
offsetLength,
|
|
76
|
+
context->getSampleRate(),
|
|
77
|
+
context->getCurrentSampleFrame());
|
|
73
78
|
|
|
74
79
|
if (!isPlaying() && !isStopScheduled()) {
|
|
75
80
|
processingBus->zero();
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
namespace audioapi {
|
|
14
14
|
|
|
15
15
|
class AudioBus;
|
|
16
|
-
|
|
16
|
+
struct OscillatorOptions;
|
|
17
17
|
|
|
18
18
|
class OscillatorNode : public AudioScheduledSourceNode {
|
|
19
19
|
public:
|
|
20
20
|
explicit OscillatorNode(
|
|
21
|
-
std::shared_ptr<BaseAudioContext> context,
|
|
21
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
22
22
|
const OscillatorOptions &options);
|
|
23
23
|
|
|
24
24
|
[[nodiscard]] std::shared_ptr<AudioParam> getFrequencyParam() const;
|
|
@@ -23,7 +23,9 @@
|
|
|
23
23
|
|
|
24
24
|
namespace audioapi {
|
|
25
25
|
#if !RN_AUDIO_API_FFMPEG_DISABLED
|
|
26
|
-
StreamerNode::StreamerNode(
|
|
26
|
+
StreamerNode::StreamerNode(
|
|
27
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
28
|
+
const StreamerOptions &options)
|
|
27
29
|
: AudioScheduledSourceNode(context),
|
|
28
30
|
fmtCtx_(nullptr),
|
|
29
31
|
codecCtx_(nullptr),
|
|
@@ -38,7 +40,10 @@ StreamerNode::StreamerNode(std::shared_ptr<BaseAudioContext> context, const Stre
|
|
|
38
40
|
maxResampledSamples_(0),
|
|
39
41
|
processedSamples_(0) {}
|
|
40
42
|
#else
|
|
41
|
-
StreamerNode::StreamerNode(
|
|
43
|
+
StreamerNode::StreamerNode(
|
|
44
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
45
|
+
const StreamerOptions &options)
|
|
46
|
+
: AudioScheduledSourceNode(context) {}
|
|
42
47
|
#endif // RN_AUDIO_API_FFMPEG_DISABLED
|
|
43
48
|
|
|
44
49
|
StreamerNode::~StreamerNode() {
|
|
@@ -112,7 +117,13 @@ std::shared_ptr<AudioBus> StreamerNode::processNode(
|
|
|
112
117
|
processingBus->zero();
|
|
113
118
|
return processingBus;
|
|
114
119
|
}
|
|
115
|
-
updatePlaybackInfo(
|
|
120
|
+
updatePlaybackInfo(
|
|
121
|
+
processingBus,
|
|
122
|
+
framesToProcess,
|
|
123
|
+
startOffset,
|
|
124
|
+
offsetLength,
|
|
125
|
+
context->getSampleRate(),
|
|
126
|
+
context->getCurrentSampleFrame());
|
|
116
127
|
isNodeFinished_.store(isFinished(), std::memory_order_release);
|
|
117
128
|
|
|
118
129
|
if (!isPlaying() && !isStopScheduled()) {
|
|
@@ -217,7 +228,9 @@ void StreamerNode::streamAudio() {
|
|
|
217
228
|
}
|
|
218
229
|
}
|
|
219
230
|
|
|
220
|
-
bool StreamerNode::processFrameWithResampler(
|
|
231
|
+
bool StreamerNode::processFrameWithResampler(
|
|
232
|
+
AVFrame *frame,
|
|
233
|
+
std::shared_ptr<BaseAudioContext> context) {
|
|
221
234
|
// Check if we need to reallocate the resampled buffer
|
|
222
235
|
int out_samples = swr_get_out_samples(swrCtx_, frame->nb_samples);
|
|
223
236
|
if (out_samples > maxResampledSamples_) {
|
|
@@ -59,11 +59,13 @@ struct StreamingData {
|
|
|
59
59
|
namespace audioapi {
|
|
60
60
|
|
|
61
61
|
class AudioBus;
|
|
62
|
-
|
|
62
|
+
struct StreamerOptions;
|
|
63
63
|
|
|
64
64
|
class StreamerNode : public AudioScheduledSourceNode {
|
|
65
65
|
public:
|
|
66
|
-
explicit StreamerNode(
|
|
66
|
+
explicit StreamerNode(
|
|
67
|
+
const std::shared_ptr<BaseAudioContext> &context,
|
|
68
|
+
const StreamerOptions &options);
|
|
67
69
|
~StreamerNode() override;
|
|
68
70
|
|
|
69
71
|
/**
|
|
@@ -30,7 +30,7 @@ void AudioFileWriter::invokeOnErrorCallback(const std::string &message) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
std::unordered_map<std::string, EventValue> eventPayload = {{"message", message}};
|
|
33
|
-
audioEventHandlerRegistry_->invokeHandlerWithEventBody(
|
|
33
|
+
audioEventHandlerRegistry_->invokeHandlerWithEventBody(AudioEvent::RECORDER_ERROR, callbackId, eventPayload);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
bool AudioFileWriter::isFileOpen() {
|
|
@@ -76,7 +76,7 @@ void AudioRecorderCallback::invokeCallback(const std::shared_ptr<AudioBus> &bus,
|
|
|
76
76
|
eventPayload.insert({"numFrames", numFrames});
|
|
77
77
|
|
|
78
78
|
if (audioEventHandlerRegistry_) {
|
|
79
|
-
audioEventHandlerRegistry_->invokeHandlerWithEventBody(
|
|
79
|
+
audioEventHandlerRegistry_->invokeHandlerWithEventBody(AudioEvent::AUDIO_READY, callbackId_, eventPayload);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -98,7 +98,7 @@ void AudioRecorderCallback::invokeOnErrorCallback(const std::string &message) {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
std::unordered_map<std::string, EventValue> eventPayload = {{"message", message}};
|
|
101
|
-
audioEventHandlerRegistry_->invokeHandlerWithEventBody(
|
|
101
|
+
audioEventHandlerRegistry_->invokeHandlerWithEventBody(AudioEvent::RECORDER_ERROR, callbackId, eventPayload);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
} // namespace audioapi
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
namespace audioapi {
|
|
4
|
+
|
|
5
|
+
enum class AudioEvent {
|
|
6
|
+
PLAYBACK_NOTIFICATION_PLAY,
|
|
7
|
+
PLAYBACK_NOTIFICATION_PAUSE,
|
|
8
|
+
PLAYBACK_NOTIFICATION_STOP,
|
|
9
|
+
PLAYBACK_NOTIFICATION_NEXT_TRACK,
|
|
10
|
+
PLAYBACK_NOTIFICATION_PREVIOUS_TRACK,
|
|
11
|
+
PLAYBACK_NOTIFICATION_SKIP_FORWARD,
|
|
12
|
+
PLAYBACK_NOTIFICATION_SKIP_BACKWARD,
|
|
13
|
+
PLAYBACK_NOTIFICATION_SEEK_FORWARD,
|
|
14
|
+
PLAYBACK_NOTIFICATION_SEEK_BACKWARD,
|
|
15
|
+
PLAYBACK_NOTIFICATION_SEEK_TO,
|
|
16
|
+
PLAYBACK_NOTIFICATION_DISMISSED,
|
|
17
|
+
RECORDING_NOTIFICATION_RESUME,
|
|
18
|
+
RECORDING_NOTIFICATION_PAUSE,
|
|
19
|
+
ROUTE_CHANGE,
|
|
20
|
+
INTERRUPTION,
|
|
21
|
+
VOLUME_CHANGE,
|
|
22
|
+
DUCK,
|
|
23
|
+
ENDED,
|
|
24
|
+
LOOP_ENDED,
|
|
25
|
+
AUDIO_READY,
|
|
26
|
+
POSITION_CHANGED,
|
|
27
|
+
BUFFER_ENDED,
|
|
28
|
+
RECORDER_ERROR,
|
|
29
|
+
};
|
|
30
|
+
} // namespace audioapi
|
|
@@ -9,25 +9,14 @@ namespace audioapi {
|
|
|
9
9
|
AudioEventHandlerRegistry::AudioEventHandlerRegistry(
|
|
10
10
|
jsi::Runtime *runtime,
|
|
11
11
|
const std::shared_ptr<react::CallInvoker> &callInvoker)
|
|
12
|
-
: IAudioEventHandlerRegistry() {
|
|
13
|
-
runtime_ = runtime;
|
|
14
|
-
callInvoker_ = callInvoker;
|
|
15
|
-
|
|
16
|
-
for (const auto &eventName : SYSTEM_EVENT_NAMES) {
|
|
17
|
-
eventHandlers_[std::string(eventName)] = {};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
for (const auto &eventName : AUDIO_API_EVENT_NAMES) {
|
|
21
|
-
eventHandlers_[std::string(eventName)] = {};
|
|
22
|
-
}
|
|
23
|
-
}
|
|
12
|
+
: IAudioEventHandlerRegistry(), callInvoker_(callInvoker), runtime_(runtime) {}
|
|
24
13
|
|
|
25
14
|
AudioEventHandlerRegistry::~AudioEventHandlerRegistry() {
|
|
26
15
|
eventHandlers_.clear();
|
|
27
16
|
}
|
|
28
17
|
|
|
29
18
|
uint64_t AudioEventHandlerRegistry::registerHandler(
|
|
30
|
-
|
|
19
|
+
AudioEvent eventName,
|
|
31
20
|
const std::shared_ptr<jsi::Function> &handler) {
|
|
32
21
|
uint64_t listenerId = listenerIdCounter_++;
|
|
33
22
|
|
|
@@ -45,7 +34,7 @@ uint64_t AudioEventHandlerRegistry::registerHandler(
|
|
|
45
34
|
}
|
|
46
35
|
|
|
47
36
|
void AudioEventHandlerRegistry::unregisterHandler(
|
|
48
|
-
|
|
37
|
+
AudioEvent eventName,
|
|
49
38
|
uint64_t listenerId) {
|
|
50
39
|
if (callInvoker_ == nullptr || runtime_ == nullptr) {
|
|
51
40
|
// If callInvoker or runtime is not valid, we cannot unregister the handler
|
|
@@ -69,7 +58,7 @@ void AudioEventHandlerRegistry::unregisterHandler(
|
|
|
69
58
|
}
|
|
70
59
|
|
|
71
60
|
void AudioEventHandlerRegistry::invokeHandlerWithEventBody(
|
|
72
|
-
|
|
61
|
+
AudioEvent eventName,
|
|
73
62
|
const std::unordered_map<std::string, EventValue> &body) {
|
|
74
63
|
// callInvoker_ and runtime_ must be valid to invoke handlers
|
|
75
64
|
// this might happen when react-native is reloaded or the app is closed
|
|
@@ -100,7 +89,7 @@ void AudioEventHandlerRegistry::invokeHandlerWithEventBody(
|
|
|
100
89
|
jsi::Object eventObject(*runtime_);
|
|
101
90
|
// handle special logic for microphone, because we pass audio buffer
|
|
102
91
|
// which has significant size
|
|
103
|
-
if (eventName
|
|
92
|
+
if (eventName == AudioEvent::AUDIO_READY) {
|
|
104
93
|
auto bufferIt = body.find("buffer");
|
|
105
94
|
if (bufferIt != body.end()) {
|
|
106
95
|
auto bufferHostObject = std::static_pointer_cast<AudioBufferHostObject>(
|
|
@@ -117,14 +106,14 @@ void AudioEventHandlerRegistry::invokeHandlerWithEventBody(
|
|
|
117
106
|
throw;
|
|
118
107
|
} catch (...) {
|
|
119
108
|
printf(
|
|
120
|
-
"Unknown exception occurred while invoking handler for event: %
|
|
109
|
+
"Unknown exception occurred while invoking handler for event: %d\n", eventName);
|
|
121
110
|
}
|
|
122
111
|
}
|
|
123
112
|
});
|
|
124
113
|
}
|
|
125
114
|
|
|
126
115
|
void AudioEventHandlerRegistry::invokeHandlerWithEventBody(
|
|
127
|
-
|
|
116
|
+
AudioEvent eventName,
|
|
128
117
|
uint64_t listenerId,
|
|
129
118
|
const std::unordered_map<std::string, EventValue> &body) {
|
|
130
119
|
// callInvoker_ and runtime_ must be valid to invoke handlers
|
|
@@ -164,7 +153,7 @@ void AudioEventHandlerRegistry::invokeHandlerWithEventBody(
|
|
|
164
153
|
jsi::Object eventObject(*runtime_);
|
|
165
154
|
// handle special logic for microphone, because we pass audio buffer which
|
|
166
155
|
// has significant size
|
|
167
|
-
if (eventName
|
|
156
|
+
if (eventName == AudioEvent::AUDIO_READY) {
|
|
168
157
|
auto bufferIt = body.find("buffer");
|
|
169
158
|
if (bufferIt != body.end()) {
|
|
170
159
|
auto bufferHostObject = std::static_pointer_cast<AudioBufferHostObject>(
|
|
@@ -181,7 +170,7 @@ void AudioEventHandlerRegistry::invokeHandlerWithEventBody(
|
|
|
181
170
|
throw;
|
|
182
171
|
} catch (...) {
|
|
183
172
|
printf(
|
|
184
|
-
"Unknown exception occurred while invoking handler for event: %
|
|
173
|
+
"Unknown exception occurred while invoking handler for event: %d\n", eventName);
|
|
185
174
|
}
|
|
186
175
|
});
|
|
187
176
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
3
|
#include <ReactCommon/CallInvoker.h>
|
|
4
|
+
#include <audioapi/events/AudioEvent.h>
|
|
4
5
|
#include <audioapi/events/IAudioEventHandlerRegistry.h>
|
|
5
6
|
#include <jsi/jsi.h>
|
|
6
7
|
#include <array>
|
|
@@ -23,16 +24,15 @@ class AudioEventHandlerRegistry : public IAudioEventHandlerRegistry {
|
|
|
23
24
|
const std::shared_ptr<react::CallInvoker> &callInvoker);
|
|
24
25
|
~AudioEventHandlerRegistry() override;
|
|
25
26
|
|
|
26
|
-
uint64_t registerHandler(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
void unregisterHandler(const std::string &eventName, uint64_t listenerId) override;
|
|
27
|
+
uint64_t registerHandler(AudioEvent eventName, const std::shared_ptr<jsi::Function> &handler)
|
|
28
|
+
override;
|
|
29
|
+
void unregisterHandler(AudioEvent eventName, uint64_t listenerId) override;
|
|
30
30
|
|
|
31
31
|
void invokeHandlerWithEventBody(
|
|
32
|
-
|
|
32
|
+
AudioEvent eventName,
|
|
33
33
|
const std::unordered_map<std::string, EventValue> &body) override;
|
|
34
34
|
void invokeHandlerWithEventBody(
|
|
35
|
-
|
|
35
|
+
AudioEvent eventName,
|
|
36
36
|
uint64_t listenerId,
|
|
37
37
|
const std::unordered_map<std::string, EventValue> &body) override;
|
|
38
38
|
|
|
@@ -41,36 +41,9 @@ class AudioEventHandlerRegistry : public IAudioEventHandlerRegistry {
|
|
|
41
41
|
|
|
42
42
|
std::shared_ptr<react::CallInvoker> callInvoker_;
|
|
43
43
|
jsi::Runtime *runtime_;
|
|
44
|
-
std::unordered_map<
|
|
44
|
+
std::unordered_map<AudioEvent, std::unordered_map<uint64_t, std::shared_ptr<jsi::Function>>>
|
|
45
45
|
eventHandlers_;
|
|
46
46
|
|
|
47
|
-
static constexpr std::array<std::string_view, 15> SYSTEM_EVENT_NAMES = {
|
|
48
|
-
"remotePlay",
|
|
49
|
-
"remotePause",
|
|
50
|
-
"remoteStop",
|
|
51
|
-
"remoteTogglePlayPause",
|
|
52
|
-
"remoteChangePlaybackRate",
|
|
53
|
-
"remoteNextTrack",
|
|
54
|
-
"remotePreviousTrack",
|
|
55
|
-
"remoteSkipForward",
|
|
56
|
-
"remoteSkipBackward",
|
|
57
|
-
"remoteSeekForward",
|
|
58
|
-
"remoteSeekBackward",
|
|
59
|
-
"remoteChangePlaybackPosition",
|
|
60
|
-
"routeChange",
|
|
61
|
-
"interruption",
|
|
62
|
-
"volumeChange",
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
static constexpr std::array<std::string_view, 7> AUDIO_API_EVENT_NAMES = {
|
|
66
|
-
"ended",
|
|
67
|
-
"loopEnded",
|
|
68
|
-
"audioReady",
|
|
69
|
-
"positionChanged",
|
|
70
|
-
"bufferEnded",
|
|
71
|
-
"audioError",
|
|
72
|
-
"systemStateChanged"};
|
|
73
|
-
|
|
74
47
|
jsi::Object createEventObject(const std::unordered_map<std::string, EventValue> &body);
|
|
75
48
|
jsi::Object createEventObject(
|
|
76
49
|
const std::unordered_map<std::string, EventValue> &body,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
3
|
#include <ReactCommon/CallInvoker.h>
|
|
4
|
+
#include <audioapi/events/AudioEvent.h>
|
|
4
5
|
#include <jsi/jsi.h>
|
|
5
6
|
#include <memory>
|
|
6
7
|
#include <string>
|
|
@@ -17,15 +18,15 @@ class IAudioEventHandlerRegistry {
|
|
|
17
18
|
virtual ~IAudioEventHandlerRegistry() = default;
|
|
18
19
|
|
|
19
20
|
virtual uint64_t registerHandler(
|
|
20
|
-
|
|
21
|
+
AudioEvent eventName,
|
|
21
22
|
const std::shared_ptr<facebook::jsi::Function> &handler) = 0;
|
|
22
|
-
virtual void unregisterHandler(
|
|
23
|
+
virtual void unregisterHandler(AudioEvent eventName, uint64_t listenerId) = 0;
|
|
23
24
|
|
|
24
25
|
virtual void invokeHandlerWithEventBody(
|
|
25
|
-
|
|
26
|
+
AudioEvent eventName,
|
|
26
27
|
const std::unordered_map<std::string, EventValue> &body) = 0;
|
|
27
28
|
virtual void invokeHandlerWithEventBody(
|
|
28
|
-
|
|
29
|
+
AudioEvent eventName,
|
|
29
30
|
uint64_t listenerId,
|
|
30
31
|
const std::unordered_map<std::string, EventValue> &body) = 0;
|
|
31
32
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
+
#include <audioapi/events/AudioEvent.h>
|
|
3
4
|
#include <audioapi/events/IAudioEventHandlerRegistry.h>
|
|
4
5
|
#include <gmock/gmock.h>
|
|
5
6
|
#include <memory>
|
|
@@ -15,18 +16,12 @@ class MockAudioEventHandlerRegistry : public IAudioEventHandlerRegistry {
|
|
|
15
16
|
MOCK_METHOD(
|
|
16
17
|
uint64_t,
|
|
17
18
|
registerHandler,
|
|
18
|
-
(
|
|
19
|
-
(override));
|
|
20
|
-
MOCK_METHOD(
|
|
21
|
-
void,
|
|
22
|
-
unregisterHandler,
|
|
23
|
-
(const std::string &eventName, uint64_t listenerId),
|
|
19
|
+
(AudioEvent eventName, const std::shared_ptr<facebook::jsi::Function> &handler),
|
|
24
20
|
(override));
|
|
21
|
+
MOCK_METHOD(void, unregisterHandler, (AudioEvent eventName, uint64_t listenerId), (override));
|
|
25
22
|
|
|
26
|
-
MOCK_METHOD2(
|
|
27
|
-
invokeHandlerWithEventBody,
|
|
28
|
-
void(const std::string &eventName, const EventMap &body));
|
|
23
|
+
MOCK_METHOD2(invokeHandlerWithEventBody, void(AudioEvent eventName, const EventMap &body));
|
|
29
24
|
MOCK_METHOD3(
|
|
30
25
|
invokeHandlerWithEventBody,
|
|
31
|
-
void(
|
|
26
|
+
void(AudioEvent eventName, uint64_t listenerId, const EventMap &body));
|
|
32
27
|
};
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
#endif // RCT_NEW_ARCH_ENABLED
|
|
8
8
|
|
|
9
9
|
#import <React/RCTEventEmitter.h>
|
|
10
|
+
#import <audioapi/events/AudioEvent.h>
|
|
10
11
|
|
|
11
12
|
@class AudioEngine;
|
|
12
13
|
@class SystemNotificationManager;
|
|
@@ -25,6 +26,7 @@
|
|
|
25
26
|
@property (nonatomic, strong) AudioSessionManager *audioSessionManager;
|
|
26
27
|
@property (nonatomic, strong) NotificationRegistry *notificationRegistry;
|
|
27
28
|
|
|
28
|
-
- (void)invokeHandlerWithEventName:(
|
|
29
|
+
- (void)invokeHandlerWithEventName:(audioapi::AudioEvent)eventName
|
|
30
|
+
eventBody:(NSDictionary *)eventBody;
|
|
29
31
|
|
|
30
32
|
@end
|
|
@@ -152,7 +152,8 @@ RCT_EXPORT_METHOD(
|
|
|
152
152
|
|
|
153
153
|
RCT_EXPORT_METHOD(
|
|
154
154
|
setAudioSessionOptions : (NSString *)category mode : (NSString *)mode options : (NSArray *)
|
|
155
|
-
options allowHaptics : (BOOL)allowHaptics)
|
|
155
|
+
options allowHaptics : (BOOL)allowHaptics notifyOthersOnDeactivation : (BOOL)
|
|
156
|
+
notifyOthersOnDeactivation)
|
|
156
157
|
{
|
|
157
158
|
if (!self.audioSessionManager.shouldManageSession) {
|
|
158
159
|
[self.audioSessionManager setShouldManageSession:true];
|
|
@@ -160,7 +161,8 @@ RCT_EXPORT_METHOD(
|
|
|
160
161
|
[self.audioSessionManager setAudioSessionOptions:category
|
|
161
162
|
mode:mode
|
|
162
163
|
options:options
|
|
163
|
-
allowHaptics:allowHaptics
|
|
164
|
+
allowHaptics:allowHaptics
|
|
165
|
+
notifyOthersOnDeactivation:notifyOthersOnDeactivation];
|
|
164
166
|
}
|
|
165
167
|
|
|
166
168
|
RCT_EXPORT_METHOD(observeAudioInterruptions : (NSString *)focusType enabled : (BOOL)enabled)
|
|
@@ -280,10 +282,9 @@ RCT_EXPORT_METHOD(
|
|
|
280
282
|
}
|
|
281
283
|
#endif // RCT_NEW_ARCH_ENABLED
|
|
282
284
|
|
|
283
|
-
- (void)invokeHandlerWithEventName:(
|
|
285
|
+
- (void)invokeHandlerWithEventName:(audioapi::AudioEvent)eventName
|
|
286
|
+
eventBody:(NSDictionary *)eventBody
|
|
284
287
|
{
|
|
285
|
-
auto name = [eventName UTF8String];
|
|
286
|
-
|
|
287
288
|
std::unordered_map<std::string, EventValue> body = {};
|
|
288
289
|
|
|
289
290
|
for (NSString *key in eventBody) {
|
|
@@ -308,7 +309,7 @@ RCT_EXPORT_METHOD(
|
|
|
308
309
|
}
|
|
309
310
|
|
|
310
311
|
if (_eventHandler != nullptr) {
|
|
311
|
-
_eventHandler->invokeHandlerWithEventBody(
|
|
312
|
+
_eventHandler->invokeHandlerWithEventBody(eventName, body);
|
|
312
313
|
}
|
|
313
314
|
}
|
|
314
315
|
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
@property (nonatomic, assign) AVAudioSessionCategory desiredCategory;
|
|
18
18
|
@property (nonatomic, assign) AVAudioSessionCategoryOptions desiredOptions;
|
|
19
19
|
@property (nonatomic, assign) bool allowHapticsAndSounds;
|
|
20
|
+
@property (nonatomic, assign) bool notifyOthersOnDeactivation;
|
|
20
21
|
|
|
21
22
|
- (instancetype)init;
|
|
22
23
|
+ (instancetype)sharedInstance;
|
|
@@ -26,7 +27,8 @@
|
|
|
26
27
|
- (void)setAudioSessionOptions:(NSString *)category
|
|
27
28
|
mode:(NSString *)mode
|
|
28
29
|
options:(NSArray *)options
|
|
29
|
-
allowHaptics:(BOOL)allowHaptics
|
|
30
|
+
allowHaptics:(BOOL)allowHaptics
|
|
31
|
+
notifyOthersOnDeactivation:(BOOL)notifyOthersOnDeactivation;
|
|
30
32
|
|
|
31
33
|
- (bool)configureAudioSession;
|
|
32
34
|
- (bool)setActive:(bool)active error:(NSError **)error;
|