Added currentProgram to VST chunk

pull/1/head
asb2m10 11 years ago
parent 4b886212c4
commit d9800f1617
  1. BIN
      Builds/MacOSX/Dexed.xcodeproj/project.xcworkspace/xcuserdata/asb2m10.xcuserdatad/UserInterfaceState.xcuserstate
  2. 13
      Source/DXLookNFeel.cpp
  3. 8
      Source/GlobalEditor.cpp
  4. 3
      Source/GlobalEditor.h
  5. 2
      Source/PluginEditor.cpp
  6. 16
      Source/PluginParam.cpp

@ -175,7 +175,7 @@ void PitchEnvDisplay::paint(Graphics &g) {
char *levels = pvalues; char *levels = pvalues;
char *rates = pvalues + 4; char *rates = pvalues + 4;
float dist[4]; float dist[4];
float total; float total;
@ -184,14 +184,19 @@ void PitchEnvDisplay::paint(Graphics &g) {
for(int i=0;i<4;i++) { for(int i=0;i<4;i++) {
int nw = pitchenv_tab[levels[i]] + 128; 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]; total += dist[i];
old = nw; 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 // TODO : this is WIP
int ratio = 96 / total; float ratio = 96 / total;
int oldx = 0; int oldx = 0;
int oldy = (pitchenv_tab[levels[3]] + 128) / 10; int oldy = (pitchenv_tab[levels[3]] + 128) / 10;

@ -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... //[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
void GlobalEditor::bind(DexedAudioProcessor *parent) { void GlobalEditor::bind(DexedAudioProcessor *parent) {
repaint();
parent->algo->bind(algo); parent->algo->bind(algo);
parent->lfoRate->bind(lfoSpeed); parent->lfoRate->bind(lfoSpeed);
parent->lfoDelay->bind(lfoDelay); parent->lfoDelay->bind(lfoDelay);
@ -412,6 +411,7 @@ void GlobalEditor::bind(DexedAudioProcessor *parent) {
algoDisplay->algo = &(parent->data[134]); algoDisplay->algo = &(parent->data[134]);
pitchEnvDisplay->pvalues = &(parent->data[126]); pitchEnvDisplay->pvalues = &(parent->data[126]);
processor = parent; processor = parent;
repaint();
} }
void GlobalEditor::setSystemMessage(String msg) { void GlobalEditor::setSystemMessage(String msg) {
@ -424,6 +424,12 @@ void GlobalEditor::setParamMessage(String msg) {
repaint(); repaint();
} }
void GlobalEditor::updateDisplay() {
algoDisplay->repaint();
pitchEnvDisplay->repaint();
repaint();
}
//[/MiscUserCode] //[/MiscUserCode]

@ -50,7 +50,8 @@ public:
void bind(DexedAudioProcessor *processor); void bind(DexedAudioProcessor *processor);
void setSystemMessage(String msg); void setSystemMessage(String msg);
void setParamMessage(String msg); void setParamMessage(String msg);
void updateDisplay();
String systemMsg; String systemMsg;
String paramMsg; String paramMsg;
//[/UserMethods] //[/UserMethods]

@ -277,7 +277,7 @@ void DexedAudioProcessorEditor::updateUI() {
int id = processor->getCurrentProgram() + 1; int id = processor->getCurrentProgram() + 1;
presets.setSelectedId(id, NotificationType::dontSendNotification); presets.setSelectedId(id, NotificationType::dontSendNotification);
global.repaint(); global.updateDisplay();
} }
void DexedAudioProcessorEditor::rebuildPresetCombobox() { void DexedAudioProcessorEditor::rebuildPresetCombobox() {

@ -386,7 +386,7 @@ int DexedAudioProcessor::importSysex(const char *imported) {
} }
patchNames[i][j] = c; patchNames[i][j] = c;
} }
patchNames[i][11] = 0; patchNames[i][10] = 0;
} }
return 0; return 0;
} }
@ -585,11 +585,15 @@ const String DexedAudioProcessor::getParameterText(int index) {
} }
#define CURRENT_PLUGINSTATE_VERSION 1
struct PluginState { struct PluginState {
int version;
uint8_t sysex[4011]; uint8_t sysex[4011];
uint8_t program[161]; uint8_t program[161];
float cutoff; float cutoff;
float reso; float reso;
int programNum;
}; };
//============================================================================== //==============================================================================
@ -602,10 +606,13 @@ void DexedAudioProcessor::getStateInformation(MemoryBlock& destData) {
PluginState state; PluginState state;
state.version = CURRENT_PLUGINSTATE_VERSION;
exportSysex((char *)(&state.sysex)); exportSysex((char *)(&state.sysex));
memcpy(state.program, data, 161); memcpy(state.program, data, 161);
state.cutoff = fx.uiCutoff; state.cutoff = fx.uiCutoff;
state.reso = fx.uiReso; state.reso = fx.uiReso;
state.programNum = currentProgram;
destData.insert(&state, sizeof(PluginState), 0); destData.insert(&state, sizeof(PluginState), 0);
} }
@ -630,12 +637,17 @@ void DexedAudioProcessor::setStateInformation(const void* source, int sizeInByte
memcpy((void *) &state, source, sizeInBytes); 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); importSysex((char *) state.sysex);
memcpy(data, state.program, 161); memcpy(data, state.program, 161);
fx.uiCutoff = state.cutoff; fx.uiCutoff = state.cutoff;
fx.uiReso = state.reso; fx.uiReso = state.reso;
currentProgram = state.programNum;
lastStateSave = (long) time(NULL); lastStateSave = (long) time(NULL);
TRACE("setting VST STATE"); TRACE("setting VST STATE");
updateUI(); updateUI();

Loading…
Cancel
Save