Skip to content

Commit

Permalink
Merge branch '5.6.30-GUI-Maintenance'
Browse files Browse the repository at this point in the history
  • Loading branch information
damiensellier committed May 11, 2024
2 parents cbef337 + 045df33 commit d105234
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions Source/Core/CtrlrSysexProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,23 +377,16 @@ void CtrlrSysexProcessor::checksumRolandJp8080(const CtrlrSysexToken token, Midi
*/

const int startByte = token.getPosition() - token.getAdditionalData();
//double chTotal = 0.0;
int checkSum = 0;
double chTotal = 0.0;
uint8 *ptr = (uint8 *)m.getRawData();

for (int i=startByte; i<token.getPosition(); i++)
{
//chTotal = chTotal + *(ptr+i); // From v5.6.31
checkSum = checkSum + *(ptr+i);
chTotal = chTotal + *(ptr+i); // From v5.6.31
}
/** Added by Dnaldoog from v5.6.31 */
//const double remainder = fmod(chTotal, 128);
//const uint8 ch = (uint8)(remainder ? (128 - remainder) : 0);
//checkSum &= 0x7F; /* Clamp to 7 bits */
checkSum = ~checkSum;
++checkSum; /* This and the above operation take the two's complement */
checkSum &= 0x7F; /* Clamp to 7 bits */
*(ptr+token.getPosition()) = checkSum;
const double remainder = fmod(chTotal, 128);
const uint8 ch = (uint8)(remainder ? (128 - remainder) : 0);
*(ptr+token.getPosition()) = ch;
}

void CtrlrSysexProcessor::checksumWaldorfRackAttack(const CtrlrSysexToken token, MidiMessage &m)
Expand Down

0 comments on commit d105234

Please sign in to comment.