mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-02-21 11:21:24 +00:00
Some improvements to filter turn off optimization and minimum volume envelope
release to minimize clicks, as well as a few other things.
This commit is contained in:
parent
304936e612
commit
1928baf194
6 changed files with 46 additions and 12 deletions
|
@ -1,3 +1,17 @@
|
|||
2003-08-19 Josh Green <jgreen@users.sourceforge.net>
|
||||
|
||||
* src/fluid_alsa.c: Added some calls to snd_strerror() to print out
|
||||
details of ALSA routine failures.
|
||||
* src/fluid_defsfont.c: Put a message about SoundFont loading code
|
||||
being borrowed from Smurf SoundFont Editor.
|
||||
* src/fluid_rev.c: Valgrind found that some values were being used
|
||||
uninitialized because fluid_revmodel_update() was being called before
|
||||
all reverb parameters were set, now setting manually and then calling
|
||||
update routine.
|
||||
* src/fluid_voice.c: Increased FLUID_MAX_AUDIBLE_FILTER_FC to minimize
|
||||
clicks from filter toggling. Added a FLUID_MIN_VOLENVRELEASE constant
|
||||
to set the minimum volume envelope release to minimize clicks.
|
||||
|
||||
2003-07-22 Josh Green <jgreen@users.sourceforge.net>
|
||||
|
||||
* src/fluid_midishare.c: Added include of header "config.h" as
|
||||
|
|
|
@ -236,14 +236,16 @@ new_fluid_alsa_audio_driver2(fluid_settings_t* settings,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (snd_pcm_hw_params_set_channels(dev->pcm, hwparams, 2) != 0) {
|
||||
FLUID_LOG(FLUID_ERR, "Failed to set the channels");
|
||||
if ((err = snd_pcm_hw_params_set_channels(dev->pcm, hwparams, 2)) != 0) {
|
||||
FLUID_LOG(FLUID_ERR, "Failed to set the channels: %s",
|
||||
snd_strerror (err));
|
||||
goto error_recovery;
|
||||
}
|
||||
|
||||
tmp = (unsigned int) sample_rate;
|
||||
if (snd_pcm_hw_params_set_rate_near(dev->pcm, hwparams, &tmp, &dir) != 0) {
|
||||
FLUID_LOG(FLUID_ERR, "Failed to set the sample rate");
|
||||
if ((err = snd_pcm_hw_params_set_rate_near(dev->pcm, hwparams, &tmp, &dir)) != 0) {
|
||||
FLUID_LOG(FLUID_ERR, "Failed to set the sample rate: %s",
|
||||
snd_strerror (err));
|
||||
goto error_recovery;
|
||||
}
|
||||
if (dir != 0) {
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
*
|
||||
* Copyright (C) 2003 Peter Hanappe and others.
|
||||
*
|
||||
* SoundFont file loading code borrowed from Smurf SoundFont Editor
|
||||
* Copyright (C) 1999-2001 Josh Green
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
|
@ -1632,7 +1635,9 @@ fluid_sample_import_sfont(fluid_sample_t* sample, SFSample* sfsample, fluid_defs
|
|||
|
||||
|
||||
|
||||
/*=================================sfload.c========================*/
|
||||
/*=================================sfload.c========================
|
||||
Borrowed from Smurf SoundFont Editor by Josh Green
|
||||
=================================================================*/
|
||||
|
||||
/*
|
||||
functions for loading data from sfont files, with appropriate byte swapping
|
||||
|
@ -2967,7 +2972,9 @@ fixup_sample (SFData * sf)
|
|||
return (OK);
|
||||
}
|
||||
|
||||
/*=================================sfont.c========================*/
|
||||
/*=================================sfont.c========================
|
||||
Smurf SoundFont Editor
|
||||
================================================================*/
|
||||
|
||||
|
||||
/* optimum chunk area sizes (could be more optimum) */
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
*
|
||||
* Copyright (C) 2003 Peter Hanappe and others.
|
||||
*
|
||||
* SoundFont loading code borrowed from Smurf SoundFont Editor by Josh Green
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
|
|
|
@ -354,10 +354,16 @@ new_fluid_revmodel()
|
|||
fluid_allpass_setfeedback(&rev->allpassR[2], 0.5f);
|
||||
fluid_allpass_setfeedback(&rev->allpassL[3], 0.5f);
|
||||
fluid_allpass_setfeedback(&rev->allpassR[3], 0.5f);
|
||||
fluid_revmodel_setlevel(rev, initialwet);
|
||||
fluid_revmodel_setroomsize(rev, initialroom);
|
||||
fluid_revmodel_setdamp(rev, initialdamp);
|
||||
fluid_revmodel_setwidth(rev, initialwidth);
|
||||
|
||||
/* set values manually, since calling set functions causes update
|
||||
and all values should be initialized for an update */
|
||||
rev->roomsize = initialroom * scaleroom + offsetroom;
|
||||
rev->damp = initialdamp * scaledamp;
|
||||
rev->wet = initialwet * scalewet;
|
||||
rev->width = initialwidth;
|
||||
|
||||
/* now its okay to update reverb */
|
||||
fluid_revmodel_update (rev);
|
||||
|
||||
/* Clear all buffers */
|
||||
fluid_revmodel_init(rev);
|
||||
|
|
|
@ -41,7 +41,7 @@ sse_t* interp_coeff_sse;
|
|||
|
||||
/* used for filter turn off optimization - if filter cutoff is above the
|
||||
specified value and filter q is below the other value, turn filter off */
|
||||
#define FLUID_MAX_AUDIBLE_FILTER_FC 16000.0f
|
||||
#define FLUID_MAX_AUDIBLE_FILTER_FC 19000.0f
|
||||
#define FLUID_MIN_AUDIBLE_FILTER_Q 1.2f
|
||||
|
||||
/* Smallest amplitude that can be perceived (full scale is +/- 0.5)
|
||||
|
@ -54,6 +54,9 @@ sse_t* interp_coeff_sse;
|
|||
#define FLUID_MIN_LOOP_SIZE 2
|
||||
#define FLUID_MIN_LOOP_PAD 1
|
||||
|
||||
/* min vol envelope release (to stop clicks) in SoundFont timecents */
|
||||
#define FLUID_MIN_VOLENVRELEASE -7200.0f /* ~16ms */
|
||||
|
||||
fluid_interp_coeff_t interp_coeff[FLUID_INTERP_MAX];
|
||||
fluid_interp_coeff_t interp_coeff_linear[FLUID_INTERP_MAX];
|
||||
fluid_real_t sinc_table7[7][FLUID_INTERP_MAX];
|
||||
|
@ -1377,7 +1380,7 @@ fluid_voice_update_param(fluid_voice_t* voice, int gen)
|
|||
|
||||
case GEN_VOLENVRELEASE: /* SF2.01 section 8.1.3 # 38 */
|
||||
x = _GEN(voice, GEN_VOLENVRELEASE);
|
||||
fluid_clip(x, -12000.0f, 8000.0f);
|
||||
fluid_clip(x, FLUID_MIN_VOLENVRELEASE, 8000.0f);
|
||||
count = 1 + NUM_BUFFERS_RELEASE(x);
|
||||
voice->volenv_data[FLUID_VOICE_ENVRELEASE].count = count;
|
||||
voice->volenv_data[FLUID_VOICE_ENVRELEASE].coeff = 1.0f;
|
||||
|
|
Loading…
Reference in a new issue