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

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

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

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

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

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

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

Loading…
Cancel
Save