MCPcopy Create free account
hub / github.com/LMMS/lmms / processAudioBuffer

Method processAudioBuffer

plugins/ReverbSC/ReverbSC.cpp:73–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73bool ReverbSCEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames )
74{
75 if( !isEnabled() || !isRunning () )
76 {
77 return( false );
78 }
79
80 double outSum = 0.0;
81 const float d = dryLevel();
82 const float w = wetLevel();
83
84 SPFLOAT tmpL, tmpR;
85 SPFLOAT dcblkL, dcblkR;
86
87 ValueBuffer * inGainBuf = m_reverbSCControls.m_inputGainModel.valueBuffer();
88 ValueBuffer * sizeBuf = m_reverbSCControls.m_sizeModel.valueBuffer();
89 ValueBuffer * colorBuf = m_reverbSCControls.m_colorModel.valueBuffer();
90 ValueBuffer * outGainBuf = m_reverbSCControls.m_outputGainModel.valueBuffer();
91
92 for( fpp_t f = 0; f < frames; ++f )
93 {
94 sample_t s[2] = { buf[f][0], buf[f][1] };
95
96 const SPFLOAT inGain = (SPFLOAT)DB2LIN((inGainBuf ?
97 inGainBuf->values()[f]
98 : m_reverbSCControls.m_inputGainModel.value()));
99 const SPFLOAT outGain = (SPFLOAT)DB2LIN((outGainBuf ?
100 outGainBuf->values()[f]
101 : m_reverbSCControls.m_outputGainModel.value()));
102
103 s[0] *= inGain;
104 s[1] *= inGain;
105 revsc->feedback = (SPFLOAT)(sizeBuf ?
106 sizeBuf->values()[f]
107 : m_reverbSCControls.m_sizeModel.value());
108
109 revsc->lpfreq = (SPFLOAT)(colorBuf ?
110 colorBuf->values()[f]
111 : m_reverbSCControls.m_colorModel.value());
112
113
114 sp_revsc_compute(sp, revsc, &s[0], &s[1], &tmpL, &tmpR);
115 sp_dcblock_compute(sp, dcblk[0], &tmpL, &dcblkL);
116 sp_dcblock_compute(sp, dcblk[1], &tmpR, &dcblkR);
117 buf[f][0] = d * buf[f][0] + w * dcblkL * outGain;
118 buf[f][1] = d * buf[f][1] + w * dcblkR * outGain;
119
120 outSum += buf[f][0]*buf[f][0] + buf[f][1]*buf[f][1];
121 }
122
123
124 checkGate( outSum / frames );
125
126 return isRunning();
127}
128
129void ReverbSCEffect::changeSampleRate()
130{

Callers

nothing calls this directly

Calls 9

isEnabledFunction · 0.85
dryLevelFunction · 0.85
wetLevelFunction · 0.85
sp_revsc_computeFunction · 0.85
sp_dcblock_computeFunction · 0.85
valuesMethod · 0.80
isRunningFunction · 0.50
valueBufferMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected