diff --git a/src/utils/fluid_conv.c b/src/utils/fluid_conv.c index 13ea6b5e..ea4f0310 100644 --- a/src/utils/fluid_conv.c +++ b/src/utils/fluid_conv.c @@ -86,7 +86,7 @@ fluid_conversion_config(void) implemented according to the pictures on SF2.01 page 73. */ for (i = 1; i < 127; i++) { - x = -20.0 / 96.0 * log((i * i) / (127.0 * 127.0)) / log(10.0); + x = -20.0 / 96.0 * log((i * i) / (127.0 * 127.0)) / M_LN10; fluid_convex_tab[i] = (fluid_real_t) (1.0 - x); fluid_concave_tab[127 - i] = (fluid_real_t) x; } @@ -281,7 +281,7 @@ fluid_act2hz(fluid_real_t c) fluid_real_t fluid_hz2ct(fluid_real_t f) { - return (fluid_real_t) (6900 + 1200 * log(f / 440.0) / log(2.0)); + return (fluid_real_t) (6900 + 1200 * log(f / 440.0) / M_LN2); } /* diff --git a/src/utils/fluidsynth_priv.h b/src/utils/fluidsynth_priv.h index 7289c413..ae134b74 100644 --- a/src/utils/fluidsynth_priv.h +++ b/src/utils/fluidsynth_priv.h @@ -206,10 +206,6 @@ typedef struct _fluid_sample_timer_t fluid_sample_timer_t; #define FLUID_DEFAULT_AUDIO_RT_PRIO 60 /**< Default setting for audio.realtime-prio */ #define FLUID_DEFAULT_MIDI_RT_PRIO 50 /**< Default setting for midi.realtime-prio */ -#ifndef PI -#define PI 3.141592654 -#endif - /*************************************************************** * * SYSTEM INTERFACE @@ -280,6 +276,13 @@ typedef FILE* fluid_file; #define M_PI 3.1415926535897932384626433832795 #endif +#ifndef M_LN2 +#define M_LN2 0.69314718055994530941723212145818 +#endif + +#ifndef M_LN10 +#define M_LN10 2.3025850929940456840179914546844 +#endif #define FLUID_ASSERT(a,b) #define FLUID_ASSERT_P(a,b)