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

Method SetPitchColor

Source/KeyboardDisplay.cpp:157–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157void KeyboardDisplay::SetPitchColor(int pitch)
158{
159 if (mShowScale)
160 {
161 if (TheScale->IsRoot(pitch))
162 ofSetColor(0, 200, 0);
163 else if (TheScale->IsInPentatonic(pitch))
164 ofSetColor(255, 128, 0);
165 else if (TheScale->IsInScale(pitch))
166 ofSetColor(180, 80, 0);
167 else
168 ofSetColor(50, 50, 50);
169 }
170 else
171 {
172 int enableOffset = 0;
173 if (!IsEnabled())
174 enableOffset = 80;
175
176 pitch %= 12;
177 ofColor color;
178 if (pitch == 0 || pitch == 2 || pitch == 4 || pitch == 5 || pitch == 7 || pitch == 9 || pitch == 11)
179 color.setHsb(240, 145, 200 - enableOffset);
180 else
181 color.setHsb(240, 145, 120 - enableOffset);
182 ofSetColor(color);
183 }
184}
185
186void KeyboardDisplay::Resize(float w, float h)
187{

Callers

nothing calls this directly

Calls 5

ofSetColorFunction · 0.85
IsRootMethod · 0.80
IsInPentatonicMethod · 0.80
IsInScaleMethod · 0.80
setHsbMethod · 0.80

Tested by

no test coverage detected