I am having problems setting up the tool in the javax.sound.midi package.
Synthesizer synthesizer = MidiSystem.getSynthesizer(); MidiChannel[] channels = synthesizer.getChannels(); channels[0].programChange(5); System.out.println(channels[0].getProgram());
From the documentation for MidiChannel, calls to the channels [0] .programChange (int) should change the tool on which MidiChannel is installed and is immediately displayed in the channels [0] .getProgram (). However, my program prints "0", indicating that nothing has changed.
Later in the code, I use MidiChannel.getSequencer () to successfully play MIDI sound (although only with the default tool).
Am I trying to install the tool incorrectly?
source share