aboutsummaryrefslogtreecommitdiff
path: root/Plugins/tools.h
diff options
context:
space:
mode:
Diffstat (limited to 'Plugins/tools.h')
-rw-r--r--Plugins/tools.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/Plugins/tools.h b/Plugins/tools.h
new file mode 100644
index 0000000..272ff63
--- /dev/null
+++ b/Plugins/tools.h
@@ -0,0 +1,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);
+}