Add private setters for "from" and "to" (#7071)

* Add private setters for "from" and "to"

Add private setters for the "from" and "to" values in `AudioFileProcessorWaveView`. When being used the setters will ensure that the bounds are respected.

Also add a `range` method because this computation was done repeatedly throughout the code.

Fixes #7068 but masks some of the original problems with the code that computes out-of-bounds values for "from" and "to" like the `slide` method. Problematic code can still be found by temporarily adding the following assertions to the setters:
* `assert (to <= m_sample->sampleSize());` in `setTo`
* `assert (from >= 0);` in `setFrom`

* Remove superfluous calls to qMax and qMin
This commit is contained in:
Michael Gregorius
2024-01-24 18:12:42 +01:00
committed by GitHub
parent 8e8f68552f
commit ffcf8c261d
2 changed files with 35 additions and 15 deletions

View File

@@ -152,6 +152,9 @@ public:
void updateSampleRange();
private:
void setTo(f_cnt_t to);
void setFrom(f_cnt_t from);
f_cnt_t range() const;
void zoom(const bool out = false);
void slide(int px);
void slideSamplePointByPx(Point point, int px);