8bitbubsy wrote on 2022-06-17, 20:57:
4 channel mixing @ 30kHz on an 8086 8MHz without stuttering is really amazing. I'm also a bit amazed at how fast the 150kB module loads to RAM after you select it in the file browser. Feel like sharing the source code?
The maximum mix speed depends on the module as well, if it does not need to mix 4 Channels all the time.
Where have you seen 30KHz ? the limit is more around 26/28KHz
Basically, I used a lot of trick, 6 Buffers, Channel mix paused if the buffer calculation is too late, don't do a ADD, but a MOV for the first channel mix (Faster and avoid to clean the buffer before)
The sample loop is extended at the end of the sample, to not test if the sample end is reached all the time.
So, even if the CPU Does not follow, we can't hear problem in the sound.
For the module load speed, it can be much faster if you convert the file to the .MMM format.
I plan to release the code, as a sound system.
I already shared it with some ppls.