Merge pull request #328 from carlo-bramini/master

No need to do extra addition at every cycle.
This commit is contained in:
Tom M 2018-01-20 14:13:25 +01:00 committed by GitHub
commit 0417d42a51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -514,11 +514,12 @@ fluid_chorus_triangle(int *buf, int len, int depth)
incr = 2.0 / len * (double)depth * (double) INTERPOLATION_SUBSAMPLES; incr = 2.0 / len * (double)depth * (double) INTERPOLATION_SUBSAMPLES;
/* Initialize first value */ /* Initialize first value */
val = 0.; val = 0. - 3. * MAX_SAMPLES * INTERPOLATION_SUBSAMPLES;
/* Build triangular modulation waveform */ /* Build triangular modulation waveform */
while (il <= ir) { while (il <= ir) {
ival= (int)(val + 0.5) - 3 * MAX_SAMPLES * INTERPOLATION_SUBSAMPLES; /* Assume 'val' to be always negative for rounding mode */
ival = (int)(val - 0.5);
*il++ = ival; *il++ = ival;
*ir-- = ival; *ir-- = ival;