diff --git a/Builds/MacOSX/Dexed.xcodeproj/project.xcworkspace/xcuserdata/asb2m10.xcuserdatad/UserInterfaceState.xcuserstate b/Builds/MacOSX/Dexed.xcodeproj/project.xcworkspace/xcuserdata/asb2m10.xcuserdatad/UserInterfaceState.xcuserstate index b9259ca..c2b8736 100644 Binary files a/Builds/MacOSX/Dexed.xcodeproj/project.xcworkspace/xcuserdata/asb2m10.xcuserdatad/UserInterfaceState.xcuserstate and b/Builds/MacOSX/Dexed.xcodeproj/project.xcworkspace/xcuserdata/asb2m10.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Source/DXLookNFeel.cpp b/Source/DXLookNFeel.cpp index 97d0c26..4291d82 100644 --- a/Source/DXLookNFeel.cpp +++ b/Source/DXLookNFeel.cpp @@ -175,7 +175,7 @@ void PitchEnvDisplay::paint(Graphics &g) { char *levels = pvalues; char *rates = pvalues + 4; - + float dist[4]; float total; @@ -184,14 +184,19 @@ void PitchEnvDisplay::paint(Graphics &g) { for(int i=0;i<4;i++) { int nw = pitchenv_tab[levels[i]] + 128; - dist[i] = abs(old - nw) / pitchenv_rate[rates[i]]; + dist[i] = ((float)abs(nw - old)) / pitchenv_rate[rates[i]]; total += dist[i]; old = nw; } - + if ( total == 0 ) { + dist[0] = 1; + total = 1; + } + //TRACE("DISPLAY %f %f %f %f", dist[0], dist[1], dist[2], dist[3]); + // TODO : this is WIP - int ratio = 96 / total; + float ratio = 96 / total; int oldx = 0; int oldy = (pitchenv_tab[levels[3]] + 128) / 10; diff --git a/Source/GlobalEditor.cpp b/Source/GlobalEditor.cpp index df9b500..dd6adbc 100644 --- a/Source/GlobalEditor.cpp +++ b/Source/GlobalEditor.cpp @@ -387,7 +387,6 @@ void GlobalEditor::comboBoxChanged (ComboBox* comboBoxThatHasChanged) //[MiscUserCode] You can add your own definitions of your custom methods or any other code here... void GlobalEditor::bind(DexedAudioProcessor *parent) { - repaint(); parent->algo->bind(algo); parent->lfoRate->bind(lfoSpeed); parent->lfoDelay->bind(lfoDelay); @@ -412,6 +411,7 @@ void GlobalEditor::bind(DexedAudioProcessor *parent) { algoDisplay->algo = &(parent->data[134]); pitchEnvDisplay->pvalues = &(parent->data[126]); processor = parent; + repaint(); } void GlobalEditor::setSystemMessage(String msg) { @@ -424,6 +424,12 @@ void GlobalEditor::setParamMessage(String msg) { repaint(); } +void GlobalEditor::updateDisplay() { + algoDisplay->repaint(); + pitchEnvDisplay->repaint(); + repaint(); +} + //[/MiscUserCode] diff --git a/Source/GlobalEditor.h b/Source/GlobalEditor.h index 139a4f5..6b44096 100644 --- a/Source/GlobalEditor.h +++ b/Source/GlobalEditor.h @@ -50,7 +50,8 @@ public: void bind(DexedAudioProcessor *processor); void setSystemMessage(String msg); void setParamMessage(String msg); - + void updateDisplay(); + String systemMsg; String paramMsg; //[/UserMethods] diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index def4cdd..323c4bf 100755 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -277,7 +277,7 @@ void DexedAudioProcessorEditor::updateUI() { int id = processor->getCurrentProgram() + 1; presets.setSelectedId(id, NotificationType::dontSendNotification); - global.repaint(); + global.updateDisplay(); } void DexedAudioProcessorEditor::rebuildPresetCombobox() { diff --git a/Source/PluginParam.cpp b/Source/PluginParam.cpp index 90419fa..36cc65c 100755 --- a/Source/PluginParam.cpp +++ b/Source/PluginParam.cpp @@ -386,7 +386,7 @@ int DexedAudioProcessor::importSysex(const char *imported) { } patchNames[i][j] = c; } - patchNames[i][11] = 0; + patchNames[i][10] = 0; } return 0; } @@ -585,11 +585,15 @@ const String DexedAudioProcessor::getParameterText(int index) { } + +#define CURRENT_PLUGINSTATE_VERSION 1 struct PluginState { + int version; uint8_t sysex[4011]; uint8_t program[161]; float cutoff; float reso; + int programNum; }; //============================================================================== @@ -602,10 +606,13 @@ void DexedAudioProcessor::getStateInformation(MemoryBlock& destData) { PluginState state; + state.version = CURRENT_PLUGINSTATE_VERSION; + exportSysex((char *)(&state.sysex)); memcpy(state.program, data, 161); state.cutoff = fx.uiCutoff; state.reso = fx.uiReso; + state.programNum = currentProgram; destData.insert(&state, sizeof(PluginState), 0); } @@ -630,12 +637,17 @@ void DexedAudioProcessor::setStateInformation(const void* source, int sizeInByte memcpy((void *) &state, source, sizeInBytes); + if ( state.version != CURRENT_PLUGINSTATE_VERSION ) { + TRACE("version of VST chunk is not compatible, bailing out"); + return; + } importSysex((char *) state.sysex); memcpy(data, state.program, 161); fx.uiCutoff = state.cutoff; fx.uiReso = state.reso; - + currentProgram = state.programNum; + lastStateSave = (long) time(NULL); TRACE("setting VST STATE"); updateUI();