mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-12-01 00:21:14 +00:00
Use integer math
Since 'data' is an integer value clipped between +/-8192 and 'nrpn_scale' is a char value, this calculation could be done with integers and then return the fluid_real_t value. Addresses #455.
This commit is contained in:
parent
a948f7c5b2
commit
2205e4a8fc
1 changed files with 3 additions and 3 deletions
|
@ -150,7 +150,7 @@ fluid_real_t fluid_gen_scale(int gen, float value)
|
|||
|
||||
fluid_real_t fluid_gen_scale_nrpn(int gen, int data)
|
||||
{
|
||||
fluid_real_t value = (float) data - 8192.0f;
|
||||
fluid_clip(value, -8192, 8192);
|
||||
return value * (float) fluid_gen_info[gen].nrpn_scale;
|
||||
data = data - 8192;
|
||||
fluid_clip(data, -8192, 8192);
|
||||
return (fluid_real_t)(data * fluid_gen_info[gen].nrpn_scale);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue