| 600 | } |
| 601 | |
| 602 | void FloatSlider::DoCompute(int samplesIn /*= 0*/) |
| 603 | { |
| 604 | if (mLastComputeTime == gTime && mLastComputeSamplesIn == samplesIn) |
| 605 | return; //we've just calculated this, no need to do it again! earlying out avoids wasted work and circular modulation loops |
| 606 | |
| 607 | if (mLFOControl && mLFOControl->Active() && mLFOControl->InLowResMode() && samplesIn != 0) |
| 608 | return; //only do the math on Compute(0) for low res mode |
| 609 | |
| 610 | mLastComputeTime = gTime; |
| 611 | mLastComputeSamplesIn = samplesIn; |
| 612 | |
| 613 | float oldVal = *mVar; |
| 614 | |
| 615 | const bool kUseCache = true; |
| 616 | if (kUseCache && IsAudioThread() && samplesIn >= 0 && samplesIn < gBufferSize && mLastComputeCacheTime[samplesIn] == gTime) |
| 617 | { |
| 618 | *mVar = mLastComputeCacheValue[samplesIn]; |
| 619 | } |
| 620 | else |
| 621 | { |
| 622 | if (mModulator && mModulator->Active()) |
| 623 | { |
| 624 | if (mIsSmoothing) |
| 625 | mSmoothTarget = mModulator->Value(samplesIn); |
| 626 | else |
| 627 | *mVar = mModulator->Value(samplesIn); |
| 628 | } |
| 629 | |
| 630 | if (mIsSmoothing) |
| 631 | *mVar = mRamp.Value(gTime + samplesIn * gInvSampleRateMs); |
| 632 | |
| 633 | if (IsAudioThread() && samplesIn >= 0 && samplesIn < gBufferSize && mLastComputeCacheTime[samplesIn] != gTime) |
| 634 | { |
| 635 | mLastComputeCacheValue[samplesIn] = *mVar; |
| 636 | mLastComputeCacheTime[samplesIn] = gTime; |
| 637 | } |
| 638 | } |
| 639 | |
| 640 | if (oldVal != *mVar) |
| 641 | mOwner->FloatSliderUpdated(this, oldVal, gTime + samplesIn * gInvSampleRateMs); |
| 642 | } |
| 643 | |
| 644 | float* FloatSlider::GetModifyValue() |
| 645 | { |
nothing calls this directly
no test coverage detected