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

Method GetInsertPosition

Source/BeatBloks.cpp:873–894  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

871}
872
873float BeatBloks::GetInsertPosition(int& insertIndex)
874{
875 float insertPos = mBufferX;
876 int sourceSampleLength = mSample->LengthInSamples();
877 int i = 0;
878 for (auto iter = mRemixBloks.begin(); iter != mRemixBloks.end(); ++iter, ++i)
879 {
880 float dur = ofMap((*iter)->mDuration * sourceSampleLength, mRemixZoomStart, mRemixZoomEnd, 0, 1);
881
882 float width = MAX(0.0f, mBufferW * dur);
883
884 if (mMouseX < insertPos + width / 2)
885 {
886 insertIndex = i;
887 return insertPos;
888 }
889
890 insertPos += width;
891 }
892 insertIndex = -1;
893 return insertPos;
894}
895
896BeatBloks::Blok* BeatBloks::RemoveBlokAt(int x)
897{

Callers

nothing calls this directly

Calls 2

ofMapFunction · 0.85
LengthInSamplesMethod · 0.80

Tested by

no test coverage detected