| 108 | } |
| 109 | |
| 110 | void BiquadFilterEffect::DrawModule() |
| 111 | { |
| 112 | mTypeSelector->Draw(); |
| 113 | |
| 114 | mFSlider->Draw(); |
| 115 | mQSlider->Draw(); |
| 116 | mGSlider->Draw(); |
| 117 | |
| 118 | auto FreqForPos = [](float pos) |
| 119 | { |
| 120 | return 20.0 * std::pow(2.0, pos * 10); |
| 121 | }; |
| 122 | |
| 123 | float w, h; |
| 124 | GetModuleDimensions(w, h); |
| 125 | ofSetColor(52, 204, 235); |
| 126 | ofSetLineWidth(1); |
| 127 | ofBeginShape(); |
| 128 | const int kPixelStep = 1; |
| 129 | for (int x = 0; x < w + kPixelStep; x += kPixelStep) |
| 130 | { |
| 131 | float freq = FreqForPos(x / w); |
| 132 | if (freq < gSampleRate / 2) |
| 133 | { |
| 134 | float response = mBiquad[0].GetMagnitudeResponseAt(freq); |
| 135 | ofVertex(x, (.5f - .666f * log10(response)) * h); |
| 136 | } |
| 137 | } |
| 138 | ofEndShape(false); |
| 139 | } |
| 140 | |
| 141 | float BiquadFilterEffect::GetEffectAmount() |
| 142 | { |
nothing calls this directly
no test coverage detected