Merge pull request #459 from carlo-bramini/minor-math-fix

Minor math fixes
This commit is contained in:
Tom M 2018-11-06 18:06:44 +01:00 committed by GitHub
commit 417dc59ffd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -2152,7 +2152,7 @@ int fluid_player_set_midi_tempo(fluid_player_t *player, int tempo)
*/
int fluid_player_set_bpm(fluid_player_t *player, int bpm)
{
return fluid_player_set_midi_tempo(player, (int)((double) 60 * 1e6 / bpm));
return fluid_player_set_midi_tempo(player, 60000000L / bpm);
}
/**

View File

@ -592,7 +592,7 @@ fluid_rvoice_noteoff_LOCAL(fluid_rvoice_t *voice, unsigned int min_ticks)
{
fluid_real_t lfo = fluid_lfo_get_val(&voice->envlfo.modlfo) * -voice->envlfo.modlfo_to_vol;
fluid_real_t amp = fluid_adsr_env_get_val(&voice->envlfo.volenv) * fluid_cb2amp(lfo);
fluid_real_t env_value = - ((-200 * log(amp) / log(10.0) - lfo) / FLUID_PEAK_ATTENUATION - 1);
fluid_real_t env_value = - (((-200 / M_LN10) * log(amp) - lfo) / FLUID_PEAK_ATTENUATION - 1);
fluid_clip(env_value, 0.0, 1.0);
fluid_adsr_env_set_val(&voice->envlfo.volenv, env_value);
}