I’ve already stated that I’m redoing the 4 channel XM engine, and it’s up and running with a few looped notes until I finish parsing a particular mod file for simple demonstration, but I also have another engine I threw it together over a couple of hours on the weekend; an 8 channel static PCM player. 8 PCM channels at 6bit (higher than the native 5bit) and still leaves 4 normal PCE channels. Yeah, a total of 12 channels.
The second engine required more support though. The first engine only required a small 384 word table. This second engine, because all the PCM channels are mixed in software, requires volume tables because multiplying each sample is waaayy out of the scope of the PCE – tables do the work even faster. The PCM format also needs to be in 2’s complemented numbers. The PCM data might be 6bit, but it’s in 8bit format as signed numbers. Maybe this is overkill, but it just feels cleaner than adding any possible side effect because it’s not centered (a relative centerline). I’ve done mixing in software before with unsigned samples, but the center line moves around (the waveforms still accumulate the same). It just doesn’t sit well with me, so 2’s complement signed format it is. But that means the volume table has to include all 256 entries even it only uses 6bit resolution/values. At 32 levels of volume control, that’s an 8k table. Doesn’t need to be ram; fits anywhere in rom.
But yeah, so it needs more support/tools surrounding it. I had to make a wave file converter in C. I needed to make one anyway, so this isn’t a total waste of time. So what does this engine eat up cpu wise? about 21-22% cpu resource. I kid you not. 8 PCM channels, at 6bit vs 5bit, and still have 4 PCE channels left over – all faster than Air Zonk does to play a single PCM channel. Yeah, Air Zonk has a horrible PCM routine that eats up 30-33% cpu resource. I couldn’t believe it, but I checked it about 20 times over, and each time was 30 to 33% (33% when it has to fetch a new sample to bit shift, 30% when it’s just playing that sample).
Keep in mind, none of these 8 channels in the second engine scale in frequency like the first engine. It’s actually nothing super special or radical. 8 channels are soft mixed, with volume control for each channel, into a single buffer. That buffer is played using two PCE DDA channels to output 10bit audio. That’s it. The other downside is that it’s mono. If you want stereo, you have to take away another two PCE channels for a second 10bit paired output. Not enough channels you say? Want stereo you say? Well, bump up that number up to 37.3% cpu resource and get 16 PCM channels – stereo. You still have 2 regular PCE channels left over. For an extra 5% cpu resource on top of that, I can make 4 of those stereo channels frequency scale XM style. So many options…
That’s ridiculous! What the hell would someone do with 16 PCM 6bit stereo channels!? But hey, 18 channels on the PCE would make a great demo – no? Brag rights and all that sort of thing, I guess. Does the PCE have enough power to do more than 18 channels? Don’t ask. But yes. It does.