mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-12-13 14:11:14 +00:00
Merge branch '2.1.x' into master
This commit is contained in:
commit
73182866e0
1 changed files with 32 additions and 17 deletions
|
@ -451,6 +451,18 @@ fluid_rvoice_buffers_mix(fluid_rvoice_buffers_t *buffers,
|
||||||
* But it seems like having two separate loops is easier for compilers to understand, and therefore
|
* But it seems like having two separate loops is easier for compilers to understand, and therefore
|
||||||
* auto-vectorizing the loops.
|
* auto-vectorizing the loops.
|
||||||
*/
|
*/
|
||||||
|
if(sample_count < FLUID_BUFSIZE)
|
||||||
|
{
|
||||||
|
// scalar loop variant, the voice will have finished afterwards
|
||||||
|
for(dsp_i = 0; dsp_i < sample_count; dsp_i++)
|
||||||
|
{
|
||||||
|
buf[start_block * FLUID_BUFSIZE + dsp_i] += current_amp * dsp_buf[start_block * FLUID_BUFSIZE + dsp_i];
|
||||||
|
current_amp += amp_incr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// here goes the vectorizable loop
|
||||||
#pragma omp simd aligned(dsp_buf,buf:FLUID_DEFAULT_ALIGNMENT)
|
#pragma omp simd aligned(dsp_buf,buf:FLUID_DEFAULT_ALIGNMENT)
|
||||||
for(dsp_i = 0; dsp_i < FLUID_BUFSIZE; dsp_i++)
|
for(dsp_i = 0; dsp_i < FLUID_BUFSIZE; dsp_i++)
|
||||||
{
|
{
|
||||||
|
@ -458,6 +470,7 @@ fluid_rvoice_buffers_mix(fluid_rvoice_buffers_t *buffers,
|
||||||
buf[start_block * FLUID_BUFSIZE + dsp_i] += (current_amp + amp_incr * dsp_i) * dsp_buf[start_block * FLUID_BUFSIZE + dsp_i];
|
buf[start_block * FLUID_BUFSIZE + dsp_i] += (current_amp + amp_incr * dsp_i) * dsp_buf[start_block * FLUID_BUFSIZE + dsp_i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we have reached the target_amp
|
||||||
if(target_amp > 0)
|
if(target_amp > 0)
|
||||||
{
|
{
|
||||||
/* Note, that this loop could be unrolled by FLUID_BUFSIZE elements */
|
/* Note, that this loop could be unrolled by FLUID_BUFSIZE elements */
|
||||||
|
@ -472,6 +485,8 @@ fluid_rvoice_buffers_mix(fluid_rvoice_buffers_t *buffers,
|
||||||
buf[start_block * FLUID_BUFSIZE + dsp_i] += target_amp * dsp_buf[start_block * FLUID_BUFSIZE + dsp_i];
|
buf[start_block * FLUID_BUFSIZE + dsp_i] += target_amp * dsp_buf[start_block * FLUID_BUFSIZE + dsp_i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
buffers->bufs[i].current_amp = target_amp;
|
buffers->bufs[i].current_amp = target_amp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue