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

Method DrawModule

Source/Producer.cpp:261–340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261void Producer::DrawModule()
262{
263
264 if (Minimized() || IsVisible() == false)
265 return;
266
267 mVolumeSlider->Draw();
268 mPlayCheckbox->Draw();
269 mLoopCheckbox->Draw();
270
271 if (mSample)
272 {
273 ofPushMatrix();
274 ofTranslate(mBufferX, mBufferY);
275 ofPushStyle();
276
277 mSample->LockDataMutex(true);
278 DrawAudioBuffer(mBufferW, mBufferH, mSample->Data(), mZoomStart, mZoomEnd, (int)mPlayhead);
279 mSample->LockDataMutex(false);
280
281 ofFill();
282 for (int measure = 0; GetMeasureSample(measure) < mZoomEnd; ++measure)
283 {
284 if (GetMeasureSample(measure) >= mZoomStart)
285 {
286 float pos = GetBufferPos(GetMeasureSample(measure));
287 ofSetColor(0, 0, 255);
288 ofRect(pos * mBufferW, 0, 1, mBufferH);
289
290 if (IsSkipMeasure(measure))
291 {
292 ofSetColor(255, 0, 0, 100);
293 ofRect(pos * mBufferW, 0, (GetBufferPos(GetMeasureSample(measure + 1)) - pos) * mBufferW, mBufferH);
294 }
295 }
296 }
297
298 /*int start = ofMap(mClipStart, 0, length, 0, width, true);
299 int end = ofMap(mClipEnd, 0, length, 0, width, true);
300
301 for (int i = 0; i < mNumBars; i++)
302 {
303 float barSpacing = float(end-start)/mNumBars;
304 int x = barSpacing * i + start;
305 x += barSpacing * -mOffset;
306 ofSetColor(255,255,0);
307 ofLine(x, 0, x, height);
308 }
309
310 ofSetColor(255,0,0);
311 ofLine(start,0,start,height);
312 ofLine(end,0,end,height);
313
314 ofSetColor(0,255,0);
315 int position = ofMap(pos, 0, length, 0, width, true);
316 ofLine(position,0,position,height);*/
317
318 ofPopStyle();

Callers

nothing calls this directly

Calls 15

ofPushMatrixFunction · 0.85
ofTranslateFunction · 0.85
ofPushStyleFunction · 0.85
DrawAudioBufferFunction · 0.85
ofFillFunction · 0.85
ofSetColorFunction · 0.85
ofRectFunction · 0.85
ofPopStyleFunction · 0.85
ofPopMatrixFunction · 0.85
DrawTextNormalFunction · 0.85
ofToStringFunction · 0.85
LockDataMutexMethod · 0.80

Tested by

no test coverage detected