|
I would not recommend using DirectSound to control sound channel amplitudes, mainly because it would require a buffer for each sound channel you wish to emulate (5 sound channels, plus any additional ones you might get from certain mappers). A better approach would probably be the way most people already do it: generate each sound wave for each channel (at their respective amplitudes) and mix them together into a single waveform, then send *that* waveform to DirectSound (at maximum volume, of course). The main advantage is that you only have to deal with buffering for one sound channel; the disadvantage is that you have to manually generate each channel's waveform in real-time (but you should be doing this already).
The proper way to do fades is to let the APU do them for you. Read Brad Taylor's APU document (which you should have done already) to figure out how the envelope generator works - take the bits written to the channel volume, add 1 (to get N), then decrement the channel amplitude once every N quarter-frames.
-- Quietust P.S. If you don't get this note, let me know and I'll write you another.
|