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

Method process

src/extended/SfxrNode.cpp:703–799  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

701}
702
703void SfxrNode::process(ContextRenderLock &r, int bufferSize)
704{
705 AudioBus * outputBus = output(0)->bus(r);
706
707 if (!isInitialized() || !outputBus->numberOfChannels())
708 {
709 outputBus->zero();
710 return;
711 }
712
713 int quantumFrameOffset = _scheduler._renderOffset;
714 int nonSilentFramesToProcess = _scheduler._renderLength;
715
716 if (!nonSilentFramesToProcess)
717 {
718 outputBus->zero();
719 return;
720 }
721
722 float * destP = outputBus->channel(0)->mutableData();
723
724 // Start rendering at the correct offset.
725 destP += quantumFrameOffset;
726 int n = nonSilentFramesToProcess;
727
728#define UPDATE(typ, cur, val) \
729 { \
730 typ v = static_cast<typ>(val->value()); \
731 if (sfxr->cur != v) \
732 { \
733 needUpdate = true; \
734 sfxr->cur = v; \
735 } \
736 }
737
738 bool needUpdate = false;
739 {
740 int v = _waveType->valueUint32();
741 if (sfxr->wave_type != v)
742 {
743 needUpdate = true;
744 sfxr->wave_type = v;
745 }
746 }
747
748 /// @fixme these values should be per sample, not per quantum
749 /// -or- they should be settings if they don't vary per sample
750 UPDATE(float, p_base_freq, _startFrequency)
751 UPDATE(float, p_freq_limit, _minFrequency)
752 UPDATE(float, p_freq_ramp, _slide)
753 UPDATE(float, p_freq_dramp, _deltaSlide)
754 UPDATE(float, p_duty, _squareDuty)
755 UPDATE(float, p_duty_ramp, _dutySweep)
756
757 UPDATE(float, p_vib_strength, _vibratoDepth)
758 UPDATE(float, p_vib_speed, _vibratoSpeed)
759
760 UPDATE(float, p_env_attack, _attack)

Callers

nothing calls this directly

Calls 9

mutableDataMethod · 0.80
channelMethod · 0.80
valueUint32Method · 0.80
ResetSampleMethod · 0.80
SynthSampleMethod · 0.80
busMethod · 0.45
numberOfChannelsMethod · 0.45
zeroMethod · 0.45
clearSilentFlagMethod · 0.45

Tested by

no test coverage detected