Skip to content

Commit 90bd367

Browse files
mdydekmaciejmakowski2003
andauthored
test: tests for stereo panner (#714)
* test: tests for stereo panner * refactor: aligned processNode to web audio api spec and fixed sterao panner * test: fixed tests after changing StereoPannerNode implementation * ci: yarn format * fix: nitpick * fix: lint --------- Co-authored-by: maciejmakowski2003 <[email protected]>
1 parent ea268f4 commit 90bd367

36 files changed

+235
-68
lines changed

apps/fabric-example/ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3081,7 +3081,7 @@ SPEC CHECKSUMS:
30813081
ReactAppDependencyProvider: c91900fa724baee992f01c05eeb4c9e01a807f78
30823082
ReactCodegen: 8125d6ee06ea06f48f156cbddec5c2ca576d62e6
30833083
ReactCommon: 116d6ee71679243698620d8cd9a9042541e44aa6
3084-
RNAudioAPI: 33e9940fd9e8b3694107f461a45fe23eb40c652b
3084+
RNAudioAPI: 0d2c90bedff404ca1b8b31dfe8e734937244a9c0
30853085
RNGestureHandler: 3a73f098d74712952870e948b3d9cf7b6cae9961
30863086
RNReanimated: a035264789d1f64cb5adba7085d6aac6e9ec70a7
30873087
RNScreens: 6ced6ae8a526512a6eef6e28c2286e1fc2d378c3

packages/custom-node-generator/templates/basic/shared/MyProcessorNode.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ MyProcessorNode::MyProcessorNode(BaseAudioContext *context)
77
isInitialized_ = true;
88
}
99

10-
void MyProcessorNode::processNode(const std::shared_ptr<AudioBus> &bus,
10+
std::shared_ptr<AudioBus> MyProcessorNode::processNode(const std::shared_ptr<AudioBus> &bus,
1111
int framesToProcess) {
1212
// put your processing logic here
1313
}
14-
} // namespace audioapi
14+
} // namespace audioapi

packages/custom-node-generator/templates/basic/shared/MyProcessorNode.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ class MyProcessorNode : public AudioNode {
99
explicit MyProcessorNode(BaseAudioContext *context);
1010

1111
protected:
12-
void processNode(const std::shared_ptr<AudioBus> &bus,
12+
std::shared_ptr<AudioBus> processNode(const std::shared_ptr<AudioBus> &bus,
1313
int framesToProcess) override;
1414

1515
};
16-
} // namespace audioapi
16+
} // namespace audioapi

packages/react-native-audio-api/common/cpp/audioapi/core/AudioNode.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ std::shared_ptr<AudioBus> AudioNode::processAudio(
142142
mixInputsBuses(processingBus);
143143

144144
assert(processingBus != nullptr);
145-
// Finally, process the node itself.
146-
processNode(processingBus, framesToProcess);
147145

148-
return processingBus;
146+
// Finally, process the node itself.
147+
return processNode(processingBus, framesToProcess);
148+
;
149149
}
150150

151151
bool AudioNode::isAlreadyProcessed() {

packages/react-native-audio-api/common/cpp/audioapi/core/AudioNode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class AudioNode : public std::enable_shared_from_this<AudioNode> {
6868
static std::string toString(ChannelCountMode mode);
6969
static std::string toString(ChannelInterpretation interpretation);
7070

71-
virtual void processNode(const std::shared_ptr<AudioBus>&, int) = 0;
71+
virtual std::shared_ptr<AudioBus> processNode(const std::shared_ptr<AudioBus>&, int) = 0;
7272

7373
bool isAlreadyProcessed();
7474
std::shared_ptr<AudioBus> processInputs(const std::shared_ptr<AudioBus>& outputBus, int framesToProcess, bool checkIsAlreadyProcessed);

packages/react-native-audio-api/common/cpp/audioapi/core/analysis/AnalyserNode.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ void AnalyserNode::getByteTimeDomainData(uint8_t *data, int length) {
143143
}
144144
}
145145

146-
void AnalyserNode::processNode(
146+
std::shared_ptr<AudioBus> AnalyserNode::processNode(
147147
const std::shared_ptr<AudioBus> &processingBus,
148148
int framesToProcess) {
149149
// Analyser should behave like a sniffer node, it should not modify the
@@ -156,6 +156,8 @@ void AnalyserNode::processNode(
156156
downMixBus_->getChannel(0)->getData(), framesToProcess, true);
157157

158158
shouldDoFFTAnalysis_ = true;
159+
160+
return processingBus;
159161
}
160162

161163
void AnalyserNode::doFFTAnalysis() {

packages/react-native-audio-api/common/cpp/audioapi/core/analysis/AnalyserNode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class AnalyserNode : public AudioNode {
3939
void getByteTimeDomainData(uint8_t *data, int length);
4040

4141
protected:
42-
void processNode(const std::shared_ptr<AudioBus>& processingBus, int framesToProcess) override;
42+
std::shared_ptr<AudioBus> processNode(const std::shared_ptr<AudioBus>& processingBus, int framesToProcess) override;
4343

4444
private:
4545
int fftSize_;

packages/react-native-audio-api/common/cpp/audioapi/core/destinations/AudioDestinationNode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class AudioDestinationNode : public AudioNode {
2424
protected:
2525
// DestinationNode is triggered by AudioContext using renderAudio
2626
// processNode function is not necessary and is never called.
27-
void processNode(const std::shared_ptr<AudioBus>& processingBus, int) final {};
27+
std::shared_ptr<AudioBus> processNode(const std::shared_ptr<AudioBus>& processingBus, int) final { return processingBus; };
2828

2929
private:
3030
std::size_t currentSampleFrame_;

packages/react-native-audio-api/common/cpp/audioapi/core/effects/BiquadFilterNode.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ void BiquadFilterNode::applyFilter() {
353353
}
354354
}
355355

356-
void BiquadFilterNode::processNode(
356+
std::shared_ptr<AudioBus> BiquadFilterNode::processNode(
357357
const std::shared_ptr<AudioBus> &processingBus,
358358
int framesToProcess) {
359359
int numChannels = processingBus->getNumberOfChannels();
@@ -393,6 +393,8 @@ void BiquadFilterNode::processNode(
393393
x2_ = x2;
394394
y1_ = y1;
395395
y2_ = y2;
396+
397+
return processingBus;
396398
}
397399

398400
} // namespace audioapi

packages/react-native-audio-api/common/cpp/audioapi/core/effects/BiquadFilterNode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class BiquadFilterNode : public AudioNode {
3333
int length);
3434

3535
protected:
36-
void processNode(
36+
std::shared_ptr<AudioBus> processNode(
3737
const std::shared_ptr<AudioBus> &processingBus,
3838
int framesToProcess) override;
3939

0 commit comments

Comments
 (0)