OK. For now, I've done the following:
- Note on/off for the primary 4-OP channels (channels 0/1/2) handle the primary channels normally.
- Note on/off and 4-OP mode changes for a channel handle the second channel too. The operators affected are detected at the start of the note on/off function, where:
-- The 4-OP extended (upper) operators are notified of their old key-on state (for change detection at a later point in time, further down the function (it only keeps the lower operators original state)).
-- The 4-OP extended (upper) operators get their data source (for frequency number, block number sources and key-on (of modulator or carrier) state of their assigned channel) updated with either the 4-OP channel or their original channel (both precalculated, as this is fixed).
-- Flags are checked for 4-OP mode changes to force update fnum-related data and other upper channels properly.
Then, when processing the key-on and key-off, it will check (for the 4-OP upper channels) it's new source and update:
- Frequency number / octave / increment as it does usually, but depending on the new 4-OP or 2-OP source channel settings.
- Key-on and key-off are handled in the same way as normal key-on or key-off, but for an upper source instead (if the source gets changed, the (non) changing modulator/carrier key-on state of the new channel (or same channel if not changed) will trigger a key-on or key-off to match the new channel being selected.
So if you turn an OPL3 4-OP note on and then disable 4-OP mode, the then split 2-OP modulator/carrier note on bits will affect the modulator/carrier accordingly. Frequency/octave/increment(which is based on the frequency/block and operator frequency multiplier) are always reloaded in this case (as happens with any note on/off event).
Edit: Found a bug with feedback when enabled being forced, even though it shouldn't. Although that doesn't affect anything other than normal modulators, which have the feedback setting used anyways.
Does the OPL2 drum channels force feedback in some ways? Or is that a myth?
Edit: For now, implemented the basic (pretty much same) Sound Blaster Pro II DSP (which is effectively the same as the Pro I from what I can see, other than the version number reported and OPL3).
The sound card will of course enable the new OPL3 chip for emulation.
Although that doesn't mean that the new modes I implemented are working properly, they just work in theory so far. Until a bug is found (like in the new waveforms or 4-OP mode), at which point that'll need fixing.
The 0xE3 DSP command is implemented and recognised, but it will just give nothing as a result (according to Dosbox), thus acting as a NOP command of sorts.
The OPL3 chip is actually activated in it's full glory in this Sound Blaster version, so it can be tested.
All the backend if in theory implemented, just not sure yet if the 4-OP mode is properly working (and the final (8th) waveform is actually correct). Waveforms #4, #5 and #6 (#7 being the 8th waveform) should be correct, although maybe the 5th and 6th (#4/5) waveforms might be a bit squashed? That could be due to putting a 1024-entry waveform in half it's actual timespace, thus distorting it because you're fitting the 1024-entry full sinus waveform inside 512 entries (skipping every other entry). But that's probably also happening on a real OPL3 I'd think?