It was decoding one 28-sample subframes and blocked layout handled
frames, doing some voodoo to skip CD sectors.
Now decodes one 28*8-sample frame and blocked layout handles CD sectors.
Decoding is byte-exact vs before.
- Code now more verbose, but easier to understand (by me, at least)
- Unify normal and badflags code
- Fix hist1 not being properly clamped, though not noticeable
- Fix inFamous (PS3) which seemingly wasn't using the extended table but
hitting some compiler weirdness? (failed in foobar and worked in test)
- Use int math for PSX-cfg, which should be minimally more accurate
To open external files it was using get_realname, which only was
actually implemented in Audacious, but Audacious can use get_name to
open external files just fine anyway (for any path, encoding, etc)
Used to play separate intro+loop files, mask channels, play subsongs in
single files without having to demux, etc.
Also a channel mask parsing during main render_vgmstream.
It's not the easiest thing to follow so here is what's going on with
STREAMFILEs:
- external player opens base-streamfile, with a base FILE
- meta scd parses stuff, then per DSP channel/layer:
- open temp-streamfile, which does custom IO with base-streamfile
(doesn't open any FILE)
- pass temp-streamfile to init_vgmstream_ngc_dsp_std
- init parses ok, and re-opens temp-streamfile (with custom IO) as its
own dsp-vgmstream-streamfile; internally it does fopen/fdopen the
original FILE from base-streamfile
- scd_int_layout stores the newly created VGMSTREAM (internally has
the dsp-vgmstream-streamfile too)
- close temp-streamfile, that doesn't close base-streamfile as it's
wrapped to avoid doing so, nor affects dsp-vgmstream-streamfile in any
way.
- meta parsing is done, so external player closes base-streamfile (but
the re-fopen'ed dsp-vgmstream-streamfile FILE remains)
- vgmstream renders pcm buffers, etc
- finally player calls close_vgmstream
- scd_int_layout calls close_vgmstream for each stored VGMSTREAM
- the VGMSTREAM internally closes the dsp-vgmstream-streamfile, which
in turn closes its own FILE
So ultimately all FILEs, STREAMFILEs and their clones should be properly
handled and closed.