That's essentially an independent re-implementation of
this fix I already made and completely forgot about. Derp
The real issue was that when you request samples from the MSU-1 and it doesn't have any (song not playing, maybe other reasons I can't think of), it should still return the requested buffer size, padded with 0's. It was just returning the available samples, which in some cases was nothing at all. The rest of the changes in that commit ended up not being real issues after all, like increasing the counter variable sizes and shrinking the counter values by a factor of 10, since I was worried about potential counter overflows, but that really wasn't an issue. The relevant change in both is at line 357 or 425, depending on which version you're looking at.