react-native-audio-api 0.4.9 → 0.4.10
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/core/AudioPlayer.cpp +3 -3
- package/android/src/main/cpp/core/AudioPlayer.h +4 -3
- package/common/cpp/HostObjects/AudioContextHostObject.h +13 -3
- package/common/cpp/core/AudioBufferSourceNode.cpp +12 -0
- package/common/cpp/core/AudioBufferSourceNode.h +2 -0
- package/common/cpp/core/AudioContext.cpp +4 -3
- package/common/cpp/core/AudioContext.h +1 -1
- package/common/cpp/core/AudioDestinationNode.cpp +3 -3
- package/common/cpp/core/AudioDestinationNode.h +2 -2
- package/common/cpp/core/AudioNode.cpp +17 -12
- package/common/cpp/core/AudioNode.h +5 -5
- package/ios/core/IOSAudioPlayer.h +4 -4
- package/ios/core/IOSAudioPlayer.mm +4 -7
- package/lib/module/core/AudioContext.js +8 -4
- package/lib/module/core/AudioContext.js.map +1 -1
- package/lib/module/core/AudioNode.js +1 -0
- package/lib/module/core/AudioNode.js.map +1 -1
- package/lib/module/core/AudioParam.js +24 -8
- package/lib/module/core/AudioParam.js.map +1 -1
- package/lib/module/core/BaseAudioContext.js +6 -13
- package/lib/module/core/BaseAudioContext.js.map +1 -1
- package/lib/module/errors/NotSupportedError.js +10 -0
- package/lib/module/errors/NotSupportedError.js.map +1 -0
- package/lib/module/errors/index.js +1 -0
- package/lib/module/errors/index.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/web-core/AudioContext.js +10 -7
- package/lib/module/web-core/AudioContext.js.map +1 -1
- package/lib/module/web-core/AudioNode.js +1 -0
- package/lib/module/web-core/AudioNode.js.map +1 -1
- package/lib/module/web-core/AudioParam.js +24 -8
- package/lib/module/web-core/AudioParam.js.map +1 -1
- package/lib/typescript/core/AudioContext.d.ts +3 -2
- package/lib/typescript/core/AudioContext.d.ts.map +1 -1
- package/lib/typescript/core/AudioNode.d.ts +1 -1
- package/lib/typescript/core/AudioNode.d.ts.map +1 -1
- package/lib/typescript/core/AudioParam.d.ts +7 -7
- package/lib/typescript/core/AudioParam.d.ts.map +1 -1
- package/lib/typescript/core/BaseAudioContext.d.ts.map +1 -1
- package/lib/typescript/errors/NotSupportedError.d.ts +5 -0
- package/lib/typescript/errors/NotSupportedError.d.ts.map +1 -0
- package/lib/typescript/errors/index.d.ts +1 -0
- package/lib/typescript/errors/index.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/interfaces.d.ts +1 -1
- package/lib/typescript/interfaces.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +4 -1
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/web-core/AudioContext.d.ts +3 -3
- package/lib/typescript/web-core/AudioContext.d.ts.map +1 -1
- package/lib/typescript/web-core/AudioNode.d.ts +1 -1
- package/lib/typescript/web-core/AudioNode.d.ts.map +1 -1
- package/lib/typescript/web-core/AudioParam.d.ts +7 -7
- package/lib/typescript/web-core/AudioParam.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/AudioContext.ts +12 -4
- package/src/core/AudioNode.ts +3 -1
- package/src/core/AudioParam.ts +48 -15
- package/src/core/BaseAudioContext.ts +9 -16
- package/src/errors/NotSupportedError.tsx +8 -0
- package/src/errors/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/interfaces.ts +1 -1
- package/src/types.ts +5 -1
- package/src/web-core/AudioContext.tsx +20 -10
- package/src/web-core/AudioNode.tsx +3 -1
- package/src/web-core/AudioParam.tsx +48 -15
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
namespace audioapi {
|
|
10
10
|
|
|
11
11
|
AudioPlayer::AudioPlayer(
|
|
12
|
-
const std::function<void(AudioBus
|
|
12
|
+
const std::function<void(std::shared_ptr<AudioBus>, int)> &renderAudio)
|
|
13
13
|
: renderAudio_(renderAudio) {
|
|
14
14
|
AudioStreamBuilder builder;
|
|
15
15
|
|
|
@@ -29,7 +29,7 @@ AudioPlayer::AudioPlayer(
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
AudioPlayer::AudioPlayer(
|
|
32
|
-
const std::function<void(AudioBus
|
|
32
|
+
const std::function<void(std::shared_ptr<AudioBus>, int)> &renderAudio,
|
|
33
33
|
float sampleRate)
|
|
34
34
|
: renderAudio_(renderAudio) {
|
|
35
35
|
AudioStreamBuilder builder;
|
|
@@ -86,7 +86,7 @@ DataCallbackResult AudioPlayer::onAudioReady(
|
|
|
86
86
|
while (processedFrames < numFrames) {
|
|
87
87
|
int framesToProcess =
|
|
88
88
|
std::min(numFrames - processedFrames, RENDER_QUANTUM_SIZE);
|
|
89
|
-
renderAudio_(mBus_
|
|
89
|
+
renderAudio_(mBus_, framesToProcess);
|
|
90
90
|
|
|
91
91
|
// TODO: optimize this with SIMD?
|
|
92
92
|
for (int i = 0; i < framesToProcess; i++) {
|
|
@@ -13,9 +13,10 @@ class AudioBus;
|
|
|
13
13
|
|
|
14
14
|
class AudioPlayer : public AudioStreamDataCallback {
|
|
15
15
|
public:
|
|
16
|
-
explicit AudioPlayer(
|
|
16
|
+
explicit AudioPlayer(
|
|
17
|
+
const std::function<void(std::shared_ptr<AudioBus>, int)> &renderAudio);
|
|
17
18
|
AudioPlayer(
|
|
18
|
-
const std::function<void(AudioBus
|
|
19
|
+
const std::function<void(std::shared_ptr<AudioBus>, int)> &renderAudio,
|
|
19
20
|
float sampleRate);
|
|
20
21
|
|
|
21
22
|
[[nodiscard]] float getSampleRate() const;
|
|
@@ -28,7 +29,7 @@ class AudioPlayer : public AudioStreamDataCallback {
|
|
|
28
29
|
int32_t numFrames) override;
|
|
29
30
|
|
|
30
31
|
private:
|
|
31
|
-
std::function<void(AudioBus
|
|
32
|
+
std::function<void(std::shared_ptr<AudioBus>, int)> renderAudio_;
|
|
32
33
|
std::shared_ptr<AudioStream> mStream_;
|
|
33
34
|
std::shared_ptr<AudioBus> mBus_;
|
|
34
35
|
bool isInitialized_ = false;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
#include <jsi/jsi.h>
|
|
4
4
|
#include <memory>
|
|
5
|
+
#include <utility>
|
|
5
6
|
#include <vector>
|
|
6
7
|
|
|
7
8
|
#include "AudioContext.h"
|
|
@@ -20,9 +21,18 @@ class AudioContextHostObject : public BaseAudioContextHostObject {
|
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
JSI_HOST_FUNCTION(close) {
|
|
23
|
-
auto
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
auto promise = promiseVendor_->createPromise([this](std::shared_ptr<Promise> promise) {
|
|
25
|
+
std::thread([this, promise = std::move(promise)]() {
|
|
26
|
+
auto audioContext = std::static_pointer_cast<AudioContext>(context_);
|
|
27
|
+
audioContext->close();
|
|
28
|
+
|
|
29
|
+
promise->resolve([](jsi::Runtime &runtime) {
|
|
30
|
+
return jsi::Value::undefined();
|
|
31
|
+
});
|
|
32
|
+
}).detach();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
return promise;
|
|
26
36
|
}
|
|
27
37
|
};
|
|
28
38
|
} // namespace audioapi
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
#include "AudioUtils.h"
|
|
9
9
|
#include "BaseAudioContext.h"
|
|
10
10
|
#include "Constants.h"
|
|
11
|
+
#include "Locker.h"
|
|
11
12
|
|
|
12
13
|
namespace audioapi {
|
|
13
14
|
|
|
@@ -67,6 +68,8 @@ void AudioBufferSourceNode::setLoopEnd(double loopEnd) {
|
|
|
67
68
|
|
|
68
69
|
void AudioBufferSourceNode::setBuffer(
|
|
69
70
|
const std::shared_ptr<AudioBuffer> &buffer) {
|
|
71
|
+
Locker locker(getBufferLock());
|
|
72
|
+
|
|
70
73
|
if (!buffer) {
|
|
71
74
|
buffer_ = std::shared_ptr<AudioBuffer>(nullptr);
|
|
72
75
|
alignedBus_ = std::make_shared<AudioBus>(
|
|
@@ -109,6 +112,10 @@ void AudioBufferSourceNode::start(double when, double offset, double duration) {
|
|
|
109
112
|
vReadIndex_ = static_cast<double>(buffer_->getSampleRate() * offset);
|
|
110
113
|
}
|
|
111
114
|
|
|
115
|
+
std::mutex &AudioBufferSourceNode::getBufferLock() {
|
|
116
|
+
return bufferLock_;
|
|
117
|
+
}
|
|
118
|
+
|
|
112
119
|
void AudioBufferSourceNode::processNode(
|
|
113
120
|
AudioBus *processingBus,
|
|
114
121
|
int framesToProcess) {
|
|
@@ -118,6 +125,11 @@ void AudioBufferSourceNode::processNode(
|
|
|
118
125
|
return;
|
|
119
126
|
}
|
|
120
127
|
|
|
128
|
+
if (!Locker::tryLock(getBufferLock())) {
|
|
129
|
+
processingBus->zero();
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
121
133
|
size_t startOffset = 0;
|
|
122
134
|
size_t offsetLength = 0;
|
|
123
135
|
|
|
@@ -30,6 +30,7 @@ class AudioBufferSourceNode : public AudioScheduledSourceNode {
|
|
|
30
30
|
void start(double when, double offset, double duration = -1);
|
|
31
31
|
|
|
32
32
|
protected:
|
|
33
|
+
std::mutex &getBufferLock();
|
|
33
34
|
void processNode(AudioBus *processingBus, int framesToProcess) override;
|
|
34
35
|
|
|
35
36
|
private:
|
|
@@ -37,6 +38,7 @@ class AudioBufferSourceNode : public AudioScheduledSourceNode {
|
|
|
37
38
|
bool loop_;
|
|
38
39
|
double loopStart_;
|
|
39
40
|
double loopEnd_;
|
|
41
|
+
std::mutex bufferLock_;
|
|
40
42
|
|
|
41
43
|
// playback rate aka pitch change params
|
|
42
44
|
std::shared_ptr<AudioParam> detuneParam_;
|
|
@@ -48,12 +48,13 @@ void AudioContext::close() {
|
|
|
48
48
|
audioPlayer_->stop();
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
std::function<void(AudioBus
|
|
51
|
+
std::function<void(std::shared_ptr<AudioBus>, int)>
|
|
52
|
+
AudioContext::renderAudio() {
|
|
52
53
|
if (!isRunning() || !destination_) {
|
|
53
|
-
return [](AudioBus
|
|
54
|
+
return [](const std::shared_ptr<AudioBus> &, int) {};
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
return [this](AudioBus
|
|
57
|
+
return [this](const std::shared_ptr<AudioBus> &data, int frames) {
|
|
57
58
|
destination_->renderAudio(data, frames);
|
|
58
59
|
};
|
|
59
60
|
}
|
|
@@ -27,7 +27,7 @@ class AudioContext : public BaseAudioContext {
|
|
|
27
27
|
std::shared_ptr<IOSAudioPlayer> audioPlayer_;
|
|
28
28
|
#endif
|
|
29
29
|
|
|
30
|
-
std::function<void(AudioBus
|
|
30
|
+
std::function<void(std::shared_ptr<AudioBus>, int)> renderAudio();
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
} // namespace audioapi
|
|
@@ -23,7 +23,7 @@ double AudioDestinationNode::getCurrentTime() const {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
void AudioDestinationNode::renderAudio(
|
|
26
|
-
AudioBus
|
|
26
|
+
const std::shared_ptr<AudioBus> &destinationBus,
|
|
27
27
|
int numFrames) {
|
|
28
28
|
if (numFrames < 0 || !destinationBus || !isInitialized_) {
|
|
29
29
|
return;
|
|
@@ -33,10 +33,10 @@ void AudioDestinationNode::renderAudio(
|
|
|
33
33
|
|
|
34
34
|
destinationBus->zero();
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
auto processedBus = processAudio(destinationBus, numFrames);
|
|
37
37
|
|
|
38
38
|
if (processedBus && processedBus != destinationBus) {
|
|
39
|
-
destinationBus->copy(processedBus);
|
|
39
|
+
destinationBus->copy(processedBus.get());
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
destinationBus->normalize();
|
|
@@ -16,11 +16,11 @@ class AudioDestinationNode : public AudioNode {
|
|
|
16
16
|
public:
|
|
17
17
|
explicit AudioDestinationNode(BaseAudioContext *context);
|
|
18
18
|
|
|
19
|
-
void renderAudio(AudioBus *audioData, int numFrames);
|
|
20
|
-
|
|
21
19
|
std::size_t getCurrentSampleFrame() const;
|
|
22
20
|
double getCurrentTime() const;
|
|
23
21
|
|
|
22
|
+
void renderAudio(const std::shared_ptr<AudioBus>& audioData, int numFrames);
|
|
23
|
+
|
|
24
24
|
protected:
|
|
25
25
|
// DestinationNode is triggered by AudioContext using renderAudio
|
|
26
26
|
// processNode function is not necessary and is never called.
|
|
@@ -97,17 +97,19 @@ std::string AudioNode::toString(ChannelInterpretation interpretation) {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
AudioBus
|
|
100
|
+
std::shared_ptr<AudioBus> AudioNode::processAudio(
|
|
101
|
+
std::shared_ptr<AudioBus> outputBus,
|
|
102
|
+
int framesToProcess) {
|
|
101
103
|
if (!isInitialized_) {
|
|
102
104
|
return outputBus;
|
|
103
105
|
}
|
|
104
106
|
|
|
105
107
|
if (isAlreadyProcessed()) {
|
|
106
|
-
return audioBus_
|
|
108
|
+
return audioBus_;
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
// Process inputs and return the bus with the most channels.
|
|
110
|
-
|
|
112
|
+
auto processingBus = processInputs(outputBus, framesToProcess);
|
|
111
113
|
|
|
112
114
|
// Apply channel count mode.
|
|
113
115
|
processingBus = applyChannelCountMode(processingBus);
|
|
@@ -117,7 +119,7 @@ AudioBus *AudioNode::processAudio(AudioBus *outputBus, int framesToProcess) {
|
|
|
117
119
|
|
|
118
120
|
assert(processingBus != nullptr);
|
|
119
121
|
// Finally, process the node itself.
|
|
120
|
-
processNode(processingBus, framesToProcess);
|
|
122
|
+
processNode(processingBus.get(), framesToProcess);
|
|
121
123
|
|
|
122
124
|
return processingBus;
|
|
123
125
|
}
|
|
@@ -138,8 +140,10 @@ bool AudioNode::isAlreadyProcessed() {
|
|
|
138
140
|
return false;
|
|
139
141
|
}
|
|
140
142
|
|
|
141
|
-
AudioBus
|
|
142
|
-
|
|
143
|
+
std::shared_ptr<AudioBus> AudioNode::processInputs(
|
|
144
|
+
const std::shared_ptr<AudioBus> &outputBus,
|
|
145
|
+
int framesToProcess) {
|
|
146
|
+
auto processingBus = audioBus_;
|
|
143
147
|
processingBus->zero();
|
|
144
148
|
|
|
145
149
|
int maxNumberOfChannels = 0;
|
|
@@ -162,28 +166,29 @@ AudioBus *AudioNode::processInputs(AudioBus *outputBus, int framesToProcess) {
|
|
|
162
166
|
return processingBus;
|
|
163
167
|
}
|
|
164
168
|
|
|
165
|
-
AudioBus
|
|
169
|
+
std::shared_ptr<AudioBus> AudioNode::applyChannelCountMode(
|
|
170
|
+
std::shared_ptr<AudioBus> processingBus) {
|
|
166
171
|
// If the channelCountMode is EXPLICIT, the node should output the number of
|
|
167
172
|
// channels specified by the channelCount.
|
|
168
173
|
if (channelCountMode_ == ChannelCountMode::EXPLICIT) {
|
|
169
|
-
return audioBus_
|
|
174
|
+
return audioBus_;
|
|
170
175
|
}
|
|
171
176
|
|
|
172
177
|
// If the channelCountMode is CLAMPED_MAX, the node should output the maximum
|
|
173
178
|
// number of channels clamped to channelCount.
|
|
174
179
|
if (channelCountMode_ == ChannelCountMode::CLAMPED_MAX &&
|
|
175
180
|
processingBus->getNumberOfChannels() >= channelCount_) {
|
|
176
|
-
return audioBus_
|
|
181
|
+
return audioBus_;
|
|
177
182
|
}
|
|
178
183
|
|
|
179
184
|
return processingBus;
|
|
180
185
|
}
|
|
181
186
|
|
|
182
|
-
void AudioNode::mixInputsBuses(AudioBus
|
|
187
|
+
void AudioNode::mixInputsBuses(const std::shared_ptr<AudioBus> &processingBus) {
|
|
183
188
|
assert(processingBus != nullptr);
|
|
184
189
|
|
|
185
|
-
for (auto inputBus : inputBuses_) {
|
|
186
|
-
processingBus->sum(inputBus, channelInterpretation_);
|
|
190
|
+
for (const auto &inputBus : inputBuses_) {
|
|
191
|
+
processingBus->sum(inputBus.get(), channelInterpretation_);
|
|
187
192
|
}
|
|
188
193
|
|
|
189
194
|
inputBuses_.clear();
|
|
@@ -57,18 +57,18 @@ class AudioNode : public std::enable_shared_from_this<AudioNode> {
|
|
|
57
57
|
std::size_t lastRenderedFrame_{SIZE_MAX};
|
|
58
58
|
|
|
59
59
|
private:
|
|
60
|
-
std::vector<AudioBus
|
|
60
|
+
std::vector<std::shared_ptr<AudioBus>> inputBuses_ = {};
|
|
61
61
|
|
|
62
62
|
static std::string toString(ChannelCountMode mode);
|
|
63
63
|
static std::string toString(ChannelInterpretation interpretation);
|
|
64
64
|
|
|
65
|
-
AudioBus
|
|
65
|
+
std::shared_ptr<AudioBus> processAudio(std::shared_ptr<AudioBus> outputBus, int framesToProcess);
|
|
66
66
|
virtual void processNode(AudioBus *processingBus, int framesToProcess) = 0;
|
|
67
67
|
|
|
68
68
|
bool isAlreadyProcessed();
|
|
69
|
-
AudioBus
|
|
70
|
-
AudioBus
|
|
71
|
-
void mixInputsBuses(AudioBus
|
|
69
|
+
std::shared_ptr<AudioBus> processInputs(const std::shared_ptr<AudioBus>& outputBus, int framesToProcess);
|
|
70
|
+
std::shared_ptr<AudioBus> applyChannelCountMode(std::shared_ptr<AudioBus> processingBus);
|
|
71
|
+
void mixInputsBuses(const std::shared_ptr<AudioBus>& processingBus);
|
|
72
72
|
|
|
73
73
|
void connectNode(const std::shared_ptr<AudioNode> &node);
|
|
74
74
|
void disconnectNode(const std::shared_ptr<AudioNode> &node);
|
|
@@ -15,15 +15,15 @@ class AudioBus;
|
|
|
15
15
|
|
|
16
16
|
class IOSAudioPlayer {
|
|
17
17
|
protected:
|
|
18
|
-
AudioBus
|
|
18
|
+
std::shared_ptr<AudioBus> audioBus_;
|
|
19
19
|
AudioPlayer *audioPlayer_;
|
|
20
|
-
std::function<void(AudioBus
|
|
20
|
+
std::function<void(std::shared_ptr<AudioBus>, int)> renderAudio_;
|
|
21
21
|
|
|
22
22
|
public:
|
|
23
23
|
explicit IOSAudioPlayer(
|
|
24
|
-
const std::function<void(AudioBus
|
|
24
|
+
const std::function<void(std::shared_ptr<AudioBus>, int)> &renderAudio);
|
|
25
25
|
IOSAudioPlayer(
|
|
26
|
-
const std::function<void(AudioBus
|
|
26
|
+
const std::function<void(std::shared_ptr<AudioBus>, int)> &renderAudio,
|
|
27
27
|
float sampleRate);
|
|
28
28
|
~IOSAudioPlayer();
|
|
29
29
|
|
|
@@ -7,11 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
namespace audioapi {
|
|
9
9
|
|
|
10
|
-
IOSAudioPlayer::IOSAudioPlayer(const std::function<void(AudioBus
|
|
10
|
+
IOSAudioPlayer::IOSAudioPlayer(const std::function<void(std::shared_ptr<AudioBus>, int)> &renderAudio)
|
|
11
11
|
: renderAudio_(renderAudio), audioBus_(0)
|
|
12
12
|
{
|
|
13
|
-
audioBus_ = new AudioBus(RENDER_QUANTUM_SIZE, CHANNEL_COUNT, getSampleRate());
|
|
14
|
-
|
|
15
13
|
RenderAudioBlock renderAudioBlock = ^(AudioBufferList *outputData, int numFrames) {
|
|
16
14
|
int processedFrames = 0;
|
|
17
15
|
|
|
@@ -34,10 +32,10 @@ IOSAudioPlayer::IOSAudioPlayer(const std::function<void(AudioBus *, int)> &rende
|
|
|
34
32
|
};
|
|
35
33
|
|
|
36
34
|
audioPlayer_ = [[AudioPlayer alloc] initWithRenderAudioBlock:renderAudioBlock];
|
|
37
|
-
audioBus_ =
|
|
35
|
+
audioBus_ = std::make_shared<AudioBus>(RENDER_QUANTUM_SIZE, CHANNEL_COUNT, getSampleRate());
|
|
38
36
|
}
|
|
39
37
|
|
|
40
|
-
IOSAudioPlayer::IOSAudioPlayer(const std::function<void(AudioBus
|
|
38
|
+
IOSAudioPlayer::IOSAudioPlayer(const std::function<void(std::shared_ptr<AudioBus>, int)> &renderAudio, float sampleRate)
|
|
41
39
|
: renderAudio_(renderAudio), audioBus_(0)
|
|
42
40
|
{
|
|
43
41
|
RenderAudioBlock renderAudioBlock = ^(AudioBufferList *outputData, int numFrames) {
|
|
@@ -62,7 +60,7 @@ IOSAudioPlayer::IOSAudioPlayer(const std::function<void(AudioBus *, int)> &rende
|
|
|
62
60
|
};
|
|
63
61
|
|
|
64
62
|
audioPlayer_ = [[AudioPlayer alloc] initWithRenderAudioBlock:renderAudioBlock sampleRate:sampleRate];
|
|
65
|
-
audioBus_ =
|
|
63
|
+
audioBus_ = std::make_shared<AudioBus>(RENDER_QUANTUM_SIZE, CHANNEL_COUNT, getSampleRate());
|
|
66
64
|
}
|
|
67
65
|
|
|
68
66
|
IOSAudioPlayer::~IOSAudioPlayer()
|
|
@@ -71,7 +69,6 @@ IOSAudioPlayer::~IOSAudioPlayer()
|
|
|
71
69
|
[audioPlayer_ cleanup];
|
|
72
70
|
|
|
73
71
|
if (audioBus_) {
|
|
74
|
-
delete audioBus_;
|
|
75
72
|
audioBus_ = 0;
|
|
76
73
|
}
|
|
77
74
|
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import BaseAudioContext from "./BaseAudioContext.js";
|
|
4
|
+
import { NotSupportedError } from "../errors/index.js";
|
|
4
5
|
export default class AudioContext extends BaseAudioContext {
|
|
5
|
-
constructor(
|
|
6
|
-
|
|
6
|
+
constructor(options) {
|
|
7
|
+
if (options && (options.sampleRate < 8000 || options.sampleRate > 96000)) {
|
|
8
|
+
throw new NotSupportedError(`The provided sampleRate is not supported: ${options.sampleRate}`);
|
|
9
|
+
}
|
|
10
|
+
super(global.__AudioAPIInstaller.createAudioContext(options?.sampleRate));
|
|
7
11
|
}
|
|
8
|
-
close() {
|
|
9
|
-
this.context.close();
|
|
12
|
+
async close() {
|
|
13
|
+
await this.context.close();
|
|
10
14
|
}
|
|
11
15
|
}
|
|
12
16
|
//# sourceMappingURL=AudioContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BaseAudioContext","AudioContext","constructor","sampleRate","global","__AudioAPIInstaller","createAudioContext","close","context"],"sourceRoot":"../../../src","sources":["core/AudioContext.ts"],"mappings":";;AACA,OAAOA,gBAAgB,MAAM,uBAAoB;AAEjD,eAAe,MAAMC,YAAY,
|
|
1
|
+
{"version":3,"names":["BaseAudioContext","NotSupportedError","AudioContext","constructor","options","sampleRate","global","__AudioAPIInstaller","createAudioContext","close","context"],"sourceRoot":"../../../src","sources":["core/AudioContext.ts"],"mappings":";;AACA,OAAOA,gBAAgB,MAAM,uBAAoB;AAEjD,SAASC,iBAAiB,QAAQ,oBAAW;AAE7C,eAAe,MAAMC,YAAY,SAASF,gBAAgB,CAAC;EACzDG,WAAWA,CAACC,OAA6B,EAAE;IACzC,IAAIA,OAAO,KAAKA,OAAO,CAACC,UAAU,GAAG,IAAI,IAAID,OAAO,CAACC,UAAU,GAAG,KAAK,CAAC,EAAE;MACxE,MAAM,IAAIJ,iBAAiB,CACzB,6CAA6CG,OAAO,CAACC,UAAU,EACjE,CAAC;IACH;IAEA,KAAK,CAACC,MAAM,CAACC,mBAAmB,CAACC,kBAAkB,CAACJ,OAAO,EAAEC,UAAU,CAAC,CAAC;EAC3E;EAEA,MAAMI,KAAKA,CAAA,EAAuB;IAChC,MAAO,IAAI,CAACC,OAAO,CAAmBD,KAAK,CAAC,CAAC;EAC/C;AACF","ignoreList":[]}
|
|
@@ -16,6 +16,7 @@ export default class AudioNode {
|
|
|
16
16
|
throw new InvalidAccessError('The AudioNodes are from different BaseAudioContexts');
|
|
17
17
|
}
|
|
18
18
|
this.node.connect(destination.node);
|
|
19
|
+
return destination;
|
|
19
20
|
}
|
|
20
21
|
disconnect(destination) {
|
|
21
22
|
this.node.disconnect(destination?.node);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["InvalidAccessError","AudioNode","constructor","context","node","numberOfInputs","numberOfOutputs","channelCount","channelCountMode","channelInterpretation","connect","destination","disconnect"],"sourceRoot":"../../../src","sources":["core/AudioNode.ts"],"mappings":";;AAGA,SAASA,kBAAkB,QAAQ,oBAAW;AAE9C,eAAe,MAAMC,SAAS,CAAC;EAS7BC,WAAWA,CAACC,OAAyB,EAAEC,IAAgB,EAAE;IACvD,IAAI,CAACD,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,cAAc,GAAG,IAAI,CAACD,IAAI,CAACC,cAAc;IAC9C,IAAI,CAACC,eAAe,GAAG,IAAI,CAACF,IAAI,CAACE,eAAe;IAChD,IAAI,CAACC,YAAY,GAAG,IAAI,CAACH,IAAI,CAACG,YAAY;IAC1C,IAAI,CAACC,gBAAgB,GAAG,IAAI,CAACJ,IAAI,CAACI,gBAAgB;IAClD,IAAI,CAACC,qBAAqB,GAAG,IAAI,CAACL,IAAI,CAACK,qBAAqB;EAC9D;EAEOC,OAAOA,CAACC,WAAsB,
|
|
1
|
+
{"version":3,"names":["InvalidAccessError","AudioNode","constructor","context","node","numberOfInputs","numberOfOutputs","channelCount","channelCountMode","channelInterpretation","connect","destination","disconnect"],"sourceRoot":"../../../src","sources":["core/AudioNode.ts"],"mappings":";;AAGA,SAASA,kBAAkB,QAAQ,oBAAW;AAE9C,eAAe,MAAMC,SAAS,CAAC;EAS7BC,WAAWA,CAACC,OAAyB,EAAEC,IAAgB,EAAE;IACvD,IAAI,CAACD,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,cAAc,GAAG,IAAI,CAACD,IAAI,CAACC,cAAc;IAC9C,IAAI,CAACC,eAAe,GAAG,IAAI,CAACF,IAAI,CAACE,eAAe;IAChD,IAAI,CAACC,YAAY,GAAG,IAAI,CAACH,IAAI,CAACG,YAAY;IAC1C,IAAI,CAACC,gBAAgB,GAAG,IAAI,CAACJ,IAAI,CAACI,gBAAgB;IAClD,IAAI,CAACC,qBAAqB,GAAG,IAAI,CAACL,IAAI,CAACK,qBAAqB;EAC9D;EAEOC,OAAOA,CAACC,WAAsB,EAAa;IAChD,IAAI,IAAI,CAACR,OAAO,KAAKQ,WAAW,CAACR,OAAO,EAAE;MACxC,MAAM,IAAIH,kBAAkB,CAC1B,qDACF,CAAC;IACH;IAEA,IAAI,CAACI,IAAI,CAACM,OAAO,CAACC,WAAW,CAACP,IAAI,CAAC;IAEnC,OAAOO,WAAW;EACpB;EAEOC,UAAUA,CAACD,WAAuB,EAAQ;IAC/C,IAAI,CAACP,IAAI,CAACQ,UAAU,CAACD,WAAW,EAAEP,IAAI,CAAC;EACzC;AACF","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { RangeError } from "../errors/index.js";
|
|
3
|
+
import { RangeError, InvalidStateError } from "../errors/index.js";
|
|
4
4
|
export default class AudioParam {
|
|
5
5
|
constructor(audioParam) {
|
|
6
6
|
this.audioParam = audioParam;
|
|
@@ -17,45 +17,61 @@ export default class AudioParam {
|
|
|
17
17
|
}
|
|
18
18
|
setValueAtTime(value, startTime) {
|
|
19
19
|
if (startTime < 0) {
|
|
20
|
-
throw new RangeError(`
|
|
20
|
+
throw new RangeError(`startTime must be a finite non-negative number: ${startTime}`);
|
|
21
21
|
}
|
|
22
22
|
this.audioParam.setValueAtTime(value, startTime);
|
|
23
|
+
return this;
|
|
23
24
|
}
|
|
24
25
|
linearRampToValueAtTime(value, endTime) {
|
|
25
26
|
if (endTime < 0) {
|
|
26
|
-
throw new RangeError(`
|
|
27
|
+
throw new RangeError(`endTime must be a finite non-negative number: ${endTime}`);
|
|
27
28
|
}
|
|
28
29
|
this.audioParam.linearRampToValueAtTime(value, endTime);
|
|
30
|
+
return this;
|
|
29
31
|
}
|
|
30
32
|
exponentialRampToValueAtTime(value, endTime) {
|
|
31
33
|
if (endTime < 0) {
|
|
32
|
-
throw new RangeError(`
|
|
34
|
+
throw new RangeError(`endTime must be a finite non-negative number: ${endTime}`);
|
|
33
35
|
}
|
|
34
36
|
this.audioParam.exponentialRampToValueAtTime(value, endTime);
|
|
37
|
+
return this;
|
|
35
38
|
}
|
|
36
39
|
setTargetAtTime(target, startTime, timeConstant) {
|
|
37
40
|
if (startTime < 0) {
|
|
38
|
-
throw new RangeError(`
|
|
41
|
+
throw new RangeError(`startTime must be a finite non-negative number: ${startTime}`);
|
|
42
|
+
}
|
|
43
|
+
if (timeConstant < 0) {
|
|
44
|
+
throw new RangeError(`timeConstant must be a finite non-negative number: ${startTime}`);
|
|
39
45
|
}
|
|
40
46
|
this.audioParam.setTargetAtTime(target, startTime, timeConstant);
|
|
47
|
+
return this;
|
|
41
48
|
}
|
|
42
49
|
setValueCurveAtTime(values, startTime, duration) {
|
|
43
50
|
if (startTime < 0) {
|
|
44
|
-
throw new RangeError(`
|
|
51
|
+
throw new RangeError(`startTime must be a finite non-negative number: ${startTime}`);
|
|
52
|
+
}
|
|
53
|
+
if (duration < 0) {
|
|
54
|
+
throw new RangeError(`duration must be a finite non-negative number: ${startTime}`);
|
|
55
|
+
}
|
|
56
|
+
if (values.length < 2) {
|
|
57
|
+
throw new InvalidStateError(`values must contain at least two values`);
|
|
45
58
|
}
|
|
46
59
|
this.audioParam.setValueCurveAtTime(values, startTime, duration);
|
|
60
|
+
return this;
|
|
47
61
|
}
|
|
48
62
|
cancelScheduledValues(cancelTime) {
|
|
49
63
|
if (cancelTime < 0) {
|
|
50
|
-
throw new RangeError(`
|
|
64
|
+
throw new RangeError(`cancelTime must be a finite non-negative number: ${cancelTime}`);
|
|
51
65
|
}
|
|
52
66
|
this.audioParam.cancelScheduledValues(cancelTime);
|
|
67
|
+
return this;
|
|
53
68
|
}
|
|
54
69
|
cancelAndHoldAtTime(cancelTime) {
|
|
55
70
|
if (cancelTime < 0) {
|
|
56
|
-
throw new RangeError(`
|
|
71
|
+
throw new RangeError(`cancelTime must be a finite non-negative number: ${cancelTime}`);
|
|
57
72
|
}
|
|
58
73
|
this.audioParam.cancelAndHoldAtTime(cancelTime);
|
|
74
|
+
return this;
|
|
59
75
|
}
|
|
60
76
|
}
|
|
61
77
|
//# sourceMappingURL=AudioParam.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RangeError","AudioParam","constructor","audioParam","value","defaultValue","minValue","maxValue","setValueAtTime","startTime","linearRampToValueAtTime","endTime","exponentialRampToValueAtTime","setTargetAtTime","target","timeConstant","setValueCurveAtTime","values","duration","cancelScheduledValues","cancelTime","cancelAndHoldAtTime"],"sourceRoot":"../../../src","sources":["core/AudioParam.ts"],"mappings":";;AACA,SAASA,UAAU,QAAQ,oBAAW;
|
|
1
|
+
{"version":3,"names":["RangeError","InvalidStateError","AudioParam","constructor","audioParam","value","defaultValue","minValue","maxValue","setValueAtTime","startTime","linearRampToValueAtTime","endTime","exponentialRampToValueAtTime","setTargetAtTime","target","timeConstant","setValueCurveAtTime","values","duration","length","cancelScheduledValues","cancelTime","cancelAndHoldAtTime"],"sourceRoot":"../../../src","sources":["core/AudioParam.ts"],"mappings":"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","ignoreList":[]}
|
|
@@ -9,7 +9,7 @@ import AudioBufferSourceNode from "./AudioBufferSourceNode.js";
|
|
|
9
9
|
import AudioBuffer from "./AudioBuffer.js";
|
|
10
10
|
import PeriodicWave from "./PeriodicWave.js";
|
|
11
11
|
import AnalyserNode from "./AnalyserNode.js";
|
|
12
|
-
import { InvalidAccessError } from "../errors/index.js";
|
|
12
|
+
import { InvalidAccessError, NotSupportedError } from "../errors/index.js";
|
|
13
13
|
export default class BaseAudioContext {
|
|
14
14
|
constructor(context) {
|
|
15
15
|
this.context = context;
|
|
@@ -39,13 +39,13 @@ export default class BaseAudioContext {
|
|
|
39
39
|
}
|
|
40
40
|
createBuffer(numOfChannels, length, sampleRate) {
|
|
41
41
|
if (numOfChannels < 1 || numOfChannels >= 32) {
|
|
42
|
-
throw new
|
|
42
|
+
throw new NotSupportedError(`The number of channels provided (${numOfChannels}) is outside the range [1, 32]`);
|
|
43
43
|
}
|
|
44
44
|
if (length <= 0) {
|
|
45
|
-
throw new
|
|
45
|
+
throw new NotSupportedError(`The number of frames provided (${length}) is less than or equal to the minimum bound (0)`);
|
|
46
46
|
}
|
|
47
|
-
if (sampleRate
|
|
48
|
-
throw new
|
|
47
|
+
if (sampleRate < 8000 || sampleRate > 96000) {
|
|
48
|
+
throw new NotSupportedError(`The sample rate provided (${sampleRate}) is outside the range [8000, 96000]`);
|
|
49
49
|
}
|
|
50
50
|
return new AudioBuffer(this.context.createBuffer(numOfChannels, length, sampleRate));
|
|
51
51
|
}
|
|
@@ -64,14 +64,7 @@ export default class BaseAudioContext {
|
|
|
64
64
|
if (sourcePath.startsWith('file://')) {
|
|
65
65
|
sourcePath = sourcePath.replace('file://', '');
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
const buffer = await this.context.decodeAudioDataSource(sourcePath);
|
|
69
|
-
return new AudioBuffer(buffer);
|
|
70
|
-
} catch (error) {
|
|
71
|
-
// Handle error gracefully, for example log it or throw it further with a custom message
|
|
72
|
-
console.error('Error decoding audio data source:', error);
|
|
73
|
-
throw new Error(`Failed to decode audio data from source: ${sourcePath}.`);
|
|
74
|
-
}
|
|
67
|
+
return new AudioBuffer(await this.context.decodeAudioDataSource(sourcePath));
|
|
75
68
|
}
|
|
76
69
|
}
|
|
77
70
|
//# sourceMappingURL=BaseAudioContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AudioDestinationNode","OscillatorNode","GainNode","StereoPannerNode","BiquadFilterNode","AudioBufferSourceNode","AudioBuffer","PeriodicWave","AnalyserNode","InvalidAccessError","BaseAudioContext","constructor","context","destination","sampleRate","currentTime","state","createOscillator","createGain","createStereoPanner","createBiquadFilter","createBufferSource","createBuffer","numOfChannels","length","
|
|
1
|
+
{"version":3,"names":["AudioDestinationNode","OscillatorNode","GainNode","StereoPannerNode","BiquadFilterNode","AudioBufferSourceNode","AudioBuffer","PeriodicWave","AnalyserNode","InvalidAccessError","NotSupportedError","BaseAudioContext","constructor","context","destination","sampleRate","currentTime","state","createOscillator","createGain","createStereoPanner","createBiquadFilter","createBufferSource","createBuffer","numOfChannels","length","createPeriodicWave","real","imag","constraints","disableNormalization","createAnalyser","decodeAudioDataSource","sourcePath","startsWith","replace"],"sourceRoot":"../../../src","sources":["core/BaseAudioContext.ts"],"mappings":";;AAEA,OAAOA,oBAAoB,MAAM,2BAAwB;AACzD,OAAOC,cAAc,MAAM,qBAAkB;AAC7C,OAAOC,QAAQ,MAAM,eAAY;AACjC,OAAOC,gBAAgB,MAAM,uBAAoB;AACjD,OAAOC,gBAAgB,MAAM,uBAAoB;AACjD,OAAOC,qBAAqB,MAAM,4BAAyB;AAC3D,OAAOC,WAAW,MAAM,kBAAe;AACvC,OAAOC,YAAY,MAAM,mBAAgB;AACzC,OAAOC,YAAY,MAAM,mBAAgB;AACzC,SAASC,kBAAkB,EAAEC,iBAAiB,QAAQ,oBAAW;AAEjE,eAAe,MAAMC,gBAAgB,CAAC;EAKpCC,WAAWA,CAACC,OAA0B,EAAE;IACtC,IAAI,CAACA,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,WAAW,GAAG,IAAId,oBAAoB,CAAC,IAAI,EAAEa,OAAO,CAACC,WAAW,CAAC;IACtE,IAAI,CAACC,UAAU,GAAGF,OAAO,CAACE,UAAU;EACtC;EAEA,IAAWC,WAAWA,CAAA,EAAW;IAC/B,OAAO,IAAI,CAACH,OAAO,CAACG,WAAW;EACjC;EAEA,IAAWC,KAAKA,CAAA,EAAiB;IAC/B,OAAO,IAAI,CAACJ,OAAO,CAACI,KAAK;EAC3B;EAEAC,gBAAgBA,CAAA,EAAmB;IACjC,OAAO,IAAIjB,cAAc,CAAC,IAAI,EAAE,IAAI,CAACY,OAAO,CAACK,gBAAgB,CAAC,CAAC,CAAC;EAClE;EAEAC,UAAUA,CAAA,EAAa;IACrB,OAAO,IAAIjB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAACW,OAAO,CAACM,UAAU,CAAC,CAAC,CAAC;EACtD;EAEAC,kBAAkBA,CAAA,EAAqB;IACrC,OAAO,IAAIjB,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAACU,OAAO,CAACO,kBAAkB,CAAC,CAAC,CAAC;EACtE;EAEAC,kBAAkBA,CAAA,EAAqB;IACrC,OAAO,IAAIjB,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAACS,OAAO,CAACQ,kBAAkB,CAAC,CAAC,CAAC;EACtE;EAEAC,kBAAkBA,CAAA,EAA0B;IAC1C,OAAO,IAAIjB,qBAAqB,CAAC,IAAI,EAAE,IAAI,CAACQ,OAAO,CAACS,kBAAkB,CAAC,CAAC,CAAC;EAC3E;EAEAC,YAAYA,CACVC,aAAqB,EACrBC,MAAc,EACdV,UAAkB,EACL;IACb,IAAIS,aAAa,GAAG,CAAC,IAAIA,aAAa,IAAI,EAAE,EAAE;MAC5C,MAAM,IAAId,iBAAiB,CACzB,oCAAoCc,aAAa,gCACnD,CAAC;IACH;IAEA,IAAIC,MAAM,IAAI,CAAC,EAAE;MACf,MAAM,IAAIf,iBAAiB,CACzB,kCAAkCe,MAAM,kDAC1C,CAAC;IACH;IAEA,IAAIV,UAAU,GAAG,IAAI,IAAIA,UAAU,GAAG,KAAK,EAAE;MAC3C,MAAM,IAAIL,iBAAiB,CACzB,6BAA6BK,UAAU,sCACzC,CAAC;IACH;IAEA,OAAO,IAAIT,WAAW,CACpB,IAAI,CAACO,OAAO,CAACU,YAAY,CAACC,aAAa,EAAEC,MAAM,EAAEV,UAAU,CAC7D,CAAC;EACH;EAEAW,kBAAkBA,CAChBC,IAAc,EACdC,IAAc,EACdC,WAAqC,EACvB;IACd,IAAIF,IAAI,CAACF,MAAM,KAAKG,IAAI,CAACH,MAAM,EAAE;MAC/B,MAAM,IAAIhB,kBAAkB,CAC1B,4BAA4BkB,IAAI,CAACF,MAAM,oBAAoBG,IAAI,CAACH,MAAM,sBACxE,CAAC;IACH;IAEA,MAAMK,oBAAoB,GAAGD,WAAW,EAAEC,oBAAoB,IAAI,KAAK;IAEvE,OAAO,IAAIvB,YAAY,CACrB,IAAI,CAACM,OAAO,CAACa,kBAAkB,CAACC,IAAI,EAAEC,IAAI,EAAEE,oBAAoB,CAClE,CAAC;EACH;EAEAC,cAAcA,CAAA,EAAiB;IAC7B,OAAO,IAAIvB,YAAY,CAAC,IAAI,EAAE,IAAI,CAACK,OAAO,CAACkB,cAAc,CAAC,CAAC,CAAC;EAC9D;EAEA,MAAMC,qBAAqBA,CAACC,UAAkB,EAAwB;IACpE;IACA,IAAIA,UAAU,CAACC,UAAU,CAAC,SAAS,CAAC,EAAE;MACpCD,UAAU,GAAGA,UAAU,CAACE,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;IAChD;IAEA,OAAO,IAAI7B,WAAW,CACpB,MAAM,IAAI,CAACO,OAAO,CAACmB,qBAAqB,CAACC,UAAU,CACrD,CAAC;EACH;AACF","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NotSupportedError","Error","constructor","message","name"],"sourceRoot":"../../../src","sources":["errors/NotSupportedError.tsx"],"mappings":";;AAAA,MAAMA,iBAAiB,SAASC,KAAK,CAAC;EACpCC,WAAWA,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,mBAAmB;EACjC;AACF;AAEA,eAAeJ,iBAAiB","ignoreList":[]}
|
|
@@ -4,4 +4,5 @@ export { default as IndexSizeError } from "./IndexSizeError.js";
|
|
|
4
4
|
export { default as InvalidAccessError } from "./InvalidAccessError.js";
|
|
5
5
|
export { default as InvalidStateError } from "./InvalidStateError.js";
|
|
6
6
|
export { default as RangeError } from "./RangeError.js";
|
|
7
|
+
export { default as NotSupportedError } from "./NotSupportedError.js";
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["default","IndexSizeError","InvalidAccessError","InvalidStateError","RangeError"],"sourceRoot":"../../../src","sources":["errors/index.ts"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,cAAc,QAAQ,qBAAkB;AAC5D,SAASD,OAAO,IAAIE,kBAAkB,QAAQ,yBAAsB;AACpE,SAASF,OAAO,IAAIG,iBAAiB,QAAQ,wBAAqB;AAClE,SAASH,OAAO,IAAII,UAAU,QAAQ,iBAAc","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["default","IndexSizeError","InvalidAccessError","InvalidStateError","RangeError","NotSupportedError"],"sourceRoot":"../../../src","sources":["errors/index.ts"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,cAAc,QAAQ,qBAAkB;AAC5D,SAASD,OAAO,IAAIE,kBAAkB,QAAQ,yBAAsB;AACpE,SAASF,OAAO,IAAIG,iBAAiB,QAAQ,wBAAqB;AAClE,SAASH,OAAO,IAAII,UAAU,QAAQ,iBAAc;AACpD,SAASJ,OAAO,IAAIK,iBAAiB,QAAQ,wBAAqB","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -18,5 +18,5 @@ export { default as GainNode } from "./core/GainNode.js";
|
|
|
18
18
|
export { default as OscillatorNode } from "./core/OscillatorNode.js";
|
|
19
19
|
export { default as StereoPannerNode } from "./core/StereoPannerNode.js";
|
|
20
20
|
export { OscillatorType, BiquadFilterType, ChannelCountMode, ChannelInterpretation, ContextState, WindowType, PeriodicWaveConstraints } from "./types.js";
|
|
21
|
-
export { IndexSizeError, InvalidAccessError, InvalidStateError, RangeError } from "./errors/index.js";
|
|
21
|
+
export { IndexSizeError, InvalidAccessError, InvalidStateError, RangeError, NotSupportedError } from "./errors/index.js";
|
|
22
22
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["installModule","global","__AudioAPIInstaller","default","AudioBuffer","AudioBufferSourceNode","AudioContext","AudioDestinationNode","AudioNode","AnalyserNode","AudioParam","AudioScheduledSourceNode","BaseAudioContext","BiquadFilterNode","GainNode","OscillatorNode","StereoPannerNode","OscillatorType","BiquadFilterType","ChannelCountMode","ChannelInterpretation","ContextState","WindowType","PeriodicWaveConstraints","IndexSizeError","InvalidAccessError","InvalidStateError","RangeError"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,oBAAiB;AAE/C,IAAIC,MAAM,CAACC,mBAAmB,IAAI,IAAI,EAAE;EACtCF,aAAa,CAAC,CAAC;AACjB;AAEA,SAASG,OAAO,IAAIC,WAAW,QAAQ,uBAAoB;AAC3D,SAASD,OAAO,IAAIE,qBAAqB,QAAQ,iCAA8B;AAC/E,SAASF,OAAO,IAAIG,YAAY,QAAQ,wBAAqB;AAC7D,SAASH,OAAO,IAAII,oBAAoB,QAAQ,gCAA6B;AAC7E,SAASJ,OAAO,IAAIK,SAAS,QAAQ,qBAAkB;AACvD,SAASL,OAAO,IAAIM,YAAY,QAAQ,wBAAqB;AAC7D,SAASN,OAAO,IAAIO,UAAU,QAAQ,sBAAmB;AACzD,SAASP,OAAO,IAAIQ,wBAAwB,QAAQ,oCAAiC;AACrF,SAASR,OAAO,IAAIS,gBAAgB,QAAQ,4BAAyB;AACrE,SAAST,OAAO,IAAIU,gBAAgB,QAAQ,4BAAyB;AACrE,SAASV,OAAO,IAAIW,QAAQ,QAAQ,oBAAiB;AACrD,SAASX,OAAO,IAAIY,cAAc,QAAQ,0BAAuB;AACjE,SAASZ,OAAO,IAAIa,gBAAgB,QAAQ,4BAAyB;AAErE,SACEC,cAAc,EACdC,gBAAgB,EAChBC,gBAAgB,EAChBC,qBAAqB,EACrBC,YAAY,EACZC,UAAU,EACVC,uBAAuB,QAClB,YAAS;AAEhB,SACEC,cAAc,EACdC,kBAAkB,EAClBC,iBAAiB,EACjBC,UAAU,
|
|
1
|
+
{"version":3,"names":["installModule","global","__AudioAPIInstaller","default","AudioBuffer","AudioBufferSourceNode","AudioContext","AudioDestinationNode","AudioNode","AnalyserNode","AudioParam","AudioScheduledSourceNode","BaseAudioContext","BiquadFilterNode","GainNode","OscillatorNode","StereoPannerNode","OscillatorType","BiquadFilterType","ChannelCountMode","ChannelInterpretation","ContextState","WindowType","PeriodicWaveConstraints","IndexSizeError","InvalidAccessError","InvalidStateError","RangeError","NotSupportedError"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,oBAAiB;AAE/C,IAAIC,MAAM,CAACC,mBAAmB,IAAI,IAAI,EAAE;EACtCF,aAAa,CAAC,CAAC;AACjB;AAEA,SAASG,OAAO,IAAIC,WAAW,QAAQ,uBAAoB;AAC3D,SAASD,OAAO,IAAIE,qBAAqB,QAAQ,iCAA8B;AAC/E,SAASF,OAAO,IAAIG,YAAY,QAAQ,wBAAqB;AAC7D,SAASH,OAAO,IAAII,oBAAoB,QAAQ,gCAA6B;AAC7E,SAASJ,OAAO,IAAIK,SAAS,QAAQ,qBAAkB;AACvD,SAASL,OAAO,IAAIM,YAAY,QAAQ,wBAAqB;AAC7D,SAASN,OAAO,IAAIO,UAAU,QAAQ,sBAAmB;AACzD,SAASP,OAAO,IAAIQ,wBAAwB,QAAQ,oCAAiC;AACrF,SAASR,OAAO,IAAIS,gBAAgB,QAAQ,4BAAyB;AACrE,SAAST,OAAO,IAAIU,gBAAgB,QAAQ,4BAAyB;AACrE,SAASV,OAAO,IAAIW,QAAQ,QAAQ,oBAAiB;AACrD,SAASX,OAAO,IAAIY,cAAc,QAAQ,0BAAuB;AACjE,SAASZ,OAAO,IAAIa,gBAAgB,QAAQ,4BAAyB;AAErE,SACEC,cAAc,EACdC,gBAAgB,EAChBC,gBAAgB,EAChBC,qBAAqB,EACrBC,YAAY,EACZC,UAAU,EACVC,uBAAuB,QAClB,YAAS;AAEhB,SACEC,cAAc,EACdC,kBAAkB,EAClBC,iBAAiB,EACjBC,UAAU,EACVC,iBAAiB,QACZ,mBAAU","ignoreList":[]}
|