5 float A =
log(10) / 20;
10 float u =
exp(1 + A * mi);
12 return mi + (t - mi) * (f / u);
19 float A =
log(10) / 20;
24 float u =
exp(1 + A * mi);
26 return u * ((f - mi) / (t - mi));
35 me.configureXonoticSlider(me, theValueMin, theValueMax, theValueStep, theCvar, theTooltip);
46 if (!me.controlledCvar)
49 v =
cvar(me.controlledCvar);
59 if (!me.controlledCvar)
62 if(me.value > me.valueMax - 0.5 * me.valueStep)
71 if(v > me.valueMax - 0.5 * me.valueStep)
72 return CTX(_(
"VOL^MAX"));
73 else if(v <= me.valueMin)
74 return CTX(_(
"VOL^OFF"));
76 return sprintf(
"%d %%", (v - me.valueMin) / (me.valueMax - me.valueMin) * 100);
78 return sprintf(
"%.1f", (v - me.valueMin) / (me.valueMax - me.valueMin) * 10);
89 for (
int i = -400; i < 0; ++i)
95 LOG_INFOF(
"%f -> %f -> %f (diff: %f)", db, v, dbv, d);
float toDecibelOfSquare(float f, float mi)
ERASEABLE string ftos_decimals(float number, int decimals)
converts a number to a string with the indicated number of decimals
void Slider_setValue_noAnim(entity me, float val)
float fromDecibelOfSquare(float f, float mi)
#define EXPECT_GT(val1, val2)
#define SUCCEED()
Must be present at the end of a test.
string XonoticDecibelsSlider_valueToText(entity me, float v)
bool autocvar_test_XonoticDecibelsSlider
entity makeXonoticDecibelsSlider(float theValueMin, float theValueMax, float theValueStep, string theCvar)
float autocvar_menu_snd_sliderscale
TEST(XonoticDecibelsSlider, SoundTest)
ERASEABLE string CTX(string s)
entity makeXonoticDecibelsSlider_T(float theValueMin, float theValueMax, float theValueStep, string theCvar, string theTooltip)
void XonoticDecibelsSlider_loadCvars(entity me)
void XonoticDecibelsSlider_saveCvars(entity me)