Skip to content

Commit

Permalink
- timidity++: better handling of soundfont terminal preset record
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-lysiuk committed Jun 8, 2020
1 parent e8b2bd4 commit 9d71752
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions thirdparty/timidityplus/sndfont.cpp
Expand Up @@ -267,15 +267,16 @@ void Instruments::init_sf(SFInsts *rec)
return;
}

if(load_soundfont(&sfinfo, rec->tf))
// SoundFont spec, 7.2: ... contains a minimum of two records, one record for each preset and one for a terminal record
if(load_soundfont(&sfinfo, rec->tf) || sfinfo.npresets < 2)
{
end_soundfont(rec);
return;
}

correct_samples(&sfinfo);
current_sfrec = rec;
for (i = 0; i < sfinfo.npresets; i++) {
for (i = 0; i < sfinfo.npresets - 1; i++) {
int bank = sfinfo.preset[i].bank;
int preset = sfinfo.preset[i].preset;

Expand Down

0 comments on commit 9d71752

Please sign in to comment.