I've been attacking the envelope problems a bit more, mostly targeting problems with Radiant Silvergun, and I've came up with some more fixes. One problem I discovered is that if a slot was already in the release state, keying it off stopped it cold - this shouldn't be happening.
Changes: -Prevented keyoffs from killing slots when already in the release state -Envelope steps in the attack state are apparently exponential. To account for this, I change the envelope output to linear for attacks. -Change the release rate calculation to use the decay table instead of the attack one.
Also, I noticed in the MAME scsp.c source that the 16-bit PCM sample fix I posted earlier in this thread didn't get put in. Radiant Silvergun will need it for correct sound playback.
Here's the fix again, slightly modified so that it compiles without warnings in MAME (strict C90 compliance):
Ok, that's definitely much better. The drums at the start of Sakura Taisen #20 don't cut off immediately now, and Radient Silvergun is indeed quite improved. The 16-bit fix also corrects a few errant sound effects in Shienryu (one of the most underrated shmups ever, IMO).
I've launched my rip page. First up: a full SSF set of Radiant Silvergun from the ST-V version, fully tagged and timed. Plus a rarity that fell into my hands: a Qsound demo for the Saturn that was given away free to developers and made by game music legend Brian Schmidt. RSG will play quite nicely in the next AO test version (hopefully later today), but the QSound demo only works properly in kingshriek's KBmedia plugin for now.
Last edited by R. Belmont; 12/02/0711:12 PM. Reason: I was on a bad spelling rampage this morning. all better.
With the SCSP EG in pretty good shape, I have turned to fix some of the remaining issues in the DSP. The main fix I put in was support for the input effect mixer which fixes many of the dry/wet balance issues. I put in floating point support as well for ring-buffer read/writes. This fixes popping issues when the DSP initially reads from the ring-buffer, which most driver versions initialize to 0x6000 (the DSP floating-point representation of zero).
I also noticed that the EG_Update() function can possibly return a negative value in the DECAY1 state, which would potentially cause a segfault when later used as an index for table lookup (and if it doesn't, the output from it would probably sound very bad). I fixed this by adding a clamp to zero in the DECAY1 state.
I also took a brief look at LFO code and noticed that the saw PLFO was mistakenly set to a triangle waveform, so I fixed that too.