mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-12-01 08:31:37 +00:00
This reverts commit 29d1947ccc
. Reading the spec again, the final gain amp should actually applied for the whole voice, not just single buffers (cf. sect. 9.1.8 Figure 2). Thus rvoice_mixer is not the correct place to implement this. It should instead be done in fluid_rvoice_calc_amp().
reopens #319
closes #399
This commit is contained in:
parent
a55e7e8d79
commit
b6b6931468
1 changed files with 1 additions and 16 deletions
|
@ -310,21 +310,6 @@ fluid_rvoice_buffers_mix(fluid_rvoice_buffers_t* buffers,
|
||||||
int start_block, int sample_count,
|
int start_block, int sample_count,
|
||||||
fluid_real_t** dest_bufs, int dest_bufcount)
|
fluid_real_t** dest_bufs, int dest_bufcount)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* SF2.04 9.1.7 Envelope Generators:
|
|
||||||
*
|
|
||||||
* "When 96 dB of attenuation is reached in the final gain amplifier,
|
|
||||||
* an abrupt jump to zero gain (infinite dB of attenuation) occurs."
|
|
||||||
*
|
|
||||||
* fluidsynth is a 24 bit synth, it could (should??) use 144 dB of attenuation.
|
|
||||||
* However the spec makes no distinction between 16 or 24 bit synths, so use
|
|
||||||
* 96 dB here.
|
|
||||||
*
|
|
||||||
* This magic number was obtained by
|
|
||||||
* powl(10.0L, -FLUID_PEAK_ATTENUATION / 200.0L);
|
|
||||||
*/
|
|
||||||
static const fluid_real_t MIN_GAIN = 0.000015848931924611135L;
|
|
||||||
|
|
||||||
int bufcount = buffers->count;
|
int bufcount = buffers->count;
|
||||||
int i, dsp_i;
|
int i, dsp_i;
|
||||||
if (sample_count <= 0 || dest_bufcount <= 0)
|
if (sample_count <= 0 || dest_bufcount <= 0)
|
||||||
|
@ -337,7 +322,7 @@ fluid_rvoice_buffers_mix(fluid_rvoice_buffers_t* buffers,
|
||||||
fluid_real_t *FLUID_RESTRICT buf = get_dest_buf(buffers, i, dest_bufs, dest_bufcount);
|
fluid_real_t *FLUID_RESTRICT buf = get_dest_buf(buffers, i, dest_bufs, dest_bufcount);
|
||||||
fluid_real_t amp = buffers->bufs[i].amp;
|
fluid_real_t amp = buffers->bufs[i].amp;
|
||||||
|
|
||||||
if (buf == NULL || amp <= MIN_GAIN)
|
if (buf == NULL || amp == 0.0f)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
FLUID_ASSERT((uintptr_t)buf % FLUID_DEFAULT_ALIGNMENT == 0);
|
FLUID_ASSERT((uintptr_t)buf % FLUID_DEFAULT_ALIGNMENT == 0);
|
||||||
|
|
Loading…
Reference in a new issue