First post, by ripsaw8080
- DOSBox Author
I've recently been trying to find the source of a problem playing MIDI data from the Cakewalk 3.0 sequencer for DOS running in DOSBox using the MPU-401 intelligent mode. The problem is that at some point during playing the program gets stuck in a loop with a hanging note still sounding. These hangs occur at various times, but I believe it has something to do with the amount of MIDI data, because it happens right away for relatively small songs, and later on for larger ones.
Using the debugger to log commands sent to the MPU-401, I can see that the hangs are coincident with the first 0xFC command, at which point that command is sent repeatedly and rapidly, over and over. The online MIDI specs I've been able to find describe this as a "Stop" or "End" command, and DOSBox is not doing anything special with it other than generating an ACK. Unable to think of anything else to try, I modified MPU401_WriteCommand so it does not generate an ACK for the command, and the hangs no longer occur. I think Cakewalk is waiting for the queue to be empty, and keeps sending the command until it is empty, but ACKing the command prevents it from ever being empty when the status is checked, in a feedback loop.
Why Cakewalk is using the command at some point during playback is unclear to me, but I know with certainty that the program does not have the problem with a real MPU-401 interface, so I'm guessing what I've described is a minor compatibility issue. However, the issue may very well not have an impact on any game, so it might not be addressed in future versions of DOSBox; but perhaps the information will still be useful to others interested in experimenting with Cakewalk running in modified versions of DOSBox.