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

Method lfoShapeSample

src/core/EnvelopeAndLfoParameters.cpp:204–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202
203
204inline sample_t EnvelopeAndLfoParameters::lfoShapeSample( fpp_t _frame_offset )
205{
206 f_cnt_t frame = ( m_lfoFrame + _frame_offset ) % m_lfoOscillationFrames;
207 const float phase = frame / static_cast<float>(
208 m_lfoOscillationFrames );
209 sample_t shape_sample;
210 switch( m_lfoWaveModel.value() )
211 {
212 case TriangleWave:
213 shape_sample = Oscillator::triangleSample( phase );
214 break;
215 case SquareWave:
216 shape_sample = Oscillator::squareSample( phase );
217 break;
218 case SawWave:
219 shape_sample = Oscillator::sawSample( phase );
220 break;
221 case UserDefinedWave:
222 shape_sample = m_userWave.userWaveSample( phase );
223 break;
224 case RandomWave:
225 if( frame == 0 )
226 {
227 m_random = Oscillator::noiseSample( 0.0f );
228 }
229 shape_sample = m_random;
230 break;
231 case SineWave:
232 default:
233 shape_sample = Oscillator::sinSample( phase );
234 break;
235 }
236 return shape_sample * m_lfoAmount;
237}
238
239
240

Callers

nothing calls this directly

Calls 6

triangleSampleFunction · 0.85
squareSampleFunction · 0.85
sawSampleFunction · 0.85
noiseSampleFunction · 0.85
sinSampleFunction · 0.85
valueMethod · 0.45

Tested by

no test coverage detected