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

Method DrawModule

Source/BandVocoder.cpp:164–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162}
163
164void BandVocoder::DrawModule()
165{
166 if (Minimized() || IsVisible() == false)
167 return;
168
169 mInputSlider->Draw();
170 mCarrierSlider->Draw();
171 mVolumeSlider->Draw();
172 mDryWetSlider->Draw();
173 mFBaseSlider->Draw();
174 mFRangeSlider->Draw();
175 mQSlider->Draw();
176 mNumBandsSlider->Draw();
177 mRingTimeSlider->Draw();
178 mMaxBandSlider->Draw();
179 mSpacingStyleSlider->Draw();
180
181 float w, h;
182 GetModuleDimensions(w, h);
183
184 auto PosForFreq = [](float freq)
185 {
186 return log2(freq / 20) / 10;
187 };
188 ofSetColor(0, 255, 0);
189 for (int i = 0; i < mNumBands; ++i)
190 {
191 float x = PosForFreq(mBiquadCarrier[i].mF) * w;
192 ofLine(x, h, x, h - mPeaks[i].GetPeak() * 200);
193 }
194
195 auto FreqForPos = [](float pos)
196 {
197 return 20.0 * std::pow(2.0, pos * 10);
198 };
199 ofSetColor(52, 204, 235, 70);
200 ofSetLineWidth(1);
201 for (int i = 0; i < mNumBands; ++i)
202 {
203 ofBeginShape();
204 const int kPixelStep = 1;
205 for (int x = 0; x < w + kPixelStep; x += kPixelStep)
206 {
207 float freq = FreqForPos(x / w);
208 if (freq < gSampleRate / 2)
209 {
210 float response = mBiquadCarrier[i].GetMagnitudeResponseAt(freq);
211 ofVertex(x, (.5f - .666f * log10(response)) * h);
212 }
213 }
214 ofEndShape(false);
215 }
216
217 if (!mCarrierDataSet)
218 {
219 ofPushStyle();
220 ofSetColor(255, 0, 0);
221 DrawTextNormal("no vocodercarrier!", 5, h - 5);

Callers

nothing calls this directly

Calls 12

ofSetColorFunction · 0.85
ofLineFunction · 0.85
ofSetLineWidthFunction · 0.85
ofBeginShapeFunction · 0.85
ofVertexFunction · 0.85
ofEndShapeFunction · 0.85
ofPushStyleFunction · 0.85
DrawTextNormalFunction · 0.85
ofPopStyleFunction · 0.85
GetPeakMethod · 0.80
DrawMethod · 0.45

Tested by

no test coverage detected