Adding partial sample via source file

Hello all!

This is my first post and I am new to JUCE, so apologies if my introduction to the forum is embarrassingly simple. I am working on building a sampler and I have caught on to the UI pretty quickly, but I have reached a point where I’m learning the backend.

I can successfully load a sample using:

mSampler.addSound(new juce::SamplerSound(key_num, *mFormatReader, range, key_num_int, 0.1, 0.1, 10));

But with the sampler, I am trying to allow users to crop the sample as my UI shows:
image

I understand a lot of the DSP processing of the samples needs to occur in the processBlock of my plugin processor. Which currently looks like this:

void NewProjectAudioProcessor::processBlock (juce::AudioBuffer& buffer, juce::MidiBuffer& midiMessages)
{
juce::ScopedNoDenormals noDenormals;
auto totalNumInputChannels = getTotalNumInputChannels();
auto totalNumOutputChannels = getTotalNumOutputChannels();

// this code if your algorithm always overwrites all the output channels.
for (auto i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
    buffer.clear (i, 0, buffer.getNumSamples());

mSampler.renderNextBlock(buffer, midiMessages, 0, buffer.getNumSamples());

}

I can’t assign the starting point when adding a sound to my sampler, what’s the recommended way to do this? Audio transport? Can those be assigned to a sampler and mapped to a key?

Thanks in advance!