Closed milnak closed 3 months ago
I looked at this again to understand what happened, but it is more mysterious than I thought.
The original implementation of my refaceDX adaptation was in C++, it is here:
That code is even older and comes from a never published predecessor to Knobkraft. And strangely, in the same file there is another implementation which is more inline with your version:
int sum = 0;
std::for_each(bulkDump.begin() + 6, bulkDump.end(), [&](uint8 byte) { sum -= byte; });
bulkDump.push_back(sum & 0x7f);
Note that it does subtract instead of add - doesn't make a difference I guess when the result should be 0 in the end after dropping additional bits. I think we can take your version as it certainly is cleaner to read!
Fixed in 2.4.0
Reface MIDI data spec says: The Check-sum is the value that results in a value of 0 for the lower 7 bits when the Model ID, Start Address, Data and Check sum itself are added.
Current implementation is (which does work, so consider this a nit):
but it seems more correct to do something like: