Fixes for using standard math constants

This commit is contained in:
carlo-bramini 2017-10-21 12:54:00 +02:00
parent 48936975e7
commit 4293fddc05
2 changed files with 9 additions and 6 deletions

View file

@ -86,7 +86,7 @@ fluid_conversion_config(void)
implemented according to the pictures on SF2.01 page 73. */ implemented according to the pictures on SF2.01 page 73. */
for (i = 1; i < 127; i++) { 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_convex_tab[i] = (fluid_real_t) (1.0 - x);
fluid_concave_tab[127 - i] = (fluid_real_t) x; fluid_concave_tab[127 - i] = (fluid_real_t) x;
} }
@ -281,7 +281,7 @@ fluid_act2hz(fluid_real_t c)
fluid_real_t fluid_real_t
fluid_hz2ct(fluid_real_t f) 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);
} }
/* /*

View file

@ -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_AUDIO_RT_PRIO 60 /**< Default setting for audio.realtime-prio */
#define FLUID_DEFAULT_MIDI_RT_PRIO 50 /**< Default setting for midi.realtime-prio */ #define FLUID_DEFAULT_MIDI_RT_PRIO 50 /**< Default setting for midi.realtime-prio */
#ifndef PI
#define PI 3.141592654
#endif
/*************************************************************** /***************************************************************
* *
* SYSTEM INTERFACE * SYSTEM INTERFACE
@ -280,6 +276,13 @@ typedef FILE* fluid_file;
#define M_PI 3.1415926535897932384626433832795 #define M_PI 3.1415926535897932384626433832795
#endif #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(a,b)
#define FLUID_ASSERT_P(a,b) #define FLUID_ASSERT_P(a,b)