Skip to content

Conversation

@mdydek
Copy link
Contributor

@mdydek mdydek commented Nov 12, 2025

Closes RNAA-320

⚠️ Breaking changes ⚠️

Introduced changes

  • added new type of node DelayNode

Checklist

  • Linked relevant issue
  • Updated relevant documentation
  • Added/Conducted relevant tests
  • Performed self-review of the code
  • Updated Web Audio API coverage
  • Added support for web

@mdydek mdydek added the feature New feature label Nov 12, 2025
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>) {
Copy link
Collaborator

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.

Copy link
Collaborator

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,
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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()) %
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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(
Copy link
Collaborator

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;
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants