MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / PlayNote

Method PlayNote

Source/SignalGenerator.cpp:208–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206}
207
208void SignalGenerator::PlayNote(double time, int pitch, int velocity, int voiceIdx, ModulationParameters modulation)
209{
210 if (velocity > 0)
211 {
212 if (mFreqMode == kFreqMode_Instant)
213 {
214 mFreq = TheScale->PitchToFreq(pitch);
215 }
216 else if (mFreqMode == kFreqMode_Ramp)
217 {
218 mFreqRamp.Start(time, TheScale->PitchToFreq(pitch), time + mFreqRampTime);
219 }
220 else if (mFreqMode == kFreqMode_Slider)
221 {
222 float freq = TheScale->PitchToFreq(pitch);
223 if (freq >= mFreq)
224 {
225 mFreqSliderAmount = 0;
226 mFreqSliderStart = mFreq;
227 mFreqSliderEnd = freq;
228 }
229 else
230 {
231 mFreqSliderAmount = 1;
232 mFreqSliderStart = freq;
233 mFreqSliderEnd = mFreq;
234 }
235 }
236 }
237}
238
239void SignalGenerator::OnPulse(double time, float velocity, int flags)
240{

Callers

nothing calls this directly

Calls 2

PitchToFreqMethod · 0.80
StartMethod · 0.45

Tested by

no test coverage detected