]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/misc.cc
* python/convertrules.py (conv): warning on \tempo{}
[lilypond.git] / lily / misc.cc
index 607cbe99534ccc246d421cf725bec332144b643a..e7c3063df234c6ce79bca6185bf9358e837e401b 100644 (file)
@@ -9,7 +9,6 @@
 
 
 #include "misc.hh"
-#include "std-string.hh"
 
 /*
   Return the 2-log, rounded down
@@ -35,31 +34,6 @@ log_2 (double x)
   return log (x) / log (2.0);
 }
 
-Array<std::string>
-split_string (std::string s, char c)
-{
-  Array<std::string> rv;
-  while (s.length ())
-    {
-      ssize i = s.find (c);
-
-      if (i == 0)
-       {
-         s = s.substr (1);
-         continue;
-       }
-
-      if (i == NPOS)
-       i = s.length ();
-
-      rv.push (s.substr (0, i));
-      s = s.substr (i);
-    }
-
-  return rv;
-}
-
-
 Real
 directed_round (Real f, Direction d)
 {
@@ -69,3 +43,15 @@ directed_round (Real f, Direction d)
     return ceil (f);
 }
 
+
+
+/*
+   0 at threshold,  1 at 0, with 1/x falloff.
+ */
+Real
+peak_around (Real epsilon,  Real threshold, Real x)
+{
+  if (x < 0)
+    return 1.0;
+  return max (- epsilon * (x - threshold) / ((x + epsilon)  * threshold), 0.0);
+}