|
From: <ge...@us...> - 2003-08-12 21:08:35
|
Update of /cvsroot/jsynthlib/JSynthLib/synthdrivers/NordLead
In directory sc8-pr-cvs1:/tmp/cvs-serv18405
Added Files:
NL2PerfBankDriver.java NL2PerfSingleDriver.java
Log Message:
Added finally the missing two NL2-drivers
--- NEW FILE: NL2PerfBankDriver.java ---
// written by Kenneth L. Martinez
// $Id: NL2PerfBankDriver.java,v 1.1 2003/08/12 20:56:01 gehnen Exp $
package synthdrivers.NordLead;
import core.*;
import javax.swing.*;
public class NL2PerfBankDriver extends BankDriver {
static final int BANK_NUM_OFFSET = 4;
static final int PATCH_NUM_OFFSET = 5;
static final int NUM_IN_BANK = 100;
NordLeadConfig nlConfig;
public NL2PerfBankDriver(NordLeadConfig nlc) {
nlConfig = nlc;
authors = "Kenneth L. Martinez";
manufacturer = "Nord";
model = "Lead2";
patchType = "Perf Bank";
id = "Lead2";
sysexID = "F033**04**";
sysexRequestDump = new SysexHandler("F0 33 @@ 04 *bankNum* *patchNum* F7");
singleSysexID = "F033**04**";
singleSize = 715;
patchSize = singleSize * NUM_IN_BANK;
patchNameStart = -1;
patchNameSize = 0;
deviceIDoffset = 2;
bankNumbers = NLPerfSingleDriver.BANK_LIST;
patchNumbers = NLPerfSingleDriver.PATCH_LIST;
numPatches = patchNumbers.length;
numColumns = 5;
}
public void calculateChecksum(Patch p) {
// doesn't use checksum
}
public void calculateChecksum(Patch p, int start, int end, int ofs) {
// doesn't use checksum
}
public void storePatch (Patch p, int bankNum, int patchNum) {
if (bankNum == 0) {
JOptionPane.showMessageDialog(PatchEdit.instance,
"Cannot send to ROM bank",
"Store Patch",
JOptionPane.WARNING_MESSAGE
);
} else {
setBankNum(bankNum); // must set bank - sysex patch dump always stored in current bank
setPatchNum(patchNum); // must send program change to make bank change take effect
sendPatchWorker(p, bankNum);
}
}
public void putPatch(Patch bank, Patch p, int patchNum) {
if (!canHoldPatch(p)) {
ErrorMsg.reportError("Error", "This type of patch does not fit in to this type of bank.");
return;
}
System.arraycopy(p.sysex, 0, bank.sysex, patchNum * singleSize, singleSize);
bank.sysex[patchNum * singleSize + PATCH_NUM_OFFSET] = (byte)patchNum; // set program #
}
public Patch getPatch(Patch bank, int patchNum) {
byte sysex[] = new byte[singleSize];
System.arraycopy(bank.sysex, patchNum * singleSize, sysex, 0, singleSize);
Patch p = new Patch(sysex);
return p;
}
public String getPatchName(Patch p, int patchNum) {
return "-";
}
public void setPatchName(Patch p,int patchNum, String name) {}
protected void sendPatchWorker (Patch p) {
sendPatchWorker(p, 0);
}
protected void sendPatchWorker (Patch p, int bankNum) {
byte tmp[] = new byte[singleSize]; // send in 100 single-performance messages
try {
PatchEdit.waitDialog.show();
for (int i = 0; i < NUM_IN_BANK; i++) {
System.arraycopy(p.sysex, i * singleSize, tmp, 0, singleSize);
tmp[deviceIDoffset] = (byte)(nlConfig.getGlobalChannel() - 1);
tmp[BANK_NUM_OFFSET] = (byte)31;
tmp[PATCH_NUM_OFFSET] = (byte)i; // performance #
PatchEdit.MidiOut.writeLongMessage(port, tmp);
Thread.sleep(50);
}
PatchEdit.waitDialog.hide();
} catch (Exception e) {
ErrorMsg.reportStatus (e);
ErrorMsg.reportError("Error", "Unable to send Patch");
}
}
public Patch createNewPatch() {
byte tmp[] = new byte[singleSize];
byte sysex[] = new byte[patchSize];
System.arraycopy(NLPerfSingleDriver.NEW_PATCH, 0, tmp, 0, singleSize);
for (int i = 0; i < NUM_IN_BANK; i++) {
tmp[PATCH_NUM_OFFSET] = (byte)i; // program #
System.arraycopy(tmp, 0, sysex, i * singleSize, singleSize);
}
Patch p = new Patch(sysex);
p.ChooseDriver();
return p;
}
public void requestPatchDump(int bankNum, int patchNum) {
for (int i = 0; i < NUM_IN_BANK; i++) {
sysexRequestDump.send(port, (byte)(nlConfig.getGlobalChannel()),
new NameValue("bankNum", 41),
new NameValue("patchNum", i)
);
try {
Thread.sleep(250); // it takes some time for each performance to be sent
} catch (Exception e) {
ErrorMsg.reportStatus (e);
ErrorMsg.reportError("Error", "Unable to request Patch " + i);
}
}
}
}
--- NEW FILE: NL2PerfSingleDriver.java ---
// written by Kenneth L. Martinez
// $Id: NL2PerfSingleDriver.java,v 1.1 2003/08/12 20:56:01 gehnen Exp $
package synthdrivers.NordLead;
import core.*;
import javax.swing.*;
public class NL2PerfSingleDriver extends Driver {
static final String BANK_LIST[] = new String[] { "PCMCIA" };
static final String PATCH_LIST[] = new String[] {
"A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9",
"B0", "B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8", "B9",
"C0", "C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9",
"D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", "D8", "D9",
"E0", "E1", "E2", "E3", "E4", "E5", "E6", "E7", "E8", "E9",
"F0", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9",
"G0", "G1", "G2", "G3", "G4", "G5", "G6", "G7", "G8", "G9",
"H0", "H1", "H2", "H3", "H4", "H5", "H6", "H7", "H8", "H9",
"J0", "J1", "J2", "J3", "J4", "J5", "J6", "J7", "J8", "J9",
"L0", "L1", "L2", "L3", "L4", "L5", "L6", "L7", "L8", "L9"
};
static final int BANK_NUM_OFFSET = 4;
static final int PATCH_NUM_OFFSET = 5;
static final byte NEW_PATCH[] = {
(byte)0xF0, (byte)0x33, (byte)0x00, (byte)0x04, (byte)0x1F, (byte)0x00, (byte)0x07, (byte)0x06,
(byte)0x0A, (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x0D, (byte)0x01, (byte)0x03, (byte)0x02,
(byte)0x09, (byte)0x03, (byte)0x00, (byte)0x00, (byte)0x0B, (byte)0x06, (byte)0x00, (byte)0x00,
(byte)0x0E, (byte)0x05, (byte)0x00, (byte)0x00, (byte)0x0A, (byte)0x06, (byte)0x00, (byte)0x00,
(byte)0x02, (byte)0x05, (byte)0x00, (byte)0x00, (byte)0x02, (byte)0x04, (byte)0x00, (byte)0x00,
(byte)0x0B, (byte)0x02, (byte)0x00, (byte)0x00, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x04,
(byte)0x08, (byte)0x04, (byte)0x0E, (byte)0x03, (byte)0x0B, (byte)0x02, (byte)0x0E, (byte)0x03,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x0D, (byte)0x0E, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x04, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x03,
(byte)0x01, (byte)0x0F, (byte)0x02, (byte)0x00, (byte)0x02, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x03, (byte)0x00, (byte)0x01, (byte)0x00, (byte)0x01, (byte)0x00, (byte)0x02, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x02, (byte)0x00, (byte)0x03, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x02, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01, (byte)0x00, (byte)0x03, (byte)0x00,
(byte)0x03, (byte)0x00, (byte)0x00, (byte)0x03, (byte)0x0A, (byte)0x04, (byte)0x0B, (byte)0x03,
(byte)0x06, (byte)0x03, (byte)0x03, (byte)0x01, (byte)0x0E, (byte)0x04, (byte)0x07, (byte)0x03,
(byte)0x08, (byte)0x04, (byte)0x00, (byte)0x00, (byte)0x0E, (byte)0x04, (byte)0x0C, (byte)0x02,
(byte)0x08, (byte)0x02, (byte)0x00, (byte)0x00, (byte)0x08, (byte)0x05, (byte)0x02, (byte)0x06,
(byte)0x06, (byte)0x01, (byte)0x03, (byte)0x02, (byte)0x03, (byte)0x03, (byte)0x00, (byte)0x00,
(byte)0x0D, (byte)0x00, (byte)0x03, (byte)0x06, (byte)0x03, (byte)0x02, (byte)0x00, (byte)0x06,
(byte)0x0C, (byte)0x04, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x02, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01, (byte)0x00, (byte)0x01, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x02, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x02, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x01, (byte)0x00, (byte)0x01, (byte)0x00, (byte)0x01, (byte)0x00,
(byte)0x01, (byte)0x00, (byte)0x02, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x0A, (byte)0x05,
(byte)0x00, (byte)0x04, (byte)0x0D, (byte)0x03, (byte)0x03, (byte)0x05, (byte)0x07, (byte)0x02,
(byte)0x00, (byte)0x00, (byte)0x04, (byte)0x03, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x06, (byte)0x02, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x03, (byte)0x01, (byte)0x08, (byte)0x01, (byte)0x0E, (byte)0x03,
(byte)0x0E, (byte)0x02, (byte)0x03, (byte)0x06, (byte)0x08, (byte)0x03, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x03, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x0B, (byte)0x02, (byte)0x0C, (byte)0x01, (byte)0x02, (byte)0x02,
(byte)0x0E, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x02, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x02, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x04, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x02, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x04, (byte)0x00,
(byte)0x04, (byte)0x00, (byte)0x0A, (byte)0x05, (byte)0x00, (byte)0x04, (byte)0x0D, (byte)0x03,
(byte)0x03, (byte)0x05, (byte)0x07, (byte)0x02, (byte)0x00, (byte)0x00, (byte)0x04, (byte)0x03,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x06, (byte)0x02, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x03, (byte)0x01,
(byte)0x08, (byte)0x01, (byte)0x0E, (byte)0x03, (byte)0x0E, (byte)0x02, (byte)0x03, (byte)0x06,
(byte)0x08, (byte)0x03, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x03, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x0B, (byte)0x02,
(byte)0x0C, (byte)0x01, (byte)0x02, (byte)0x02, (byte)0x0E, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x02, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x02, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x04, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x02, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x04, (byte)0x00, (byte)0x04, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x02, (byte)0x00, (byte)0x03, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x03, (byte)0x00, (byte)0x08, (byte)0x00, (byte)0x01, (byte)0x00, (byte)0x07, (byte)0x01,
(byte)0x07, (byte)0x01, (byte)0x07, (byte)0x01, (byte)0x07, (byte)0x01, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x08, (byte)0x00,
(byte)0x03, (byte)0x00, (byte)0x08, (byte)0x00, (byte)0x08, (byte)0x00, (byte)0x07, (byte)0x01,
(byte)0x07, (byte)0x01, (byte)0x07, (byte)0x01, (byte)0x07, (byte)0x01, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x08, (byte)0x00,
(byte)0x08, (byte)0x00, (byte)0x08, (byte)0x00, (byte)0x08, (byte)0x00, (byte)0x07, (byte)0x01,
(byte)0x07, (byte)0x01, (byte)0x07, (byte)0x01, (byte)0x07, (byte)0x01, (byte)0x03, (byte)0x00,
(byte)0x03, (byte)0x00, (byte)0x01, (byte)0x00, (byte)0x0F, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01, (byte)0x00,
(byte)0x0F, (byte)0x0F, (byte)0x00, (byte)0x00, (byte)0x03, (byte)0x01, (byte)0x01, (byte)0x00,
(byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x04, (byte)0x04, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0xF7
};
NordLeadConfig nlConfig;
public NL2PerfSingleDriver(NordLeadConfig nlc) {
nlConfig = nlc;
authors = "Kenneth L. Martinez";
manufacturer = "Nord";
model = "Lead2";
patchType = "Perf Single";
id = "Lead2";
sysexID = "F033**04**";
sysexRequestDump = new SysexHandler("F0 33 @@ 04 *bankNum* *patchNum* F7");
patchSize = 715;
patchNameStart = -1;
patchNameSize = 0;
deviceIDoffset = 2;
bankNumbers = BANK_LIST;
patchNumbers = PATCH_LIST;
}
public void calculateChecksum(Patch p) {
// doesn't use checksum
}
public void calculateChecksum(Patch p, int start, int end, int ofs) {
// doesn't use checksum
}
public String getPatchName(Patch p) {
return "perf" + (p.sysex[PATCH_NUM_OFFSET] + 1);
}
public void setPatchName(Patch p, String name) {}
public void sendPatch(Patch p) {
sendPatch(p, 30, 0); // using edit buffer
}
public void sendPatch(Patch p, int bankNum, int patchNum) {
Patch p2 = new Patch(p.sysex);
p2.sysex[BANK_NUM_OFFSET] = (byte)bankNum;
p2.sysex[PATCH_NUM_OFFSET] = (byte)patchNum;
sendPatchWorker(p2);
}
// Sends a patch to a set location in the user bank
public void storePatch(Patch p, int bankNum, int patchNum) {
sendPatch(p, 31, patchNum);
setPatchNum(patchNum); // send program change to get new sound in edit buffer
}
public void playPatch(Patch p) {
byte sysex[] = new byte[patchSize];
System.arraycopy(p.sysex, 0, sysex, 0, patchSize);
sysex[BANK_NUM_OFFSET] = 30; // edit buffer
sysex[PATCH_NUM_OFFSET] = 0;
Patch p2 = new Patch(sysex);
super.playPatch(p2);
}
public Patch createNewPatch() {
Patch p = new Patch(NEW_PATCH);
p.ChooseDriver();
return p;
}
protected void sendPatchWorker(Patch p) {
p.sysex[deviceIDoffset] = (byte)(nlConfig.getGlobalChannel() - 1);
try {
PatchEdit.MidiOut.writeLongMessage(port, p.sysex);
} catch (Exception e) {
ErrorMsg.reportStatus (e);
}
}
public void requestPatchDump(int bankNum, int patchNum) {
sysexRequestDump.send(port, (byte)(nlConfig.getGlobalChannel()),
new NameValue("bankNum", 41), new NameValue("patchNum", patchNum)
);
}
}
|