diff options
author | Chris Robinson <[email protected]> | 2014-01-04 03:20:17 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-01-04 03:20:17 -0800 |
commit | 4834f56779261a7fd7761544f79c90df0d06fc39 (patch) | |
tree | 385f44e6e1cb04577345517b799d9a23c704f899 /Alc/midi | |
parent | 2dd87946fd261d3960deac74420dc1860e19ae8e (diff) |
Don't create presets that don't have any usable sounds
Diffstat (limited to 'Alc/midi')
-rw-r--r-- | Alc/midi/sf2load.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Alc/midi/sf2load.c b/Alc/midi/sf2load.c index a27bf624..c960566b 100644 --- a/Alc/midi/sf2load.c +++ b/Alc/midi/sf2load.c @@ -1185,10 +1185,6 @@ ALboolean loadSf2(Reader *stream, ALsoundfont *soundfont, ALCcontext *context) if(sfont.phdr[i+1].mZoneIdx == sfont.phdr[i].mZoneIdx) continue; - presets[presets_size] = NewPreset(context); - presets[presets_size]->Preset = sfont.phdr[i].mPreset; - presets[presets_size]->Bank = sfont.phdr[i].mBank; - GenModList_Construct(&gzone); zone = sfont.pbag + sfont.phdr[i].mZoneIdx; zone_end = sfont.pbag + sfont.phdr[i+1].mZoneIdx; @@ -1252,13 +1248,16 @@ ALboolean loadSf2(Reader *stream, ALsoundfont *soundfont, ALCcontext *context) { ALsizei j; + presets[presets_size] = NewPreset(context); + presets[presets_size]->Preset = sfont.phdr[i].mPreset; + presets[presets_size]->Bank = sfont.phdr[i].mBank; + for(j = 0;j < sounds_size;j++) IncrementRef(&sounds[j]->ref); sounds = ExchangePtr((XchgPtr*)&presets[presets_size]->Sounds, sounds); ExchangeInt(&presets[presets_size]->NumSounds, sounds_size); + presets_size++; } - presets_size++; - free(sounds); GenModList_Destruct(&gzone); |