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

Method PlayNote

Source/PitchChorus.cpp:91–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91void PitchChorus::PlayNote(double time, int pitch, int velocity, int voiceIdx, ModulationParameters modulation)
92{
93 for (int i = 0; i < kNumShifters; ++i)
94 {
95 if (velocity > 0 && mShifters[i].mOn == false)
96 {
97 float ratio = TheScale->PitchToFreq(pitch) / TheScale->PitchToFreq(60);
98 mShifters[i].mOn = true;
99 mShifters[i].mShifter.SetRatio(ratio);
100 mShifters[i].mPitch = pitch;
101 mShifters[i].mRamp.Start(time, 1, time + 100);
102 break;
103 }
104 if (velocity == 0 && mShifters[i].mOn == true && mShifters[i].mPitch == pitch)
105 {
106 mShifters[i].mOn = false;
107 mShifters[i].mRamp.Start(time, 0, time + 100);
108 break;
109 }
110 }
111}
112
113void PitchChorus::DrawModule()
114{

Callers

nothing calls this directly

Calls 3

PitchToFreqMethod · 0.80
SetRatioMethod · 0.80
StartMethod · 0.45

Tested by

no test coverage detected