aboutsummaryrefslogtreecommitdiff
path: root/Plugins/tools.h
blob: 272ff63564b4bfbc730847ff36c3224b46c4376f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//
// some small helpers
//
// written by olaf.matthes@gmx.de
//

// scale an input f that goes from il to ih to go from ol to oh
__inline long scl(long f, long il, long ih, long ol, long oh)
{
	long or = abs(oh-ol);
	long ir = abs(ih-il);
	float ratio = or/ir;
	long steps = f-il;
	return(steps*ratio+ol);
}