Handmade Hero»Forums»Code
Matt Campbell
4 posts
Day 142 - minor bug in OutputPlayingSounds?
I think we can clamp to TargetVolume a bit early if both channels end during the same loop, but on different samples.

To pick numbers from thin air, assume SamplesToMix == 800, channel 0's VolumeSampleCount is 700, and channel 1's VolumeSampleCount is 100. My claim is that SamplesToMix will end at 100, but VolumeEnded[0] == VolumeEnded[1] == 1. This will result in channel 0's volume being clamped 600 samples earlier than it should. Of course, it's late and I could be missing something.
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
Day 142 - minor bug in OutputPlayingSounds?
That is an excellent point! I think you are right, but I don't have the code in front of me. I'll try to remember to look at that on tomorrow's stream.

- Casey