Why are the MIDI channels sometimes not muted after SoundHelix quits?

If SoundHelix quits normally (either by using "quit" or by hitting CTRL+C), the MIDI channels will be muted correctly. However, due to a race condition, this did not always work correctly before version 0.9, leaving some MIDI channels unmuted.

For handling non-normal termination (without using "quit"), SoundHelix registers a Java shutdown hook in order to mute all MIDI channels if SoundHelix is terminated during playback.

This works in all situations, except when

  • the JVM is terminated the hard way (e.g. via SIGKILL in Linux)
  • SoundHelix is running in a Cygwin shell on Windows and CTRL+C is pressed - the Cygwin shell seems to terminate the JVM the hard way upon hitting CTRL+C, see https://cygwin.com/ml/cygwin/2012-08/msg00067.html for details

The shutdown hook will log its start and finish using trace log level. If you want to see if it is called, make sure that you enable the trace level in log4j. For a completed call, you should see the start and the finish message of the shutdown hook.

Add new comment