Fix checksum check

pull/1/head
asb2m10 11 years ago
parent 5d654eabbb
commit 95ec8a76bd
  1. BIN
      Builds/MacOSX/Dexed.xcodeproj/project.xcworkspace/xcuserdata/asb2m10.xcuserdatad/UserInterfaceState.xcuserstate
  2. 3
      Source/DXComponents.cpp
  3. 3
      Source/DXLookNFeel.cpp
  4. 3
      Source/DXLookNFeel.h
  5. 9
      Source/OperatorEditor.cpp
  6. 3
      Source/OperatorEditor.h
  7. 31
      Source/PluginData.cpp
  8. 2
      Source/PluginProcessor.cpp

@ -198,6 +198,7 @@ void EnvDisplay::paint(Graphics &g) {
g.drawText(len, 5, 1, 72, 14, Justification::left, true);
}
PitchEnvDisplay::PitchEnvDisplay() {
pvalues = (char *) &TMP_LEVEL_PTR;
vPos = 0;
@ -253,8 +254,6 @@ void PitchEnvDisplay::paint(Graphics &g) {
if ( vPos == i ) {
g.fillEllipse(oldx-2, oldy-2, 4, 4);
}
TRACE("pitch pos %d", vPos);
}

@ -20,6 +20,9 @@
#include "DXLookNFeel.h"
Colour DXLookNFeel::dxDarkBrown = Colour(0xFF0FC00F);
Colour DXLookNFeel::dxLightBrown = Colour(0xFFA87B67);
DXLookNFeel::DXLookNFeel() {
setColour(TextButton::buttonColourId,Colour(0xFF0FC00F));
setColour(Slider::rotarySliderOutlineColourId,Colour(0xFF0FC00F));

@ -25,6 +25,9 @@
class DXLookNFeel : public LookAndFeel_V3 {
public:
static Colour dxDarkBrown;
static Colour dxLightBrown;
DXLookNFeel();
};

@ -110,6 +110,7 @@ OperatorEditor::OperatorEditor ()
khzDisplay->setJustificationType (Justification::centred);
khzDisplay->setEditable (false, false, false);
khzDisplay->setColour (Label::backgroundColourId, Colour (0x6a000000));
khzDisplay->setColour (Label::textColourId, Colours::white);
khzDisplay->setColour (Label::outlineColourId, Colour (0x00000000));
khzDisplay->setColour (TextEditor::textColourId, Colours::black);
khzDisplay->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
@ -547,10 +548,10 @@ BEGIN_JUCER_METADATA
style="Rotary" textBoxPos="NoTextBox" textBoxEditable="1" textBoxWidth="80"
textBoxHeight="20" skewFactor="1"/>
<LABEL name="khz" id="eb961eed8902a6fc" memberName="khzDisplay" virtualName=""
explicitFocusOrder="0" pos="32 8 88 16" bkgCol="6a000000" outlineCol="0"
edTextCol="ff000000" edBkgCol="0" labelText="1,000 kHz" editableSingleClick="0"
editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
fontsize="11" bold="0" italic="0" justification="36"/>
explicitFocusOrder="0" pos="32 8 88 16" bkgCol="6a000000" textCol="ffffffff"
outlineCol="0" edTextCol="ff000000" edBkgCol="0" labelText="1,000 kHz"
editableSingleClick="0" editableDoubleClick="0" focusDiscardsChanges="0"
fontname="Default font" fontsize="11" bold="0" italic="0" justification="36"/>
<SLIDER name="detune" id="f093ec8defca2fc2" memberName="detune" virtualName=""
explicitFocusOrder="0" pos="24 24 56 24" min="-7" max="7" int="1"
style="LinearHorizontal" textBoxPos="NoTextBox" textBoxEditable="0"

@ -59,6 +59,9 @@ public:
void resized();
void sliderValueChanged (Slider* sliderThatWasMoved);
void comboBoxChanged (ComboBox* comboBoxThatHasChanged);
private:
//[UserVariables] -- You can add your own custom variables in this section.
//[/UserVariables]

@ -26,10 +26,11 @@
uint8_t sysexChecksum(const char *sysex) {
uint8_t sum = 0;
for (int i=0; i<4096; i++)
sum = (sum + sysex[i]) % (1 << 8);
return ((1 << 8) - sum);
int sum = 0;
int i;
for (i = 0; i < 4096; sum -= sysex[i++]);
return sum & 0x7F;
}
void extractProgramNames(const char *block, StringArray &dest) {
@ -127,14 +128,18 @@ void packProgram(uint8_t *dest, uint8_t *src, int idx, String name) {
* This function normalize data that comes from corrupted sysex.
* It used to avoid engine crashing upon extrem values
*/
char normparm(char value, char max) {
if ( value <= max )
char normparm(char value, char max, int id) {
if ( value <= max && value >= 0 )
return value;
// if this is beyond the max, we expect a 0-255 range, normalize this
// to the expected return value; and this value as a random data.
return ((float)value)/255 * max;
value = abs(value);
char v = ((float)value)/255 * max;
return v;
}
void DexedAudioProcessor::unpackProgram(int idx) {
@ -144,7 +149,7 @@ void DexedAudioProcessor::unpackProgram(int idx) {
// eg rate and level, brk pt, depth, scaling
for(int i=0; i<11; i++) {
data[op * 21 + i] = normparm(bulk[op * 17 + i], 99);
data[op * 21 + i] = normparm(bulk[op * 17 + i], 99, i);
}
memcpy(data + op * 21, bulk + op * 17, 11);
@ -165,10 +170,10 @@ void DexedAudioProcessor::unpackProgram(int idx) {
}
for (int i=0; i<8; i++) {
data[126+i] = normparm(bulk[102+i], 99);
data[126+i] = normparm(bulk[102+i], 99, 126+i);
}
data[134] = normparm(bulk[110], 31);
data[134] = normparm(bulk[110], 31, 134);
char oks_fb = bulk[111];
data[135] = oks_fb & 7;
data[136] = oks_fb >> 3;
@ -193,14 +198,13 @@ int DexedAudioProcessor::importSysex(const char *imported) {
extractProgramNames(sysex, programNames);
if ( checksum != imported[4102] ) {
TRACE("sysex import checksum doesnt match");
TRACE("sysex import checksum doesnt match %d != %d", checksum, imported[4102]);
return 1;
}
return 0;
}
void DexedAudioProcessor::updateProgramFromSysex(const uint8 *rawdata) {
memcpy(data, rawdata, 160);
triggerAsyncUpdate();
@ -208,6 +212,7 @@ void DexedAudioProcessor::updateProgramFromSysex(const uint8 *rawdata) {
void DexedAudioProcessor::loadBuiltin(int idx) {
char syx_data[4104];
memset(&syx_data, 0, 4104);
cartManager.getSysex(idx, (char *) &syx_data);
importSysex((char *) &syx_data);
}

@ -51,6 +51,8 @@ DexedAudioProcessor::DexedAudioProcessor() {
setCurrentProgram(0);
sendSysexChange = true;
normalizeDxVelocity = false;
memset(&voiceStatus, 0, sizeof(VoiceStatus));
}
DexedAudioProcessor::~DexedAudioProcessor() {

Loading…
Cancel
Save