public abstract class AbstractDriver extends Object implements IDriver
| Modifier and Type | Field and Description |
|---|---|
protected String[] |
bankNumbers
Array holding names or numbers for all banks.
|
protected int |
checksumEnd
End of range that Checksum covers.
|
protected int |
checksumOffset
Offset of checksum byte.
|
protected int |
checksumStart
Start of range that Checksum covers.
|
protected int |
deviceIDoffset
Offset of deviceID in sysex.
|
protected org.apache.log4j.Logger |
log |
protected int |
numSysexMsgs
Number of sysex messages in patch dump.
|
protected int |
patchNameSize
Number of characters in the patch name.
|
protected int |
patchNameStart
The offset in the patch where the patchname starts.
|
protected String[] |
patchNumbers
Array holding names/numbers for all patches.
|
protected int |
patchSize
The size of the patch this Driver supports (or 0 for variable).
|
protected String |
sysexID
The hex header that sysex files of the format this driver supports will
have.
|
protected SysexHandler |
sysexRequestDump
SysexHandler object to request dump.
|
protected int |
trimSize
The size of the patch for trimming purposes.
|
| Constructor and Description |
|---|
AbstractDriver(String patchType,
String authors)
Creates a new
Driver instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
calculateChecksum(byte[] sysex,
int start,
int end,
int ofs)
Caluculate check sum of a byte array
sysex. |
void |
calculateChecksum(Patch p)
Calculate check sum of a
Patch. |
protected void |
calculateChecksum(Patch patch,
int start,
int end,
int offset)
Calculate check sum of a
Patch. |
boolean |
canCreatePatch()
Check if this driver supports creating a new patch.
|
protected Patch |
createNewPatch()
Create a new Patch.
|
Patch |
createPatch()
Create a new Patch for this driver.
|
Patch |
createPatch(byte[] sysex)
Create a patch from a byte array for the driver.
|
Patch[] |
createPatches(SysexMessage[] msgs)
Create an array of patches from an array of SysexMessage for the driver.
|
protected String[] |
generateNumbers(int min,
int max,
String format)
A utility method to generates an array of formatted numbers.
|
String |
getAuthors()
return the names of the authors of this driver.
|
String[] |
getBankNumbers()
Returns String[] returns full list of bankNumbers.
|
int |
getChannel()
Return MIDI channel number.
|
int |
getChecksumEnd() |
int |
getChecksumOffset() |
int |
getChecksumStart() |
Device |
getDevice()
Return
Device with which this driver go.. |
int |
getDeviceID()
Return MIDI devide ID.
|
int |
getDeviceIDoffset() |
protected String |
getManufacturerName()
Return the name of manufacturer of synth.
|
protected String |
getModelName()
Return the name of model of synth.
|
protected PatchFactory |
getPatchFactory() |
int |
getPatchNameSize()
Getter of patchNameSize.
|
int |
getPatchNameStart() |
String[] |
getPatchNumbers()
Returns String[] returns full list of patchNumbers.
|
int |
getPatchSize()
Return the size of the patch which the driver handles.
|
String |
getPatchType()
return type of patch which the driver handles.
|
protected String |
getSynthName()
Return the personal name of the synth.
|
String |
getSysexID() |
SysexHandler |
getSysexRequestDump() |
int |
getTrimSize() |
void |
playPatch(Patch p)
Play note.
|
void |
requestPatchDump(int bankNum,
int patchNum)
Request the synth to send a patch dump.
|
void |
send(byte[] sysex)
Send Sysex byte array data to MIDI outport.
|
void |
send(int status,
int d1)
Send ShortMessage to MIDI outport.
|
void |
send(int status,
int d1,
int d2)
Send ShortMessage to MIDI outport.
|
void |
send(MidiMessage msg)
Send a MidiMessage to the MIDI outport for this driver.
|
void |
sendPatch(Patch p)
Sends a patch to the synth's edit buffer.
|
protected void |
sendPatchWorker(Patch p)
Set Device ID and send the sysex data to MIDI output.
|
protected void |
setBankNum(int bankNum)
Send Control Change (Bank Select) MIDI message.
|
void |
setBankNumbers(String[] bankNumbers) |
void |
setChecksumEnd(int checksumEnd) |
void |
setChecksumOffset(int checksumOffset) |
void |
setChecksumStart(int checksumStart) |
void |
setDevice(Device d)
Set
Device with which this driver go. |
void |
setDeviceIDoffset(int deviceIDoffset) |
void |
setPatchNameSize(int patchNameSize) |
void |
setPatchNameStart(int patchNameStart) |
protected void |
setPatchNum(int patchNum)
Send Program Change MIDI message.
|
void |
setPatchNumbers(String[] patchNumbers) |
void |
setPatchSize(int patchSize) |
void |
setSysexID(String sysexID) |
void |
setSysexRequestDump(SysexHandler sysexRequestDump) |
void |
setTrimSize(int trimSize) |
boolean |
supportsPatch(String patchString,
byte[] sysex)
Compares the header & size of a Patch to this driver to see if this
driver is the correct one to support the patch.
|
String |
toString()
Returns full name for referring to this Driver.
|
int |
trimSysex(Patch patch)
This method trims a patch, containing more than one real patch to a
correct size.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waiteditPatch, getPatchName, hasEditor, isBankDriver, isConverter, isSingleDriver, setPatchName, storePatchprotected final transient org.apache.log4j.Logger log
protected int patchSize
supportsPatch(java.lang.String, byte[])protected String sysexID
*). (ex. "F041**003F12")supportsPatch(java.lang.String, byte[])protected String[] patchNumbers
getPatchNumbers(),
#getPatchNumbersForStore,
DriverUtil#generateNumbersprotected String[] bankNumbers
getBankNumbers(),
DriverUtil#generateNumbersprotected int deviceIDoffset
sendPatchWorker method.protected SysexHandler sysexRequestDump
requestPatchDump method.requestPatchDump(int, int),
SysexHandlerprotected int checksumOffset
Need to be set if default calculateChecksum(Patch) method is
used.
calculateChecksum(Patch)protected int checksumStart
Need to be set if default calculateChecksum(Patch) method is
used.
calculateChecksum(Patch)protected int checksumEnd
Need to be set if default calculateChecksum(Patch) method is
used.
calculateChecksum(Patch)protected int patchNameStart
protected int patchNameSize
protected int trimSize
protected int numSysexMsgs
public final String getPatchType()
IDrivergetPatchType in interface IDriverpublic final String getAuthors()
IDrivergetAuthors in interface IDriverpublic void setDevice(Device d)
IDriverDevice with which this driver go.public final Device getDevice()
IDriverDevice with which this driver go..public boolean supportsPatch(String patchString, byte[] sysex)
supportsPatch in interface IDriverpatchString - the result of p.getPatchHeader().sysex - a byte array of sysex messagetrue if this driver supports the Patch.patchSize,
sysexIDpublic int getPatchSize()
IDriverSysexGetDialog uses this to estimate timeout value.getPatchSize in interface IDriverSysexGetDialogpublic String[] getPatchNumbers()
IDrivergetPatchNumbers in interface IDriverDriverUtil#generateNumberspublic String[] getBankNumbers()
IDrivergetBankNumbers in interface IDriverDriverUtil#generateNumberspublic void sendPatch(Patch p)
Override this in the subclass if parameters or warnings need to be sent to the user (aka if the particular synth does not have a edit buffer or it is not MIDI accessable).
sendPatch in interface IDriverPatch.send(),
ISinglePatch#send()protected final void sendPatchWorker(Patch p)
sendPatch(Patch)public final void send(byte[] sysex)
sysex - a byte array of Sysex data. If it has checksum, the checksum
must be calculated before calling this method.public void playPatch(Patch p)
playPatch in interface IDriverPatch.play(),
ISinglePatch#play()public final void send(MidiMessage msg)
IDriverpublic Patch[] createPatches(SysexMessage[] msgs)
IDriverrequestPatchDump(int, int).createPatches in interface IDrivermsgs - an array of SysexMessage.IPatch value.IDriver.requestPatchDump(int, int),
SysexGetDialogpublic Patch createPatch(byte[] sysex)
IDriverIDriver.supportsPatch() returns true.createPatch in interface IDriversysex - a byte array of sysex data.IPatch object.IDriver.supportsPatch(String, byte[]),
DriverUtil#createPatch(byte[])protected final String getManufacturerName()
protected final String getModelName()
protected final String getSynthName()
public final int getDeviceID()
IDrivergetDeviceID in interface IDriverpublic final int getChannel()
getChannel in interface IDriverpublic int getPatchNameSize()
IDrivergetPatchNameSize in interface IDriverpublic void calculateChecksum(Patch p)
Patch.
Need to be overridden if a patch is consist from multiple SysEX messages.
calculateChecksum in interface IDriverp - a Patch valueprotected final void calculateChecksum(Patch patch, int start, int end, int offset)
Patch.
This method is called by calculateChecksum(Patch). The checksum calculation method of this method is used by Roland, YAMAHA, etc. Override this for different checksum calculation method.
Compatibility Note: This method became 'static' method.
patch - a Patch valuestart - start offsetend - end offsetoffset - offset of the checksum datacalculateChecksum(Patch)public int trimSysex(Patch patch)
trimSysex in interface IDriverpatch - the patch, which should be trimmed to the right sizefixPatch(Patch, String),
IDriver.createPatches(SysexMessage[])protected void setBankNum(int bankNum)
IDriver.storePatch(Patch, int, int)public void requestPatchDump(int bankNum,
int patchNum)
sysexRequestDump
is not null, a request dump message is sent. Otherwise a
dialog window will prompt users.requestPatchDump in interface IDriverIDriver.requestPatchDump(int, int),
SysexHandlerprotected void setPatchNum(int patchNum)
IDriver.storePatch(Patch, int, int)public final void send(int status,
int d1,
int d2)
public final void send(int status,
int d1)
public boolean canCreatePatch()
canCreatePatch in interface IDriverIDriver.createPatch()public String toString()
IDriverpublic final Patch createPatch()
IDrivercreatePatch in interface IDriverprotected Patch createNewPatch()
IDriver.createPatch(),
createPatch()protected PatchFactory getPatchFactory()
protected String[] generateNumbers(int min, int max, String format)
patchNumbers = generateNumbers(1, 10, "Patch 00");setups the following array,
{
"Patch 01", "Patch 02", "Patch 03", "Patch 04", "Patch 05"
"Patch 06", "Patch 07", "Patch 08", "Patch 09", "Patch 10"
}
min - minumux valuemax - maximum valueformat - pattern String for java.text.DecimalFormatDecimalFormat,
IDriver.getPatchNumbers(),
IPatchDriver.getPatchNumbersForStore(),
IDriver.getBankNumbers()public void calculateChecksum(byte[] sysex,
int start,
int end,
int ofs)
IDriversysex.
The checksum calculation method of this method is used by Roland, YAMAHA, etc.
Compatibility Note: This method became 'static' method.
calculateChecksum in interface IDriversysex - a byte arraystart - start offsetend - end offsetofs - offset of the checksum datacalculateChecksum(Patch)public String getSysexID()
getSysexID in interface IDriverpublic void setSysexID(String sysexID)
setSysexID in interface IDriverpublic int getDeviceIDoffset()
getDeviceIDoffset in interface IDriverpublic void setDeviceIDoffset(int deviceIDoffset)
setDeviceIDoffset in interface IDriverpublic SysexHandler getSysexRequestDump()
getSysexRequestDump in interface IDriverpublic void setSysexRequestDump(SysexHandler sysexRequestDump)
setSysexRequestDump in interface IDriverpublic int getChecksumOffset()
getChecksumOffset in interface IDriverpublic void setChecksumOffset(int checksumOffset)
setChecksumOffset in interface IDriverpublic int getChecksumStart()
getChecksumStart in interface IDriverpublic void setChecksumStart(int checksumStart)
setChecksumStart in interface IDriverpublic int getChecksumEnd()
getChecksumEnd in interface IDriverpublic void setChecksumEnd(int checksumEnd)
setChecksumEnd in interface IDriverpublic int getPatchNameStart()
getPatchNameStart in interface IDriverpublic void setPatchNameStart(int patchNameStart)
setPatchNameStart in interface IDriverpublic int getTrimSize()
getTrimSize in interface IDriverpublic void setTrimSize(int trimSize)
setTrimSize in interface IDriverpublic void setPatchSize(int patchSize)
setPatchSize in interface IDriverpublic void setPatchNumbers(String[] patchNumbers)
setPatchNumbers in interface IDriverpublic void setBankNumbers(String[] bankNumbers)
setBankNumbers in interface IDriverpublic void setPatchNameSize(int patchNameSize)
setPatchNameSize in interface IDriverCopyright © 2014. All Rights Reserved.