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

Method SampleDropped

Source/Looper.cpp:1005–1024  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1003}
1004
1005void Looper::SampleDropped(int x, int y, Sample* sample)
1006{
1007 assert(sample);
1008 int numSamples = sample->LengthInSamples();
1009
1010 if (numSamples <= 0)
1011 return;
1012
1013 if (sample->GetNumBars() > 0)
1014 SetNumBars(sample->GetNumBars());
1015
1016 float lengthRatio = float(numSamples) / mLoopLength;
1017 mBuffer->SetNumActiveChannels(sample->NumChannels());
1018 for (int i = 0; i < mLoopLength; ++i)
1019 {
1020 float offset = i * lengthRatio;
1021 for (int ch = 0; ch < sample->NumChannels(); ++ch)
1022 mBuffer->GetChannel(ch)[i] = GetInterpolatedSample(offset, sample->Data()->GetChannel(ch), numSamples);
1023 }
1024}
1025
1026void Looper::GetModuleDimensions(float& width, float& height)
1027{

Callers

nothing calls this directly

Calls 7

GetInterpolatedSampleFunction · 0.85
LengthInSamplesMethod · 0.80
SetNumActiveChannelsMethod · 0.80
GetChannelMethod · 0.80
DataMethod · 0.80
GetNumBarsMethod · 0.45
NumChannelsMethod · 0.45

Tested by

no test coverage detected