| 111 | } |
| 112 | |
| 113 | void WaveformViewer::DrawModule() |
| 114 | { |
| 115 | if (Minimized() || IsVisible() == false) |
| 116 | return; |
| 117 | |
| 118 | mDisplayFreqEntry->Draw(); |
| 119 | mLengthSamplesSlider->Draw(); |
| 120 | mDrawGainSlider->Draw(); |
| 121 | /*mHueNote->Draw(); |
| 122 | mHueAudio->Draw(); |
| 123 | mHueInstrument->Draw(); |
| 124 | mHueNoteSource->Draw(); |
| 125 | mSaturation->Draw(); |
| 126 | mBrightness->Draw();*/ |
| 127 | |
| 128 | if (!mEnabled) |
| 129 | return; |
| 130 | |
| 131 | ofPushStyle(); |
| 132 | ofPushMatrix(); |
| 133 | |
| 134 | ofSetColor(245, 58, 135); |
| 135 | ofSetLineWidth(2); |
| 136 | |
| 137 | float w, h; |
| 138 | GetDimensions(w, h); |
| 139 | int lengthSamples = MIN(mLengthSamples, BUFFER_VIZ_SIZE); |
| 140 | float vizPhaseInc = GetPhaseInc(mDisplayFreq / 2); |
| 141 | float phaseStart = (FTWO_PI - mVizPhase[mDoubleBufferFlip]) / vizPhaseInc; |
| 142 | float end = lengthSamples - (FTWO_PI / vizPhaseInc); |
| 143 | |
| 144 | if (mDrawWaveform) |
| 145 | { |
| 146 | ofBeginShape(); |
| 147 | for (int i = phaseStart; i < lengthSamples; i++) |
| 148 | { |
| 149 | float x = ofMap(i - phaseStart, 0, end, 0, w, true); |
| 150 | float samp = mAudioView[(i + mBufferVizOffset[mDoubleBufferFlip]) % lengthSamples][mDoubleBufferFlip]; |
| 151 | samp *= mDrawGain; |
| 152 | if (x < w) |
| 153 | ofVertex(x, h / 2 - samp * (h / 2)); |
| 154 | } |
| 155 | ofEndShape(false); |
| 156 | } |
| 157 | |
| 158 | if (mDrawCircle) |
| 159 | { |
| 160 | ofSetCircleResolution(32); |
| 161 | ofSetLineWidth(1); |
| 162 | for (int i = phaseStart; i < lengthSamples; i++) |
| 163 | { |
| 164 | float a = float(i - phaseStart) / end; |
| 165 | if (a < 1) |
| 166 | { |
| 167 | float rad = a * MIN(w, h) / 2; |
| 168 | float samp = mAudioView[(i + mBufferVizOffset[mDoubleBufferFlip]) % lengthSamples][mDoubleBufferFlip]; |
| 169 | if (samp > 0) |
| 170 | ofSetColor(245, 58, 135, ofMap(samp * mDrawGain / 10, 0, 1, 0, 255, true)); |
nothing calls this directly
no test coverage detected