From 8186849bea19a329950783be124c6bb13e5aa345 Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 17 Sep 1996 08:57:15 +0000 Subject: [PATCH] lilypond-0.0.1 --- misc.cc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 misc.cc diff --git a/misc.cc b/misc.cc new file mode 100644 index 0000000000..d07c358d1a --- /dev/null +++ b/misc.cc @@ -0,0 +1,32 @@ +#include "misc.hh" +#include "glob.hh" +#include "mtime.hh" +#include + +int intlog2(int d) { + int i=0; + while (!(d&1)) { + d/= 2; i++; + } + assert(!(d/2)); + return i; +} + +double log2(double x) { + return log(x) /log(2.0); +} + + +// golden ratio + +const Real PHI = (1+sqrt(5))/2; +const double ENGRAVERS_SPACE = PHI; +const double WHOLE_SPACE = 10.0; + + +Real +duration_to_idealspace(Mtime d) +{ + // see Roelofs, p. 57 + return WHOLE_SPACE * pow(ENGRAVERS_SPACE, log2(d)); +} -- 2.39.5