react-native-audio-api 0.8.3-nightly-e918179-20251003 → 0.8.3-nightly-ea268f4-20251004
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/common/cpp/audioapi/AudioAPIModuleInstaller.h +31 -14
- package/common/cpp/audioapi/HostObjects/BaseAudioContextHostObject.cpp +74 -4
- package/common/cpp/audioapi/HostObjects/BaseAudioContextHostObject.h +3 -0
- package/common/cpp/audioapi/HostObjects/WorkletProcessingNodeHostObject.h +18 -0
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferSourceNodeHostObject.cpp +20 -1
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferSourceNodeHostObject.h +3 -0
- package/common/cpp/audioapi/HostObjects/sources/ConstantSourceNodeHostObject.cpp +19 -0
- package/common/cpp/audioapi/HostObjects/sources/ConstantSourceNodeHostObject.h +21 -0
- package/common/cpp/audioapi/HostObjects/sources/WorkletSourceNodeHostObject.h +18 -0
- package/common/cpp/audioapi/core/AudioContext.cpp +2 -2
- package/common/cpp/audioapi/core/AudioContext.h +2 -2
- package/common/cpp/audioapi/core/AudioParam.cpp +2 -2
- package/common/cpp/audioapi/core/BaseAudioContext.cpp +32 -3
- package/common/cpp/audioapi/core/BaseAudioContext.h +9 -4
- package/common/cpp/audioapi/core/OfflineAudioContext.cpp +2 -2
- package/common/cpp/audioapi/core/OfflineAudioContext.h +2 -2
- package/common/cpp/audioapi/core/effects/WorkletNode.cpp +4 -3
- package/common/cpp/audioapi/core/effects/WorkletNode.h +4 -3
- package/common/cpp/audioapi/core/effects/WorkletProcessingNode.cpp +89 -0
- package/common/cpp/audioapi/core/effects/WorkletProcessingNode.h +52 -0
- package/common/cpp/audioapi/core/sources/AudioBufferBaseSourceNode.cpp +1 -6
- package/common/cpp/audioapi/core/sources/AudioBufferSourceNode.cpp +30 -0
- package/common/cpp/audioapi/core/sources/AudioBufferSourceNode.h +6 -0
- package/common/cpp/audioapi/core/sources/AudioScheduledSourceNode.cpp +1 -6
- package/common/cpp/audioapi/core/sources/ConstantSourceNode.cpp +51 -0
- package/common/cpp/audioapi/core/sources/ConstantSourceNode.h +26 -0
- package/common/cpp/audioapi/core/sources/WorkletSourceNode.cpp +82 -0
- package/common/cpp/audioapi/core/sources/WorkletSourceNode.h +47 -0
- package/common/cpp/audioapi/core/utils/AudioParamEventQueue.cpp +12 -6
- package/common/cpp/audioapi/core/utils/Constants.h +5 -0
- package/common/cpp/audioapi/core/utils/worklets/SafeIncludes.h +7 -0
- package/common/cpp/audioapi/core/utils/worklets/{UiWorkletsRunner.cpp → WorkletsRunner.cpp} +2 -2
- package/common/cpp/audioapi/core/utils/worklets/{UiWorkletsRunner.h → WorkletsRunner.h} +2 -2
- package/common/cpp/audioapi/events/AudioEventHandlerRegistry.h +2 -1
- package/common/cpp/audioapi/jsi/JsiPromise.cpp +23 -27
- package/common/cpp/audioapi/jsi/JsiPromise.h +10 -1
- package/common/cpp/audioapi/utils/ThreadPool.hpp +104 -0
- package/common/cpp/test/AudioParamTest.cpp +204 -0
- package/common/cpp/test/CMakeLists.txt +3 -0
- package/common/cpp/test/GainTest.cpp +2 -1
- package/common/cpp/test/OscillatorTest.cpp +2 -1
- package/ios/audioapi/ios/core/IOSAudioRecorder.h +2 -1
- package/lib/commonjs/api.js +27 -0
- package/lib/commonjs/api.js.map +1 -1
- package/lib/commonjs/api.web.js +8 -0
- package/lib/commonjs/api.web.js.map +1 -1
- package/lib/commonjs/core/AudioBufferBaseSourceNode.js +7 -7
- package/lib/commonjs/core/AudioBufferBaseSourceNode.js.map +1 -1
- package/lib/commonjs/core/AudioBufferQueueSourceNode.js +1 -6
- package/lib/commonjs/core/AudioBufferQueueSourceNode.js.map +1 -1
- package/lib/commonjs/core/AudioBufferSourceNode.js +15 -0
- package/lib/commonjs/core/AudioBufferSourceNode.js.map +1 -1
- package/lib/commonjs/core/AudioContext.js +10 -1
- package/lib/commonjs/core/AudioContext.js.map +1 -1
- package/lib/commonjs/core/BaseAudioContext.js +35 -2
- package/lib/commonjs/core/BaseAudioContext.js.map +1 -1
- package/lib/commonjs/core/ConstantSourceNode.js +17 -0
- package/lib/commonjs/core/ConstantSourceNode.js.map +1 -0
- package/lib/commonjs/core/OfflineAudioContext.js +11 -2
- package/lib/commonjs/core/OfflineAudioContext.js.map +1 -1
- package/lib/commonjs/core/WorkletProcessingNode.js +11 -0
- package/lib/commonjs/core/WorkletProcessingNode.js.map +1 -0
- package/lib/commonjs/core/WorkletSourceNode.js +11 -0
- package/lib/commonjs/core/WorkletSourceNode.js.map +1 -0
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/web-core/AudioContext.js +4 -0
- package/lib/commonjs/web-core/AudioContext.js.map +1 -1
- package/lib/commonjs/web-core/ConstantSourceNode.js +17 -0
- package/lib/commonjs/web-core/ConstantSourceNode.js.map +1 -0
- package/lib/commonjs/web-core/OfflineAudioContext.js +4 -0
- package/lib/commonjs/web-core/OfflineAudioContext.js.map +1 -1
- package/lib/module/api.js +4 -1
- package/lib/module/api.js.map +1 -1
- package/lib/module/api.web.js +1 -0
- package/lib/module/api.web.js.map +1 -1
- package/lib/module/core/AudioBufferBaseSourceNode.js +7 -7
- package/lib/module/core/AudioBufferBaseSourceNode.js.map +1 -1
- package/lib/module/core/AudioBufferQueueSourceNode.js +1 -6
- package/lib/module/core/AudioBufferQueueSourceNode.js.map +1 -1
- package/lib/module/core/AudioBufferSourceNode.js +15 -0
- package/lib/module/core/AudioBufferSourceNode.js.map +1 -1
- package/lib/module/core/AudioContext.js +10 -1
- package/lib/module/core/AudioContext.js.map +1 -1
- package/lib/module/core/BaseAudioContext.js +35 -2
- package/lib/module/core/BaseAudioContext.js.map +1 -1
- package/lib/module/core/ConstantSourceNode.js +11 -0
- package/lib/module/core/ConstantSourceNode.js.map +1 -0
- package/lib/module/core/OfflineAudioContext.js +11 -2
- package/lib/module/core/OfflineAudioContext.js.map +1 -1
- package/lib/module/core/WorkletProcessingNode.js +5 -0
- package/lib/module/core/WorkletProcessingNode.js.map +1 -0
- package/lib/module/core/WorkletSourceNode.js +5 -0
- package/lib/module/core/WorkletSourceNode.js.map +1 -0
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/web-core/AudioContext.js +4 -0
- package/lib/module/web-core/AudioContext.js.map +1 -1
- package/lib/module/web-core/ConstantSourceNode.js +11 -0
- package/lib/module/web-core/ConstantSourceNode.js.map +1 -0
- package/lib/module/web-core/OfflineAudioContext.js +4 -0
- package/lib/module/web-core/OfflineAudioContext.js.map +1 -1
- package/lib/typescript/api.d.ts +6 -3
- package/lib/typescript/api.d.ts.map +1 -1
- package/lib/typescript/api.web.d.ts +1 -0
- package/lib/typescript/api.web.d.ts.map +1 -1
- package/lib/typescript/core/AudioBufferBaseSourceNode.d.ts +2 -2
- package/lib/typescript/core/AudioBufferBaseSourceNode.d.ts.map +1 -1
- package/lib/typescript/core/AudioBufferQueueSourceNode.d.ts +1 -1
- package/lib/typescript/core/AudioBufferQueueSourceNode.d.ts.map +1 -1
- package/lib/typescript/core/AudioBufferSourceNode.d.ts +4 -0
- package/lib/typescript/core/AudioBufferSourceNode.d.ts.map +1 -1
- package/lib/typescript/core/AudioContext.d.ts +1 -0
- package/lib/typescript/core/AudioContext.d.ts.map +1 -1
- package/lib/typescript/core/BaseAudioContext.d.ts +8 -2
- package/lib/typescript/core/BaseAudioContext.d.ts.map +1 -1
- package/lib/typescript/core/ConstantSourceNode.d.ts +9 -0
- package/lib/typescript/core/ConstantSourceNode.d.ts.map +1 -0
- package/lib/typescript/core/OfflineAudioContext.d.ts +1 -0
- package/lib/typescript/core/OfflineAudioContext.d.ts.map +1 -1
- package/lib/typescript/core/WorkletProcessingNode.d.ts +4 -0
- package/lib/typescript/core/WorkletProcessingNode.d.ts.map +1 -0
- package/lib/typescript/core/WorkletSourceNode.d.ts +4 -0
- package/lib/typescript/core/WorkletSourceNode.d.ts.map +1 -0
- package/lib/typescript/events/types.d.ts +1 -0
- package/lib/typescript/events/types.d.ts.map +1 -1
- package/lib/typescript/interfaces.d.ts +16 -2
- package/lib/typescript/interfaces.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +1 -0
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/utils/index.d.ts +1 -0
- package/lib/typescript/utils/index.d.ts.map +1 -1
- package/lib/typescript/web-core/AudioContext.d.ts +2 -0
- package/lib/typescript/web-core/AudioContext.d.ts.map +1 -1
- package/lib/typescript/web-core/BaseAudioContext.d.ts +2 -0
- package/lib/typescript/web-core/BaseAudioContext.d.ts.map +1 -1
- package/lib/typescript/web-core/ConstantSourceNode.d.ts +8 -0
- package/lib/typescript/web-core/ConstantSourceNode.d.ts.map +1 -0
- package/lib/typescript/web-core/OfflineAudioContext.d.ts +2 -0
- package/lib/typescript/web-core/OfflineAudioContext.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api.ts +10 -2
- package/src/api.web.ts +1 -0
- package/src/core/AudioBufferBaseSourceNode.ts +9 -9
- package/src/core/AudioBufferQueueSourceNode.ts +1 -9
- package/src/core/AudioBufferSourceNode.ts +28 -0
- package/src/core/AudioContext.ts +12 -1
- package/src/core/BaseAudioContext.ts +90 -1
- package/src/core/ConstantSourceNode.ts +13 -0
- package/src/core/OfflineAudioContext.ts +18 -2
- package/src/core/WorkletProcessingNode.ts +3 -0
- package/src/core/WorkletSourceNode.ts +3 -0
- package/src/events/types.ts +1 -0
- package/src/interfaces.ts +42 -2
- package/src/types.ts +2 -0
- package/src/utils/index.ts +3 -0
- package/src/web-core/AudioContext.tsx +5 -0
- package/src/web-core/BaseAudioContext.tsx +2 -0
- package/src/web-core/ConstantSourceNode.tsx +12 -0
- package/src/web-core/OfflineAudioContext.tsx +5 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#include <thread>
|
|
3
|
+
#include <vector>
|
|
4
|
+
#include <functional>
|
|
5
|
+
#include <variant>
|
|
6
|
+
#include <audioapi/utils/SpscChannel.hpp>
|
|
7
|
+
|
|
8
|
+
namespace audioapi {
|
|
9
|
+
|
|
10
|
+
/// @brief A simple thread pool implementation using lock-free SPSC channels for task scheduling and execution.
|
|
11
|
+
/// @note The thread pool consists of a load balancer thread and multiple worker threads.
|
|
12
|
+
/// @note The load balancer receives tasks and distributes them to worker threads in a round-robin fashion.
|
|
13
|
+
/// @note Each worker thread has its own SPSC channel to receive tasks from the load balancer.
|
|
14
|
+
/// @note The thread pool can be shut down gracefully by sending a stop event to the load balancer, which then propagates the stop event to all worker threads.
|
|
15
|
+
/// @note IMPORTANT: ThreadPool is not thread-safe and events should be scheduled from a single thread only.
|
|
16
|
+
class ThreadPool {
|
|
17
|
+
struct StopEvent {};
|
|
18
|
+
struct TaskEvent { std::function<void()> task; };
|
|
19
|
+
using Event = std::variant<TaskEvent, StopEvent>;
|
|
20
|
+
|
|
21
|
+
using Sender = channels::spsc::Sender<Event, channels::spsc::OverflowStrategy::WAIT_ON_FULL, channels::spsc::WaitStrategy::ATOMIC_WAIT>;
|
|
22
|
+
using Receiver = channels::spsc::Receiver<Event, channels::spsc::OverflowStrategy::WAIT_ON_FULL, channels::spsc::WaitStrategy::ATOMIC_WAIT>;
|
|
23
|
+
public:
|
|
24
|
+
/// @brief Construct a new ThreadPool
|
|
25
|
+
/// @param numThreads The number of worker threads to create
|
|
26
|
+
/// @param loadBalancerQueueSize The size of the load balancer's queue
|
|
27
|
+
/// @param workerQueueSize The size of each worker thread's queue
|
|
28
|
+
ThreadPool(size_t numThreads, size_t loadBalancerQueueSize = 32, size_t workerQueueSize = 32) {
|
|
29
|
+
auto [sender, receiver] = channels::spsc::channel<Event, channels::spsc::OverflowStrategy::WAIT_ON_FULL, channels::spsc::WaitStrategy::ATOMIC_WAIT>(loadBalancerQueueSize);
|
|
30
|
+
loadBalancerSender = std::move(sender);
|
|
31
|
+
std::vector<Sender> workerSenders;
|
|
32
|
+
workerSenders.reserve(numThreads);
|
|
33
|
+
for (size_t i = 0; i < numThreads; ++i) {
|
|
34
|
+
auto [workerSender, workerReceiver] = channels::spsc::channel<Event, channels::spsc::OverflowStrategy::WAIT_ON_FULL, channels::spsc::WaitStrategy::ATOMIC_WAIT>(workerQueueSize);
|
|
35
|
+
workers.emplace_back(&ThreadPool::workerThreadFunc, this, std::move(workerReceiver));
|
|
36
|
+
workerSenders.emplace_back(std::move(workerSender));
|
|
37
|
+
}
|
|
38
|
+
loadBalancerThread = std::thread(&ThreadPool::loadBalancerThreadFunc, this, std::move(receiver), std::move(workerSenders));
|
|
39
|
+
}
|
|
40
|
+
~ThreadPool() {
|
|
41
|
+
loadBalancerSender.send(StopEvent{});
|
|
42
|
+
loadBalancerThread.join();
|
|
43
|
+
for (auto& worker : workers) {
|
|
44
|
+
worker.join();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/// @brief Schedule a task to be executed by the thread pool
|
|
49
|
+
/// @param task The task to be executed
|
|
50
|
+
/// @note This function is lock-free and most of the time wait-free, but may block if the load balancer queue is full.
|
|
51
|
+
/// @note Please remember that the task will be executed in a different thread, so make sure to capture any required variables by value.
|
|
52
|
+
/// @note The task should not throw exceptions, as they will not be caught.
|
|
53
|
+
/// @note The task should end at some point, otherwise the thread pool will never be able to shut down.
|
|
54
|
+
/// @note IMPORTANT: This function is not thread-safe and should be called from a single thread only.
|
|
55
|
+
void schedule(std::function<void()> &&task) noexcept {
|
|
56
|
+
loadBalancerSender.send(TaskEvent{std::move(task)});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
private:
|
|
60
|
+
std::thread loadBalancerThread;
|
|
61
|
+
std::vector<std::thread> workers;
|
|
62
|
+
Sender loadBalancerSender;
|
|
63
|
+
|
|
64
|
+
void workerThreadFunc(Receiver &&receiver) {
|
|
65
|
+
Receiver localReceiver = std::move(receiver);
|
|
66
|
+
while (true) {
|
|
67
|
+
auto event = localReceiver.receive();
|
|
68
|
+
/// We use [[unlikely]] and [[likely]] attributes to help the compiler optimize the branching.
|
|
69
|
+
/// we expect most of the time to receive TaskEvent, and rarely StopEvent.
|
|
70
|
+
/// and whenever we receive StopEvent we can burn some cycles as it will not be expected to execute fast.
|
|
71
|
+
if (std::holds_alternative<StopEvent>(event)) [[ unlikely ]] {
|
|
72
|
+
break;
|
|
73
|
+
} else if (std::holds_alternative<TaskEvent>(event)) [[ likely ]] {
|
|
74
|
+
std::get<TaskEvent>(event).task();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
void loadBalancerThreadFunc(Receiver &&receiver, std::vector<Sender> &&workerSenders) {
|
|
80
|
+
Receiver localReceiver = std::move(receiver);
|
|
81
|
+
std::vector<Sender> localWorkerSenders = std::move(workerSenders);
|
|
82
|
+
size_t nextWorker = 0;
|
|
83
|
+
while (true) {
|
|
84
|
+
auto event = localReceiver.receive();
|
|
85
|
+
/// We use [[unlikely]] and [[likely]] attributes to help the compiler optimize the branching.
|
|
86
|
+
/// we expect most of the time to receive TaskEvent, and rarely StopEvent.
|
|
87
|
+
/// and whenever we receive StopEvent we can burn some cycles as it will not be expected to execute fast.
|
|
88
|
+
if (std::holds_alternative<StopEvent>(event)) [[ unlikely ]] {
|
|
89
|
+
// Propagate stop event to all workers
|
|
90
|
+
for (size_t i = 0; i < localWorkerSenders.size(); ++i) {
|
|
91
|
+
localWorkerSenders[i].send(StopEvent{});
|
|
92
|
+
}
|
|
93
|
+
break;
|
|
94
|
+
} else if (std::holds_alternative<TaskEvent>(event)) [[ likely ]] {
|
|
95
|
+
// Dispatch task to the next worker in round-robin fashion
|
|
96
|
+
auto& taskEvent = std::get<TaskEvent>(event);
|
|
97
|
+
localWorkerSenders[nextWorker].send(std::move(taskEvent));
|
|
98
|
+
nextWorker = (nextWorker + 1) % localWorkerSenders.size();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
}; // namespace audioapi
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
#include <audioapi/core/AudioParam.h>
|
|
2
|
+
#include <audioapi/core/OfflineAudioContext.h>
|
|
3
|
+
#include <audioapi/core/utils/worklets/SafeIncludes.h>
|
|
4
|
+
#include <gtest/gtest.h>
|
|
5
|
+
#include "MockAudioEventHandlerRegistry.h"
|
|
6
|
+
|
|
7
|
+
using namespace audioapi;
|
|
8
|
+
|
|
9
|
+
class AudioParamTest : public ::testing::Test {
|
|
10
|
+
protected:
|
|
11
|
+
std::shared_ptr<IAudioEventHandlerRegistry> eventRegistry;
|
|
12
|
+
std::unique_ptr<OfflineAudioContext> context;
|
|
13
|
+
static constexpr int sampleRate = 44100;
|
|
14
|
+
|
|
15
|
+
void SetUp() override {
|
|
16
|
+
eventRegistry = std::make_shared<MockAudioEventHandlerRegistry>();
|
|
17
|
+
context = std::make_unique<OfflineAudioContext>(
|
|
18
|
+
2, 5 * sampleRate, sampleRate, eventRegistry, RuntimeRegistry{});
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
TEST_F(AudioParamTest, ValueSetters) {
|
|
23
|
+
AudioParam param = AudioParam(0.5, 0.0, 1.0, context.get());
|
|
24
|
+
param.setValue(0.8);
|
|
25
|
+
EXPECT_FLOAT_EQ(param.getValue(), 0.8);
|
|
26
|
+
param.setValue(-0.5);
|
|
27
|
+
EXPECT_FLOAT_EQ(param.getValue(), 0.0);
|
|
28
|
+
param.setValue(1.5);
|
|
29
|
+
EXPECT_FLOAT_EQ(param.getValue(), 1.0);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
TEST_F(AudioParamTest, SetValueAtTime) {
|
|
33
|
+
AudioParam param = AudioParam(0.5, 0.0, 1.0, context.get());
|
|
34
|
+
param.setValueAtTime(0.8, 0.1);
|
|
35
|
+
param.setValueAtTime(0.3, 0.2);
|
|
36
|
+
|
|
37
|
+
float value = param.processKRateParam(1, 0.05);
|
|
38
|
+
EXPECT_FLOAT_EQ(value, 0.5);
|
|
39
|
+
|
|
40
|
+
value = param.processKRateParam(1, 0.1);
|
|
41
|
+
EXPECT_FLOAT_EQ(value, 0.8);
|
|
42
|
+
|
|
43
|
+
value = param.processKRateParam(1, 0.15);
|
|
44
|
+
EXPECT_FLOAT_EQ(value, 0.8);
|
|
45
|
+
|
|
46
|
+
value = param.processKRateParam(1, 0.2);
|
|
47
|
+
EXPECT_FLOAT_EQ(value, 0.3);
|
|
48
|
+
|
|
49
|
+
value = param.processKRateParam(1, 0.25);
|
|
50
|
+
EXPECT_FLOAT_EQ(value, 0.3);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
TEST_F(AudioParamTest, LinearRampToValueAtTime) {
|
|
54
|
+
AudioParam param = AudioParam(0, 0, 1.0, context.get());
|
|
55
|
+
param.linearRampToValueAtTime(1.0, 0.2);
|
|
56
|
+
|
|
57
|
+
float value = param.processKRateParam(1, 0.05);
|
|
58
|
+
EXPECT_FLOAT_EQ(value, 0.25);
|
|
59
|
+
|
|
60
|
+
value = param.processKRateParam(1, 0.1);
|
|
61
|
+
EXPECT_FLOAT_EQ(value, 0.5);
|
|
62
|
+
|
|
63
|
+
value = param.processKRateParam(1, 0.15);
|
|
64
|
+
EXPECT_FLOAT_EQ(value, 0.75);
|
|
65
|
+
|
|
66
|
+
value = param.processKRateParam(1, 0.2);
|
|
67
|
+
EXPECT_FLOAT_EQ(value, 1.0);
|
|
68
|
+
|
|
69
|
+
value = param.processKRateParam(1, 0.25);
|
|
70
|
+
EXPECT_FLOAT_EQ(value, 1.0);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
TEST_F(AudioParamTest, ExponentialRampToValueAtTime) {
|
|
74
|
+
AudioParam param = AudioParam(0.1, 0.0, 1.0, context.get());
|
|
75
|
+
param.exponentialRampToValueAtTime(1.0, 0.2);
|
|
76
|
+
// value(time) = startValue * (endValue/startValue)^((time -
|
|
77
|
+
// startTime)/(endTime - startTime)) value(time) = 0.1 * (1.0/0.1)^((time -
|
|
78
|
+
// 0.0)/(0.2 - 0.0))
|
|
79
|
+
float value = param.processKRateParam(1, 0.05);
|
|
80
|
+
EXPECT_NEAR(value, 0.17783, 1e-5);
|
|
81
|
+
|
|
82
|
+
value = param.processKRateParam(1, 0.1);
|
|
83
|
+
EXPECT_NEAR(value, 0.316228, 1e-5);
|
|
84
|
+
|
|
85
|
+
value = param.processKRateParam(1, 0.15);
|
|
86
|
+
EXPECT_NEAR(value, 0.562341, 1e-5);
|
|
87
|
+
|
|
88
|
+
value = param.processKRateParam(1, 0.2);
|
|
89
|
+
EXPECT_FLOAT_EQ(value, 1.0);
|
|
90
|
+
|
|
91
|
+
value = param.processKRateParam(1, 0.25);
|
|
92
|
+
EXPECT_FLOAT_EQ(value, 1.0);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
TEST_F(AudioParamTest, SetTargetAtTime) {
|
|
96
|
+
AudioParam param = AudioParam(0.0, 0.0, 1.0, context.get());
|
|
97
|
+
param.setTargetAtTime(1.0, 0.1, 0.1);
|
|
98
|
+
// value(time) = target + (startValue - target) * exp(-(time -
|
|
99
|
+
// startTime)/timeConstant) value(time) = 1.0 + (0.0 - 1.0) * exp(-time/0.1)
|
|
100
|
+
float value = param.processKRateParam(1, 0.05);
|
|
101
|
+
EXPECT_FLOAT_EQ(value, 0.0);
|
|
102
|
+
|
|
103
|
+
value = param.processKRateParam(1, 0.1);
|
|
104
|
+
EXPECT_FLOAT_EQ(value, 0.0);
|
|
105
|
+
|
|
106
|
+
value = param.processKRateParam(1, 0.15);
|
|
107
|
+
EXPECT_NEAR(value, 0.393469, 1e-5);
|
|
108
|
+
|
|
109
|
+
value = param.processKRateParam(1, 0.2);
|
|
110
|
+
EXPECT_NEAR(value, 0.632120, 1e-5);
|
|
111
|
+
|
|
112
|
+
value = param.processKRateParam(1, 0.25);
|
|
113
|
+
EXPECT_NEAR(value, 0.776869, 1e-5);
|
|
114
|
+
|
|
115
|
+
value = param.processKRateParam(1, 0.5);
|
|
116
|
+
EXPECT_NEAR(value, 0.981684, 1e-5);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
TEST_F(AudioParamTest, SetValueCurveAtTime) {
|
|
120
|
+
AudioParam param = AudioParam(0.0, 0.0, 1.0, context.get());
|
|
121
|
+
param.setValue(0.5);
|
|
122
|
+
auto curve = std::make_shared<std::vector<float>>(
|
|
123
|
+
std::vector<float>{0.1, 0.4, 0.2, 0.8, 0.5});
|
|
124
|
+
param.setValueCurveAtTime(curve, curve->size(), 0.1, 0.2);
|
|
125
|
+
// 5 elements over 0.2s => each element is 0.04s apart
|
|
126
|
+
|
|
127
|
+
float value = param.processKRateParam(1, 0.05);
|
|
128
|
+
EXPECT_FLOAT_EQ(value, 0.0);
|
|
129
|
+
|
|
130
|
+
value = param.processKRateParam(1, 0.1);
|
|
131
|
+
EXPECT_FLOAT_EQ(value, 0.1);
|
|
132
|
+
|
|
133
|
+
// k = 4/0.2 * (0.14 - 0.1) = 0.8 -> floor is 0
|
|
134
|
+
// linear interpolation between 0 and 1 -> 0.1 + (0.4 - 0.1) * 0.8 = 0.34
|
|
135
|
+
value = param.processKRateParam(1, 0.14);
|
|
136
|
+
EXPECT_FLOAT_EQ(value, 0.34);
|
|
137
|
+
|
|
138
|
+
// k = 4/0.2 * (0.18 - 0.1) = 1.6 -> floor is 1
|
|
139
|
+
// linear interpolation between 1 and 2 -> 0.4 + (0.2 - 0.4) * 0.6 = 0.28
|
|
140
|
+
value = param.processKRateParam(1, 0.18);
|
|
141
|
+
EXPECT_FLOAT_EQ(value, 0.28);
|
|
142
|
+
|
|
143
|
+
// k = 4/0.2 * (0.22 - 0.1) = 2.4 -> floor is 2
|
|
144
|
+
// linear interpolation between 2 and 3 -> 0.2 + (0.8 - 0.2) * 0.4 = 0.44
|
|
145
|
+
value = param.processKRateParam(1, 0.22);
|
|
146
|
+
EXPECT_FLOAT_EQ(value, 0.44);
|
|
147
|
+
|
|
148
|
+
// k = 4/0.2 * (0.26 - 0.1) = 3.2 -> floor is 3
|
|
149
|
+
// linear interpolation between 3 and 4 -> 0.8 + (0.5 - 0.8) * 0.2 = 0.74
|
|
150
|
+
value = param.processKRateParam(1, 0.26);
|
|
151
|
+
EXPECT_FLOAT_EQ(value, 0.74);
|
|
152
|
+
|
|
153
|
+
// k = 4/0.2 * (0.3 - 0.1) = 4.0 -> floor is 4
|
|
154
|
+
// at or after end of curve -> last value
|
|
155
|
+
value = param.processKRateParam(1, 0.35);
|
|
156
|
+
EXPECT_FLOAT_EQ(value, 0.5);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
TEST_F(AudioParamTest, CancelScheduledValues) {
|
|
160
|
+
AudioParam param = AudioParam(0.0, 0.0, 1.0, context.get());
|
|
161
|
+
param.setValueAtTime(0.8, 0.1);
|
|
162
|
+
param.setValueAtTime(0.3, 0.2);
|
|
163
|
+
param.linearRampToValueAtTime(1.0, 0.4);
|
|
164
|
+
param.cancelScheduledValues(0.15);
|
|
165
|
+
|
|
166
|
+
float value = param.processKRateParam(1, 0.05);
|
|
167
|
+
EXPECT_FLOAT_EQ(value, 0.0);
|
|
168
|
+
|
|
169
|
+
value = param.processKRateParam(1, 0.1);
|
|
170
|
+
EXPECT_FLOAT_EQ(value, 0.8);
|
|
171
|
+
|
|
172
|
+
value = param.processKRateParam(1, 0.15);
|
|
173
|
+
EXPECT_FLOAT_EQ(value, 0.8);
|
|
174
|
+
|
|
175
|
+
// Events after cancel time are removed -> stays at last value
|
|
176
|
+
value = param.processKRateParam(1, 0.2);
|
|
177
|
+
EXPECT_FLOAT_EQ(value, 0.8);
|
|
178
|
+
|
|
179
|
+
value = param.processKRateParam(1, 0.25);
|
|
180
|
+
EXPECT_FLOAT_EQ(value, 0.8);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
TEST_F(AudioParamTest, CancelAndHoldAtTime) {
|
|
184
|
+
AudioParam param = AudioParam(0.0, 0.0, 1.0, context.get());
|
|
185
|
+
param.setValueAtTime(0.8, 0.1);
|
|
186
|
+
param.linearRampToValueAtTime(1.0, 0.2);
|
|
187
|
+
param.cancelAndHoldAtTime(0.15);
|
|
188
|
+
|
|
189
|
+
float value = param.processKRateParam(1, 0.05);
|
|
190
|
+
EXPECT_FLOAT_EQ(value, 0.0);
|
|
191
|
+
|
|
192
|
+
value = param.processKRateParam(1, 0.1);
|
|
193
|
+
EXPECT_FLOAT_EQ(value, 0.8);
|
|
194
|
+
|
|
195
|
+
value = param.processKRateParam(1, 0.15);
|
|
196
|
+
EXPECT_FLOAT_EQ(value, 0.9);
|
|
197
|
+
|
|
198
|
+
// Events after cancel time are removed -> stays at last value
|
|
199
|
+
value = param.processKRateParam(1, 0.2);
|
|
200
|
+
EXPECT_FLOAT_EQ(value, 0.9);
|
|
201
|
+
|
|
202
|
+
value = param.processKRateParam(1, 0.25);
|
|
203
|
+
EXPECT_FLOAT_EQ(value, 0.9);
|
|
204
|
+
}
|
|
@@ -30,6 +30,8 @@ list(FILTER RNAUDIOAPI_SRC EXCLUDE REGEX ".*/audioapi/HostObjects/.*\\.cpp$")
|
|
|
30
30
|
list(REMOVE_ITEM RNAUDIOAPI_SRC
|
|
31
31
|
"${ROOT}/node_modules/react-native-audio-api/common/cpp/audioapi/core/AudioContext.cpp"
|
|
32
32
|
"${ROOT}/node_modules/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletNode.cpp"
|
|
33
|
+
"${ROOT}/node_modules/react-native-audio-api/common/cpp/audioapi/core/effects/WorkletProcessingNode.cpp"
|
|
34
|
+
"${ROOT}/node_modules/react-native-audio-api/common/cpp/audioapi/core/sources/WorkletSourceNode.cpp"
|
|
33
35
|
"${ROOT}/node_modules/react-native-audio-api/common/cpp/audioapi/core/sources/StreamerNode.cpp"
|
|
34
36
|
"${ROOT}/node_modules/react-native-audio-api/common/cpp/audioapi/core/sources/StreamerNode.h"
|
|
35
37
|
"${ROOT}/node_modules/react-native-audio-api/common/cpp/audioapi/libs/ffmpeg/FFmpegDecoding.cpp"
|
|
@@ -64,6 +66,7 @@ add_executable(
|
|
|
64
66
|
tests
|
|
65
67
|
OscillatorTest.cpp
|
|
66
68
|
GainTest.cpp
|
|
69
|
+
AudioParamTest.cpp
|
|
67
70
|
)
|
|
68
71
|
|
|
69
72
|
add_compile_definitions(AUDIO_API_TEST_SUITE)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#include <audioapi/core/OfflineAudioContext.h>
|
|
2
2
|
#include <audioapi/core/effects/GainNode.h>
|
|
3
|
+
#include <audioapi/core/utils/worklets/SafeIncludes.h>
|
|
3
4
|
#include <audioapi/utils/AudioArray.h>
|
|
4
5
|
#include <audioapi/utils/AudioBus.h>
|
|
5
6
|
#include <gtest/gtest.h>
|
|
@@ -14,7 +15,7 @@ class GainTest : public ::testing::Test {
|
|
|
14
15
|
void SetUp() override {
|
|
15
16
|
eventRegistry = std::make_shared<MockAudioEventHandlerRegistry>();
|
|
16
17
|
context = std::make_unique<audioapi::OfflineAudioContext>(
|
|
17
|
-
2, 5 * sampleRate, sampleRate, eventRegistry,
|
|
18
|
+
2, 5 * sampleRate, sampleRate, eventRegistry, RuntimeRegistry{});
|
|
18
19
|
}
|
|
19
20
|
};
|
|
20
21
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#include <audioapi/core/OfflineAudioContext.h>
|
|
2
2
|
#include <audioapi/core/sources/OscillatorNode.h>
|
|
3
|
+
#include <audioapi/core/utils/worklets/SafeIncludes.h>
|
|
3
4
|
#include <gtest/gtest.h>
|
|
4
5
|
#include "MockAudioEventHandlerRegistry.h"
|
|
5
6
|
|
|
@@ -12,7 +13,7 @@ class OscillatorTest : public ::testing::Test {
|
|
|
12
13
|
void SetUp() override {
|
|
13
14
|
eventRegistry = std::make_shared<MockAudioEventHandlerRegistry>();
|
|
14
15
|
context = std::make_unique<audioapi::OfflineAudioContext>(
|
|
15
|
-
2, 5 * sampleRate, sampleRate, eventRegistry,
|
|
16
|
+
2, 5 * sampleRate, sampleRate, eventRegistry, RuntimeRegistry{});
|
|
16
17
|
}
|
|
17
18
|
};
|
|
18
19
|
|
|
@@ -18,7 +18,8 @@ class IOSAudioRecorder : public AudioRecorder {
|
|
|
18
18
|
IOSAudioRecorder(
|
|
19
19
|
float sampleRate,
|
|
20
20
|
int bufferLength,
|
|
21
|
-
const std::shared_ptr<AudioEventHandlerRegistry>
|
|
21
|
+
const std::shared_ptr<AudioEventHandlerRegistry>
|
|
22
|
+
&audioEventHandlerRegistry);
|
|
22
23
|
|
|
23
24
|
~IOSAudioRecorder() override;
|
|
24
25
|
|
package/lib/commonjs/api.js
CHANGED
|
@@ -69,6 +69,12 @@ Object.defineProperty(exports, "AudioScheduledSourceNode", {
|
|
|
69
69
|
return _AudioScheduledSourceNode.default;
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
+
Object.defineProperty(exports, "AudioWorkletRuntime", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return _types.AudioWorkletRuntime;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
72
78
|
Object.defineProperty(exports, "BaseAudioContext", {
|
|
73
79
|
enumerable: true,
|
|
74
80
|
get: function () {
|
|
@@ -99,6 +105,12 @@ Object.defineProperty(exports, "ChannelInterpretation", {
|
|
|
99
105
|
return _types.ChannelInterpretation;
|
|
100
106
|
}
|
|
101
107
|
});
|
|
108
|
+
Object.defineProperty(exports, "ConstantSourceNode", {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function () {
|
|
111
|
+
return _ConstantSourceNode.default;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
102
114
|
Object.defineProperty(exports, "ContextState", {
|
|
103
115
|
enumerable: true,
|
|
104
116
|
get: function () {
|
|
@@ -195,6 +207,18 @@ Object.defineProperty(exports, "WorkletNode", {
|
|
|
195
207
|
return _WorkletNode.default;
|
|
196
208
|
}
|
|
197
209
|
});
|
|
210
|
+
Object.defineProperty(exports, "WorkletProcessingNode", {
|
|
211
|
+
enumerable: true,
|
|
212
|
+
get: function () {
|
|
213
|
+
return _WorkletProcessingNode.default;
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
Object.defineProperty(exports, "WorkletSourceNode", {
|
|
217
|
+
enumerable: true,
|
|
218
|
+
get: function () {
|
|
219
|
+
return _WorkletSourceNode.default;
|
|
220
|
+
}
|
|
221
|
+
});
|
|
198
222
|
Object.defineProperty(exports, "useSystemVolume", {
|
|
199
223
|
enumerable: true,
|
|
200
224
|
get: function () {
|
|
@@ -203,6 +227,8 @@ Object.defineProperty(exports, "useSystemVolume", {
|
|
|
203
227
|
});
|
|
204
228
|
var _specs = require("./specs");
|
|
205
229
|
var _WorkletNode = _interopRequireDefault(require("./core/WorkletNode"));
|
|
230
|
+
var _WorkletSourceNode = _interopRequireDefault(require("./core/WorkletSourceNode"));
|
|
231
|
+
var _WorkletProcessingNode = _interopRequireDefault(require("./core/WorkletProcessingNode"));
|
|
206
232
|
var _RecorderAdapterNode = _interopRequireDefault(require("./core/RecorderAdapterNode"));
|
|
207
233
|
var _AudioBuffer = _interopRequireDefault(require("./core/AudioBuffer"));
|
|
208
234
|
var _AudioBufferSourceNode = _interopRequireDefault(require("./core/AudioBufferSourceNode"));
|
|
@@ -221,6 +247,7 @@ var _OscillatorNode = _interopRequireDefault(require("./core/OscillatorNode"));
|
|
|
221
247
|
var _StereoPannerNode = _interopRequireDefault(require("./core/StereoPannerNode"));
|
|
222
248
|
var _AudioRecorder = _interopRequireDefault(require("./core/AudioRecorder"));
|
|
223
249
|
var _StreamerNode = _interopRequireDefault(require("./core/StreamerNode"));
|
|
250
|
+
var _ConstantSourceNode = _interopRequireDefault(require("./core/ConstantSourceNode"));
|
|
224
251
|
var _system = _interopRequireDefault(require("./system"));
|
|
225
252
|
var _useSystemVolume = _interopRequireDefault(require("./hooks/useSystemVolume"));
|
|
226
253
|
var _types = require("./types");
|
package/lib/commonjs/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_specs","require","_WorkletNode","_interopRequireDefault","_RecorderAdapterNode","_AudioBuffer","_AudioBufferSourceNode","_AudioBufferQueueSourceNode","_AudioContext","_OfflineAudioContext","_AudioDestinationNode","_AudioNode","_AnalyserNode","_AudioParam","_AudioScheduledSourceNode","_BaseAudioContext","_BiquadFilterNode","_GainNode","_OscillatorNode","_StereoPannerNode","_AudioRecorder","_StreamerNode","_system","_useSystemVolume","_types","_errors","e","__esModule","default","global","createAudioContext","createOfflineAudioContext","createAudioRecorder","AudioEventEmitter","NativeAudioAPIModule","Error","install"],"sourceRoot":"../../src","sources":["api.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_specs","require","_WorkletNode","_interopRequireDefault","_WorkletSourceNode","_WorkletProcessingNode","_RecorderAdapterNode","_AudioBuffer","_AudioBufferSourceNode","_AudioBufferQueueSourceNode","_AudioContext","_OfflineAudioContext","_AudioDestinationNode","_AudioNode","_AnalyserNode","_AudioParam","_AudioScheduledSourceNode","_BaseAudioContext","_BiquadFilterNode","_GainNode","_OscillatorNode","_StereoPannerNode","_AudioRecorder","_StreamerNode","_ConstantSourceNode","_system","_useSystemVolume","_types","_errors","e","__esModule","default","global","createAudioContext","createOfflineAudioContext","createAudioRecorder","AudioEventEmitter","NativeAudioAPIModule","Error","install"],"sourceRoot":"../../src","sources":["api.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AA8CA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,sBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,oBA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AM,CAACE,yBAAyB,IAAI,IAAI,IACxCF,MAAM,CAACG,mBAAmB,IAAI,IAAI,IAClCH,MAAM,CAACI,iBAAiB,IAAI,IAAI,EAChC;EACA,IAAI,CAACC,2BAAoB,EAAE;IACzB,MAAM,IAAIC,KAAK,CACb,iFACF,CAAC;EACH;EAEAD,2BAAoB,CAACE,OAAO,CAAC,CAAC;AAChC","ignoreList":[]}
|
package/lib/commonjs/api.web.js
CHANGED
|
@@ -18,6 +18,7 @@ var _exportNames = {
|
|
|
18
18
|
GainNode: true,
|
|
19
19
|
OscillatorNode: true,
|
|
20
20
|
StereoPannerNode: true,
|
|
21
|
+
ConstantSourceNode: true,
|
|
21
22
|
OscillatorType: true,
|
|
22
23
|
BiquadFilterType: true,
|
|
23
24
|
ChannelCountMode: true,
|
|
@@ -109,6 +110,12 @@ Object.defineProperty(exports, "ChannelInterpretation", {
|
|
|
109
110
|
return _types.ChannelInterpretation;
|
|
110
111
|
}
|
|
111
112
|
});
|
|
113
|
+
Object.defineProperty(exports, "ConstantSourceNode", {
|
|
114
|
+
enumerable: true,
|
|
115
|
+
get: function () {
|
|
116
|
+
return _ConstantSourceNode.default;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
112
119
|
Object.defineProperty(exports, "ContextState", {
|
|
113
120
|
enumerable: true,
|
|
114
121
|
get: function () {
|
|
@@ -201,6 +208,7 @@ var _BiquadFilterNode = _interopRequireDefault(require("./web-core/BiquadFilterN
|
|
|
201
208
|
var _GainNode = _interopRequireDefault(require("./web-core/GainNode"));
|
|
202
209
|
var _OscillatorNode = _interopRequireDefault(require("./web-core/OscillatorNode"));
|
|
203
210
|
var _StereoPannerNode = _interopRequireDefault(require("./web-core/StereoPannerNode"));
|
|
211
|
+
var _ConstantSourceNode = _interopRequireDefault(require("./web-core/ConstantSourceNode"));
|
|
204
212
|
var _custom = require("./web-core/custom");
|
|
205
213
|
Object.keys(_custom).forEach(function (key) {
|
|
206
214
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_AudioBuffer","_interopRequireDefault","require","_AudioBufferSourceNode","_AudioContext","_OfflineAudioContext","_AudioDestinationNode","_AudioNode","_AnalyserNode","_AudioParam","_AudioScheduledSourceNode","_BaseAudioContext","_BiquadFilterNode","_GainNode","_OscillatorNode","_StereoPannerNode","_custom","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_types","_errors","e","__esModule","default"],"sourceRoot":"../../src","sources":["api.web.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_AudioBuffer","_interopRequireDefault","require","_AudioBufferSourceNode","_AudioContext","_OfflineAudioContext","_AudioDestinationNode","_AudioNode","_AnalyserNode","_AudioParam","_AudioScheduledSourceNode","_BaseAudioContext","_BiquadFilterNode","_GainNode","_OscillatorNode","_StereoPannerNode","_ConstantSourceNode","_custom","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_types","_errors","e","__esModule","default"],"sourceRoot":"../../src","sources":["api.web.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,oBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,qBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,UAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,aAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,WAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,yBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,iBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,iBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,SAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,eAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,iBAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,mBAAA,GAAAf,sBAAA,CAAAC,OAAA;AAEA,IAAAe,OAAA,GAAAf,OAAA;AAAAgB,MAAA,CAAAC,IAAA,CAAAF,OAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,OAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,OAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAEA,IAAAS,MAAA,GAAA5B,OAAA;AAUA,IAAA6B,OAAA,GAAA7B,OAAA;AAMkB,SAAAD,uBAAA+B,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -14,19 +14,19 @@ class AudioBufferBaseSourceNode extends _AudioScheduledSourceNode.default {
|
|
|
14
14
|
this.playbackRate = new _AudioParam.default(node.playbackRate, context);
|
|
15
15
|
}
|
|
16
16
|
get onPositionChanged() {
|
|
17
|
-
return this.
|
|
17
|
+
return this.onPositionChangedCallback;
|
|
18
18
|
}
|
|
19
19
|
set onPositionChanged(callback) {
|
|
20
20
|
if (!callback) {
|
|
21
21
|
this.node.onPositionChanged = '0';
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
22
|
+
this.onPositionChangedSubscription?.remove();
|
|
23
|
+
this.onPositionChangedSubscription = undefined;
|
|
24
|
+
this.onPositionChangedCallback = undefined;
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
this.node.onPositionChanged = this.
|
|
27
|
+
this.onPositionChangedCallback = callback;
|
|
28
|
+
this.onPositionChangedSubscription = this.audioEventEmitter.addAudioEventListener('positionChanged', callback);
|
|
29
|
+
this.node.onPositionChanged = this.onPositionChangedSubscription.subscriptionId;
|
|
30
30
|
}
|
|
31
31
|
get onPositionChangedInterval() {
|
|
32
32
|
return this.node.onPositionChangedInterval;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_AudioParam","_interopRequireDefault","require","_AudioScheduledSourceNode","e","__esModule","default","AudioBufferBaseSourceNode","AudioScheduledSourceNode","constructor","context","node","detune","AudioParam","playbackRate","onPositionChanged","
|
|
1
|
+
{"version":3,"names":["_AudioParam","_interopRequireDefault","require","_AudioScheduledSourceNode","e","__esModule","default","AudioBufferBaseSourceNode","AudioScheduledSourceNode","constructor","context","node","detune","AudioParam","playbackRate","onPositionChanged","onPositionChangedCallback","callback","onPositionChangedSubscription","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,MAAM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
22
22
|
this.node.clearBuffers();
|
|
23
23
|
}
|
|
24
|
-
start(when = 0
|
|
24
|
+
start(when = 0) {
|
|
25
25
|
if (when < 0) {
|
|
26
26
|
throw new _errors.RangeError(`when must be a finite non-negative number: ${when}`);
|
|
27
27
|
}
|
|
28
|
-
if (offset) {
|
|
29
|
-
if (offset < 0) {
|
|
30
|
-
throw new _errors.RangeError(`offset must be a finite non-negative number: ${offset}`);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
28
|
this.node.start(when);
|
|
34
29
|
}
|
|
35
30
|
stop(when = 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_AudioBufferBaseSourceNode","_interopRequireDefault","require","_errors","e","__esModule","default","AudioBufferQueueSourceNode","AudioBufferBaseSourceNode","enqueueBuffer","buffer","node","dequeueBuffer","bufferId","id","parseInt","isNaN","RangeError","clearBuffers","start","when","
|
|
1
|
+
{"version":3,"names":["_AudioBufferBaseSourceNode","_interopRequireDefault","require","_errors","e","__esModule","default","AudioBufferQueueSourceNode","AudioBufferBaseSourceNode","enqueueBuffer","buffer","node","dequeueBuffer","bufferId","id","parseInt","isNaN","RangeError","clearBuffers","start","when","stop","pause","exports"],"sourceRoot":"../../../src","sources":["core/AudioBufferQueueSourceNode.ts"],"mappings":";;;;;;AACA,IAAAA,0BAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAAuC,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAExB,MAAMG,0BAA0B,SAASC,kCAAyB,CAAC;EACzEC,aAAaA,CAACC,MAAmB,EAAU;IAChD,OAAQ,IAAI,CAACC,IAAI,CAAiCF,aAAa,CAC7DC,MAAM,CAACA,MACT,CAAC;EACH;EAEOE,aAAaA,CAACC,QAAgB,EAAQ;IAC3C,MAAMC,EAAE,GAAGC,QAAQ,CAACF,QAAQ,EAAE,EAAE,CAAC;IACjC,IAAIG,KAAK,CAACF,EAAE,CAAC,IAAIA,EAAE,GAAG,CAAC,EAAE;MACvB,MAAM,IAAIG,kBAAU,CAClB,4CAA4CJ,QAAQ,EACtD,CAAC;IACH;IACC,IAAI,CAACF,IAAI,CAAiCC,aAAa,CAACE,EAAE,CAAC;EAC9D;EAEOI,YAAYA,CAAA,EAAS;IACzB,IAAI,CAACP,IAAI,CAAiCO,YAAY,CAAC,CAAC;EAC3D;EAEgBC,KAAKA,CAACC,IAAY,GAAG,CAAC,EAAQ;IAC5C,IAAIA,IAAI,GAAG,CAAC,EAAE;MACZ,MAAM,IAAIH,kBAAU,CAClB,8CAA8CG,IAAI,EACpD,CAAC;IACH;IAEC,IAAI,CAACT,IAAI,CAAiCQ,KAAK,CAACC,IAAI,CAAC;EACxD;EAEgBC,IAAIA,CAACD,IAAY,GAAG,CAAC,EAAQ;IAC3C,IAAIA,IAAI,GAAG,CAAC,EAAE;MACZ,MAAM,IAAIH,kBAAU,CAClB,8CAA8CG,IAAI,EACpD,CAAC;IACH;IAEC,IAAI,CAACT,IAAI,CAAiCU,IAAI,CAACD,IAAI,CAAC;EACvD;EAEOE,KAAKA,CAAA,EAAS;IAClB,IAAI,CAACX,IAAI,CAAiCW,KAAK,CAAC,CAAC;EACpD;AACF;AAACC,OAAA,CAAAjB,OAAA,GAAAC,0BAAA","ignoreList":[]}
|
|
@@ -69,6 +69,21 @@ class AudioBufferSourceNode extends _AudioBufferBaseSourceNode.default {
|
|
|
69
69
|
set onEnded(callback) {
|
|
70
70
|
super.onEnded = callback;
|
|
71
71
|
}
|
|
72
|
+
get onLoopEnded() {
|
|
73
|
+
return this.onLoopEndedCallback;
|
|
74
|
+
}
|
|
75
|
+
set onLoopEnded(callback) {
|
|
76
|
+
if (!callback) {
|
|
77
|
+
this.node.onLoopEnded = '0';
|
|
78
|
+
this.onLoopEndedSubscription?.remove();
|
|
79
|
+
this.onLoopEndedSubscription = undefined;
|
|
80
|
+
this.onLoopEndedCallback = undefined;
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
this.onLoopEndedCallback = callback;
|
|
84
|
+
this.onLoopEndedSubscription = this.audioEventEmitter.addAudioEventListener('loopEnded', callback);
|
|
85
|
+
this.node.onLoopEnded = this.onLoopEndedSubscription.subscriptionId;
|
|
86
|
+
}
|
|
72
87
|
}
|
|
73
88
|
exports.default = AudioBufferSourceNode;
|
|
74
89
|
//# sourceMappingURL=AudioBufferSourceNode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_AudioBufferBaseSourceNode","_interopRequireDefault","require","_AudioBuffer","_errors","e","__esModule","default","AudioBufferSourceNode","AudioBufferBaseSourceNode","buffer","node","AudioBuffer","setBuffer","loopSkip","value","loop","loopStart","loopEnd","start","when","offset","duration","RangeError","hasBeenStarted","InvalidStateError","onEnded","callback","exports"],"sourceRoot":"../../../src","sources":["core/AudioBufferSourceNode.ts"],"mappings":";;;;;;AACA,IAAAA,0BAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAA0D,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;
|
|
1
|
+
{"version":3,"names":["_AudioBufferBaseSourceNode","_interopRequireDefault","require","_AudioBuffer","_errors","e","__esModule","default","AudioBufferSourceNode","AudioBufferBaseSourceNode","buffer","node","AudioBuffer","setBuffer","loopSkip","value","loop","loopStart","loopEnd","start","when","offset","duration","RangeError","hasBeenStarted","InvalidStateError","onEnded","callback","onLoopEnded","onLoopEndedCallback","onLoopEndedSubscription","remove","undefined","audioEventEmitter","addAudioEventListener","subscriptionId","exports"],"sourceRoot":"../../../src","sources":["core/AudioBufferSourceNode.ts"],"mappings":";;;;;;AACA,IAAAA,0BAAA,GAAAC,sBAAA,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AAI,CAACH,mBAAmB,GAAGG,SAAS;MAEpC;IACF;IAEA,IAAI,CAACH,mBAAmB,GAAGF,QAAQ;IACnC,IAAI,CAACG,uBAAuB,GAAG,IAAI,CAACG,iBAAiB,CAACC,qBAAqB,CACzE,WAAW,EACXP,QACF,CAAC;IAEA,IAAI,CAAChB,IAAI,CAA4BiB,WAAW,GAC/C,IAAI,CAACE,uBAAuB,CAACK,cAAc;EAC/C;AACF;AAACC,OAAA,CAAA7B,OAAA,GAAAC,qBAAA","ignoreList":[]}
|
|
@@ -7,13 +7,22 @@ exports.default = void 0;
|
|
|
7
7
|
var _BaseAudioContext = _interopRequireDefault(require("./BaseAudioContext"));
|
|
8
8
|
var _system = _interopRequireDefault(require("../system"));
|
|
9
9
|
var _errors = require("../errors");
|
|
10
|
+
var _utils = require("../utils");
|
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
12
|
class AudioContext extends _BaseAudioContext.default {
|
|
13
|
+
// We need to keep here a reference to this runtime to better manage its lifecycle
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
15
|
+
_audioRuntime = null;
|
|
12
16
|
constructor(options) {
|
|
13
17
|
if (options && options.sampleRate && (options.sampleRate < 8000 || options.sampleRate > 96000)) {
|
|
14
18
|
throw new _errors.NotSupportedError(`The provided sampleRate is not supported: ${options.sampleRate}`);
|
|
15
19
|
}
|
|
16
|
-
|
|
20
|
+
let audioRuntime = null;
|
|
21
|
+
if (_utils.isWorkletsAvailable) {
|
|
22
|
+
audioRuntime = _utils.workletsModule.createWorkletRuntime('AudioWorkletRuntime');
|
|
23
|
+
}
|
|
24
|
+
super(global.createAudioContext(options?.sampleRate || _system.default.getDevicePreferredSampleRate(), options?.initSuspended || false, audioRuntime));
|
|
25
|
+
this._audioRuntime = audioRuntime;
|
|
17
26
|
}
|
|
18
27
|
async close() {
|
|
19
28
|
return this.context.close();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_BaseAudioContext","_interopRequireDefault","require","_system","_errors","e","__esModule","default","AudioContext","BaseAudioContext","constructor","options","sampleRate","NotSupportedError","global","createAudioContext","AudioManager","getDevicePreferredSampleRate","initSuspended","close","context","resume","suspend","exports"],"sourceRoot":"../../../src","sources":["core/AudioContext.ts"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;
|
|
1
|
+
{"version":3,"names":["_BaseAudioContext","_interopRequireDefault","require","_system","_errors","_utils","e","__esModule","default","AudioContext","BaseAudioContext","_audioRuntime","constructor","options","sampleRate","NotSupportedError","audioRuntime","isWorkletsAvailable","workletsModule","createWorkletRuntime","global","createAudioContext","AudioManager","getDevicePreferredSampleRate","initSuspended","close","context","resume","suspend","exports"],"sourceRoot":"../../../src","sources":["core/AudioContext.ts"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAA+D,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhD,MAAMG,YAAY,SAASC,yBAAgB,CAAC;EACzD;EACA;EACQC,aAAa,GAAQ,IAAI;EAEjCC,WAAWA,CAACC,OAA6B,EAAE;IACzC,IACEA,OAAO,IACPA,OAAO,CAACC,UAAU,KACjBD,OAAO,CAACC,UAAU,GAAG,IAAI,IAAID,OAAO,CAACC,UAAU,GAAG,KAAK,CAAC,EACzD;MACA,MAAM,IAAIC,yBAAiB,CACzB,6CAA6CF,OAAO,CAACC,UAAU,EACjE,CAAC;IACH;IACA,IAAIE,YAAY,GAAG,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