Am So., 24. Feb. 2019 um 14:53 Uhr schrieb Mark Raynsford <address@hidden
On 2019-02-24T14:29:01 +0100
Marcus Weseloh <address@hidden> wrote:
> So your parser can't simply ignore the terminal zones.
Ah, to be clear, the parser itself doesn't ignore them. It uses them
internally to determine numbers of records and the like. It's just that
the programmer using the parser doesn't see the terminal record; they
just receive a (possibly empty) list of the available non-terminal
I might have misunderstood the logs that you've sent up to now, but it seems to me like your parser only turns the structures in the SF2 file into (lists of) objects and exposes them to the user. The user then needs to follow the pointers to the different structures, for example look up the generators for a given instrument zone. If that is how your parser works and you omit the terminal records from the lists, then you are not giving the user all the information that he needs to make sense of the data. So either the parser itself needs to resolve the links between the data structures before passing the data on to the user, or return the terminal records to the user as well.
Tom suggested that the last instrument should simply take all residual generators from the specified index onward. I think that is actually not according to spec and is also not the way Fluidsynth does it. Fluidsynth strictly checks the terminal ibag for the terminal igen index. There are a few workarounds in Fluidsynth where we ignore missing terminal records. Those are needed because there are some broken Soundfont editors out there. But we do that only where the terminal records isn't actually needed, in other words only in leafs in the Soundfont tree, i.e. preset modulators or generators.