Add warning if soundfont bigger 2GB (#811)

Advice the user to use fluidsynth 2.2.0 or later when loading soundfonts > 2GB
This commit is contained in:
Tom M 2021-03-14 17:20:09 +01:00 committed by GitHub
parent 2c1561ea18
commit 8a778e0c0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2406,6 +2406,14 @@ static int fluid_sffile_read_wav(SFData *sf, unsigned int start, unsigned int en
if(sf->fcbs->fread(loaded_data, num_samples * sizeof(short), sf->sffd) == FLUID_FAILED) if(sf->fcbs->fread(loaded_data, num_samples * sizeof(short), sf->sffd) == FLUID_FAILED)
{ {
#if FLUID_VERSION_CHECK(FLUIDSYNTH_VERSION_MAJOR, FLUIDSYNTH_VERSION_MINOR, FLUIDSYNTH_VERSION_MICRO) < FLUID_VERSION_CHECK(2,2,0)
if((int)(num_samples * sizeof(short)) < 0)
{
FLUID_LOG(FLUID_INFO,
"This SoundFont seems to be bigger than 2GB, which is not supported in this version of fluidsynth. "
"You need to use at least fluidsynth 2.2.0");
}
#endif
FLUID_LOG(FLUID_ERR, "Failed to read sample data"); FLUID_LOG(FLUID_ERR, "Failed to read sample data");
goto error_exit; goto error_exit;
} }