On 2019-02-22T21:29:05 +0000 Mark Raynsford <list+org.fluidsy...@io7m.com> wrote: > > Thanks, this helps a lot. I see what it means now... wGenNdx points to > the first index (in the same style as PBAG) and I'm actually supposed > to parse n values starting at that index. The way I was interpreting it > originally was that there would be n PBAG values and there'd be a 1:1 > mapping between PBAG and PGEN values for a given zone. In other words, > for each PBAG value, I look up the corresponding PGEN value. With the > arrangement of PBAG values I showed in basic.sf2, that would obviously > mean that I'd miss the all-important Instrument PGEN!
I take that back, partially. I'm still not sure about this. Here's the output from a trivial SF2 that just has a single instrument and doesn't have any presets (http://ataxia.io7m.com/2019/02/23/trivial.sf2): TRACE com.io7m.jnoisetype.vanilla.NTParsers: [inst][0] NTParsedInstrument{name=NTInstrumentName{value=i0}, instrumentZoneIndex=0} TRACE com.io7m.jnoisetype.vanilla.NTParsers: [ibag][0] NTParsedInstrumentZone{generatorIndex=0, modulatorIndex=0} TRACE com.io7m.jnoisetype.vanilla.NTParsers: [ibag][1] NTParsedInstrumentZone{generatorIndex=0, modulatorIndex=0} TRACE com.io7m.jnoisetype.vanilla.NTParsers: [igen][0] NTParsedInstrumentZoneGenerator{generatorOperator=17, amount=NTParsedGenericAmount{value=0}} TRACE com.io7m.jnoisetype.vanilla.NTParsers: [igen][1] NTParsedInstrumentZoneGenerator{generatorOperator=53, amount=NTParsedGenericAmount{value=0}} So I start at INST[0]. The spec says: "The first zone in a given instrument is located at that instrument’s wInstBagNdx. The number of zones in the instrument is determined by the difference between the next instrument’s wInstBagNdx and the current wInstBagNdx." Well, there isn't a next instrument, so I make the obvious assumption that all of the zones given in IBAG belong to the one defined instrument. So, I first inspect IBAG[0] and see that the generator index field points to IGEN[0]. The spec says, for modulators (it seems to miss this information in IGEN as it does the corresponding paragraph in PGEN that you noted was missing): "The zone’s wInstModNdx points to the first modulator for that zone, and the number of modulators present for a zone is determined by the difference between the next higher zone’s wInstModNdx and the current zone’s wModNdx. A difference of zero indicates there are no modulators in this zone." So in other words, in order to know how many elements of IGEN I need to inspect for the IBAG[0] zone, I need to look in IBAG[1]. Well, the generator index value in IBAG[1] is 0. So... What does that mean? The spec says, for modulators, that a difference of zero indicates that there are no modulators for the zone. Clearly there are generators for the zone. How do I know how many to consume? -- Mark Raynsford | http://www.io7m.com
pgp3wD6_cd_BT.pgp
Description: OpenPGP digital signature
_______________________________________________ fluid-dev mailing list fluid-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/fluid-dev