diff options
author | Chris Robinson <[email protected]> | 2014-07-05 03:55:45 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-07-05 03:55:45 -0700 |
commit | ad92181a26ab1cc7c7797d93e90349bd8829e3cd (patch) | |
tree | 77027033e5ccb270ff5b069ef8454aa481e54ed4 | |
parent | ff915534cd9f542c9320dcf4efc8b2426a139776 (diff) |
Don't set modulators that have no destination
-rw-r--r-- | Alc/midi/fluidsynth.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Alc/midi/fluidsynth.c b/Alc/midi/fluidsynth.c index c4b64243..8810f607 100644 --- a/Alc/midi/fluidsynth.c +++ b/Alc/midi/fluidsynth.c @@ -174,22 +174,24 @@ static void FSample_Construct(FSample *self, ALfontsound *sound) self->Mods = calloc(sound->ModulatorMap.size, sizeof(self->Mods[0])); if(self->Mods) { - ALsizei i; + ALsizei i, j; - self->NumMods = sound->ModulatorMap.size; - for(i = 0;i < self->NumMods;i++) + for(i = j = 0;i < sound->ModulatorMap.size;i++) { ALsfmodulator *mod = sound->ModulatorMap.array[i].value; - fluid_mod_set_source1(&self->Mods[i], getGenInput(mod->Source[0].Input), + if(mod->Dest == AL_NONE) + continue; + fluid_mod_set_source1(&self->Mods[j], getGenInput(mod->Source[0].Input), getGenFlags(mod->Source[0].Input, mod->Source[0].Type, mod->Source[0].Form)); - fluid_mod_set_source2(&self->Mods[i], getGenInput(mod->Source[1].Input), + fluid_mod_set_source2(&self->Mods[j], getGenInput(mod->Source[1].Input), getGenFlags(mod->Source[1].Input, mod->Source[1].Type, mod->Source[1].Form)); - fluid_mod_set_amount(&self->Mods[i], mod->Amount); - fluid_mod_set_dest(&self->Mods[i], getSf2Gen(mod->Dest)); - self->Mods[i].next = NULL; + fluid_mod_set_amount(&self->Mods[j], mod->Amount); + fluid_mod_set_dest(&self->Mods[j], getSf2Gen(mod->Dest)); + self->Mods[j++].next = NULL; } + self->NumMods = j; } } |