MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / process

Method process

Engine/lib/openal-soft/core/mastering.cpp:395–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

393
394
395void Compressor::process(const uint SamplesToDo, FloatBufferLine *OutBuffer)
396{
397 const size_t numChans{mNumChans};
398
399 ASSUME(SamplesToDo > 0);
400 ASSUME(numChans > 0);
401
402 const float preGain{mPreGain};
403 if(preGain != 1.0f)
404 {
405 auto apply_gain = [SamplesToDo,preGain](FloatBufferLine &input) noexcept -> void
406 {
407 float *buffer{al::assume_aligned<16>(input.data())};
408 std::transform(buffer, buffer+SamplesToDo, buffer,
409 std::bind(std::multiplies<float>{}, _1, preGain));
410 };
411 std::for_each(OutBuffer, OutBuffer+numChans, apply_gain);
412 }
413
414 LinkChannels(this, SamplesToDo, OutBuffer);
415
416 if(mAuto.Attack || mAuto.Release)
417 CrestDetector(this, SamplesToDo);
418
419 if(mHold)
420 PeakHoldDetector(this, SamplesToDo);
421 else
422 PeakDetector(this, SamplesToDo);
423
424 GainCompressor(this, SamplesToDo);
425
426 if(mDelay)
427 SignalDelay(this, SamplesToDo, OutBuffer);
428
429 const float (&sideChain)[BufferLineSize*2] = mSideChain;
430 auto apply_comp = [SamplesToDo,&sideChain](FloatBufferLine &input) noexcept -> void
431 {
432 float *buffer{al::assume_aligned<16>(input.data())};
433 const float *gains{al::assume_aligned<16>(&sideChain[0])};
434 std::transform(gains, gains+SamplesToDo, buffer, buffer,
435 std::bind(std::multiplies<float>{}, _1, _2));
436 };
437 std::for_each(OutBuffer, OutBuffer+numChans, apply_comp);
438
439 auto side_begin = std::begin(mSideChain) + SamplesToDo;
440 std::copy(side_begin, side_begin+mLookAhead, std::begin(mSideChain));
441}

Callers 2

CalcHrirOnsetFunction · 0.45
AverageHrirOnsetFunction · 0.45

Calls 10

transformFunction · 0.85
for_eachFunction · 0.85
LinkChannelsFunction · 0.85
CrestDetectorFunction · 0.85
PeakHoldDetectorFunction · 0.85
PeakDetectorFunction · 0.85
GainCompressorFunction · 0.85
SignalDelayFunction · 0.85
beginFunction · 0.85
dataMethod · 0.45

Tested by

no test coverage detected