MCPcopy Create free account
hub / github.com/LabSound/LabSound / process

Method process

src/core/DynamicsCompressorNode.cpp:58–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58void DynamicsCompressorNode::process(ContextRenderLock &r, int bufferSize)
59{
60 /// @fixme these values should be per sample, not per quantum
61 /// -or- they should be settings if they don't vary per sample
62 float threshold = m_threshold->value();
63 float knee = m_knee->value();
64 float ratio = m_ratio->value();
65 float attack = m_attack->value();
66 float release = m_release->value();
67
68 m_dynamicsCompressor->setParameterValue(DynamicsCompressor::ParamThreshold, threshold);
69 m_dynamicsCompressor->setParameterValue(DynamicsCompressor::ParamKnee, knee);
70 m_dynamicsCompressor->setParameterValue(DynamicsCompressor::ParamRatio, ratio);
71 m_dynamicsCompressor->setParameterValue(DynamicsCompressor::ParamAttack, attack);
72 m_dynamicsCompressor->setParameterValue(DynamicsCompressor::ParamRelease, release);
73
74 int numberOfSourceChannels = input(0)->numberOfChannels(r);
75 int numberOfActiveBusChannels = input(0)->bus(r)->numberOfChannels();
76 if (numberOfActiveBusChannels != numberOfSourceChannels)
77 {
78 checkNumberOfChannelsForInput(r, input(0).get());
79 }
80
81 int numberOfDestChannels = output(0)->numberOfChannels();
82 if (numberOfDestChannels != numberOfActiveBusChannels)
83 {
84 output(0)->setNumberOfChannels(r, numberOfActiveBusChannels);
85 output(0)->updateRenderingState(r);
86 numberOfDestChannels = output(0)->numberOfChannels();
87 }
88
89 AudioBus* outputBus = output(0)->bus(r);
90 ASSERT(outputBus && outputBus->numberOfChannels() == numberOfDestChannels);
91
92 m_dynamicsCompressor->process(r, input(0)->bus(r), outputBus, bufferSize, _scheduler._renderOffset, _scheduler._renderLength);
93
94 float reduction = m_dynamicsCompressor->parameterValue(DynamicsCompressor::ParamReduction);
95 m_reduction->setValue(reduction);
96}
97
98void DynamicsCompressorNode::reset(ContextRenderLock &)
99{

Callers

nothing calls this directly

Calls 9

setParameterValueMethod · 0.80
getMethod · 0.80
parameterValueMethod · 0.80
setValueMethod · 0.80
valueMethod · 0.45
numberOfChannelsMethod · 0.45
busMethod · 0.45
setNumberOfChannelsMethod · 0.45
updateRenderingStateMethod · 0.45

Tested by

no test coverage detected