-
-
Notifications
You must be signed in to change notification settings - Fork 33
Feat/delay node #803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feat/delay node #803
Conversation
packages/react-native-audio-api/common/cpp/audioapi/HostObjects/BaseAudioContextHostObject.cpp
Outdated
Show resolved
Hide resolved
packages/react-native-audio-api/common/cpp/audioapi/core/effects/DelayNode.cpp
Outdated
Show resolved
Hide resolved
| if constexpr (std::is_base_of_v<AudioScheduledSourceNode, U>) { | ||
| return node.use_count() == 1 && (node->isUnscheduled() || node->isFinished()); | ||
| } else if constexpr (std::is_base_of_v<ConvolverNode, U>) { | ||
| } else if constexpr (std::is_base_of_v<ConvolverNode, U> || std::is_base_of_v<DelayNode, U>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets add comment about the reason behind it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets add requiresTailProcessing method to AudioNode instead of explicit class check
| static_cast<size_t>( | ||
| maxDelayTime * context->getSampleRate() + | ||
| 1), // +1 to enable delayTime equal to maxDelayTime | ||
| 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use channelCount property
| } | ||
| } | ||
|
|
||
| // delay buffer always has 2 channels, mix if needed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // delay buffer always has 2 channels, mix if needed | |
| // delay buffer always has ${channelCount_} channels, mix if needed |
| } | ||
| auto delayTime = delayTimeParam_->processKRateParam(framesToProcess, context_->getCurrentTime()); | ||
| size_t processingBusStartIndex = 0; | ||
| size_t writeIndex = static_cast<size_t>(readIndex_ + delayTime * context_->getSampleRate()) % |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| size_t writeIndex = static_cast<size_t>(readIndex_ + delayTime * context_->getSampleRate()) % | |
| auto writeIndex = static_cast<size_t>(readIndex_ + delayTime * context_->getSampleRate()) % |
| } | ||
|
|
||
| // delay buffer always has 2 channels, mix if needed | ||
| std::shared_ptr<AudioBus> DelayNode::processNode( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add comments about write/read process, separate each step with new line
| processingBus->sum(delayBuffer_.get(), readIndex_, 0, framesToProcess); | ||
| delayBuffer_->zero(readIndex_, framesToProcess); | ||
| readIndex_ += framesToProcess; | ||
| return processingBus; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you format the process method a bit? It is really hard to read when it is wall of text
Closes RNAA-320
Introduced changes
DelayNodeChecklist