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

Method UpdateSample

Source/SamplePlayer.cpp:494–519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

492}
493
494void SamplePlayer::UpdateSample(Sample* sample, bool ownsSample)
495{
496 Sample* oldSamplePtr = mSample;
497 bool ownedOldSample = mOwnsSample;
498
499 float lengthSeconds = sample->LengthInSamples() / (gSampleRate * sample->GetSampleRateRatio());
500 mCuePointStartSlider->SetExtents(0, lengthSeconds);
501 mCuePointLengthSlider->SetExtents(0, lengthSeconds);
502
503 sample->SetPlayPosition(0);
504 sample->SetLooping(mLoop);
505 sample->SetRate(mSpeed);
506 mSample = sample;
507 mPlay = false;
508 mOwnsSample = ownsSample;
509 mZoomLevel = 1;
510 mZoomOffset = 0;
511 mRecordingLength = 0;
512
513 mErrorString = "";
514
515 if (ownedOldSample)
516 delete oldSamplePtr;
517
518 mIsLoadingSample = true;
519}
520
521void SamplePlayer::ButtonClicked(ClickButton* button, double time)
522{

Callers

nothing calls this directly

Calls 6

LengthInSamplesMethod · 0.80
SetPlayPositionMethod · 0.80
SetLoopingMethod · 0.80
GetSampleRateRatioMethod · 0.45
SetExtentsMethod · 0.45
SetRateMethod · 0.45

Tested by

no test coverage detected