mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-11-10 15:01:40 +00:00
Merge pull request #459 from carlo-bramini/minor-math-fix
Minor math fixes
This commit is contained in:
commit
417dc59ffd
2 changed files with 2 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue