@@ -29,7 +29,7 @@ namespace audio
2929 state (),
3030 params (*this , state),
3131 macroProcessor (params),
32- midiLearn (params, state),
32+ midiManager (params, state),
3333#if PPDHasHQ
3434 oversampler (),
3535#endif
@@ -115,13 +115,13 @@ namespace audio
115115 void ProcessorBackEnd::savePatch ()
116116 {
117117 params.savePatch (props);
118- midiLearn .savePatch ();
118+ midiManager .savePatch ();
119119 }
120120
121121 void ProcessorBackEnd::loadPatch ()
122122 {
123123 params.loadPatch (props);
124- midiLearn .loadPatch ();
124+ midiManager .loadPatch ();
125125 forcePrepareToPlay ();
126126 }
127127
@@ -185,7 +185,8 @@ namespace audio
185185 // PROCESSOR
186186
187187 Processor::Processor () :
188- ProcessorBackEnd ()
188+ ProcessorBackEnd (),
189+ absorb ()
189190 {
190191 }
191192
@@ -195,13 +196,15 @@ namespace audio
195196#if PPDHasHQ
196197 oversampler.setEnabled (params[PID ::HQ ]->getValMod () > .5f );
197198 oversampler.prepare (sampleRate, maxBlockSize);
198- // const auto sampleRateUp = oversampler.getFsUp();
199- // const auto sampleRateUpF = static_cast<float>(sampleRateUp);
200- // const auto blockSizeUp = oversampler.getBlockSizeUp();
199+ const auto sampleRateUp = oversampler.getFsUp ();
200+ const auto sampleRateUpF = static_cast <float >(sampleRateUp);
201+ const auto blockSizeUp = oversampler.getBlockSizeUp ();
201202 latency = oversampler.getLatency ();
202203#endif
203204 const auto sampleRateF = static_cast <float >(sampleRate);
204205
206+ absorb.prepare (sampleRateUpF, blockSizeUp);
207+
205208 dryWetMix.prepare (sampleRateF, maxBlockSize, latency);
206209
207210 meters.prepare (sampleRateF, maxBlockSize);
@@ -215,7 +218,7 @@ namespace audio
215218 {
216219 const ScopedNoDenormals noDenormals;
217220
218- midiLearn (midi);
221+ // midiLearn(midi);
219222 macroProcessor ();
220223
221224 auto mainBus = getBus (true , 0 );
@@ -228,6 +231,8 @@ namespace audio
228231 if (numSamples == 0 )
229232 return ;
230233
234+ midiManager (midi, numSamples);
235+
231236 if (params[PID ::Power]->getValMod () < .5f )
232237 return processBlockBypassed (buffer, midi);
233238
@@ -267,21 +272,22 @@ namespace audio
267272#else
268273 auto resampledBuf = &buffer;
269274#endif
275+ auto resampledMainBuf = mainBus->getBusBuffer (*resampledBuf);
270276
271277#if PPDHasSidechain
272278 if (wrapperType != wrapperType_Standalone)
273279 {
274- const auto scBus = getBus (true , 1 );
280+ auto scBus = getBus (true , 1 );
275281 if (scBus != nullptr )
276282 if (scBus->isEnabled ())
277283 {
278- const auto scBuffer = scBus->getBusBuffer (*resampledBuf);
284+ auto scBuffer = scBus->getBusBuffer (*resampledBuf);
279285
280286 processBlockCustom (
281- resampledBuf-> getArrayOfWritePointers (),
282- resampledBuf-> getNumChannels (),
283- resampledBuf-> getNumSamples (),
284- scBuffer.getArrayOfReadPointers (),
287+ resampledMainBuf. getArrayOfWritePointers (),
288+ resampledMainBuf. getNumChannels (),
289+ resampledMainBuf. getNumSamples (),
290+ scBuffer.getArrayOfWritePointers (),
285291 scBuffer.getNumChannels ()
286292 );
287293 }
@@ -292,9 +298,9 @@ namespace audio
292298 }
293299#else
294300 processBlockCustom (
295- resampledBuf-> getArrayOfWritePointers (),
296- resampledBuf-> getNumChannels (),
297- resampledBuf-> getNumSamples ()
301+ resampledMainBuf. getArrayOfWritePointers (),
302+ resampledMainBuf. getNumChannels (),
303+ resampledMainBuf. getNumSamples ()
298304 );
299305#endif
300306
@@ -329,20 +335,18 @@ namespace audio
329335
330336 void Processor::processBlockCustom (float ** samples, int numChannels, int numSamples
331337#if PPDHasSidechain
332- , const float ** samplesSC, int numChannelsSC
338+ , float ** samplesSC, int numChannelsSC
333339#endif
334340 ) noexcept
335341 {
336- for (auto ch = 0 ; ch < numChannels; ++ch)
337- {
338- const auto chSC = ch % numChannelsSC;
339- const auto smplsSC = samplesSC[chSC];
340-
341- auto smpls = samples[ch];
342-
343- for (auto s = 0 ; s < numSamples; ++s)
344- smpls[s] *= smplsSC[s] * 2 .f ;
345- }
342+ auto rm = params[PID ::AbsorbRM]->getValModDenorm ();
343+ auto am = params[PID ::AbsorbAM]->getValModDenorm ();
344+ auto shapr = params[PID ::AbsorbShapr]->getValModDenorm ();
345+ auto crushr = params[PID ::AbsorbCrushr]->getValModDenorm ();
346+ auto foldr = params[PID ::AbsorbFoldr]->getValModDenorm ();
347+
348+ absorb (samples, numChannels, numSamples, samplesSC, numChannelsSC,
349+ rm, am, shapr, crushr, foldr);
346350 }
347351
348352 void Processor::releaseResources () {}
0 commit comments