Draw fader ticks

Draw fader ticks in case the model is a linear one. This means that for
now they should only be painted for the mixer faders but not for the
faders of the Compressor, Delay, etc.

Extract the computation of the scaled ratio between the maximum model dB
value and the minimum supported fader dB value into the new private
method `computeScaledRatio`. This is necessary because it is needed to
paint the fader knob at the correct position (using the knob bottom as
the reference) and to paint the fader ticks at the correct position
(using the knob center).

Introduce the private method `paintFaderTicks` which paints the fader
ticks.

Note: to paint some non-evenly spaced fader ticks replace the `for`
expression in `paintFaderTicks` with something like the following:
```
for (auto & i : {6.f, 0.f, -6.f, -12.f, -24.f, -36.f, -48.f, -60.f, -72.f, -84.f, -96.f, -108.f, -120.f})
```
This commit is contained in:
Michael Gregorius
2024-12-29 14:10:02 +01:00
parent 795c681a2c
commit 344fae26f2
2 changed files with 45 additions and 4 deletions

View File

@@ -118,10 +118,21 @@ private:
void paintEvent(QPaintEvent* ev) override;
void paintLevels(QPaintEvent* ev, QPainter& painter, bool linear = false);
void paintFaderTicks(QPainter& painter);
int calculateKnobPosYFromModel() const;
void setVolumeByLocalPixelValue(int y);
// Computes the scaled ratio between the maximum dB value supported by the model and the minimum
// dB value that's supported by the fader from the given actual dB value.
// If the provided input value lies inside the aforementioned interval then the result will be
// a value between 0 (value == minimum value) and 1 (value == maximum model value).
// If you look at the graphical representation of the fader then 0 represents a point at the bottom
// of the fader and 1 a point at the top of the fader.
// The ratio is scaled by an internal exponent which is an implementation detail that cannot be
// changed for now.
float computeScaledRatio(float dBValue) const;
void setPeak(float fPeak, float& targetPeak, float& persistentPeak, QElapsedTimer& lastPeakTimer);
void updateTextFloat();