PatchEdit.MidiOut.writeShortMessage(getPort(),(byte)0xF0,(byte)0x42); PatchEdit.MidiOut.writeShortMessage(getPort(),(byte)(0x30+(getChannel()-1)),(byte)0x35); PatchEdit.MidiOut.writeLongMessage(getPort(), programMode);
send(0xF0, 0x42); send(0x30+(getChannel()-1), 0x35); send(programMode);
  public void setPatchNum (int patchNum)  {    try      {	byte[] programMode = {(byte)0x4E, (byte)0x02, (byte)0x00, (byte)0xF7};	byte[] programEditMode = {(byte)0x4E, (byte)0x03, (byte)0x00, (byte)0xF7};	// go to PROGRAM mode	PatchEdit.MidiOut.writeShortMessage(getPort(),(byte)0xF0,(byte)0x42);	PatchEdit.MidiOut.writeShortMessage(getPort(),(byte)(0x30+(getChannel()-1)),(byte)0x35);	PatchEdit.MidiOut.writeLongMessage(getPort(), programMode);	try {Thread.sleep(100); } catch (Exception e){}   	// set patch	PatchEdit.MidiOut.writeShortMessage (getPort(),(byte)(0xC0+(getChannel()-1)),(byte)patchNum,(byte)0xF7);	try {Thread.sleep(100); } catch (Exception e){}   	// go to PROGRAM EDIT mode	PatchEdit.MidiOut.writeShortMessage(getPort(),(byte)0xF0,(byte)0x42);	PatchEdit.MidiOut.writeShortMessage(getPort(),(byte)(0x30+(getChannel()-1)),(byte)0x35);	PatchEdit.MidiOut.writeLongMessage(getPort(), programEditMode);	try {Thread.sleep(100); } catch (Exception e){}         } catch (Exception e) {};  }