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

Method processAudioBuffer

plugins/MultitapEcho/MultitapEcho.cpp:92–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90
91
92bool MultitapEchoEffect::processAudioBuffer( sampleFrame * buf, const fpp_t frames )
93{
94 if( !isEnabled() || !isRunning () )
95 {
96 return( false );
97 }
98
99 double outSum = 0.0;
100 const float d = dryLevel();
101 const float w = wetLevel();
102
103 // get processing vars
104 const int steps = m_controls.m_steps.value();
105 const float stepLength = m_controls.m_stepLength.value();
106 const float dryGain = dbfsToAmp( m_controls.m_dryGain.value() );
107 const bool swapInputs = m_controls.m_swapInputs.value();
108
109 // check if number of stages has changed
110 if( m_controls.m_stages.isValueChanged() )
111 {
112 m_stages = static_cast<int>( m_controls.m_stages.value() );
113 updateFilters( 0, steps - 1 );
114 }
115
116 // add dry buffer - never swap inputs for dry
117 m_buffer.writeAddingMultiplied( buf, 0, frames, dryGain );
118
119 // swapped inputs?
120 if( swapInputs )
121 {
122 float offset = stepLength;
123 for( int i = 0; i < steps; ++i ) // add all steps swapped
124 {
125 for( int s = 0; s < m_stages; ++s )
126 {
127 runFilter( m_work, buf, m_filter[i][s], frames );
128 }
129 m_buffer.writeSwappedAddingMultiplied( m_work, offset, frames, m_amp[i] );
130 offset += stepLength;
131 }
132 }
133 else
134 {
135 float offset = stepLength;
136 for( int i = 0; i < steps; ++i ) // add all steps
137 {
138 for( int s = 0; s < m_stages; ++s )
139 {
140 runFilter( m_work, buf, m_filter[i][s], frames );
141 }
142 m_buffer.writeAddingMultiplied( m_work, offset, frames, m_amp[i] );
143 offset += stepLength;
144 }
145 }
146
147 // pop the buffer and mix it into output
148 m_buffer.pop( m_work );
149

Callers

nothing calls this directly

Calls 9

isEnabledFunction · 0.85
dryLevelFunction · 0.85
wetLevelFunction · 0.85
dbfsToAmpFunction · 0.85
writeAddingMultipliedMethod · 0.80
isRunningFunction · 0.50
valueMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected