I have gotten a good number of responses on various forums, and I am beginning to see a distinct pattern. In cases where getDefaultSoundbank() does not return null (i.e. software-synthesis mode) then volume does not become silent at zero. In cases where getDefaultSoundbank() does return null (i.e. hardware-synthesis mode) then volume becomes silent at zero. This theory is further supported by some test cases I've done here. When I run the test as an application, they all report that getDefaultSoundbank() does not return null, and volume does not become silent at zero. On my laptop running Vista, the applet also reports not null for getDefaultSoundbank(), and volume does not become silent at zero. For all my other test machines, the applet reports that getDefaultSoundbank() does return null, and volume becomes silent at zero (the same machines where volume did not become silent at zero when running as an application).
Of course I will keep looking for exceptions to this theory as more reports come in (and I haven't had anyone report yet that volume didn't change for them at all), but I can make a deduction based on the current information:
When running in hardware-synthesis mode, volume changes work properly. The code that runs in this case is:
Receiver receiver = MidiSystem.getReceiver();
ShortMessage volumeMessage= new ShortMessage();
for( int c = 0; c < 16; c++ )
{
volumeMessage.setMessage( ShortMessage.CONTROL_CHANGE, c,
CHANGE_VOLUME, midiVolume );
receiver.send( volumeMessage, -1 );
}
On the other hand, when running in software-synthesis mode, volume changes do not work properly. The code that runs in this case is:
javax.sound.midi.MidiChannel[] channels = synthesizer.getChannels();
for( int c = 0; channels != null && c < channels.length; c++ )
{
channels[c].controlChange( CHANGE_VOLUME, midiVolume );
}
It would appear that using the ShortMessages method works better for changing the volume than using the synthesizer channels method. I've tried mixing and matching the two methods, but the volume does not change at all if using the wrong method with the wrong synthesis mode. I've also tried using both modes at the same time for both methods, and that doesn't cause any problems, but it doesn't correct the software-synthesis mode volume problem either. I'll keep looking into this, and post some questions on various forums. If my theory is right, then at least we have a little bit better idea on where to focus.
Oh, and we also know that the problem of volume not changing at all is not common, and since your laptop is running Windows 7, we know it is probably not an issue Windows 7.