MCPcopy Create free account
hub / github.com/crownengine/crown / process

Method process

3rdparty/openal/alc/mastering.cpp:422–468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

420
421
422void Compressor::process(const ALuint SamplesToDo, FloatBufferLine *OutBuffer)
423{
424 const ALuint numChans{mNumChans};
425
426 ASSUME(SamplesToDo > 0);
427 ASSUME(numChans > 0);
428
429 const ALfloat preGain{mPreGain};
430 if(preGain != 1.0f)
431 {
432 auto apply_gain = [SamplesToDo,preGain](FloatBufferLine &input) noexcept -> void
433 {
434 ALfloat *buffer{al::assume_aligned<16>(input.data())};
435 std::transform(buffer, buffer+SamplesToDo, buffer,
436 std::bind(std::multiplies<float>{}, _1, preGain));
437 };
438 std::for_each(OutBuffer, OutBuffer+numChans, apply_gain);
439 }
440
441 LinkChannels(this, SamplesToDo, OutBuffer);
442
443 if(mAuto.Attack || mAuto.Release)
444 CrestDetector(this, SamplesToDo);
445
446 if(mHold)
447 PeakHoldDetector(this, SamplesToDo);
448 else
449 PeakDetector(this, SamplesToDo);
450
451 GainCompressor(this, SamplesToDo);
452
453 if(mDelay)
454 SignalDelay(this, SamplesToDo, OutBuffer);
455
456 const ALfloat (&sideChain)[BUFFERSIZE*2] = mSideChain;
457 auto apply_comp = [SamplesToDo,&sideChain](FloatBufferLine &input) noexcept -> void
458 {
459 ALfloat *buffer{al::assume_aligned<16>(input.data())};
460 const ALfloat *gains{al::assume_aligned<16>(&sideChain[0])};
461 std::transform(gains, gains+SamplesToDo, buffer, buffer,
462 std::bind(std::multiplies<float>{}, _1, _2));
463 };
464 std::for_each(OutBuffer, OutBuffer+numChans, apply_comp);
465
466 auto side_begin = std::begin(mSideChain) + SamplesToDo;
467 std::copy(side_begin, side_begin+mLookAhead, std::begin(mSideChain));
468}

Callers 8

ProcessAmbiDecMethod · 0.45
ProcessBs2bMethod · 0.45
ProcessContextFunction · 0.45
alu.cppFile · 0.45
aluMixDataFunction · 0.45
BuildBFormatHrtfFunction · 0.45
DoFiltersFunction · 0.45
runMethod · 0.45

Calls 9

LinkChannelsFunction · 0.85
CrestDetectorFunction · 0.85
PeakHoldDetectorFunction · 0.85
PeakDetectorFunction · 0.85
GainCompressorFunction · 0.85
SignalDelayFunction · 0.85
beginFunction · 0.50
copyFunction · 0.50
dataMethod · 0.45

Tested by

no test coverage detected