From 76102f200921fd4bdf2e48382bc659042a545660 Mon Sep 17 00:00:00 2001 From: Marcus Weseloh Date: Wed, 4 Apr 2018 11:03:47 +0200 Subject: [PATCH] Remove unnecessary fluid_sample_t::valid flag --- src/sfloader/fluid_defsfont.c | 2 -- src/sfloader/fluid_sfont.c | 6 ++---- src/sfloader/fluid_sfont.h | 1 - src/synth/fluid_voice.c | 4 ++-- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/sfloader/fluid_defsfont.c b/src/sfloader/fluid_defsfont.c index 7de2ad58..cfe6ccb4 100644 --- a/src/sfloader/fluid_defsfont.c +++ b/src/sfloader/fluid_defsfont.c @@ -1863,7 +1863,5 @@ fluid_sample_import_sfont(fluid_sample_t* sample, SFSample* sfsample, fluid_defs fluid_sample_sanitize_loop(sample, sfont->samplesize); - sample->valid = TRUE; - return FLUID_OK; } diff --git a/src/sfloader/fluid_sfont.c b/src/sfloader/fluid_sfont.c index e2be547e..69e53ec1 100644 --- a/src/sfloader/fluid_sfont.c +++ b/src/sfloader/fluid_sfont.c @@ -504,7 +504,6 @@ fluid_sample_set_sound_data (fluid_sample_t* sample, sample->samplerate = sample_rate; sample->sampletype = FLUID_SAMPLETYPE_MONO; - sample->valid = 1; sample->auto_free = copy_data; return FLUID_OK; @@ -751,9 +750,8 @@ int fluid_sample_decompress_vorbis(fluid_sample_t *sample) // empty sample if (!sfinfo.frames || !sfinfo.channels) { - sample->start = sample->end = - sample->loopstart = sample->loopend = - sample->valid = 0; + sample->start = sample->end = 0; + sample->loopstart = sample->loopend = 0; sample->data = NULL; sf_close(sndfile); return FLUID_OK; diff --git a/src/sfloader/fluid_sfont.h b/src/sfloader/fluid_sfont.h index 53f10a8c..2ce3ee10 100644 --- a/src/sfloader/fluid_sfont.h +++ b/src/sfloader/fluid_sfont.h @@ -183,7 +183,6 @@ struct _fluid_sample_t int origpitch; /**< Original pitch (MIDI note number, 0-127) */ int pitchadj; /**< Fine pitch adjustment (+/- 99 cents) */ int sampletype; /**< Specifies the type of this sample as indicated by the #fluid_sample_type enum */ - int valid; /**< Should be TRUE if sample data is valid, FALSE otherwise (in which case it will not be synthesized) */ int auto_free; /**< TRUE if _fluid_sample_t::data and _fluid_sample_t::data24 should be freed upon sample destruction */ short* data; /**< Pointer to the sample's 16 bit PCM data */ char* data24; /**< If not NULL, pointer to the least significant byte counterparts of each sample data point in order to create 24 bit audio samples */ diff --git a/src/synth/fluid_voice.c b/src/synth/fluid_voice.c index f2659385..69623931 100644 --- a/src/synth/fluid_voice.c +++ b/src/synth/fluid_voice.c @@ -1726,8 +1726,8 @@ fluid_voice_optimize_sample(fluid_sample_t* s) double result; unsigned int i; - /* ignore ROM and other(?) invalid samples */ - if (!s->valid) return (FLUID_OK); + /* ignore disabled samples */ + if (s->start == s->end) return (FLUID_OK); if (!s->amplitude_that_reaches_noise_floor_is_valid) { /* Only once */ /* Scan the loop */