fluid-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [fluid-dev] Slightly OT: Parsing SF2; duplicate pbag entries?


From: Marcus Weseloh
Subject: Re: [fluid-dev] Slightly OT: Parsing SF2; duplicate pbag entries?
Date: Sun, 24 Feb 2019 16:41:00 +0100

(resend to include mailing list)

Hi,

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
records.

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.

Cheers,
Marcus

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:
>
> And that might actually be your problem. The terminal entries are important
> to determine the length of the collections. For example, the terminal ibag
> entry has the wInstGenNdx that you need to determine the number of
> generators in the previous ibag entry (terminal wInstGenNdx - previous
> wInstGenNdx). And that method is used in nearly all the collections
> (modulators, ibags, pbags, ...).
>
> 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
records.

--
Mark Raynsford | http://www.io7m.com


reply via email to

[Prev in Thread] Current Thread [Next in Thread]