mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-04-08 08:41:21 +00:00
Fixed a crash bug from attempt to optimize ROM samples.
This commit is contained in:
parent
f5d9ebdafc
commit
af0522461d
3 changed files with 16 additions and 3 deletions
|
@ -1,3 +1,13 @@
|
|||
2003-06-28 Josh Green <jgreen@users.sourceforge.net>
|
||||
|
||||
* src/fluid_defsfont.c: Moved call to fluid_voice_optimize_sample
|
||||
from fluid_inst_zone_import_sfont to fluid_defsfont_load. Also
|
||||
reduced minimum sample size before rejection from 48 to 8 (could
|
||||
be lower?).
|
||||
* src/fluid_voice.c (fluid_voice_optimize_sample): Added a check
|
||||
for sample->valid to ignore ROM samples which was causing a crash
|
||||
with Vintage Dreams and other SoundFont files with ROM samples.
|
||||
|
||||
2003-06-17 Josh Green <jgreen@users.sourceforge.net>
|
||||
|
||||
Release version 1.0.2
|
||||
|
|
|
@ -313,6 +313,7 @@ int fluid_defsfont_load(fluid_defsfont_t* sfont, const char* file)
|
|||
return FLUID_FAILED;
|
||||
}
|
||||
fluid_defsfont_add_sample(sfont, sample);
|
||||
fluid_voice_optimize_sample(sample);
|
||||
p = fluid_list_next(p);
|
||||
}
|
||||
|
||||
|
@ -1384,7 +1385,6 @@ fluid_inst_zone_import_sfont(fluid_inst_zone_t* zone, SFZone *sfzone, fluid_defs
|
|||
FLUID_LOG(FLUID_ERR, "Couldn't find sample name");
|
||||
return FLUID_FAILED;
|
||||
}
|
||||
fluid_voice_optimize_sample(zone->sample);
|
||||
}
|
||||
|
||||
/* Import the modulators (only SF2.1 and higher) */
|
||||
|
@ -1606,7 +1606,7 @@ fluid_sample_import_sfont(fluid_sample_t* sample, SFSample* sfsample, fluid_defs
|
|||
sample->valid = 0;
|
||||
FLUID_LOG(FLUID_WARN, "Ignoring sample %s: can't use ROM samples", sample->name);
|
||||
}
|
||||
if (sample->end - sample->start < 48) {
|
||||
if (sample->end - sample->start < 8) {
|
||||
sample->valid = 0;
|
||||
FLUID_LOG(FLUID_WARN, "Ignoring sample %s: too few sample data points", sample->name);
|
||||
} else {
|
||||
|
|
|
@ -1978,7 +1978,10 @@ int fluid_voice_optimize_sample(fluid_sample_t* s)
|
|||
signed short peak;
|
||||
double result;
|
||||
int i;
|
||||
|
||||
|
||||
/* ignore ROM and other(?) invalid samples */
|
||||
if (!s->valid) return (FLUID_OK);
|
||||
|
||||
if (!s->amplitude_that_reaches_noise_floor_is_valid){ /* Only once */
|
||||
/* Scan the loop */
|
||||
for (i = (int)s->loopstart; i < (int) s->loopend; i ++){
|
||||
|
|
Loading…
Reference in a new issue