Note that there are some explanatory texts on larger screens.

plurals
  1. POmidi keyboard not working on all platforms
    text
    copied!<p>I made a <a href="https://github.com/soundhaven/keyboard" rel="nofollow">keyboard application</a> a while ago that gets a midi soundbank as a resource from a jar, and uses it to get the instrument names contained in the soundbank. This seems to work fine on machines using windows 7 with suns java 6 and in linux using suns java 6. However, this does not seem to work on machines using windows xp using the same version of java. What seems to be happening is that the instrument array has not been loaded when the <code>getInstrumentName()</code> method is called. The instrument array gets populated in the constructor of the <code>DefaultControl</code> class (second code sample). Could someone please help me to understand why would this be the case, and why would it seem to be machine dependent? </p> <p>I get the current instrument name like this: </p> <pre><code>data.setControls(new DefaultControls()); data.setKeyboard(new KeyboardPanel(data.getPressed())); data.getKeyboard().setInstrumentName(data.getControls().getInstrumentName()); </code></pre> <p>I get and load the soundbank like this:</p> <pre><code>this.synth=MidiSystem.getSynthesizer(); synth.open(); synth.loadAllInstruments( MidiSystem.getSoundbank( getClass().getResourceAsStream("soundbank.gm"))); this.instrument=synth.getAvailableInstruments(); this.channels=synth.getChannels(); </code></pre> <p>This is the method that is called to load the name is this:</p> <pre><code>public String getInstrumentName(){ return instrument[selected_instrument].getName(); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload