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

Method ButtonClicked

Source/BeatBloks.cpp:409–457  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

407}
408
409void BeatBloks::ButtonClicked(ClickButton* button, double time)
410{
411 if (button == mWriteButton)
412 {
413 //mWantWrite = true;
414 mClipStart = StartTime(mBars[10]) * mSample->LengthInSamples();
415 mClipEnd = StartTime(mBars[14]) * mSample->LengthInSamples();
416 mZoomStart = mClipStart - 40000;
417 mZoomEnd = mClipEnd + 40000;
418 mNumBars = 4;
419 UpdateZoomExtents();
420 }
421 if (button == mDoubleLengthButton)
422 {
423 float newEnd = (mClipEnd - mClipStart) * 2 + mClipStart;
424 if (newEnd < mSample->LengthInSamples())
425 {
426 mClipEnd = newEnd;
427 mNumBars *= 2;
428 }
429 }
430 if (button == mHalveLengthButton)
431 {
432 if (mNumBars % 2 == 0)
433 {
434 float newEnd = (mClipEnd - mClipStart) / 2 + mClipStart;
435 mClipEnd = newEnd;
436 mNumBars /= 2;
437 }
438 }
439 if (button == mClearRemixButton)
440 {
441 mRemixBloks.clear();
442 }
443
444 if (button == mGetLuckyButton)
445 {
446 std::vector<std::string> fake;
447 fake.push_back(ofToDataPath("Daft Punk - Get Lucky.mp3"));
448 FilesDropped(fake, 0, 0);
449 mOffset = -53275;
450 }
451 if (button == mLoseYourselfButton)
452 {
453 std::vector<std::string> fake;
454 fake.push_back(ofToDataPath("Daft Punk - Lose Yourself To Dance.mp3"));
455 FilesDropped(fake, 0, 0);
456 }
457}
458
459void BeatBloks::DoWrite()
460{

Callers

nothing calls this directly

Calls 2

ofToDataPathFunction · 0.85
LengthInSamplesMethod · 0.80

Tested by

no test coverage detected