Skip to content

Commit

Permalink
Merge branch 'master' into awe32-nrpn
Browse files Browse the repository at this point in the history
  • Loading branch information
derselbst committed Sep 21, 2024
2 parents d63769e + ce97c6d commit 203fa46
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 9 deletions.
10 changes: 5 additions & 5 deletions .azure/azure-pipelines-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ variables:
ICONV_VERSION: '1.17'
# libffi 3.4.4 fails due to https://github.com/libffi/libffi/issues/760
FFI_VERSION: 'ce077e5565366171aa1b4438749b0922fce887a4'
GETTEXT_VERSION: '0.21'
GETTEXT_VERSION: '0.22.5'
GLIB_VERSION: '2.72'
GLIB_EXTRAVERSION: '4'
OBOE_VERSION: '1.7.0'
SNDFILE_VERSION: '1.2.0'
SNDFILE_VERSION: '1.2.2'
INSTPATCH_VERSION: '1.1.6'
VORBIS_VERSION: '1.3.7'
OGG_VERSION: '1.3.5'
OPUS_VERSION: '1.3.1'
FLAC_VERSION: '1.4.2'
OPUS_VERSION: '1.5.2'
FLAC_VERSION: '1.4.3'
PCRE_VERSION: '8.45'

# Android NDK sources and standalone toolchain is put here
Expand All @@ -55,7 +55,7 @@ variables:
# Must be the same as $ANDROID_NDK_HOME see:
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md
# We cannot use $ANDROID_NDK_HOME because this is an environment variable, but here, we need a compile-time constant.
NDK: '/usr/local/lib/android/sdk/ndk/25.2.9519653'
NDK: '/usr/local/lib/android/sdk/ndk/27.1.12297006'

# All the built binaries, libs and their headers will be installed here
PREFIX: '$(DEV)/opt/android'
Expand Down
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ task:
freebsd_instance:
matrix:
image_family: freebsd-14-0
image_family: freebsd-13-2
image_family: freebsd-13-3

install_script: pwd && ls -la && pkg update --force && pkg install -y cmake glib alsa-lib ladspa portaudio pulseaudio pkgconf sdl2

Expand Down
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ updates:
- "*" # Group all Actions updates into a single larger pull request
schedule:
interval: weekly
ignore:
- dependency-name: "SonarSource/sonarcloud-github-c-cpp"
# Version 3 of that task causes the scanner to throw a Java exception...
versions: ["3.x"]
8 changes: 7 additions & 1 deletion src/rvoice/fluid_rvoice.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@ fluid_rvoice_write(fluid_rvoice_t *voice, fluid_real_t *dsp_buf)
/******************* amplitude **********************/

count = fluid_rvoice_calc_amp(voice);
if(count == 0)
{
// Voice has finished, remove from dsp loop
return 0;
}
// else if count is negative, still process the voice


/******************* phase **********************/
Expand Down Expand Up @@ -427,7 +433,7 @@ fluid_rvoice_write(fluid_rvoice_t *voice, fluid_real_t *dsp_buf)
* Depending on the position in the loop and the loop size, this
* may require several runs. */

if(count <= 0)
if(count < 0)
{
// The voice is quite, i.e. either in delay phase or zero volume.
// We need to update the rvoice's dsp phase, as the delay phase shall not "postpone" the sound, rather
Expand Down
6 changes: 6 additions & 0 deletions src/sfloader/fluid_sffile.c
Original file line number Diff line number Diff line change
Expand Up @@ -2500,6 +2500,12 @@ static int fluid_sffile_read_vorbis(SFData *sf, unsigned int start_byte, unsigne
goto error_exit;
}

// Avoid clipping for loud samples, see
// https://github.com/FluidSynth/fluidsynth/issues/1380
// and
// https://github.com/libsndfile/libsndfile/issues/194
sf_command(sndfile, SFC_SET_SCALE_FLOAT_INT_READ, NULL, SF_TRUE);

/* Automatically decompresses the Ogg Vorbis data to 16-bit PCM */
if(sf_readf_short(sndfile, wav_data, sfinfo.frames) < sfinfo.frames)
{
Expand Down
15 changes: 13 additions & 2 deletions src/utils/fluid_conv.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,20 @@ fluid_cb2amp(fluid_real_t cb)
*/

/* minimum attenuation: 0 dB */
if(cb < 0)
if(FLUID_UNLIKELY(cb < 0))
{
return 1.0;
/* Issue #1374: it seems that by using modLfoToVolEnv, the attenuation can become negative and
* therefore the signal needs to be amplified.
* In such a rare case, calculate the attenuation on the fly.
*
* This behavior is backed by the spec saying:
* modLfoToVolume: "A positive number indicates a positive LFO excursion increases volume;
* a negative number indicates a positive excursion decreases volume.
* [...] For example, a value of 100 indicates that the volume will first rise ten dB, then fall ten dB."
*
* And in order to rise, a negative attenuation must be permitted.
*/
return FLUID_POW(10.0f, cb / -200.0f);
}

if(cb >= FLUID_CB_AMP_SIZE)
Expand Down

0 comments on commit 203fa46

Please sign in to comment.