From: Joachim B. <jba...@pi...> - 2005-03-10 08:59:38
|
Hi, currently setBankNum(int bankNum) in the core/Driver class only supports bank changes with MIDI Controller 0 AND 32. So a driver may have to overwrite it, e.g. if just Controller 0 is used for bank changes. Therefore I have the following suggestion: 1.) A new method setBankChangeMethod(int method) to define whether Controller 0 AND 32 or 0 alone or 32 alone should be used. I don't know if any synth uses just Controller 32 but if it is so we can support it. :) The code may look the following way: /** * Constant for using MIDI Controller 0 & 32 for bank changes */ public static final int BANK_CHANGE_METHOD_MSB_LSB =3D 0; /** * Constant for using MIDI Controller 0 for bank changes */ public static final int BANK_CHANGE_METHOD_MSB =3D 1; /** * Constant for using MIDI Controller 32 for bank changes */ public static final int BANK_CHANGE_METHOD_LSB =3D 2; private int bankChangeMethod =3D BANK_CHANGE_METHOD_MSB_LSB; protected final void setBankChangeMethod(int method) { this.bankChangeMethod =3D method; } protected void setBankNum(int bankNum) { try { ShortMessage msg =3D new ShortMessage(); switch (this.bankChangeMethod) { case BANK_CHANGE_METHOD_MSB_LSB: msg.setMessage(ShortMessage.CONTROL_CHANGE, getChannel() = - 1, 0x00, // Bank Select (MSB) bankNum / 128); // Bank Number (MSB) send(msg); msg.setMessage(ShortMessage.CONTROL_CHANGE, getChannel() = - 1, 0x20, // Bank Select (LSB) bankNum % 128); // Bank Number (MSB) send(msg); break; case BANK_CHANGE_METHOD_MSB: msg.setMessage(ShortMessage.CONTROL_CHANGE, getChannel() = - 1, 0x00, // Bank Select (MSB) bankNum); // Bank Number (MSB) send(msg); break; case BANK_CHANGE_METHOD_LSB: msg.setMessage(ShortMessage.CONTROL_CHANGE, getChannel() = - 1, 0x20, // Bank Select (LSB) bankNum); // Bank Number (MSB) send(msg); break; } =20 } catch (InvalidMidiDataException e) { ErrorMsg.reportStatus(e); } } Five minutes ago I thought this idea is very good.=20 Now I'm not shure anymore. ;) What do you think? Regards, Joachim Backhaus |