Reply 20 of 930, by FreddyV
Hi,
I mix into a single buffer, but there are 4 x 1/50 of second buffers.
When the Sound blaster is playing the 1st Buffer, Mod Master is mixing the 4th buffer.
For example, If we have this during 4 x 1/50 of Second:
1 : 4 Channels
2 : 3 Channels
3 : 2 Channels
4 : 2 Channels
-> This is like mixing 3 channels in average.
With 2 Buffers, it is like Mixing 3.5 Channels then 2.
If the code can not mix more than 3 Channels, it will work in the 1st case, not in the second.
The trick with the Minimum volume to play and skipping the last channels if the mix code is only 1 Buffer ahead of the sound card is here to be sure that the mixing code is always ahead of the sound blaster.
Then, there is no "Click" and only some parts of the samples missing.
If GLX really mix the 4 Channels all the time, GLX performance is poor compared with MOD Master on a file using lots of Volume Slide...
This is exactly what we see with the Crystel Dream 2 music. GLX Fail at 15KHz when I can play it with Mod Master at 18KHz
I am sure that GLX mixing code is faster because I know I can optimize Mod Master code and with music playing 4 channels all the time, Mod Master is obviously slower.
I don't understand what you mean by mix without a volume table.
It is really too slow to mix with a Multiplication and There is not enaugh memory to pre calculate all the samples at all the volumes.
I am 100% sure GLX is not doing this as it will take a lot of time, there is not enaugh memory to do this, and GLX Files loading is fast.
You also say that always MIX 4 Channels is the fastest way, I disagree.
For each buffer byte, we can't switch between the 4 Channels as we need to read each sample Segment/Offset, the increments, the volume and so on. There is not enaugh registry and it is a waste of time.
8088 MPH Code is doing it, but it is possible ONLY because all the samples are in the same segment AND they are pre calculated with all the volumes.
I hope I am more clear now.