resonance 1.0.1
Loading...
Searching...
No Matches
LinearTransform Class Reference

Linear map from one integer range onto another, clamped to the output range. More...

#include <lineartransform.h>

Public Member Functions

 LinearTransform (int nInMin, int nInMax, int nOutMin, int nOutMax)
 Map inMin onto outMin and inMax onto outMax.
int Apply (int nValue)
 Map a value, truncating toward zero and clamping to the output range.

Detailed Description

Linear map from one integer range onto another, clamped to the output range.

The class is not polymorphic and emits no RTTI. The object is 0x20 bytes. PitchPicker's pitch chooser at 0x001c4488 builds one on its stack, storing the four range words directly before calling Recalc(). The sequence has the shape of an inline constructor around an out-of-line initialiser.

Constructor & Destructor Documentation

◆ LinearTransform()

LinearTransform::LinearTransform ( int nInMin,
int nInMax,
int nOutMin,
int nOutMax )
inline

Map inMin onto outMin and inMax onto outMax.

Parameters
nInMinThe start of the input range.
nInMaxThe end of the input range.
nOutMinThe value nInMin maps to.
nOutMaxThe value nInMax maps to.

Member Function Documentation

◆ Apply()

int LinearTransform::Apply ( int nValue)

Map a value, truncating toward zero and clamping to the output range.

Parameters
nValueThe input value.
Returns
The mapped value, between the smaller and the larger of the two output ends.
Ghidra address:
NTSC-U/C: 0x00536fe0
Ghidra address:
PAL: 0x005768a0

The documentation for this class was generated from the following file: