protected void calculateChecksum(Patch p, int start, int end, int ofs) {
protected void calculateChecksum(IPatch patch, int start, int end, int ofs) { Patch p = (Patch)patch;
    protected void calculateChecksum(Patch p, int start, int end, int ofs) {// 	ErrorMsg.reportStatus("Driver:calcChecksum:1st byte is " + p.sysex[start]);// 	ErrorMsg.reportStatus("Last byte is " + p.sysex[end]);// 	ErrorMsg.reportStatus("Checksum was " + p.sysex[ofs]);        int sum = 0;        for (int i = start; i <= end; i++)            sum += p.sysex[i];	// Here is an example of checksum calculation (for Roland, etc.)	/*	p.sysex[ofs] = (byte) (sum & 0x7f);	p.sysex[ofs] = (byte) (p.sysex[ofs] ^ 0x7f);	p.sysex[ofs] = (byte) (p.sysex[ofs] + 1);	p.sysex[ofs] = (byte) (p.sysex[ofs] & 0x7f);   //to ensure that checksum is in range 0-127;	*/	//p.sysex[ofs] = (byte) ((~sum + 1) & 0x7f);	p.sysex[ofs] = (byte) (-sum & 0x7f);//      ErrorMsg.reportStatus("Checksum is now " + p.sysex[ofs]);    }